[C#] Run tests against release library in determinism CI run
[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_UnexpectedPaths;
397                 case 24: return LDKBolt12SemanticError_InvalidPayInfo;
398                 case 25: return LDKBolt12SemanticError_MissingCreationTime;
399                 case 26: return LDKBolt12SemanticError_MissingPaymentHash;
400                 case 27: return LDKBolt12SemanticError_MissingSignature;
401         }
402         (*env)->FatalError(env, "A call to Bolt12SemanticError.ordinal() from rust returned an invalid value.");
403         abort(); // Unreachable, but will let the compiler know we don't return here
404 }
405 static jclass Bolt12SemanticError_class = NULL;
406 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_AlreadyExpired = NULL;
407 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_UnsupportedChain = NULL;
408 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedChain = NULL;
409 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_MissingAmount = NULL;
410 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_InvalidAmount = NULL;
411 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_InsufficientAmount = NULL;
412 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedAmount = NULL;
413 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_UnsupportedCurrency = NULL;
414 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_UnknownRequiredFeatures = NULL;
415 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedFeatures = NULL;
416 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_MissingDescription = NULL;
417 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_MissingSigningPubkey = NULL;
418 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_InvalidSigningPubkey = NULL;
419 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedSigningPubkey = NULL;
420 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_MissingQuantity = NULL;
421 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_InvalidQuantity = NULL;
422 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedQuantity = NULL;
423 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_InvalidMetadata = NULL;
424 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedMetadata = NULL;
425 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_MissingPayerMetadata = NULL;
426 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_MissingPayerId = NULL;
427 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_DuplicatePaymentId = NULL;
428 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_MissingPaths = NULL;
429 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedPaths = NULL;
430 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_InvalidPayInfo = NULL;
431 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_MissingCreationTime = NULL;
432 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_MissingPaymentHash = NULL;
433 static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_MissingSignature = NULL;
434 JNIEXPORT void JNICALL Java_org_ldk_enums_Bolt12SemanticError_init (JNIEnv *env, jclass clz) {
435         Bolt12SemanticError_class = (*env)->NewGlobalRef(env, clz);
436         CHECK(Bolt12SemanticError_class != NULL);
437         Bolt12SemanticError_LDKBolt12SemanticError_AlreadyExpired = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_AlreadyExpired", "Lorg/ldk/enums/Bolt12SemanticError;");
438         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_AlreadyExpired != NULL);
439         Bolt12SemanticError_LDKBolt12SemanticError_UnsupportedChain = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_UnsupportedChain", "Lorg/ldk/enums/Bolt12SemanticError;");
440         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_UnsupportedChain != NULL);
441         Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedChain = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_UnexpectedChain", "Lorg/ldk/enums/Bolt12SemanticError;");
442         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedChain != NULL);
443         Bolt12SemanticError_LDKBolt12SemanticError_MissingAmount = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_MissingAmount", "Lorg/ldk/enums/Bolt12SemanticError;");
444         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_MissingAmount != NULL);
445         Bolt12SemanticError_LDKBolt12SemanticError_InvalidAmount = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_InvalidAmount", "Lorg/ldk/enums/Bolt12SemanticError;");
446         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_InvalidAmount != NULL);
447         Bolt12SemanticError_LDKBolt12SemanticError_InsufficientAmount = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_InsufficientAmount", "Lorg/ldk/enums/Bolt12SemanticError;");
448         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_InsufficientAmount != NULL);
449         Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedAmount = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_UnexpectedAmount", "Lorg/ldk/enums/Bolt12SemanticError;");
450         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedAmount != NULL);
451         Bolt12SemanticError_LDKBolt12SemanticError_UnsupportedCurrency = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_UnsupportedCurrency", "Lorg/ldk/enums/Bolt12SemanticError;");
452         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_UnsupportedCurrency != NULL);
453         Bolt12SemanticError_LDKBolt12SemanticError_UnknownRequiredFeatures = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_UnknownRequiredFeatures", "Lorg/ldk/enums/Bolt12SemanticError;");
454         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_UnknownRequiredFeatures != NULL);
455         Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedFeatures = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_UnexpectedFeatures", "Lorg/ldk/enums/Bolt12SemanticError;");
456         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedFeatures != NULL);
457         Bolt12SemanticError_LDKBolt12SemanticError_MissingDescription = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_MissingDescription", "Lorg/ldk/enums/Bolt12SemanticError;");
458         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_MissingDescription != NULL);
459         Bolt12SemanticError_LDKBolt12SemanticError_MissingSigningPubkey = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_MissingSigningPubkey", "Lorg/ldk/enums/Bolt12SemanticError;");
460         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_MissingSigningPubkey != NULL);
461         Bolt12SemanticError_LDKBolt12SemanticError_InvalidSigningPubkey = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_InvalidSigningPubkey", "Lorg/ldk/enums/Bolt12SemanticError;");
462         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_InvalidSigningPubkey != NULL);
463         Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedSigningPubkey = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_UnexpectedSigningPubkey", "Lorg/ldk/enums/Bolt12SemanticError;");
464         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedSigningPubkey != NULL);
465         Bolt12SemanticError_LDKBolt12SemanticError_MissingQuantity = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_MissingQuantity", "Lorg/ldk/enums/Bolt12SemanticError;");
466         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_MissingQuantity != NULL);
467         Bolt12SemanticError_LDKBolt12SemanticError_InvalidQuantity = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_InvalidQuantity", "Lorg/ldk/enums/Bolt12SemanticError;");
468         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_InvalidQuantity != NULL);
469         Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedQuantity = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_UnexpectedQuantity", "Lorg/ldk/enums/Bolt12SemanticError;");
470         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedQuantity != NULL);
471         Bolt12SemanticError_LDKBolt12SemanticError_InvalidMetadata = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_InvalidMetadata", "Lorg/ldk/enums/Bolt12SemanticError;");
472         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_InvalidMetadata != NULL);
473         Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedMetadata = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_UnexpectedMetadata", "Lorg/ldk/enums/Bolt12SemanticError;");
474         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedMetadata != NULL);
475         Bolt12SemanticError_LDKBolt12SemanticError_MissingPayerMetadata = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_MissingPayerMetadata", "Lorg/ldk/enums/Bolt12SemanticError;");
476         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_MissingPayerMetadata != NULL);
477         Bolt12SemanticError_LDKBolt12SemanticError_MissingPayerId = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_MissingPayerId", "Lorg/ldk/enums/Bolt12SemanticError;");
478         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_MissingPayerId != NULL);
479         Bolt12SemanticError_LDKBolt12SemanticError_DuplicatePaymentId = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_DuplicatePaymentId", "Lorg/ldk/enums/Bolt12SemanticError;");
480         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_DuplicatePaymentId != NULL);
481         Bolt12SemanticError_LDKBolt12SemanticError_MissingPaths = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_MissingPaths", "Lorg/ldk/enums/Bolt12SemanticError;");
482         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_MissingPaths != NULL);
483         Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedPaths = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_UnexpectedPaths", "Lorg/ldk/enums/Bolt12SemanticError;");
484         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedPaths != NULL);
485         Bolt12SemanticError_LDKBolt12SemanticError_InvalidPayInfo = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_InvalidPayInfo", "Lorg/ldk/enums/Bolt12SemanticError;");
486         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_InvalidPayInfo != NULL);
487         Bolt12SemanticError_LDKBolt12SemanticError_MissingCreationTime = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_MissingCreationTime", "Lorg/ldk/enums/Bolt12SemanticError;");
488         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_MissingCreationTime != NULL);
489         Bolt12SemanticError_LDKBolt12SemanticError_MissingPaymentHash = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_MissingPaymentHash", "Lorg/ldk/enums/Bolt12SemanticError;");
490         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_MissingPaymentHash != NULL);
491         Bolt12SemanticError_LDKBolt12SemanticError_MissingSignature = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_MissingSignature", "Lorg/ldk/enums/Bolt12SemanticError;");
492         CHECK(Bolt12SemanticError_LDKBolt12SemanticError_MissingSignature != NULL);
493 }
494 static inline jclass LDKBolt12SemanticError_to_java(JNIEnv *env, LDKBolt12SemanticError val) {
495         switch (val) {
496                 case LDKBolt12SemanticError_AlreadyExpired:
497                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_AlreadyExpired);
498                 case LDKBolt12SemanticError_UnsupportedChain:
499                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_UnsupportedChain);
500                 case LDKBolt12SemanticError_UnexpectedChain:
501                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedChain);
502                 case LDKBolt12SemanticError_MissingAmount:
503                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_MissingAmount);
504                 case LDKBolt12SemanticError_InvalidAmount:
505                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_InvalidAmount);
506                 case LDKBolt12SemanticError_InsufficientAmount:
507                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_InsufficientAmount);
508                 case LDKBolt12SemanticError_UnexpectedAmount:
509                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedAmount);
510                 case LDKBolt12SemanticError_UnsupportedCurrency:
511                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_UnsupportedCurrency);
512                 case LDKBolt12SemanticError_UnknownRequiredFeatures:
513                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_UnknownRequiredFeatures);
514                 case LDKBolt12SemanticError_UnexpectedFeatures:
515                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedFeatures);
516                 case LDKBolt12SemanticError_MissingDescription:
517                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_MissingDescription);
518                 case LDKBolt12SemanticError_MissingSigningPubkey:
519                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_MissingSigningPubkey);
520                 case LDKBolt12SemanticError_InvalidSigningPubkey:
521                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_InvalidSigningPubkey);
522                 case LDKBolt12SemanticError_UnexpectedSigningPubkey:
523                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedSigningPubkey);
524                 case LDKBolt12SemanticError_MissingQuantity:
525                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_MissingQuantity);
526                 case LDKBolt12SemanticError_InvalidQuantity:
527                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_InvalidQuantity);
528                 case LDKBolt12SemanticError_UnexpectedQuantity:
529                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedQuantity);
530                 case LDKBolt12SemanticError_InvalidMetadata:
531                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_InvalidMetadata);
532                 case LDKBolt12SemanticError_UnexpectedMetadata:
533                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedMetadata);
534                 case LDKBolt12SemanticError_MissingPayerMetadata:
535                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_MissingPayerMetadata);
536                 case LDKBolt12SemanticError_MissingPayerId:
537                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_MissingPayerId);
538                 case LDKBolt12SemanticError_DuplicatePaymentId:
539                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_DuplicatePaymentId);
540                 case LDKBolt12SemanticError_MissingPaths:
541                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_MissingPaths);
542                 case LDKBolt12SemanticError_UnexpectedPaths:
543                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedPaths);
544                 case LDKBolt12SemanticError_InvalidPayInfo:
545                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_InvalidPayInfo);
546                 case LDKBolt12SemanticError_MissingCreationTime:
547                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_MissingCreationTime);
548                 case LDKBolt12SemanticError_MissingPaymentHash:
549                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_MissingPaymentHash);
550                 case LDKBolt12SemanticError_MissingSignature:
551                         return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_MissingSignature);
552                 default: abort();
553         }
554 }
555
556 static inline LDKCOption_NoneZ LDKCOption_NoneZ_from_java(JNIEnv *env, jclass clz) {
557         jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
558         if (UNLIKELY((*env)->ExceptionCheck(env))) {
559                 (*env)->ExceptionDescribe(env);
560                 (*env)->FatalError(env, "A call to COption_NoneZ.ordinal() from rust threw an exception.");
561         }
562         switch (ord) {
563                 case 0: return LDKCOption_NoneZ_Some;
564                 case 1: return LDKCOption_NoneZ_None;
565         }
566         (*env)->FatalError(env, "A call to COption_NoneZ.ordinal() from rust returned an invalid value.");
567         abort(); // Unreachable, but will let the compiler know we don't return here
568 }
569 static jclass COption_NoneZ_class = NULL;
570 static jfieldID COption_NoneZ_LDKCOption_NoneZ_Some = NULL;
571 static jfieldID COption_NoneZ_LDKCOption_NoneZ_None = NULL;
572 JNIEXPORT void JNICALL Java_org_ldk_enums_COption_1NoneZ_init (JNIEnv *env, jclass clz) {
573         COption_NoneZ_class = (*env)->NewGlobalRef(env, clz);
574         CHECK(COption_NoneZ_class != NULL);
575         COption_NoneZ_LDKCOption_NoneZ_Some = (*env)->GetStaticFieldID(env, COption_NoneZ_class, "LDKCOption_NoneZ_Some", "Lorg/ldk/enums/COption_NoneZ;");
576         CHECK(COption_NoneZ_LDKCOption_NoneZ_Some != NULL);
577         COption_NoneZ_LDKCOption_NoneZ_None = (*env)->GetStaticFieldID(env, COption_NoneZ_class, "LDKCOption_NoneZ_None", "Lorg/ldk/enums/COption_NoneZ;");
578         CHECK(COption_NoneZ_LDKCOption_NoneZ_None != NULL);
579 }
580 static inline jclass LDKCOption_NoneZ_to_java(JNIEnv *env, LDKCOption_NoneZ val) {
581         switch (val) {
582                 case LDKCOption_NoneZ_Some:
583                         return (*env)->GetStaticObjectField(env, COption_NoneZ_class, COption_NoneZ_LDKCOption_NoneZ_Some);
584                 case LDKCOption_NoneZ_None:
585                         return (*env)->GetStaticObjectField(env, COption_NoneZ_class, COption_NoneZ_LDKCOption_NoneZ_None);
586                 default: abort();
587         }
588 }
589
590 static inline LDKChannelMonitorUpdateStatus LDKChannelMonitorUpdateStatus_from_java(JNIEnv *env, jclass clz) {
591         jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
592         if (UNLIKELY((*env)->ExceptionCheck(env))) {
593                 (*env)->ExceptionDescribe(env);
594                 (*env)->FatalError(env, "A call to ChannelMonitorUpdateStatus.ordinal() from rust threw an exception.");
595         }
596         switch (ord) {
597                 case 0: return LDKChannelMonitorUpdateStatus_Completed;
598                 case 1: return LDKChannelMonitorUpdateStatus_InProgress;
599                 case 2: return LDKChannelMonitorUpdateStatus_UnrecoverableError;
600         }
601         (*env)->FatalError(env, "A call to ChannelMonitorUpdateStatus.ordinal() from rust returned an invalid value.");
602         abort(); // Unreachable, but will let the compiler know we don't return here
603 }
604 static jclass ChannelMonitorUpdateStatus_class = NULL;
605 static jfieldID ChannelMonitorUpdateStatus_LDKChannelMonitorUpdateStatus_Completed = NULL;
606 static jfieldID ChannelMonitorUpdateStatus_LDKChannelMonitorUpdateStatus_InProgress = NULL;
607 static jfieldID ChannelMonitorUpdateStatus_LDKChannelMonitorUpdateStatus_UnrecoverableError = NULL;
608 JNIEXPORT void JNICALL Java_org_ldk_enums_ChannelMonitorUpdateStatus_init (JNIEnv *env, jclass clz) {
609         ChannelMonitorUpdateStatus_class = (*env)->NewGlobalRef(env, clz);
610         CHECK(ChannelMonitorUpdateStatus_class != NULL);
611         ChannelMonitorUpdateStatus_LDKChannelMonitorUpdateStatus_Completed = (*env)->GetStaticFieldID(env, ChannelMonitorUpdateStatus_class, "LDKChannelMonitorUpdateStatus_Completed", "Lorg/ldk/enums/ChannelMonitorUpdateStatus;");
612         CHECK(ChannelMonitorUpdateStatus_LDKChannelMonitorUpdateStatus_Completed != NULL);
613         ChannelMonitorUpdateStatus_LDKChannelMonitorUpdateStatus_InProgress = (*env)->GetStaticFieldID(env, ChannelMonitorUpdateStatus_class, "LDKChannelMonitorUpdateStatus_InProgress", "Lorg/ldk/enums/ChannelMonitorUpdateStatus;");
614         CHECK(ChannelMonitorUpdateStatus_LDKChannelMonitorUpdateStatus_InProgress != NULL);
615         ChannelMonitorUpdateStatus_LDKChannelMonitorUpdateStatus_UnrecoverableError = (*env)->GetStaticFieldID(env, ChannelMonitorUpdateStatus_class, "LDKChannelMonitorUpdateStatus_UnrecoverableError", "Lorg/ldk/enums/ChannelMonitorUpdateStatus;");
616         CHECK(ChannelMonitorUpdateStatus_LDKChannelMonitorUpdateStatus_UnrecoverableError != NULL);
617 }
618 static inline jclass LDKChannelMonitorUpdateStatus_to_java(JNIEnv *env, LDKChannelMonitorUpdateStatus val) {
619         switch (val) {
620                 case LDKChannelMonitorUpdateStatus_Completed:
621                         return (*env)->GetStaticObjectField(env, ChannelMonitorUpdateStatus_class, ChannelMonitorUpdateStatus_LDKChannelMonitorUpdateStatus_Completed);
622                 case LDKChannelMonitorUpdateStatus_InProgress:
623                         return (*env)->GetStaticObjectField(env, ChannelMonitorUpdateStatus_class, ChannelMonitorUpdateStatus_LDKChannelMonitorUpdateStatus_InProgress);
624                 case LDKChannelMonitorUpdateStatus_UnrecoverableError:
625                         return (*env)->GetStaticObjectField(env, ChannelMonitorUpdateStatus_class, ChannelMonitorUpdateStatus_LDKChannelMonitorUpdateStatus_UnrecoverableError);
626                 default: abort();
627         }
628 }
629
630 static inline LDKChannelShutdownState LDKChannelShutdownState_from_java(JNIEnv *env, jclass clz) {
631         jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
632         if (UNLIKELY((*env)->ExceptionCheck(env))) {
633                 (*env)->ExceptionDescribe(env);
634                 (*env)->FatalError(env, "A call to ChannelShutdownState.ordinal() from rust threw an exception.");
635         }
636         switch (ord) {
637                 case 0: return LDKChannelShutdownState_NotShuttingDown;
638                 case 1: return LDKChannelShutdownState_ShutdownInitiated;
639                 case 2: return LDKChannelShutdownState_ResolvingHTLCs;
640                 case 3: return LDKChannelShutdownState_NegotiatingClosingFee;
641                 case 4: return LDKChannelShutdownState_ShutdownComplete;
642         }
643         (*env)->FatalError(env, "A call to ChannelShutdownState.ordinal() from rust returned an invalid value.");
644         abort(); // Unreachable, but will let the compiler know we don't return here
645 }
646 static jclass ChannelShutdownState_class = NULL;
647 static jfieldID ChannelShutdownState_LDKChannelShutdownState_NotShuttingDown = NULL;
648 static jfieldID ChannelShutdownState_LDKChannelShutdownState_ShutdownInitiated = NULL;
649 static jfieldID ChannelShutdownState_LDKChannelShutdownState_ResolvingHTLCs = NULL;
650 static jfieldID ChannelShutdownState_LDKChannelShutdownState_NegotiatingClosingFee = NULL;
651 static jfieldID ChannelShutdownState_LDKChannelShutdownState_ShutdownComplete = NULL;
652 JNIEXPORT void JNICALL Java_org_ldk_enums_ChannelShutdownState_init (JNIEnv *env, jclass clz) {
653         ChannelShutdownState_class = (*env)->NewGlobalRef(env, clz);
654         CHECK(ChannelShutdownState_class != NULL);
655         ChannelShutdownState_LDKChannelShutdownState_NotShuttingDown = (*env)->GetStaticFieldID(env, ChannelShutdownState_class, "LDKChannelShutdownState_NotShuttingDown", "Lorg/ldk/enums/ChannelShutdownState;");
656         CHECK(ChannelShutdownState_LDKChannelShutdownState_NotShuttingDown != NULL);
657         ChannelShutdownState_LDKChannelShutdownState_ShutdownInitiated = (*env)->GetStaticFieldID(env, ChannelShutdownState_class, "LDKChannelShutdownState_ShutdownInitiated", "Lorg/ldk/enums/ChannelShutdownState;");
658         CHECK(ChannelShutdownState_LDKChannelShutdownState_ShutdownInitiated != NULL);
659         ChannelShutdownState_LDKChannelShutdownState_ResolvingHTLCs = (*env)->GetStaticFieldID(env, ChannelShutdownState_class, "LDKChannelShutdownState_ResolvingHTLCs", "Lorg/ldk/enums/ChannelShutdownState;");
660         CHECK(ChannelShutdownState_LDKChannelShutdownState_ResolvingHTLCs != NULL);
661         ChannelShutdownState_LDKChannelShutdownState_NegotiatingClosingFee = (*env)->GetStaticFieldID(env, ChannelShutdownState_class, "LDKChannelShutdownState_NegotiatingClosingFee", "Lorg/ldk/enums/ChannelShutdownState;");
662         CHECK(ChannelShutdownState_LDKChannelShutdownState_NegotiatingClosingFee != NULL);
663         ChannelShutdownState_LDKChannelShutdownState_ShutdownComplete = (*env)->GetStaticFieldID(env, ChannelShutdownState_class, "LDKChannelShutdownState_ShutdownComplete", "Lorg/ldk/enums/ChannelShutdownState;");
664         CHECK(ChannelShutdownState_LDKChannelShutdownState_ShutdownComplete != NULL);
665 }
666 static inline jclass LDKChannelShutdownState_to_java(JNIEnv *env, LDKChannelShutdownState val) {
667         switch (val) {
668                 case LDKChannelShutdownState_NotShuttingDown:
669                         return (*env)->GetStaticObjectField(env, ChannelShutdownState_class, ChannelShutdownState_LDKChannelShutdownState_NotShuttingDown);
670                 case LDKChannelShutdownState_ShutdownInitiated:
671                         return (*env)->GetStaticObjectField(env, ChannelShutdownState_class, ChannelShutdownState_LDKChannelShutdownState_ShutdownInitiated);
672                 case LDKChannelShutdownState_ResolvingHTLCs:
673                         return (*env)->GetStaticObjectField(env, ChannelShutdownState_class, ChannelShutdownState_LDKChannelShutdownState_ResolvingHTLCs);
674                 case LDKChannelShutdownState_NegotiatingClosingFee:
675                         return (*env)->GetStaticObjectField(env, ChannelShutdownState_class, ChannelShutdownState_LDKChannelShutdownState_NegotiatingClosingFee);
676                 case LDKChannelShutdownState_ShutdownComplete:
677                         return (*env)->GetStaticObjectField(env, ChannelShutdownState_class, ChannelShutdownState_LDKChannelShutdownState_ShutdownComplete);
678                 default: abort();
679         }
680 }
681
682 static inline LDKConfirmationTarget LDKConfirmationTarget_from_java(JNIEnv *env, jclass clz) {
683         jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
684         if (UNLIKELY((*env)->ExceptionCheck(env))) {
685                 (*env)->ExceptionDescribe(env);
686                 (*env)->FatalError(env, "A call to ConfirmationTarget.ordinal() from rust threw an exception.");
687         }
688         switch (ord) {
689                 case 0: return LDKConfirmationTarget_OnChainSweep;
690                 case 1: return LDKConfirmationTarget_MinAllowedAnchorChannelRemoteFee;
691                 case 2: return LDKConfirmationTarget_MinAllowedNonAnchorChannelRemoteFee;
692                 case 3: return LDKConfirmationTarget_AnchorChannelFee;
693                 case 4: return LDKConfirmationTarget_NonAnchorChannelFee;
694                 case 5: return LDKConfirmationTarget_ChannelCloseMinimum;
695                 case 6: return LDKConfirmationTarget_OutputSpendingFee;
696         }
697         (*env)->FatalError(env, "A call to ConfirmationTarget.ordinal() from rust returned an invalid value.");
698         abort(); // Unreachable, but will let the compiler know we don't return here
699 }
700 static jclass ConfirmationTarget_class = NULL;
701 static jfieldID ConfirmationTarget_LDKConfirmationTarget_OnChainSweep = NULL;
702 static jfieldID ConfirmationTarget_LDKConfirmationTarget_MinAllowedAnchorChannelRemoteFee = NULL;
703 static jfieldID ConfirmationTarget_LDKConfirmationTarget_MinAllowedNonAnchorChannelRemoteFee = NULL;
704 static jfieldID ConfirmationTarget_LDKConfirmationTarget_AnchorChannelFee = NULL;
705 static jfieldID ConfirmationTarget_LDKConfirmationTarget_NonAnchorChannelFee = NULL;
706 static jfieldID ConfirmationTarget_LDKConfirmationTarget_ChannelCloseMinimum = NULL;
707 static jfieldID ConfirmationTarget_LDKConfirmationTarget_OutputSpendingFee = NULL;
708 JNIEXPORT void JNICALL Java_org_ldk_enums_ConfirmationTarget_init (JNIEnv *env, jclass clz) {
709         ConfirmationTarget_class = (*env)->NewGlobalRef(env, clz);
710         CHECK(ConfirmationTarget_class != NULL);
711         ConfirmationTarget_LDKConfirmationTarget_OnChainSweep = (*env)->GetStaticFieldID(env, ConfirmationTarget_class, "LDKConfirmationTarget_OnChainSweep", "Lorg/ldk/enums/ConfirmationTarget;");
712         CHECK(ConfirmationTarget_LDKConfirmationTarget_OnChainSweep != NULL);
713         ConfirmationTarget_LDKConfirmationTarget_MinAllowedAnchorChannelRemoteFee = (*env)->GetStaticFieldID(env, ConfirmationTarget_class, "LDKConfirmationTarget_MinAllowedAnchorChannelRemoteFee", "Lorg/ldk/enums/ConfirmationTarget;");
714         CHECK(ConfirmationTarget_LDKConfirmationTarget_MinAllowedAnchorChannelRemoteFee != NULL);
715         ConfirmationTarget_LDKConfirmationTarget_MinAllowedNonAnchorChannelRemoteFee = (*env)->GetStaticFieldID(env, ConfirmationTarget_class, "LDKConfirmationTarget_MinAllowedNonAnchorChannelRemoteFee", "Lorg/ldk/enums/ConfirmationTarget;");
716         CHECK(ConfirmationTarget_LDKConfirmationTarget_MinAllowedNonAnchorChannelRemoteFee != NULL);
717         ConfirmationTarget_LDKConfirmationTarget_AnchorChannelFee = (*env)->GetStaticFieldID(env, ConfirmationTarget_class, "LDKConfirmationTarget_AnchorChannelFee", "Lorg/ldk/enums/ConfirmationTarget;");
718         CHECK(ConfirmationTarget_LDKConfirmationTarget_AnchorChannelFee != NULL);
719         ConfirmationTarget_LDKConfirmationTarget_NonAnchorChannelFee = (*env)->GetStaticFieldID(env, ConfirmationTarget_class, "LDKConfirmationTarget_NonAnchorChannelFee", "Lorg/ldk/enums/ConfirmationTarget;");
720         CHECK(ConfirmationTarget_LDKConfirmationTarget_NonAnchorChannelFee != NULL);
721         ConfirmationTarget_LDKConfirmationTarget_ChannelCloseMinimum = (*env)->GetStaticFieldID(env, ConfirmationTarget_class, "LDKConfirmationTarget_ChannelCloseMinimum", "Lorg/ldk/enums/ConfirmationTarget;");
722         CHECK(ConfirmationTarget_LDKConfirmationTarget_ChannelCloseMinimum != NULL);
723         ConfirmationTarget_LDKConfirmationTarget_OutputSpendingFee = (*env)->GetStaticFieldID(env, ConfirmationTarget_class, "LDKConfirmationTarget_OutputSpendingFee", "Lorg/ldk/enums/ConfirmationTarget;");
724         CHECK(ConfirmationTarget_LDKConfirmationTarget_OutputSpendingFee != NULL);
725 }
726 static inline jclass LDKConfirmationTarget_to_java(JNIEnv *env, LDKConfirmationTarget val) {
727         switch (val) {
728                 case LDKConfirmationTarget_OnChainSweep:
729                         return (*env)->GetStaticObjectField(env, ConfirmationTarget_class, ConfirmationTarget_LDKConfirmationTarget_OnChainSweep);
730                 case LDKConfirmationTarget_MinAllowedAnchorChannelRemoteFee:
731                         return (*env)->GetStaticObjectField(env, ConfirmationTarget_class, ConfirmationTarget_LDKConfirmationTarget_MinAllowedAnchorChannelRemoteFee);
732                 case LDKConfirmationTarget_MinAllowedNonAnchorChannelRemoteFee:
733                         return (*env)->GetStaticObjectField(env, ConfirmationTarget_class, ConfirmationTarget_LDKConfirmationTarget_MinAllowedNonAnchorChannelRemoteFee);
734                 case LDKConfirmationTarget_AnchorChannelFee:
735                         return (*env)->GetStaticObjectField(env, ConfirmationTarget_class, ConfirmationTarget_LDKConfirmationTarget_AnchorChannelFee);
736                 case LDKConfirmationTarget_NonAnchorChannelFee:
737                         return (*env)->GetStaticObjectField(env, ConfirmationTarget_class, ConfirmationTarget_LDKConfirmationTarget_NonAnchorChannelFee);
738                 case LDKConfirmationTarget_ChannelCloseMinimum:
739                         return (*env)->GetStaticObjectField(env, ConfirmationTarget_class, ConfirmationTarget_LDKConfirmationTarget_ChannelCloseMinimum);
740                 case LDKConfirmationTarget_OutputSpendingFee:
741                         return (*env)->GetStaticObjectField(env, ConfirmationTarget_class, ConfirmationTarget_LDKConfirmationTarget_OutputSpendingFee);
742                 default: abort();
743         }
744 }
745
746 static inline LDKCreationError LDKCreationError_from_java(JNIEnv *env, jclass clz) {
747         jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
748         if (UNLIKELY((*env)->ExceptionCheck(env))) {
749                 (*env)->ExceptionDescribe(env);
750                 (*env)->FatalError(env, "A call to CreationError.ordinal() from rust threw an exception.");
751         }
752         switch (ord) {
753                 case 0: return LDKCreationError_DescriptionTooLong;
754                 case 1: return LDKCreationError_RouteTooLong;
755                 case 2: return LDKCreationError_TimestampOutOfBounds;
756                 case 3: return LDKCreationError_InvalidAmount;
757                 case 4: return LDKCreationError_MissingRouteHints;
758                 case 5: return LDKCreationError_MinFinalCltvExpiryDeltaTooShort;
759         }
760         (*env)->FatalError(env, "A call to CreationError.ordinal() from rust returned an invalid value.");
761         abort(); // Unreachable, but will let the compiler know we don't return here
762 }
763 static jclass CreationError_class = NULL;
764 static jfieldID CreationError_LDKCreationError_DescriptionTooLong = NULL;
765 static jfieldID CreationError_LDKCreationError_RouteTooLong = NULL;
766 static jfieldID CreationError_LDKCreationError_TimestampOutOfBounds = NULL;
767 static jfieldID CreationError_LDKCreationError_InvalidAmount = NULL;
768 static jfieldID CreationError_LDKCreationError_MissingRouteHints = NULL;
769 static jfieldID CreationError_LDKCreationError_MinFinalCltvExpiryDeltaTooShort = NULL;
770 JNIEXPORT void JNICALL Java_org_ldk_enums_CreationError_init (JNIEnv *env, jclass clz) {
771         CreationError_class = (*env)->NewGlobalRef(env, clz);
772         CHECK(CreationError_class != NULL);
773         CreationError_LDKCreationError_DescriptionTooLong = (*env)->GetStaticFieldID(env, CreationError_class, "LDKCreationError_DescriptionTooLong", "Lorg/ldk/enums/CreationError;");
774         CHECK(CreationError_LDKCreationError_DescriptionTooLong != NULL);
775         CreationError_LDKCreationError_RouteTooLong = (*env)->GetStaticFieldID(env, CreationError_class, "LDKCreationError_RouteTooLong", "Lorg/ldk/enums/CreationError;");
776         CHECK(CreationError_LDKCreationError_RouteTooLong != NULL);
777         CreationError_LDKCreationError_TimestampOutOfBounds = (*env)->GetStaticFieldID(env, CreationError_class, "LDKCreationError_TimestampOutOfBounds", "Lorg/ldk/enums/CreationError;");
778         CHECK(CreationError_LDKCreationError_TimestampOutOfBounds != NULL);
779         CreationError_LDKCreationError_InvalidAmount = (*env)->GetStaticFieldID(env, CreationError_class, "LDKCreationError_InvalidAmount", "Lorg/ldk/enums/CreationError;");
780         CHECK(CreationError_LDKCreationError_InvalidAmount != NULL);
781         CreationError_LDKCreationError_MissingRouteHints = (*env)->GetStaticFieldID(env, CreationError_class, "LDKCreationError_MissingRouteHints", "Lorg/ldk/enums/CreationError;");
782         CHECK(CreationError_LDKCreationError_MissingRouteHints != NULL);
783         CreationError_LDKCreationError_MinFinalCltvExpiryDeltaTooShort = (*env)->GetStaticFieldID(env, CreationError_class, "LDKCreationError_MinFinalCltvExpiryDeltaTooShort", "Lorg/ldk/enums/CreationError;");
784         CHECK(CreationError_LDKCreationError_MinFinalCltvExpiryDeltaTooShort != NULL);
785 }
786 static inline jclass LDKCreationError_to_java(JNIEnv *env, LDKCreationError val) {
787         switch (val) {
788                 case LDKCreationError_DescriptionTooLong:
789                         return (*env)->GetStaticObjectField(env, CreationError_class, CreationError_LDKCreationError_DescriptionTooLong);
790                 case LDKCreationError_RouteTooLong:
791                         return (*env)->GetStaticObjectField(env, CreationError_class, CreationError_LDKCreationError_RouteTooLong);
792                 case LDKCreationError_TimestampOutOfBounds:
793                         return (*env)->GetStaticObjectField(env, CreationError_class, CreationError_LDKCreationError_TimestampOutOfBounds);
794                 case LDKCreationError_InvalidAmount:
795                         return (*env)->GetStaticObjectField(env, CreationError_class, CreationError_LDKCreationError_InvalidAmount);
796                 case LDKCreationError_MissingRouteHints:
797                         return (*env)->GetStaticObjectField(env, CreationError_class, CreationError_LDKCreationError_MissingRouteHints);
798                 case LDKCreationError_MinFinalCltvExpiryDeltaTooShort:
799                         return (*env)->GetStaticObjectField(env, CreationError_class, CreationError_LDKCreationError_MinFinalCltvExpiryDeltaTooShort);
800                 default: abort();
801         }
802 }
803
804 static inline LDKCurrency LDKCurrency_from_java(JNIEnv *env, jclass clz) {
805         jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
806         if (UNLIKELY((*env)->ExceptionCheck(env))) {
807                 (*env)->ExceptionDescribe(env);
808                 (*env)->FatalError(env, "A call to Currency.ordinal() from rust threw an exception.");
809         }
810         switch (ord) {
811                 case 0: return LDKCurrency_Bitcoin;
812                 case 1: return LDKCurrency_BitcoinTestnet;
813                 case 2: return LDKCurrency_Regtest;
814                 case 3: return LDKCurrency_Simnet;
815                 case 4: return LDKCurrency_Signet;
816         }
817         (*env)->FatalError(env, "A call to Currency.ordinal() from rust returned an invalid value.");
818         abort(); // Unreachable, but will let the compiler know we don't return here
819 }
820 static jclass Currency_class = NULL;
821 static jfieldID Currency_LDKCurrency_Bitcoin = NULL;
822 static jfieldID Currency_LDKCurrency_BitcoinTestnet = NULL;
823 static jfieldID Currency_LDKCurrency_Regtest = NULL;
824 static jfieldID Currency_LDKCurrency_Simnet = NULL;
825 static jfieldID Currency_LDKCurrency_Signet = NULL;
826 JNIEXPORT void JNICALL Java_org_ldk_enums_Currency_init (JNIEnv *env, jclass clz) {
827         Currency_class = (*env)->NewGlobalRef(env, clz);
828         CHECK(Currency_class != NULL);
829         Currency_LDKCurrency_Bitcoin = (*env)->GetStaticFieldID(env, Currency_class, "LDKCurrency_Bitcoin", "Lorg/ldk/enums/Currency;");
830         CHECK(Currency_LDKCurrency_Bitcoin != NULL);
831         Currency_LDKCurrency_BitcoinTestnet = (*env)->GetStaticFieldID(env, Currency_class, "LDKCurrency_BitcoinTestnet", "Lorg/ldk/enums/Currency;");
832         CHECK(Currency_LDKCurrency_BitcoinTestnet != NULL);
833         Currency_LDKCurrency_Regtest = (*env)->GetStaticFieldID(env, Currency_class, "LDKCurrency_Regtest", "Lorg/ldk/enums/Currency;");
834         CHECK(Currency_LDKCurrency_Regtest != NULL);
835         Currency_LDKCurrency_Simnet = (*env)->GetStaticFieldID(env, Currency_class, "LDKCurrency_Simnet", "Lorg/ldk/enums/Currency;");
836         CHECK(Currency_LDKCurrency_Simnet != NULL);
837         Currency_LDKCurrency_Signet = (*env)->GetStaticFieldID(env, Currency_class, "LDKCurrency_Signet", "Lorg/ldk/enums/Currency;");
838         CHECK(Currency_LDKCurrency_Signet != NULL);
839 }
840 static inline jclass LDKCurrency_to_java(JNIEnv *env, LDKCurrency val) {
841         switch (val) {
842                 case LDKCurrency_Bitcoin:
843                         return (*env)->GetStaticObjectField(env, Currency_class, Currency_LDKCurrency_Bitcoin);
844                 case LDKCurrency_BitcoinTestnet:
845                         return (*env)->GetStaticObjectField(env, Currency_class, Currency_LDKCurrency_BitcoinTestnet);
846                 case LDKCurrency_Regtest:
847                         return (*env)->GetStaticObjectField(env, Currency_class, Currency_LDKCurrency_Regtest);
848                 case LDKCurrency_Simnet:
849                         return (*env)->GetStaticObjectField(env, Currency_class, Currency_LDKCurrency_Simnet);
850                 case LDKCurrency_Signet:
851                         return (*env)->GetStaticObjectField(env, Currency_class, Currency_LDKCurrency_Signet);
852                 default: abort();
853         }
854 }
855
856 static inline LDKDirection LDKDirection_from_java(JNIEnv *env, jclass clz) {
857         jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
858         if (UNLIKELY((*env)->ExceptionCheck(env))) {
859                 (*env)->ExceptionDescribe(env);
860                 (*env)->FatalError(env, "A call to Direction.ordinal() from rust threw an exception.");
861         }
862         switch (ord) {
863                 case 0: return LDKDirection_NodeOne;
864                 case 1: return LDKDirection_NodeTwo;
865         }
866         (*env)->FatalError(env, "A call to Direction.ordinal() from rust returned an invalid value.");
867         abort(); // Unreachable, but will let the compiler know we don't return here
868 }
869 static jclass Direction_class = NULL;
870 static jfieldID Direction_LDKDirection_NodeOne = NULL;
871 static jfieldID Direction_LDKDirection_NodeTwo = NULL;
872 JNIEXPORT void JNICALL Java_org_ldk_enums_Direction_init (JNIEnv *env, jclass clz) {
873         Direction_class = (*env)->NewGlobalRef(env, clz);
874         CHECK(Direction_class != NULL);
875         Direction_LDKDirection_NodeOne = (*env)->GetStaticFieldID(env, Direction_class, "LDKDirection_NodeOne", "Lorg/ldk/enums/Direction;");
876         CHECK(Direction_LDKDirection_NodeOne != NULL);
877         Direction_LDKDirection_NodeTwo = (*env)->GetStaticFieldID(env, Direction_class, "LDKDirection_NodeTwo", "Lorg/ldk/enums/Direction;");
878         CHECK(Direction_LDKDirection_NodeTwo != NULL);
879 }
880 static inline jclass LDKDirection_to_java(JNIEnv *env, LDKDirection val) {
881         switch (val) {
882                 case LDKDirection_NodeOne:
883                         return (*env)->GetStaticObjectField(env, Direction_class, Direction_LDKDirection_NodeOne);
884                 case LDKDirection_NodeTwo:
885                         return (*env)->GetStaticObjectField(env, Direction_class, Direction_LDKDirection_NodeTwo);
886                 default: abort();
887         }
888 }
889
890 static inline LDKHTLCClaim LDKHTLCClaim_from_java(JNIEnv *env, jclass clz) {
891         jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
892         if (UNLIKELY((*env)->ExceptionCheck(env))) {
893                 (*env)->ExceptionDescribe(env);
894                 (*env)->FatalError(env, "A call to HTLCClaim.ordinal() from rust threw an exception.");
895         }
896         switch (ord) {
897                 case 0: return LDKHTLCClaim_OfferedTimeout;
898                 case 1: return LDKHTLCClaim_OfferedPreimage;
899                 case 2: return LDKHTLCClaim_AcceptedTimeout;
900                 case 3: return LDKHTLCClaim_AcceptedPreimage;
901                 case 4: return LDKHTLCClaim_Revocation;
902         }
903         (*env)->FatalError(env, "A call to HTLCClaim.ordinal() from rust returned an invalid value.");
904         abort(); // Unreachable, but will let the compiler know we don't return here
905 }
906 static jclass HTLCClaim_class = NULL;
907 static jfieldID HTLCClaim_LDKHTLCClaim_OfferedTimeout = NULL;
908 static jfieldID HTLCClaim_LDKHTLCClaim_OfferedPreimage = NULL;
909 static jfieldID HTLCClaim_LDKHTLCClaim_AcceptedTimeout = NULL;
910 static jfieldID HTLCClaim_LDKHTLCClaim_AcceptedPreimage = NULL;
911 static jfieldID HTLCClaim_LDKHTLCClaim_Revocation = NULL;
912 JNIEXPORT void JNICALL Java_org_ldk_enums_HTLCClaim_init (JNIEnv *env, jclass clz) {
913         HTLCClaim_class = (*env)->NewGlobalRef(env, clz);
914         CHECK(HTLCClaim_class != NULL);
915         HTLCClaim_LDKHTLCClaim_OfferedTimeout = (*env)->GetStaticFieldID(env, HTLCClaim_class, "LDKHTLCClaim_OfferedTimeout", "Lorg/ldk/enums/HTLCClaim;");
916         CHECK(HTLCClaim_LDKHTLCClaim_OfferedTimeout != NULL);
917         HTLCClaim_LDKHTLCClaim_OfferedPreimage = (*env)->GetStaticFieldID(env, HTLCClaim_class, "LDKHTLCClaim_OfferedPreimage", "Lorg/ldk/enums/HTLCClaim;");
918         CHECK(HTLCClaim_LDKHTLCClaim_OfferedPreimage != NULL);
919         HTLCClaim_LDKHTLCClaim_AcceptedTimeout = (*env)->GetStaticFieldID(env, HTLCClaim_class, "LDKHTLCClaim_AcceptedTimeout", "Lorg/ldk/enums/HTLCClaim;");
920         CHECK(HTLCClaim_LDKHTLCClaim_AcceptedTimeout != NULL);
921         HTLCClaim_LDKHTLCClaim_AcceptedPreimage = (*env)->GetStaticFieldID(env, HTLCClaim_class, "LDKHTLCClaim_AcceptedPreimage", "Lorg/ldk/enums/HTLCClaim;");
922         CHECK(HTLCClaim_LDKHTLCClaim_AcceptedPreimage != NULL);
923         HTLCClaim_LDKHTLCClaim_Revocation = (*env)->GetStaticFieldID(env, HTLCClaim_class, "LDKHTLCClaim_Revocation", "Lorg/ldk/enums/HTLCClaim;");
924         CHECK(HTLCClaim_LDKHTLCClaim_Revocation != NULL);
925 }
926 static inline jclass LDKHTLCClaim_to_java(JNIEnv *env, LDKHTLCClaim val) {
927         switch (val) {
928                 case LDKHTLCClaim_OfferedTimeout:
929                         return (*env)->GetStaticObjectField(env, HTLCClaim_class, HTLCClaim_LDKHTLCClaim_OfferedTimeout);
930                 case LDKHTLCClaim_OfferedPreimage:
931                         return (*env)->GetStaticObjectField(env, HTLCClaim_class, HTLCClaim_LDKHTLCClaim_OfferedPreimage);
932                 case LDKHTLCClaim_AcceptedTimeout:
933                         return (*env)->GetStaticObjectField(env, HTLCClaim_class, HTLCClaim_LDKHTLCClaim_AcceptedTimeout);
934                 case LDKHTLCClaim_AcceptedPreimage:
935                         return (*env)->GetStaticObjectField(env, HTLCClaim_class, HTLCClaim_LDKHTLCClaim_AcceptedPreimage);
936                 case LDKHTLCClaim_Revocation:
937                         return (*env)->GetStaticObjectField(env, HTLCClaim_class, HTLCClaim_LDKHTLCClaim_Revocation);
938                 default: abort();
939         }
940 }
941
942 static inline LDKIOError LDKIOError_from_java(JNIEnv *env, jclass clz) {
943         jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
944         if (UNLIKELY((*env)->ExceptionCheck(env))) {
945                 (*env)->ExceptionDescribe(env);
946                 (*env)->FatalError(env, "A call to IOError.ordinal() from rust threw an exception.");
947         }
948         switch (ord) {
949                 case 0: return LDKIOError_NotFound;
950                 case 1: return LDKIOError_PermissionDenied;
951                 case 2: return LDKIOError_ConnectionRefused;
952                 case 3: return LDKIOError_ConnectionReset;
953                 case 4: return LDKIOError_ConnectionAborted;
954                 case 5: return LDKIOError_NotConnected;
955                 case 6: return LDKIOError_AddrInUse;
956                 case 7: return LDKIOError_AddrNotAvailable;
957                 case 8: return LDKIOError_BrokenPipe;
958                 case 9: return LDKIOError_AlreadyExists;
959                 case 10: return LDKIOError_WouldBlock;
960                 case 11: return LDKIOError_InvalidInput;
961                 case 12: return LDKIOError_InvalidData;
962                 case 13: return LDKIOError_TimedOut;
963                 case 14: return LDKIOError_WriteZero;
964                 case 15: return LDKIOError_Interrupted;
965                 case 16: return LDKIOError_Other;
966                 case 17: return LDKIOError_UnexpectedEof;
967         }
968         (*env)->FatalError(env, "A call to IOError.ordinal() from rust returned an invalid value.");
969         abort(); // Unreachable, but will let the compiler know we don't return here
970 }
971 static jclass IOError_class = NULL;
972 static jfieldID IOError_LDKIOError_NotFound = NULL;
973 static jfieldID IOError_LDKIOError_PermissionDenied = NULL;
974 static jfieldID IOError_LDKIOError_ConnectionRefused = NULL;
975 static jfieldID IOError_LDKIOError_ConnectionReset = NULL;
976 static jfieldID IOError_LDKIOError_ConnectionAborted = NULL;
977 static jfieldID IOError_LDKIOError_NotConnected = NULL;
978 static jfieldID IOError_LDKIOError_AddrInUse = NULL;
979 static jfieldID IOError_LDKIOError_AddrNotAvailable = NULL;
980 static jfieldID IOError_LDKIOError_BrokenPipe = NULL;
981 static jfieldID IOError_LDKIOError_AlreadyExists = NULL;
982 static jfieldID IOError_LDKIOError_WouldBlock = NULL;
983 static jfieldID IOError_LDKIOError_InvalidInput = NULL;
984 static jfieldID IOError_LDKIOError_InvalidData = NULL;
985 static jfieldID IOError_LDKIOError_TimedOut = NULL;
986 static jfieldID IOError_LDKIOError_WriteZero = NULL;
987 static jfieldID IOError_LDKIOError_Interrupted = NULL;
988 static jfieldID IOError_LDKIOError_Other = NULL;
989 static jfieldID IOError_LDKIOError_UnexpectedEof = NULL;
990 JNIEXPORT void JNICALL Java_org_ldk_enums_IOError_init (JNIEnv *env, jclass clz) {
991         IOError_class = (*env)->NewGlobalRef(env, clz);
992         CHECK(IOError_class != NULL);
993         IOError_LDKIOError_NotFound = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_NotFound", "Lorg/ldk/enums/IOError;");
994         CHECK(IOError_LDKIOError_NotFound != NULL);
995         IOError_LDKIOError_PermissionDenied = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_PermissionDenied", "Lorg/ldk/enums/IOError;");
996         CHECK(IOError_LDKIOError_PermissionDenied != NULL);
997         IOError_LDKIOError_ConnectionRefused = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_ConnectionRefused", "Lorg/ldk/enums/IOError;");
998         CHECK(IOError_LDKIOError_ConnectionRefused != NULL);
999         IOError_LDKIOError_ConnectionReset = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_ConnectionReset", "Lorg/ldk/enums/IOError;");
1000         CHECK(IOError_LDKIOError_ConnectionReset != NULL);
1001         IOError_LDKIOError_ConnectionAborted = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_ConnectionAborted", "Lorg/ldk/enums/IOError;");
1002         CHECK(IOError_LDKIOError_ConnectionAborted != NULL);
1003         IOError_LDKIOError_NotConnected = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_NotConnected", "Lorg/ldk/enums/IOError;");
1004         CHECK(IOError_LDKIOError_NotConnected != NULL);
1005         IOError_LDKIOError_AddrInUse = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_AddrInUse", "Lorg/ldk/enums/IOError;");
1006         CHECK(IOError_LDKIOError_AddrInUse != NULL);
1007         IOError_LDKIOError_AddrNotAvailable = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_AddrNotAvailable", "Lorg/ldk/enums/IOError;");
1008         CHECK(IOError_LDKIOError_AddrNotAvailable != NULL);
1009         IOError_LDKIOError_BrokenPipe = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_BrokenPipe", "Lorg/ldk/enums/IOError;");
1010         CHECK(IOError_LDKIOError_BrokenPipe != NULL);
1011         IOError_LDKIOError_AlreadyExists = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_AlreadyExists", "Lorg/ldk/enums/IOError;");
1012         CHECK(IOError_LDKIOError_AlreadyExists != NULL);
1013         IOError_LDKIOError_WouldBlock = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_WouldBlock", "Lorg/ldk/enums/IOError;");
1014         CHECK(IOError_LDKIOError_WouldBlock != NULL);
1015         IOError_LDKIOError_InvalidInput = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_InvalidInput", "Lorg/ldk/enums/IOError;");
1016         CHECK(IOError_LDKIOError_InvalidInput != NULL);
1017         IOError_LDKIOError_InvalidData = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_InvalidData", "Lorg/ldk/enums/IOError;");
1018         CHECK(IOError_LDKIOError_InvalidData != NULL);
1019         IOError_LDKIOError_TimedOut = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_TimedOut", "Lorg/ldk/enums/IOError;");
1020         CHECK(IOError_LDKIOError_TimedOut != NULL);
1021         IOError_LDKIOError_WriteZero = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_WriteZero", "Lorg/ldk/enums/IOError;");
1022         CHECK(IOError_LDKIOError_WriteZero != NULL);
1023         IOError_LDKIOError_Interrupted = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_Interrupted", "Lorg/ldk/enums/IOError;");
1024         CHECK(IOError_LDKIOError_Interrupted != NULL);
1025         IOError_LDKIOError_Other = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_Other", "Lorg/ldk/enums/IOError;");
1026         CHECK(IOError_LDKIOError_Other != NULL);
1027         IOError_LDKIOError_UnexpectedEof = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_UnexpectedEof", "Lorg/ldk/enums/IOError;");
1028         CHECK(IOError_LDKIOError_UnexpectedEof != NULL);
1029 }
1030 static inline jclass LDKIOError_to_java(JNIEnv *env, LDKIOError val) {
1031         switch (val) {
1032                 case LDKIOError_NotFound:
1033                         return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_NotFound);
1034                 case LDKIOError_PermissionDenied:
1035                         return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_PermissionDenied);
1036                 case LDKIOError_ConnectionRefused:
1037                         return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_ConnectionRefused);
1038                 case LDKIOError_ConnectionReset:
1039                         return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_ConnectionReset);
1040                 case LDKIOError_ConnectionAborted:
1041                         return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_ConnectionAborted);
1042                 case LDKIOError_NotConnected:
1043                         return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_NotConnected);
1044                 case LDKIOError_AddrInUse:
1045                         return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_AddrInUse);
1046                 case LDKIOError_AddrNotAvailable:
1047                         return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_AddrNotAvailable);
1048                 case LDKIOError_BrokenPipe:
1049                         return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_BrokenPipe);
1050                 case LDKIOError_AlreadyExists:
1051                         return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_AlreadyExists);
1052                 case LDKIOError_WouldBlock:
1053                         return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_WouldBlock);
1054                 case LDKIOError_InvalidInput:
1055                         return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_InvalidInput);
1056                 case LDKIOError_InvalidData:
1057                         return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_InvalidData);
1058                 case LDKIOError_TimedOut:
1059                         return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_TimedOut);
1060                 case LDKIOError_WriteZero:
1061                         return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_WriteZero);
1062                 case LDKIOError_Interrupted:
1063                         return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_Interrupted);
1064                 case LDKIOError_Other:
1065                         return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_Other);
1066                 case LDKIOError_UnexpectedEof:
1067                         return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_UnexpectedEof);
1068                 default: abort();
1069         }
1070 }
1071
1072 static inline LDKLevel LDKLevel_from_java(JNIEnv *env, jclass clz) {
1073         jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
1074         if (UNLIKELY((*env)->ExceptionCheck(env))) {
1075                 (*env)->ExceptionDescribe(env);
1076                 (*env)->FatalError(env, "A call to Level.ordinal() from rust threw an exception.");
1077         }
1078         switch (ord) {
1079                 case 0: return LDKLevel_Gossip;
1080                 case 1: return LDKLevel_Trace;
1081                 case 2: return LDKLevel_Debug;
1082                 case 3: return LDKLevel_Info;
1083                 case 4: return LDKLevel_Warn;
1084                 case 5: return LDKLevel_Error;
1085         }
1086         (*env)->FatalError(env, "A call to Level.ordinal() from rust returned an invalid value.");
1087         abort(); // Unreachable, but will let the compiler know we don't return here
1088 }
1089 static jclass Level_class = NULL;
1090 static jfieldID Level_LDKLevel_Gossip = NULL;
1091 static jfieldID Level_LDKLevel_Trace = NULL;
1092 static jfieldID Level_LDKLevel_Debug = NULL;
1093 static jfieldID Level_LDKLevel_Info = NULL;
1094 static jfieldID Level_LDKLevel_Warn = NULL;
1095 static jfieldID Level_LDKLevel_Error = NULL;
1096 JNIEXPORT void JNICALL Java_org_ldk_enums_Level_init (JNIEnv *env, jclass clz) {
1097         Level_class = (*env)->NewGlobalRef(env, clz);
1098         CHECK(Level_class != NULL);
1099         Level_LDKLevel_Gossip = (*env)->GetStaticFieldID(env, Level_class, "LDKLevel_Gossip", "Lorg/ldk/enums/Level;");
1100         CHECK(Level_LDKLevel_Gossip != NULL);
1101         Level_LDKLevel_Trace = (*env)->GetStaticFieldID(env, Level_class, "LDKLevel_Trace", "Lorg/ldk/enums/Level;");
1102         CHECK(Level_LDKLevel_Trace != NULL);
1103         Level_LDKLevel_Debug = (*env)->GetStaticFieldID(env, Level_class, "LDKLevel_Debug", "Lorg/ldk/enums/Level;");
1104         CHECK(Level_LDKLevel_Debug != NULL);
1105         Level_LDKLevel_Info = (*env)->GetStaticFieldID(env, Level_class, "LDKLevel_Info", "Lorg/ldk/enums/Level;");
1106         CHECK(Level_LDKLevel_Info != NULL);
1107         Level_LDKLevel_Warn = (*env)->GetStaticFieldID(env, Level_class, "LDKLevel_Warn", "Lorg/ldk/enums/Level;");
1108         CHECK(Level_LDKLevel_Warn != NULL);
1109         Level_LDKLevel_Error = (*env)->GetStaticFieldID(env, Level_class, "LDKLevel_Error", "Lorg/ldk/enums/Level;");
1110         CHECK(Level_LDKLevel_Error != NULL);
1111 }
1112 static inline jclass LDKLevel_to_java(JNIEnv *env, LDKLevel val) {
1113         switch (val) {
1114                 case LDKLevel_Gossip:
1115                         return (*env)->GetStaticObjectField(env, Level_class, Level_LDKLevel_Gossip);
1116                 case LDKLevel_Trace:
1117                         return (*env)->GetStaticObjectField(env, Level_class, Level_LDKLevel_Trace);
1118                 case LDKLevel_Debug:
1119                         return (*env)->GetStaticObjectField(env, Level_class, Level_LDKLevel_Debug);
1120                 case LDKLevel_Info:
1121                         return (*env)->GetStaticObjectField(env, Level_class, Level_LDKLevel_Info);
1122                 case LDKLevel_Warn:
1123                         return (*env)->GetStaticObjectField(env, Level_class, Level_LDKLevel_Warn);
1124                 case LDKLevel_Error:
1125                         return (*env)->GetStaticObjectField(env, Level_class, Level_LDKLevel_Error);
1126                 default: abort();
1127         }
1128 }
1129
1130 static inline LDKNetwork LDKNetwork_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 Network.ordinal() from rust threw an exception.");
1135         }
1136         switch (ord) {
1137                 case 0: return LDKNetwork_Bitcoin;
1138                 case 1: return LDKNetwork_Testnet;
1139                 case 2: return LDKNetwork_Regtest;
1140                 case 3: return LDKNetwork_Signet;
1141         }
1142         (*env)->FatalError(env, "A call to Network.ordinal() from rust returned an invalid value.");
1143         abort(); // Unreachable, but will let the compiler know we don't return here
1144 }
1145 static jclass Network_class = NULL;
1146 static jfieldID Network_LDKNetwork_Bitcoin = NULL;
1147 static jfieldID Network_LDKNetwork_Testnet = NULL;
1148 static jfieldID Network_LDKNetwork_Regtest = NULL;
1149 static jfieldID Network_LDKNetwork_Signet = NULL;
1150 JNIEXPORT void JNICALL Java_org_ldk_enums_Network_init (JNIEnv *env, jclass clz) {
1151         Network_class = (*env)->NewGlobalRef(env, clz);
1152         CHECK(Network_class != NULL);
1153         Network_LDKNetwork_Bitcoin = (*env)->GetStaticFieldID(env, Network_class, "LDKNetwork_Bitcoin", "Lorg/ldk/enums/Network;");
1154         CHECK(Network_LDKNetwork_Bitcoin != NULL);
1155         Network_LDKNetwork_Testnet = (*env)->GetStaticFieldID(env, Network_class, "LDKNetwork_Testnet", "Lorg/ldk/enums/Network;");
1156         CHECK(Network_LDKNetwork_Testnet != NULL);
1157         Network_LDKNetwork_Regtest = (*env)->GetStaticFieldID(env, Network_class, "LDKNetwork_Regtest", "Lorg/ldk/enums/Network;");
1158         CHECK(Network_LDKNetwork_Regtest != NULL);
1159         Network_LDKNetwork_Signet = (*env)->GetStaticFieldID(env, Network_class, "LDKNetwork_Signet", "Lorg/ldk/enums/Network;");
1160         CHECK(Network_LDKNetwork_Signet != NULL);
1161 }
1162 static inline jclass LDKNetwork_to_java(JNIEnv *env, LDKNetwork val) {
1163         switch (val) {
1164                 case LDKNetwork_Bitcoin:
1165                         return (*env)->GetStaticObjectField(env, Network_class, Network_LDKNetwork_Bitcoin);
1166                 case LDKNetwork_Testnet:
1167                         return (*env)->GetStaticObjectField(env, Network_class, Network_LDKNetwork_Testnet);
1168                 case LDKNetwork_Regtest:
1169                         return (*env)->GetStaticObjectField(env, Network_class, Network_LDKNetwork_Regtest);
1170                 case LDKNetwork_Signet:
1171                         return (*env)->GetStaticObjectField(env, Network_class, Network_LDKNetwork_Signet);
1172                 default: abort();
1173         }
1174 }
1175
1176 static inline LDKPaymentFailureReason LDKPaymentFailureReason_from_java(JNIEnv *env, jclass clz) {
1177         jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
1178         if (UNLIKELY((*env)->ExceptionCheck(env))) {
1179                 (*env)->ExceptionDescribe(env);
1180                 (*env)->FatalError(env, "A call to PaymentFailureReason.ordinal() from rust threw an exception.");
1181         }
1182         switch (ord) {
1183                 case 0: return LDKPaymentFailureReason_RecipientRejected;
1184                 case 1: return LDKPaymentFailureReason_UserAbandoned;
1185                 case 2: return LDKPaymentFailureReason_RetriesExhausted;
1186                 case 3: return LDKPaymentFailureReason_PaymentExpired;
1187                 case 4: return LDKPaymentFailureReason_RouteNotFound;
1188                 case 5: return LDKPaymentFailureReason_UnexpectedError;
1189         }
1190         (*env)->FatalError(env, "A call to PaymentFailureReason.ordinal() from rust returned an invalid value.");
1191         abort(); // Unreachable, but will let the compiler know we don't return here
1192 }
1193 static jclass PaymentFailureReason_class = NULL;
1194 static jfieldID PaymentFailureReason_LDKPaymentFailureReason_RecipientRejected = NULL;
1195 static jfieldID PaymentFailureReason_LDKPaymentFailureReason_UserAbandoned = NULL;
1196 static jfieldID PaymentFailureReason_LDKPaymentFailureReason_RetriesExhausted = NULL;
1197 static jfieldID PaymentFailureReason_LDKPaymentFailureReason_PaymentExpired = NULL;
1198 static jfieldID PaymentFailureReason_LDKPaymentFailureReason_RouteNotFound = NULL;
1199 static jfieldID PaymentFailureReason_LDKPaymentFailureReason_UnexpectedError = NULL;
1200 JNIEXPORT void JNICALL Java_org_ldk_enums_PaymentFailureReason_init (JNIEnv *env, jclass clz) {
1201         PaymentFailureReason_class = (*env)->NewGlobalRef(env, clz);
1202         CHECK(PaymentFailureReason_class != NULL);
1203         PaymentFailureReason_LDKPaymentFailureReason_RecipientRejected = (*env)->GetStaticFieldID(env, PaymentFailureReason_class, "LDKPaymentFailureReason_RecipientRejected", "Lorg/ldk/enums/PaymentFailureReason;");
1204         CHECK(PaymentFailureReason_LDKPaymentFailureReason_RecipientRejected != NULL);
1205         PaymentFailureReason_LDKPaymentFailureReason_UserAbandoned = (*env)->GetStaticFieldID(env, PaymentFailureReason_class, "LDKPaymentFailureReason_UserAbandoned", "Lorg/ldk/enums/PaymentFailureReason;");
1206         CHECK(PaymentFailureReason_LDKPaymentFailureReason_UserAbandoned != NULL);
1207         PaymentFailureReason_LDKPaymentFailureReason_RetriesExhausted = (*env)->GetStaticFieldID(env, PaymentFailureReason_class, "LDKPaymentFailureReason_RetriesExhausted", "Lorg/ldk/enums/PaymentFailureReason;");
1208         CHECK(PaymentFailureReason_LDKPaymentFailureReason_RetriesExhausted != NULL);
1209         PaymentFailureReason_LDKPaymentFailureReason_PaymentExpired = (*env)->GetStaticFieldID(env, PaymentFailureReason_class, "LDKPaymentFailureReason_PaymentExpired", "Lorg/ldk/enums/PaymentFailureReason;");
1210         CHECK(PaymentFailureReason_LDKPaymentFailureReason_PaymentExpired != NULL);
1211         PaymentFailureReason_LDKPaymentFailureReason_RouteNotFound = (*env)->GetStaticFieldID(env, PaymentFailureReason_class, "LDKPaymentFailureReason_RouteNotFound", "Lorg/ldk/enums/PaymentFailureReason;");
1212         CHECK(PaymentFailureReason_LDKPaymentFailureReason_RouteNotFound != NULL);
1213         PaymentFailureReason_LDKPaymentFailureReason_UnexpectedError = (*env)->GetStaticFieldID(env, PaymentFailureReason_class, "LDKPaymentFailureReason_UnexpectedError", "Lorg/ldk/enums/PaymentFailureReason;");
1214         CHECK(PaymentFailureReason_LDKPaymentFailureReason_UnexpectedError != NULL);
1215 }
1216 static inline jclass LDKPaymentFailureReason_to_java(JNIEnv *env, LDKPaymentFailureReason val) {
1217         switch (val) {
1218                 case LDKPaymentFailureReason_RecipientRejected:
1219                         return (*env)->GetStaticObjectField(env, PaymentFailureReason_class, PaymentFailureReason_LDKPaymentFailureReason_RecipientRejected);
1220                 case LDKPaymentFailureReason_UserAbandoned:
1221                         return (*env)->GetStaticObjectField(env, PaymentFailureReason_class, PaymentFailureReason_LDKPaymentFailureReason_UserAbandoned);
1222                 case LDKPaymentFailureReason_RetriesExhausted:
1223                         return (*env)->GetStaticObjectField(env, PaymentFailureReason_class, PaymentFailureReason_LDKPaymentFailureReason_RetriesExhausted);
1224                 case LDKPaymentFailureReason_PaymentExpired:
1225                         return (*env)->GetStaticObjectField(env, PaymentFailureReason_class, PaymentFailureReason_LDKPaymentFailureReason_PaymentExpired);
1226                 case LDKPaymentFailureReason_RouteNotFound:
1227                         return (*env)->GetStaticObjectField(env, PaymentFailureReason_class, PaymentFailureReason_LDKPaymentFailureReason_RouteNotFound);
1228                 case LDKPaymentFailureReason_UnexpectedError:
1229                         return (*env)->GetStaticObjectField(env, PaymentFailureReason_class, PaymentFailureReason_LDKPaymentFailureReason_UnexpectedError);
1230                 default: abort();
1231         }
1232 }
1233
1234 static inline LDKRecipient LDKRecipient_from_java(JNIEnv *env, jclass clz) {
1235         jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
1236         if (UNLIKELY((*env)->ExceptionCheck(env))) {
1237                 (*env)->ExceptionDescribe(env);
1238                 (*env)->FatalError(env, "A call to Recipient.ordinal() from rust threw an exception.");
1239         }
1240         switch (ord) {
1241                 case 0: return LDKRecipient_Node;
1242                 case 1: return LDKRecipient_PhantomNode;
1243         }
1244         (*env)->FatalError(env, "A call to Recipient.ordinal() from rust returned an invalid value.");
1245         abort(); // Unreachable, but will let the compiler know we don't return here
1246 }
1247 static jclass Recipient_class = NULL;
1248 static jfieldID Recipient_LDKRecipient_Node = NULL;
1249 static jfieldID Recipient_LDKRecipient_PhantomNode = NULL;
1250 JNIEXPORT void JNICALL Java_org_ldk_enums_Recipient_init (JNIEnv *env, jclass clz) {
1251         Recipient_class = (*env)->NewGlobalRef(env, clz);
1252         CHECK(Recipient_class != NULL);
1253         Recipient_LDKRecipient_Node = (*env)->GetStaticFieldID(env, Recipient_class, "LDKRecipient_Node", "Lorg/ldk/enums/Recipient;");
1254         CHECK(Recipient_LDKRecipient_Node != NULL);
1255         Recipient_LDKRecipient_PhantomNode = (*env)->GetStaticFieldID(env, Recipient_class, "LDKRecipient_PhantomNode", "Lorg/ldk/enums/Recipient;");
1256         CHECK(Recipient_LDKRecipient_PhantomNode != NULL);
1257 }
1258 static inline jclass LDKRecipient_to_java(JNIEnv *env, LDKRecipient val) {
1259         switch (val) {
1260                 case LDKRecipient_Node:
1261                         return (*env)->GetStaticObjectField(env, Recipient_class, Recipient_LDKRecipient_Node);
1262                 case LDKRecipient_PhantomNode:
1263                         return (*env)->GetStaticObjectField(env, Recipient_class, Recipient_LDKRecipient_PhantomNode);
1264                 default: abort();
1265         }
1266 }
1267
1268 static inline LDKRetryableSendFailure LDKRetryableSendFailure_from_java(JNIEnv *env, jclass clz) {
1269         jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
1270         if (UNLIKELY((*env)->ExceptionCheck(env))) {
1271                 (*env)->ExceptionDescribe(env);
1272                 (*env)->FatalError(env, "A call to RetryableSendFailure.ordinal() from rust threw an exception.");
1273         }
1274         switch (ord) {
1275                 case 0: return LDKRetryableSendFailure_PaymentExpired;
1276                 case 1: return LDKRetryableSendFailure_RouteNotFound;
1277                 case 2: return LDKRetryableSendFailure_DuplicatePayment;
1278         }
1279         (*env)->FatalError(env, "A call to RetryableSendFailure.ordinal() from rust returned an invalid value.");
1280         abort(); // Unreachable, but will let the compiler know we don't return here
1281 }
1282 static jclass RetryableSendFailure_class = NULL;
1283 static jfieldID RetryableSendFailure_LDKRetryableSendFailure_PaymentExpired = NULL;
1284 static jfieldID RetryableSendFailure_LDKRetryableSendFailure_RouteNotFound = NULL;
1285 static jfieldID RetryableSendFailure_LDKRetryableSendFailure_DuplicatePayment = NULL;
1286 JNIEXPORT void JNICALL Java_org_ldk_enums_RetryableSendFailure_init (JNIEnv *env, jclass clz) {
1287         RetryableSendFailure_class = (*env)->NewGlobalRef(env, clz);
1288         CHECK(RetryableSendFailure_class != NULL);
1289         RetryableSendFailure_LDKRetryableSendFailure_PaymentExpired = (*env)->GetStaticFieldID(env, RetryableSendFailure_class, "LDKRetryableSendFailure_PaymentExpired", "Lorg/ldk/enums/RetryableSendFailure;");
1290         CHECK(RetryableSendFailure_LDKRetryableSendFailure_PaymentExpired != NULL);
1291         RetryableSendFailure_LDKRetryableSendFailure_RouteNotFound = (*env)->GetStaticFieldID(env, RetryableSendFailure_class, "LDKRetryableSendFailure_RouteNotFound", "Lorg/ldk/enums/RetryableSendFailure;");
1292         CHECK(RetryableSendFailure_LDKRetryableSendFailure_RouteNotFound != NULL);
1293         RetryableSendFailure_LDKRetryableSendFailure_DuplicatePayment = (*env)->GetStaticFieldID(env, RetryableSendFailure_class, "LDKRetryableSendFailure_DuplicatePayment", "Lorg/ldk/enums/RetryableSendFailure;");
1294         CHECK(RetryableSendFailure_LDKRetryableSendFailure_DuplicatePayment != NULL);
1295 }
1296 static inline jclass LDKRetryableSendFailure_to_java(JNIEnv *env, LDKRetryableSendFailure val) {
1297         switch (val) {
1298                 case LDKRetryableSendFailure_PaymentExpired:
1299                         return (*env)->GetStaticObjectField(env, RetryableSendFailure_class, RetryableSendFailure_LDKRetryableSendFailure_PaymentExpired);
1300                 case LDKRetryableSendFailure_RouteNotFound:
1301                         return (*env)->GetStaticObjectField(env, RetryableSendFailure_class, RetryableSendFailure_LDKRetryableSendFailure_RouteNotFound);
1302                 case LDKRetryableSendFailure_DuplicatePayment:
1303                         return (*env)->GetStaticObjectField(env, RetryableSendFailure_class, RetryableSendFailure_LDKRetryableSendFailure_DuplicatePayment);
1304                 default: abort();
1305         }
1306 }
1307
1308 static inline LDKSecp256k1Error LDKSecp256k1Error_from_java(JNIEnv *env, jclass clz) {
1309         jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
1310         if (UNLIKELY((*env)->ExceptionCheck(env))) {
1311                 (*env)->ExceptionDescribe(env);
1312                 (*env)->FatalError(env, "A call to Secp256k1Error.ordinal() from rust threw an exception.");
1313         }
1314         switch (ord) {
1315                 case 0: return LDKSecp256k1Error_IncorrectSignature;
1316                 case 1: return LDKSecp256k1Error_InvalidMessage;
1317                 case 2: return LDKSecp256k1Error_InvalidPublicKey;
1318                 case 3: return LDKSecp256k1Error_InvalidSignature;
1319                 case 4: return LDKSecp256k1Error_InvalidSecretKey;
1320                 case 5: return LDKSecp256k1Error_InvalidSharedSecret;
1321                 case 6: return LDKSecp256k1Error_InvalidRecoveryId;
1322                 case 7: return LDKSecp256k1Error_InvalidTweak;
1323                 case 8: return LDKSecp256k1Error_NotEnoughMemory;
1324                 case 9: return LDKSecp256k1Error_InvalidPublicKeySum;
1325                 case 10: return LDKSecp256k1Error_InvalidParityValue;
1326         }
1327         (*env)->FatalError(env, "A call to Secp256k1Error.ordinal() from rust returned an invalid value.");
1328         abort(); // Unreachable, but will let the compiler know we don't return here
1329 }
1330 static jclass Secp256k1Error_class = NULL;
1331 static jfieldID Secp256k1Error_LDKSecp256k1Error_IncorrectSignature = NULL;
1332 static jfieldID Secp256k1Error_LDKSecp256k1Error_InvalidMessage = NULL;
1333 static jfieldID Secp256k1Error_LDKSecp256k1Error_InvalidPublicKey = NULL;
1334 static jfieldID Secp256k1Error_LDKSecp256k1Error_InvalidSignature = NULL;
1335 static jfieldID Secp256k1Error_LDKSecp256k1Error_InvalidSecretKey = NULL;
1336 static jfieldID Secp256k1Error_LDKSecp256k1Error_InvalidSharedSecret = NULL;
1337 static jfieldID Secp256k1Error_LDKSecp256k1Error_InvalidRecoveryId = NULL;
1338 static jfieldID Secp256k1Error_LDKSecp256k1Error_InvalidTweak = NULL;
1339 static jfieldID Secp256k1Error_LDKSecp256k1Error_NotEnoughMemory = NULL;
1340 static jfieldID Secp256k1Error_LDKSecp256k1Error_InvalidPublicKeySum = NULL;
1341 static jfieldID Secp256k1Error_LDKSecp256k1Error_InvalidParityValue = NULL;
1342 JNIEXPORT void JNICALL Java_org_ldk_enums_Secp256k1Error_init (JNIEnv *env, jclass clz) {
1343         Secp256k1Error_class = (*env)->NewGlobalRef(env, clz);
1344         CHECK(Secp256k1Error_class != NULL);
1345         Secp256k1Error_LDKSecp256k1Error_IncorrectSignature = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_IncorrectSignature", "Lorg/ldk/enums/Secp256k1Error;");
1346         CHECK(Secp256k1Error_LDKSecp256k1Error_IncorrectSignature != NULL);
1347         Secp256k1Error_LDKSecp256k1Error_InvalidMessage = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_InvalidMessage", "Lorg/ldk/enums/Secp256k1Error;");
1348         CHECK(Secp256k1Error_LDKSecp256k1Error_InvalidMessage != NULL);
1349         Secp256k1Error_LDKSecp256k1Error_InvalidPublicKey = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_InvalidPublicKey", "Lorg/ldk/enums/Secp256k1Error;");
1350         CHECK(Secp256k1Error_LDKSecp256k1Error_InvalidPublicKey != NULL);
1351         Secp256k1Error_LDKSecp256k1Error_InvalidSignature = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_InvalidSignature", "Lorg/ldk/enums/Secp256k1Error;");
1352         CHECK(Secp256k1Error_LDKSecp256k1Error_InvalidSignature != NULL);
1353         Secp256k1Error_LDKSecp256k1Error_InvalidSecretKey = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_InvalidSecretKey", "Lorg/ldk/enums/Secp256k1Error;");
1354         CHECK(Secp256k1Error_LDKSecp256k1Error_InvalidSecretKey != NULL);
1355         Secp256k1Error_LDKSecp256k1Error_InvalidSharedSecret = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_InvalidSharedSecret", "Lorg/ldk/enums/Secp256k1Error;");
1356         CHECK(Secp256k1Error_LDKSecp256k1Error_InvalidSharedSecret != NULL);
1357         Secp256k1Error_LDKSecp256k1Error_InvalidRecoveryId = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_InvalidRecoveryId", "Lorg/ldk/enums/Secp256k1Error;");
1358         CHECK(Secp256k1Error_LDKSecp256k1Error_InvalidRecoveryId != NULL);
1359         Secp256k1Error_LDKSecp256k1Error_InvalidTweak = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_InvalidTweak", "Lorg/ldk/enums/Secp256k1Error;");
1360         CHECK(Secp256k1Error_LDKSecp256k1Error_InvalidTweak != NULL);
1361         Secp256k1Error_LDKSecp256k1Error_NotEnoughMemory = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_NotEnoughMemory", "Lorg/ldk/enums/Secp256k1Error;");
1362         CHECK(Secp256k1Error_LDKSecp256k1Error_NotEnoughMemory != NULL);
1363         Secp256k1Error_LDKSecp256k1Error_InvalidPublicKeySum = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_InvalidPublicKeySum", "Lorg/ldk/enums/Secp256k1Error;");
1364         CHECK(Secp256k1Error_LDKSecp256k1Error_InvalidPublicKeySum != NULL);
1365         Secp256k1Error_LDKSecp256k1Error_InvalidParityValue = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_InvalidParityValue", "Lorg/ldk/enums/Secp256k1Error;");
1366         CHECK(Secp256k1Error_LDKSecp256k1Error_InvalidParityValue != NULL);
1367 }
1368 static inline jclass LDKSecp256k1Error_to_java(JNIEnv *env, LDKSecp256k1Error val) {
1369         switch (val) {
1370                 case LDKSecp256k1Error_IncorrectSignature:
1371                         return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_IncorrectSignature);
1372                 case LDKSecp256k1Error_InvalidMessage:
1373                         return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_InvalidMessage);
1374                 case LDKSecp256k1Error_InvalidPublicKey:
1375                         return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_InvalidPublicKey);
1376                 case LDKSecp256k1Error_InvalidSignature:
1377                         return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_InvalidSignature);
1378                 case LDKSecp256k1Error_InvalidSecretKey:
1379                         return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_InvalidSecretKey);
1380                 case LDKSecp256k1Error_InvalidSharedSecret:
1381                         return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_InvalidSharedSecret);
1382                 case LDKSecp256k1Error_InvalidRecoveryId:
1383                         return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_InvalidRecoveryId);
1384                 case LDKSecp256k1Error_InvalidTweak:
1385                         return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_InvalidTweak);
1386                 case LDKSecp256k1Error_NotEnoughMemory:
1387                         return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_NotEnoughMemory);
1388                 case LDKSecp256k1Error_InvalidPublicKeySum:
1389                         return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_InvalidPublicKeySum);
1390                 case LDKSecp256k1Error_InvalidParityValue:
1391                         return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_InvalidParityValue);
1392                 default: abort();
1393         }
1394 }
1395
1396 static inline LDKShortChannelIdError LDKShortChannelIdError_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 ShortChannelIdError.ordinal() from rust threw an exception.");
1401         }
1402         switch (ord) {
1403                 case 0: return LDKShortChannelIdError_BlockOverflow;
1404                 case 1: return LDKShortChannelIdError_TxIndexOverflow;
1405                 case 2: return LDKShortChannelIdError_VoutIndexOverflow;
1406         }
1407         (*env)->FatalError(env, "A call to ShortChannelIdError.ordinal() from rust returned an invalid value.");
1408         abort(); // Unreachable, but will let the compiler know we don't return here
1409 }
1410 static jclass ShortChannelIdError_class = NULL;
1411 static jfieldID ShortChannelIdError_LDKShortChannelIdError_BlockOverflow = NULL;
1412 static jfieldID ShortChannelIdError_LDKShortChannelIdError_TxIndexOverflow = NULL;
1413 static jfieldID ShortChannelIdError_LDKShortChannelIdError_VoutIndexOverflow = NULL;
1414 JNIEXPORT void JNICALL Java_org_ldk_enums_ShortChannelIdError_init (JNIEnv *env, jclass clz) {
1415         ShortChannelIdError_class = (*env)->NewGlobalRef(env, clz);
1416         CHECK(ShortChannelIdError_class != NULL);
1417         ShortChannelIdError_LDKShortChannelIdError_BlockOverflow = (*env)->GetStaticFieldID(env, ShortChannelIdError_class, "LDKShortChannelIdError_BlockOverflow", "Lorg/ldk/enums/ShortChannelIdError;");
1418         CHECK(ShortChannelIdError_LDKShortChannelIdError_BlockOverflow != NULL);
1419         ShortChannelIdError_LDKShortChannelIdError_TxIndexOverflow = (*env)->GetStaticFieldID(env, ShortChannelIdError_class, "LDKShortChannelIdError_TxIndexOverflow", "Lorg/ldk/enums/ShortChannelIdError;");
1420         CHECK(ShortChannelIdError_LDKShortChannelIdError_TxIndexOverflow != NULL);
1421         ShortChannelIdError_LDKShortChannelIdError_VoutIndexOverflow = (*env)->GetStaticFieldID(env, ShortChannelIdError_class, "LDKShortChannelIdError_VoutIndexOverflow", "Lorg/ldk/enums/ShortChannelIdError;");
1422         CHECK(ShortChannelIdError_LDKShortChannelIdError_VoutIndexOverflow != NULL);
1423 }
1424 static inline jclass LDKShortChannelIdError_to_java(JNIEnv *env, LDKShortChannelIdError val) {
1425         switch (val) {
1426                 case LDKShortChannelIdError_BlockOverflow:
1427                         return (*env)->GetStaticObjectField(env, ShortChannelIdError_class, ShortChannelIdError_LDKShortChannelIdError_BlockOverflow);
1428                 case LDKShortChannelIdError_TxIndexOverflow:
1429                         return (*env)->GetStaticObjectField(env, ShortChannelIdError_class, ShortChannelIdError_LDKShortChannelIdError_TxIndexOverflow);
1430                 case LDKShortChannelIdError_VoutIndexOverflow:
1431                         return (*env)->GetStaticObjectField(env, ShortChannelIdError_class, ShortChannelIdError_LDKShortChannelIdError_VoutIndexOverflow);
1432                 default: abort();
1433         }
1434 }
1435
1436 static inline LDKSiPrefix LDKSiPrefix_from_java(JNIEnv *env, jclass clz) {
1437         jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
1438         if (UNLIKELY((*env)->ExceptionCheck(env))) {
1439                 (*env)->ExceptionDescribe(env);
1440                 (*env)->FatalError(env, "A call to SiPrefix.ordinal() from rust threw an exception.");
1441         }
1442         switch (ord) {
1443                 case 0: return LDKSiPrefix_Milli;
1444                 case 1: return LDKSiPrefix_Micro;
1445                 case 2: return LDKSiPrefix_Nano;
1446                 case 3: return LDKSiPrefix_Pico;
1447         }
1448         (*env)->FatalError(env, "A call to SiPrefix.ordinal() from rust returned an invalid value.");
1449         abort(); // Unreachable, but will let the compiler know we don't return here
1450 }
1451 static jclass SiPrefix_class = NULL;
1452 static jfieldID SiPrefix_LDKSiPrefix_Milli = NULL;
1453 static jfieldID SiPrefix_LDKSiPrefix_Micro = NULL;
1454 static jfieldID SiPrefix_LDKSiPrefix_Nano = NULL;
1455 static jfieldID SiPrefix_LDKSiPrefix_Pico = NULL;
1456 JNIEXPORT void JNICALL Java_org_ldk_enums_SiPrefix_init (JNIEnv *env, jclass clz) {
1457         SiPrefix_class = (*env)->NewGlobalRef(env, clz);
1458         CHECK(SiPrefix_class != NULL);
1459         SiPrefix_LDKSiPrefix_Milli = (*env)->GetStaticFieldID(env, SiPrefix_class, "LDKSiPrefix_Milli", "Lorg/ldk/enums/SiPrefix;");
1460         CHECK(SiPrefix_LDKSiPrefix_Milli != NULL);
1461         SiPrefix_LDKSiPrefix_Micro = (*env)->GetStaticFieldID(env, SiPrefix_class, "LDKSiPrefix_Micro", "Lorg/ldk/enums/SiPrefix;");
1462         CHECK(SiPrefix_LDKSiPrefix_Micro != NULL);
1463         SiPrefix_LDKSiPrefix_Nano = (*env)->GetStaticFieldID(env, SiPrefix_class, "LDKSiPrefix_Nano", "Lorg/ldk/enums/SiPrefix;");
1464         CHECK(SiPrefix_LDKSiPrefix_Nano != NULL);
1465         SiPrefix_LDKSiPrefix_Pico = (*env)->GetStaticFieldID(env, SiPrefix_class, "LDKSiPrefix_Pico", "Lorg/ldk/enums/SiPrefix;");
1466         CHECK(SiPrefix_LDKSiPrefix_Pico != NULL);
1467 }
1468 static inline jclass LDKSiPrefix_to_java(JNIEnv *env, LDKSiPrefix val) {
1469         switch (val) {
1470                 case LDKSiPrefix_Milli:
1471                         return (*env)->GetStaticObjectField(env, SiPrefix_class, SiPrefix_LDKSiPrefix_Milli);
1472                 case LDKSiPrefix_Micro:
1473                         return (*env)->GetStaticObjectField(env, SiPrefix_class, SiPrefix_LDKSiPrefix_Micro);
1474                 case LDKSiPrefix_Nano:
1475                         return (*env)->GetStaticObjectField(env, SiPrefix_class, SiPrefix_LDKSiPrefix_Nano);
1476                 case LDKSiPrefix_Pico:
1477                         return (*env)->GetStaticObjectField(env, SiPrefix_class, SiPrefix_LDKSiPrefix_Pico);
1478                 default: abort();
1479         }
1480 }
1481
1482 static inline LDKSocketAddressParseError LDKSocketAddressParseError_from_java(JNIEnv *env, jclass clz) {
1483         jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
1484         if (UNLIKELY((*env)->ExceptionCheck(env))) {
1485                 (*env)->ExceptionDescribe(env);
1486                 (*env)->FatalError(env, "A call to SocketAddressParseError.ordinal() from rust threw an exception.");
1487         }
1488         switch (ord) {
1489                 case 0: return LDKSocketAddressParseError_SocketAddrParse;
1490                 case 1: return LDKSocketAddressParseError_InvalidInput;
1491                 case 2: return LDKSocketAddressParseError_InvalidPort;
1492                 case 3: return LDKSocketAddressParseError_InvalidOnionV3;
1493         }
1494         (*env)->FatalError(env, "A call to SocketAddressParseError.ordinal() from rust returned an invalid value.");
1495         abort(); // Unreachable, but will let the compiler know we don't return here
1496 }
1497 static jclass SocketAddressParseError_class = NULL;
1498 static jfieldID SocketAddressParseError_LDKSocketAddressParseError_SocketAddrParse = NULL;
1499 static jfieldID SocketAddressParseError_LDKSocketAddressParseError_InvalidInput = NULL;
1500 static jfieldID SocketAddressParseError_LDKSocketAddressParseError_InvalidPort = NULL;
1501 static jfieldID SocketAddressParseError_LDKSocketAddressParseError_InvalidOnionV3 = NULL;
1502 JNIEXPORT void JNICALL Java_org_ldk_enums_SocketAddressParseError_init (JNIEnv *env, jclass clz) {
1503         SocketAddressParseError_class = (*env)->NewGlobalRef(env, clz);
1504         CHECK(SocketAddressParseError_class != NULL);
1505         SocketAddressParseError_LDKSocketAddressParseError_SocketAddrParse = (*env)->GetStaticFieldID(env, SocketAddressParseError_class, "LDKSocketAddressParseError_SocketAddrParse", "Lorg/ldk/enums/SocketAddressParseError;");
1506         CHECK(SocketAddressParseError_LDKSocketAddressParseError_SocketAddrParse != NULL);
1507         SocketAddressParseError_LDKSocketAddressParseError_InvalidInput = (*env)->GetStaticFieldID(env, SocketAddressParseError_class, "LDKSocketAddressParseError_InvalidInput", "Lorg/ldk/enums/SocketAddressParseError;");
1508         CHECK(SocketAddressParseError_LDKSocketAddressParseError_InvalidInput != NULL);
1509         SocketAddressParseError_LDKSocketAddressParseError_InvalidPort = (*env)->GetStaticFieldID(env, SocketAddressParseError_class, "LDKSocketAddressParseError_InvalidPort", "Lorg/ldk/enums/SocketAddressParseError;");
1510         CHECK(SocketAddressParseError_LDKSocketAddressParseError_InvalidPort != NULL);
1511         SocketAddressParseError_LDKSocketAddressParseError_InvalidOnionV3 = (*env)->GetStaticFieldID(env, SocketAddressParseError_class, "LDKSocketAddressParseError_InvalidOnionV3", "Lorg/ldk/enums/SocketAddressParseError;");
1512         CHECK(SocketAddressParseError_LDKSocketAddressParseError_InvalidOnionV3 != NULL);
1513 }
1514 static inline jclass LDKSocketAddressParseError_to_java(JNIEnv *env, LDKSocketAddressParseError val) {
1515         switch (val) {
1516                 case LDKSocketAddressParseError_SocketAddrParse:
1517                         return (*env)->GetStaticObjectField(env, SocketAddressParseError_class, SocketAddressParseError_LDKSocketAddressParseError_SocketAddrParse);
1518                 case LDKSocketAddressParseError_InvalidInput:
1519                         return (*env)->GetStaticObjectField(env, SocketAddressParseError_class, SocketAddressParseError_LDKSocketAddressParseError_InvalidInput);
1520                 case LDKSocketAddressParseError_InvalidPort:
1521                         return (*env)->GetStaticObjectField(env, SocketAddressParseError_class, SocketAddressParseError_LDKSocketAddressParseError_InvalidPort);
1522                 case LDKSocketAddressParseError_InvalidOnionV3:
1523                         return (*env)->GetStaticObjectField(env, SocketAddressParseError_class, SocketAddressParseError_LDKSocketAddressParseError_InvalidOnionV3);
1524                 default: abort();
1525         }
1526 }
1527
1528 static inline LDKUtxoLookupError LDKUtxoLookupError_from_java(JNIEnv *env, jclass clz) {
1529         jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth);
1530         if (UNLIKELY((*env)->ExceptionCheck(env))) {
1531                 (*env)->ExceptionDescribe(env);
1532                 (*env)->FatalError(env, "A call to UtxoLookupError.ordinal() from rust threw an exception.");
1533         }
1534         switch (ord) {
1535                 case 0: return LDKUtxoLookupError_UnknownChain;
1536                 case 1: return LDKUtxoLookupError_UnknownTx;
1537         }
1538         (*env)->FatalError(env, "A call to UtxoLookupError.ordinal() from rust returned an invalid value.");
1539         abort(); // Unreachable, but will let the compiler know we don't return here
1540 }
1541 static jclass UtxoLookupError_class = NULL;
1542 static jfieldID UtxoLookupError_LDKUtxoLookupError_UnknownChain = NULL;
1543 static jfieldID UtxoLookupError_LDKUtxoLookupError_UnknownTx = NULL;
1544 JNIEXPORT void JNICALL Java_org_ldk_enums_UtxoLookupError_init (JNIEnv *env, jclass clz) {
1545         UtxoLookupError_class = (*env)->NewGlobalRef(env, clz);
1546         CHECK(UtxoLookupError_class != NULL);
1547         UtxoLookupError_LDKUtxoLookupError_UnknownChain = (*env)->GetStaticFieldID(env, UtxoLookupError_class, "LDKUtxoLookupError_UnknownChain", "Lorg/ldk/enums/UtxoLookupError;");
1548         CHECK(UtxoLookupError_LDKUtxoLookupError_UnknownChain != NULL);
1549         UtxoLookupError_LDKUtxoLookupError_UnknownTx = (*env)->GetStaticFieldID(env, UtxoLookupError_class, "LDKUtxoLookupError_UnknownTx", "Lorg/ldk/enums/UtxoLookupError;");
1550         CHECK(UtxoLookupError_LDKUtxoLookupError_UnknownTx != NULL);
1551 }
1552 static inline jclass LDKUtxoLookupError_to_java(JNIEnv *env, LDKUtxoLookupError val) {
1553         switch (val) {
1554                 case LDKUtxoLookupError_UnknownChain:
1555                         return (*env)->GetStaticObjectField(env, UtxoLookupError_class, UtxoLookupError_LDKUtxoLookupError_UnknownChain);
1556                 case LDKUtxoLookupError_UnknownTx:
1557                         return (*env)->GetStaticObjectField(env, UtxoLookupError_class, UtxoLookupError_LDKUtxoLookupError_UnknownTx);
1558                 default: abort();
1559         }
1560 }
1561
1562 static inline LDKCVec_u8Z CVec_u8Z_clone(const LDKCVec_u8Z *orig) {
1563         LDKCVec_u8Z ret = { .data = MALLOC(sizeof(int8_t) * orig->datalen, "LDKCVec_u8Z clone bytes"), .datalen = orig->datalen };
1564         memcpy(ret.data, orig->data, sizeof(int8_t) * ret.datalen);
1565         return ret;
1566 }
1567 struct LDKThirtyTwoBytes BigEndianScalar_get_bytes (struct LDKBigEndianScalar* thing) {
1568         LDKThirtyTwoBytes ret = { .data = *thing->big_endian_bytes };
1569         return ret;
1570 }
1571 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BigEndianScalar_1get_1bytes(JNIEnv *env, jclass clz, int64_t thing) {
1572         LDKBigEndianScalar* thing_conv = (LDKBigEndianScalar*)untag_ptr(thing);
1573         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
1574         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, BigEndianScalar_get_bytes(thing_conv).data);
1575         return ret_arr;
1576 }
1577
1578 static void BigEndianScalar_free (struct LDKBigEndianScalar thing) {}
1579 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BigEndianScalar_1free(JNIEnv *env, jclass clz, int64_t thing) {
1580         if (!ptr_is_owned(thing)) return;
1581         void* thing_ptr = untag_ptr(thing);
1582         CHECK_ACCESS(thing_ptr);
1583         LDKBigEndianScalar thing_conv = *(LDKBigEndianScalar*)(thing_ptr);
1584         FREE(untag_ptr(thing));
1585         BigEndianScalar_free(thing_conv);
1586 }
1587
1588 static jclass LDKBech32Error_MissingSeparator_class = NULL;
1589 static jmethodID LDKBech32Error_MissingSeparator_meth = NULL;
1590 static jclass LDKBech32Error_InvalidChecksum_class = NULL;
1591 static jmethodID LDKBech32Error_InvalidChecksum_meth = NULL;
1592 static jclass LDKBech32Error_InvalidLength_class = NULL;
1593 static jmethodID LDKBech32Error_InvalidLength_meth = NULL;
1594 static jclass LDKBech32Error_InvalidChar_class = NULL;
1595 static jmethodID LDKBech32Error_InvalidChar_meth = NULL;
1596 static jclass LDKBech32Error_InvalidData_class = NULL;
1597 static jmethodID LDKBech32Error_InvalidData_meth = NULL;
1598 static jclass LDKBech32Error_InvalidPadding_class = NULL;
1599 static jmethodID LDKBech32Error_InvalidPadding_meth = NULL;
1600 static jclass LDKBech32Error_MixedCase_class = NULL;
1601 static jmethodID LDKBech32Error_MixedCase_meth = NULL;
1602 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKBech32Error_init (JNIEnv *env, jclass clz) {
1603         LDKBech32Error_MissingSeparator_class =
1604                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBech32Error$MissingSeparator"));
1605         CHECK(LDKBech32Error_MissingSeparator_class != NULL);
1606         LDKBech32Error_MissingSeparator_meth = (*env)->GetMethodID(env, LDKBech32Error_MissingSeparator_class, "<init>", "()V");
1607         CHECK(LDKBech32Error_MissingSeparator_meth != NULL);
1608         LDKBech32Error_InvalidChecksum_class =
1609                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBech32Error$InvalidChecksum"));
1610         CHECK(LDKBech32Error_InvalidChecksum_class != NULL);
1611         LDKBech32Error_InvalidChecksum_meth = (*env)->GetMethodID(env, LDKBech32Error_InvalidChecksum_class, "<init>", "()V");
1612         CHECK(LDKBech32Error_InvalidChecksum_meth != NULL);
1613         LDKBech32Error_InvalidLength_class =
1614                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBech32Error$InvalidLength"));
1615         CHECK(LDKBech32Error_InvalidLength_class != NULL);
1616         LDKBech32Error_InvalidLength_meth = (*env)->GetMethodID(env, LDKBech32Error_InvalidLength_class, "<init>", "()V");
1617         CHECK(LDKBech32Error_InvalidLength_meth != NULL);
1618         LDKBech32Error_InvalidChar_class =
1619                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBech32Error$InvalidChar"));
1620         CHECK(LDKBech32Error_InvalidChar_class != NULL);
1621         LDKBech32Error_InvalidChar_meth = (*env)->GetMethodID(env, LDKBech32Error_InvalidChar_class, "<init>", "(I)V");
1622         CHECK(LDKBech32Error_InvalidChar_meth != NULL);
1623         LDKBech32Error_InvalidData_class =
1624                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBech32Error$InvalidData"));
1625         CHECK(LDKBech32Error_InvalidData_class != NULL);
1626         LDKBech32Error_InvalidData_meth = (*env)->GetMethodID(env, LDKBech32Error_InvalidData_class, "<init>", "(B)V");
1627         CHECK(LDKBech32Error_InvalidData_meth != NULL);
1628         LDKBech32Error_InvalidPadding_class =
1629                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBech32Error$InvalidPadding"));
1630         CHECK(LDKBech32Error_InvalidPadding_class != NULL);
1631         LDKBech32Error_InvalidPadding_meth = (*env)->GetMethodID(env, LDKBech32Error_InvalidPadding_class, "<init>", "()V");
1632         CHECK(LDKBech32Error_InvalidPadding_meth != NULL);
1633         LDKBech32Error_MixedCase_class =
1634                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBech32Error$MixedCase"));
1635         CHECK(LDKBech32Error_MixedCase_class != NULL);
1636         LDKBech32Error_MixedCase_meth = (*env)->GetMethodID(env, LDKBech32Error_MixedCase_class, "<init>", "()V");
1637         CHECK(LDKBech32Error_MixedCase_meth != NULL);
1638 }
1639 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKBech32Error_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
1640         LDKBech32Error *obj = (LDKBech32Error*)untag_ptr(ptr);
1641         switch(obj->tag) {
1642                 case LDKBech32Error_MissingSeparator: {
1643                         return (*env)->NewObject(env, LDKBech32Error_MissingSeparator_class, LDKBech32Error_MissingSeparator_meth);
1644                 }
1645                 case LDKBech32Error_InvalidChecksum: {
1646                         return (*env)->NewObject(env, LDKBech32Error_InvalidChecksum_class, LDKBech32Error_InvalidChecksum_meth);
1647                 }
1648                 case LDKBech32Error_InvalidLength: {
1649                         return (*env)->NewObject(env, LDKBech32Error_InvalidLength_class, LDKBech32Error_InvalidLength_meth);
1650                 }
1651                 case LDKBech32Error_InvalidChar: {
1652                         int32_t invalid_char_conv = obj->invalid_char;
1653                         return (*env)->NewObject(env, LDKBech32Error_InvalidChar_class, LDKBech32Error_InvalidChar_meth, invalid_char_conv);
1654                 }
1655                 case LDKBech32Error_InvalidData: {
1656                         int8_t invalid_data_conv = obj->invalid_data;
1657                         return (*env)->NewObject(env, LDKBech32Error_InvalidData_class, LDKBech32Error_InvalidData_meth, invalid_data_conv);
1658                 }
1659                 case LDKBech32Error_InvalidPadding: {
1660                         return (*env)->NewObject(env, LDKBech32Error_InvalidPadding_class, LDKBech32Error_InvalidPadding_meth);
1661                 }
1662                 case LDKBech32Error_MixedCase: {
1663                         return (*env)->NewObject(env, LDKBech32Error_MixedCase_class, LDKBech32Error_MixedCase_meth);
1664                 }
1665                 default: abort();
1666         }
1667 }
1668 static inline struct LDKRefundMaybeWithDerivedMetadataBuilder CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ_get_ok(LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ *NONNULL_PTR owner){
1669         LDKRefundMaybeWithDerivedMetadataBuilder ret = *owner->contents.result;
1670         ret.is_owned = false;
1671         return ret;
1672 }
1673 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1674         LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ* owner_conv = (LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ*)untag_ptr(owner);
1675         LDKRefundMaybeWithDerivedMetadataBuilder ret_var = CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ_get_ok(owner_conv);
1676         int64_t ret_ref = 0;
1677         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1678         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1679         return ret_ref;
1680 }
1681
1682 static inline enum LDKBolt12SemanticError CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ_get_err(LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ *NONNULL_PTR owner){
1683 CHECK(!owner->result_ok);
1684         return Bolt12SemanticError_clone(&*owner->contents.err);
1685 }
1686 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1687         LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ* owner_conv = (LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ*)untag_ptr(owner);
1688         jclass ret_conv = LDKBolt12SemanticError_to_java(env, CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ_get_err(owner_conv));
1689         return ret_conv;
1690 }
1691
1692 static inline struct LDKRefund CResult_RefundBolt12SemanticErrorZ_get_ok(LDKCResult_RefundBolt12SemanticErrorZ *NONNULL_PTR owner){
1693         LDKRefund ret = *owner->contents.result;
1694         ret.is_owned = false;
1695         return ret;
1696 }
1697 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RefundBolt12SemanticErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1698         LDKCResult_RefundBolt12SemanticErrorZ* owner_conv = (LDKCResult_RefundBolt12SemanticErrorZ*)untag_ptr(owner);
1699         LDKRefund ret_var = CResult_RefundBolt12SemanticErrorZ_get_ok(owner_conv);
1700         int64_t ret_ref = 0;
1701         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1702         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1703         return ret_ref;
1704 }
1705
1706 static inline enum LDKBolt12SemanticError CResult_RefundBolt12SemanticErrorZ_get_err(LDKCResult_RefundBolt12SemanticErrorZ *NONNULL_PTR owner){
1707 CHECK(!owner->result_ok);
1708         return Bolt12SemanticError_clone(&*owner->contents.err);
1709 }
1710 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1RefundBolt12SemanticErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1711         LDKCResult_RefundBolt12SemanticErrorZ* owner_conv = (LDKCResult_RefundBolt12SemanticErrorZ*)untag_ptr(owner);
1712         jclass ret_conv = LDKBolt12SemanticError_to_java(env, CResult_RefundBolt12SemanticErrorZ_get_err(owner_conv));
1713         return ret_conv;
1714 }
1715
1716 static jclass LDKCOption_u64Z_Some_class = NULL;
1717 static jmethodID LDKCOption_u64Z_Some_meth = NULL;
1718 static jclass LDKCOption_u64Z_None_class = NULL;
1719 static jmethodID LDKCOption_u64Z_None_meth = NULL;
1720 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1u64Z_init (JNIEnv *env, jclass clz) {
1721         LDKCOption_u64Z_Some_class =
1722                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_u64Z$Some"));
1723         CHECK(LDKCOption_u64Z_Some_class != NULL);
1724         LDKCOption_u64Z_Some_meth = (*env)->GetMethodID(env, LDKCOption_u64Z_Some_class, "<init>", "(J)V");
1725         CHECK(LDKCOption_u64Z_Some_meth != NULL);
1726         LDKCOption_u64Z_None_class =
1727                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_u64Z$None"));
1728         CHECK(LDKCOption_u64Z_None_class != NULL);
1729         LDKCOption_u64Z_None_meth = (*env)->GetMethodID(env, LDKCOption_u64Z_None_class, "<init>", "()V");
1730         CHECK(LDKCOption_u64Z_None_meth != NULL);
1731 }
1732 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1u64Z_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
1733         LDKCOption_u64Z *obj = (LDKCOption_u64Z*)untag_ptr(ptr);
1734         switch(obj->tag) {
1735                 case LDKCOption_u64Z_Some: {
1736                         int64_t some_conv = obj->some;
1737                         return (*env)->NewObject(env, LDKCOption_u64Z_Some_class, LDKCOption_u64Z_Some_meth, some_conv);
1738                 }
1739                 case LDKCOption_u64Z_None: {
1740                         return (*env)->NewObject(env, LDKCOption_u64Z_None_class, LDKCOption_u64Z_None_meth);
1741                 }
1742                 default: abort();
1743         }
1744 }
1745 static inline LDKCVec_BlindedPathZ CVec_BlindedPathZ_clone(const LDKCVec_BlindedPathZ *orig) {
1746         LDKCVec_BlindedPathZ ret = { .data = MALLOC(sizeof(LDKBlindedPath) * orig->datalen, "LDKCVec_BlindedPathZ clone bytes"), .datalen = orig->datalen };
1747         for (size_t i = 0; i < ret.datalen; i++) {
1748                 ret.data[i] = BlindedPath_clone(&orig->data[i]);
1749         }
1750         return ret;
1751 }
1752 static inline struct LDKRefund CResult_RefundBolt12ParseErrorZ_get_ok(LDKCResult_RefundBolt12ParseErrorZ *NONNULL_PTR owner){
1753         LDKRefund ret = *owner->contents.result;
1754         ret.is_owned = false;
1755         return ret;
1756 }
1757 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RefundBolt12ParseErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1758         LDKCResult_RefundBolt12ParseErrorZ* owner_conv = (LDKCResult_RefundBolt12ParseErrorZ*)untag_ptr(owner);
1759         LDKRefund ret_var = CResult_RefundBolt12ParseErrorZ_get_ok(owner_conv);
1760         int64_t ret_ref = 0;
1761         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1762         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1763         return ret_ref;
1764 }
1765
1766 static inline struct LDKBolt12ParseError CResult_RefundBolt12ParseErrorZ_get_err(LDKCResult_RefundBolt12ParseErrorZ *NONNULL_PTR owner){
1767         LDKBolt12ParseError ret = *owner->contents.err;
1768         ret.is_owned = false;
1769         return ret;
1770 }
1771 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RefundBolt12ParseErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1772         LDKCResult_RefundBolt12ParseErrorZ* owner_conv = (LDKCResult_RefundBolt12ParseErrorZ*)untag_ptr(owner);
1773         LDKBolt12ParseError ret_var = CResult_RefundBolt12ParseErrorZ_get_err(owner_conv);
1774         int64_t ret_ref = 0;
1775         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
1776         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
1777         return ret_ref;
1778 }
1779
1780 static jclass LDKRetry_Attempts_class = NULL;
1781 static jmethodID LDKRetry_Attempts_meth = NULL;
1782 static jclass LDKRetry_Timeout_class = NULL;
1783 static jmethodID LDKRetry_Timeout_meth = NULL;
1784 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKRetry_init (JNIEnv *env, jclass clz) {
1785         LDKRetry_Attempts_class =
1786                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKRetry$Attempts"));
1787         CHECK(LDKRetry_Attempts_class != NULL);
1788         LDKRetry_Attempts_meth = (*env)->GetMethodID(env, LDKRetry_Attempts_class, "<init>", "(I)V");
1789         CHECK(LDKRetry_Attempts_meth != NULL);
1790         LDKRetry_Timeout_class =
1791                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKRetry$Timeout"));
1792         CHECK(LDKRetry_Timeout_class != NULL);
1793         LDKRetry_Timeout_meth = (*env)->GetMethodID(env, LDKRetry_Timeout_class, "<init>", "(J)V");
1794         CHECK(LDKRetry_Timeout_meth != NULL);
1795 }
1796 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKRetry_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
1797         LDKRetry *obj = (LDKRetry*)untag_ptr(ptr);
1798         switch(obj->tag) {
1799                 case LDKRetry_Attempts: {
1800                         int32_t attempts_conv = obj->attempts;
1801                         return (*env)->NewObject(env, LDKRetry_Attempts_class, LDKRetry_Attempts_meth, attempts_conv);
1802                 }
1803                 case LDKRetry_Timeout: {
1804                         int64_t timeout_conv = obj->timeout;
1805                         return (*env)->NewObject(env, LDKRetry_Timeout_class, LDKRetry_Timeout_meth, timeout_conv);
1806                 }
1807                 default: abort();
1808         }
1809 }
1810 static jclass LDKDecodeError_UnknownVersion_class = NULL;
1811 static jmethodID LDKDecodeError_UnknownVersion_meth = NULL;
1812 static jclass LDKDecodeError_UnknownRequiredFeature_class = NULL;
1813 static jmethodID LDKDecodeError_UnknownRequiredFeature_meth = NULL;
1814 static jclass LDKDecodeError_InvalidValue_class = NULL;
1815 static jmethodID LDKDecodeError_InvalidValue_meth = NULL;
1816 static jclass LDKDecodeError_ShortRead_class = NULL;
1817 static jmethodID LDKDecodeError_ShortRead_meth = NULL;
1818 static jclass LDKDecodeError_BadLengthDescriptor_class = NULL;
1819 static jmethodID LDKDecodeError_BadLengthDescriptor_meth = NULL;
1820 static jclass LDKDecodeError_Io_class = NULL;
1821 static jmethodID LDKDecodeError_Io_meth = NULL;
1822 static jclass LDKDecodeError_UnsupportedCompression_class = NULL;
1823 static jmethodID LDKDecodeError_UnsupportedCompression_meth = NULL;
1824 static jclass LDKDecodeError_DangerousValue_class = NULL;
1825 static jmethodID LDKDecodeError_DangerousValue_meth = NULL;
1826 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKDecodeError_init (JNIEnv *env, jclass clz) {
1827         LDKDecodeError_UnknownVersion_class =
1828                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKDecodeError$UnknownVersion"));
1829         CHECK(LDKDecodeError_UnknownVersion_class != NULL);
1830         LDKDecodeError_UnknownVersion_meth = (*env)->GetMethodID(env, LDKDecodeError_UnknownVersion_class, "<init>", "()V");
1831         CHECK(LDKDecodeError_UnknownVersion_meth != NULL);
1832         LDKDecodeError_UnknownRequiredFeature_class =
1833                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKDecodeError$UnknownRequiredFeature"));
1834         CHECK(LDKDecodeError_UnknownRequiredFeature_class != NULL);
1835         LDKDecodeError_UnknownRequiredFeature_meth = (*env)->GetMethodID(env, LDKDecodeError_UnknownRequiredFeature_class, "<init>", "()V");
1836         CHECK(LDKDecodeError_UnknownRequiredFeature_meth != NULL);
1837         LDKDecodeError_InvalidValue_class =
1838                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKDecodeError$InvalidValue"));
1839         CHECK(LDKDecodeError_InvalidValue_class != NULL);
1840         LDKDecodeError_InvalidValue_meth = (*env)->GetMethodID(env, LDKDecodeError_InvalidValue_class, "<init>", "()V");
1841         CHECK(LDKDecodeError_InvalidValue_meth != NULL);
1842         LDKDecodeError_ShortRead_class =
1843                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKDecodeError$ShortRead"));
1844         CHECK(LDKDecodeError_ShortRead_class != NULL);
1845         LDKDecodeError_ShortRead_meth = (*env)->GetMethodID(env, LDKDecodeError_ShortRead_class, "<init>", "()V");
1846         CHECK(LDKDecodeError_ShortRead_meth != NULL);
1847         LDKDecodeError_BadLengthDescriptor_class =
1848                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKDecodeError$BadLengthDescriptor"));
1849         CHECK(LDKDecodeError_BadLengthDescriptor_class != NULL);
1850         LDKDecodeError_BadLengthDescriptor_meth = (*env)->GetMethodID(env, LDKDecodeError_BadLengthDescriptor_class, "<init>", "()V");
1851         CHECK(LDKDecodeError_BadLengthDescriptor_meth != NULL);
1852         LDKDecodeError_Io_class =
1853                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKDecodeError$Io"));
1854         CHECK(LDKDecodeError_Io_class != NULL);
1855         LDKDecodeError_Io_meth = (*env)->GetMethodID(env, LDKDecodeError_Io_class, "<init>", "(Lorg/ldk/enums/IOError;)V");
1856         CHECK(LDKDecodeError_Io_meth != NULL);
1857         LDKDecodeError_UnsupportedCompression_class =
1858                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKDecodeError$UnsupportedCompression"));
1859         CHECK(LDKDecodeError_UnsupportedCompression_class != NULL);
1860         LDKDecodeError_UnsupportedCompression_meth = (*env)->GetMethodID(env, LDKDecodeError_UnsupportedCompression_class, "<init>", "()V");
1861         CHECK(LDKDecodeError_UnsupportedCompression_meth != NULL);
1862         LDKDecodeError_DangerousValue_class =
1863                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKDecodeError$DangerousValue"));
1864         CHECK(LDKDecodeError_DangerousValue_class != NULL);
1865         LDKDecodeError_DangerousValue_meth = (*env)->GetMethodID(env, LDKDecodeError_DangerousValue_class, "<init>", "()V");
1866         CHECK(LDKDecodeError_DangerousValue_meth != NULL);
1867 }
1868 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKDecodeError_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
1869         LDKDecodeError *obj = (LDKDecodeError*)untag_ptr(ptr);
1870         switch(obj->tag) {
1871                 case LDKDecodeError_UnknownVersion: {
1872                         return (*env)->NewObject(env, LDKDecodeError_UnknownVersion_class, LDKDecodeError_UnknownVersion_meth);
1873                 }
1874                 case LDKDecodeError_UnknownRequiredFeature: {
1875                         return (*env)->NewObject(env, LDKDecodeError_UnknownRequiredFeature_class, LDKDecodeError_UnknownRequiredFeature_meth);
1876                 }
1877                 case LDKDecodeError_InvalidValue: {
1878                         return (*env)->NewObject(env, LDKDecodeError_InvalidValue_class, LDKDecodeError_InvalidValue_meth);
1879                 }
1880                 case LDKDecodeError_ShortRead: {
1881                         return (*env)->NewObject(env, LDKDecodeError_ShortRead_class, LDKDecodeError_ShortRead_meth);
1882                 }
1883                 case LDKDecodeError_BadLengthDescriptor: {
1884                         return (*env)->NewObject(env, LDKDecodeError_BadLengthDescriptor_class, LDKDecodeError_BadLengthDescriptor_meth);
1885                 }
1886                 case LDKDecodeError_Io: {
1887                         jclass io_conv = LDKIOError_to_java(env, obj->io);
1888                         return (*env)->NewObject(env, LDKDecodeError_Io_class, LDKDecodeError_Io_meth, io_conv);
1889                 }
1890                 case LDKDecodeError_UnsupportedCompression: {
1891                         return (*env)->NewObject(env, LDKDecodeError_UnsupportedCompression_class, LDKDecodeError_UnsupportedCompression_meth);
1892                 }
1893                 case LDKDecodeError_DangerousValue: {
1894                         return (*env)->NewObject(env, LDKDecodeError_DangerousValue_class, LDKDecodeError_DangerousValue_meth);
1895                 }
1896                 default: abort();
1897         }
1898 }
1899 static inline struct LDKRetry CResult_RetryDecodeErrorZ_get_ok(LDKCResult_RetryDecodeErrorZ *NONNULL_PTR owner){
1900 CHECK(owner->result_ok);
1901         return Retry_clone(&*owner->contents.result);
1902 }
1903 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RetryDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
1904         LDKCResult_RetryDecodeErrorZ* owner_conv = (LDKCResult_RetryDecodeErrorZ*)untag_ptr(owner);
1905         LDKRetry *ret_copy = MALLOC(sizeof(LDKRetry), "LDKRetry");
1906         *ret_copy = CResult_RetryDecodeErrorZ_get_ok(owner_conv);
1907         int64_t ret_ref = tag_ptr(ret_copy, true);
1908         return ret_ref;
1909 }
1910
1911 static inline struct LDKDecodeError CResult_RetryDecodeErrorZ_get_err(LDKCResult_RetryDecodeErrorZ *NONNULL_PTR owner){
1912 CHECK(!owner->result_ok);
1913         return DecodeError_clone(&*owner->contents.err);
1914 }
1915 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RetryDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
1916         LDKCResult_RetryDecodeErrorZ* owner_conv = (LDKCResult_RetryDecodeErrorZ*)untag_ptr(owner);
1917         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
1918         *ret_copy = CResult_RetryDecodeErrorZ_get_err(owner_conv);
1919         int64_t ret_ref = tag_ptr(ret_copy, true);
1920         return ret_ref;
1921 }
1922
1923 static jclass LDKAPIError_APIMisuseError_class = NULL;
1924 static jmethodID LDKAPIError_APIMisuseError_meth = NULL;
1925 static jclass LDKAPIError_FeeRateTooHigh_class = NULL;
1926 static jmethodID LDKAPIError_FeeRateTooHigh_meth = NULL;
1927 static jclass LDKAPIError_InvalidRoute_class = NULL;
1928 static jmethodID LDKAPIError_InvalidRoute_meth = NULL;
1929 static jclass LDKAPIError_ChannelUnavailable_class = NULL;
1930 static jmethodID LDKAPIError_ChannelUnavailable_meth = NULL;
1931 static jclass LDKAPIError_MonitorUpdateInProgress_class = NULL;
1932 static jmethodID LDKAPIError_MonitorUpdateInProgress_meth = NULL;
1933 static jclass LDKAPIError_IncompatibleShutdownScript_class = NULL;
1934 static jmethodID LDKAPIError_IncompatibleShutdownScript_meth = NULL;
1935 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKAPIError_init (JNIEnv *env, jclass clz) {
1936         LDKAPIError_APIMisuseError_class =
1937                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKAPIError$APIMisuseError"));
1938         CHECK(LDKAPIError_APIMisuseError_class != NULL);
1939         LDKAPIError_APIMisuseError_meth = (*env)->GetMethodID(env, LDKAPIError_APIMisuseError_class, "<init>", "(Ljava/lang/String;)V");
1940         CHECK(LDKAPIError_APIMisuseError_meth != NULL);
1941         LDKAPIError_FeeRateTooHigh_class =
1942                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKAPIError$FeeRateTooHigh"));
1943         CHECK(LDKAPIError_FeeRateTooHigh_class != NULL);
1944         LDKAPIError_FeeRateTooHigh_meth = (*env)->GetMethodID(env, LDKAPIError_FeeRateTooHigh_class, "<init>", "(Ljava/lang/String;I)V");
1945         CHECK(LDKAPIError_FeeRateTooHigh_meth != NULL);
1946         LDKAPIError_InvalidRoute_class =
1947                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKAPIError$InvalidRoute"));
1948         CHECK(LDKAPIError_InvalidRoute_class != NULL);
1949         LDKAPIError_InvalidRoute_meth = (*env)->GetMethodID(env, LDKAPIError_InvalidRoute_class, "<init>", "(Ljava/lang/String;)V");
1950         CHECK(LDKAPIError_InvalidRoute_meth != NULL);
1951         LDKAPIError_ChannelUnavailable_class =
1952                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKAPIError$ChannelUnavailable"));
1953         CHECK(LDKAPIError_ChannelUnavailable_class != NULL);
1954         LDKAPIError_ChannelUnavailable_meth = (*env)->GetMethodID(env, LDKAPIError_ChannelUnavailable_class, "<init>", "(Ljava/lang/String;)V");
1955         CHECK(LDKAPIError_ChannelUnavailable_meth != NULL);
1956         LDKAPIError_MonitorUpdateInProgress_class =
1957                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKAPIError$MonitorUpdateInProgress"));
1958         CHECK(LDKAPIError_MonitorUpdateInProgress_class != NULL);
1959         LDKAPIError_MonitorUpdateInProgress_meth = (*env)->GetMethodID(env, LDKAPIError_MonitorUpdateInProgress_class, "<init>", "()V");
1960         CHECK(LDKAPIError_MonitorUpdateInProgress_meth != NULL);
1961         LDKAPIError_IncompatibleShutdownScript_class =
1962                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKAPIError$IncompatibleShutdownScript"));
1963         CHECK(LDKAPIError_IncompatibleShutdownScript_class != NULL);
1964         LDKAPIError_IncompatibleShutdownScript_meth = (*env)->GetMethodID(env, LDKAPIError_IncompatibleShutdownScript_class, "<init>", "(J)V");
1965         CHECK(LDKAPIError_IncompatibleShutdownScript_meth != NULL);
1966 }
1967 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKAPIError_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
1968         LDKAPIError *obj = (LDKAPIError*)untag_ptr(ptr);
1969         switch(obj->tag) {
1970                 case LDKAPIError_APIMisuseError: {
1971                         LDKStr err_str = obj->api_misuse_error.err;
1972                         jstring err_conv = str_ref_to_java(env, err_str.chars, err_str.len);
1973                         return (*env)->NewObject(env, LDKAPIError_APIMisuseError_class, LDKAPIError_APIMisuseError_meth, err_conv);
1974                 }
1975                 case LDKAPIError_FeeRateTooHigh: {
1976                         LDKStr err_str = obj->fee_rate_too_high.err;
1977                         jstring err_conv = str_ref_to_java(env, err_str.chars, err_str.len);
1978                         int32_t feerate_conv = obj->fee_rate_too_high.feerate;
1979                         return (*env)->NewObject(env, LDKAPIError_FeeRateTooHigh_class, LDKAPIError_FeeRateTooHigh_meth, err_conv, feerate_conv);
1980                 }
1981                 case LDKAPIError_InvalidRoute: {
1982                         LDKStr err_str = obj->invalid_route.err;
1983                         jstring err_conv = str_ref_to_java(env, err_str.chars, err_str.len);
1984                         return (*env)->NewObject(env, LDKAPIError_InvalidRoute_class, LDKAPIError_InvalidRoute_meth, err_conv);
1985                 }
1986                 case LDKAPIError_ChannelUnavailable: {
1987                         LDKStr err_str = obj->channel_unavailable.err;
1988                         jstring err_conv = str_ref_to_java(env, err_str.chars, err_str.len);
1989                         return (*env)->NewObject(env, LDKAPIError_ChannelUnavailable_class, LDKAPIError_ChannelUnavailable_meth, err_conv);
1990                 }
1991                 case LDKAPIError_MonitorUpdateInProgress: {
1992                         return (*env)->NewObject(env, LDKAPIError_MonitorUpdateInProgress_class, LDKAPIError_MonitorUpdateInProgress_meth);
1993                 }
1994                 case LDKAPIError_IncompatibleShutdownScript: {
1995                         LDKShutdownScript script_var = obj->incompatible_shutdown_script.script;
1996                         int64_t script_ref = 0;
1997                         CHECK_INNER_FIELD_ACCESS_OR_NULL(script_var);
1998                         script_ref = tag_ptr(script_var.inner, false);
1999                         return (*env)->NewObject(env, LDKAPIError_IncompatibleShutdownScript_class, LDKAPIError_IncompatibleShutdownScript_meth, script_ref);
2000                 }
2001                 default: abort();
2002         }
2003 }
2004 static inline void CResult_NoneAPIErrorZ_get_ok(LDKCResult_NoneAPIErrorZ *NONNULL_PTR owner){
2005 CHECK(owner->result_ok);
2006         return *owner->contents.result;
2007 }
2008 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
2009         LDKCResult_NoneAPIErrorZ* owner_conv = (LDKCResult_NoneAPIErrorZ*)untag_ptr(owner);
2010         CResult_NoneAPIErrorZ_get_ok(owner_conv);
2011 }
2012
2013 static inline struct LDKAPIError CResult_NoneAPIErrorZ_get_err(LDKCResult_NoneAPIErrorZ *NONNULL_PTR owner){
2014 CHECK(!owner->result_ok);
2015         return APIError_clone(&*owner->contents.err);
2016 }
2017 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
2018         LDKCResult_NoneAPIErrorZ* owner_conv = (LDKCResult_NoneAPIErrorZ*)untag_ptr(owner);
2019         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
2020         *ret_copy = CResult_NoneAPIErrorZ_get_err(owner_conv);
2021         int64_t ret_ref = tag_ptr(ret_copy, true);
2022         return ret_ref;
2023 }
2024
2025 static inline LDKCVec_CResult_NoneAPIErrorZZ CVec_CResult_NoneAPIErrorZZ_clone(const LDKCVec_CResult_NoneAPIErrorZZ *orig) {
2026         LDKCVec_CResult_NoneAPIErrorZZ ret = { .data = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ) * orig->datalen, "LDKCVec_CResult_NoneAPIErrorZZ clone bytes"), .datalen = orig->datalen };
2027         for (size_t i = 0; i < ret.datalen; i++) {
2028                 ret.data[i] = CResult_NoneAPIErrorZ_clone(&orig->data[i]);
2029         }
2030         return ret;
2031 }
2032 static inline LDKCVec_APIErrorZ CVec_APIErrorZ_clone(const LDKCVec_APIErrorZ *orig) {
2033         LDKCVec_APIErrorZ ret = { .data = MALLOC(sizeof(LDKAPIError) * orig->datalen, "LDKCVec_APIErrorZ clone bytes"), .datalen = orig->datalen };
2034         for (size_t i = 0; i < ret.datalen; i++) {
2035                 ret.data[i] = APIError_clone(&orig->data[i]);
2036         }
2037         return ret;
2038 }
2039 static jclass LDKCOption_ThirtyTwoBytesZ_Some_class = NULL;
2040 static jmethodID LDKCOption_ThirtyTwoBytesZ_Some_meth = NULL;
2041 static jclass LDKCOption_ThirtyTwoBytesZ_None_class = NULL;
2042 static jmethodID LDKCOption_ThirtyTwoBytesZ_None_meth = NULL;
2043 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1ThirtyTwoBytesZ_init (JNIEnv *env, jclass clz) {
2044         LDKCOption_ThirtyTwoBytesZ_Some_class =
2045                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_ThirtyTwoBytesZ$Some"));
2046         CHECK(LDKCOption_ThirtyTwoBytesZ_Some_class != NULL);
2047         LDKCOption_ThirtyTwoBytesZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_ThirtyTwoBytesZ_Some_class, "<init>", "([B)V");
2048         CHECK(LDKCOption_ThirtyTwoBytesZ_Some_meth != NULL);
2049         LDKCOption_ThirtyTwoBytesZ_None_class =
2050                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_ThirtyTwoBytesZ$None"));
2051         CHECK(LDKCOption_ThirtyTwoBytesZ_None_class != NULL);
2052         LDKCOption_ThirtyTwoBytesZ_None_meth = (*env)->GetMethodID(env, LDKCOption_ThirtyTwoBytesZ_None_class, "<init>", "()V");
2053         CHECK(LDKCOption_ThirtyTwoBytesZ_None_meth != NULL);
2054 }
2055 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1ThirtyTwoBytesZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
2056         LDKCOption_ThirtyTwoBytesZ *obj = (LDKCOption_ThirtyTwoBytesZ*)untag_ptr(ptr);
2057         switch(obj->tag) {
2058                 case LDKCOption_ThirtyTwoBytesZ_Some: {
2059                         int8_tArray some_arr = (*env)->NewByteArray(env, 32);
2060                         (*env)->SetByteArrayRegion(env, some_arr, 0, 32, obj->some.data);
2061                         return (*env)->NewObject(env, LDKCOption_ThirtyTwoBytesZ_Some_class, LDKCOption_ThirtyTwoBytesZ_Some_meth, some_arr);
2062                 }
2063                 case LDKCOption_ThirtyTwoBytesZ_None: {
2064                         return (*env)->NewObject(env, LDKCOption_ThirtyTwoBytesZ_None_class, LDKCOption_ThirtyTwoBytesZ_None_meth);
2065                 }
2066                 default: abort();
2067         }
2068 }
2069 static jclass LDKCOption_CVec_u8ZZ_Some_class = NULL;
2070 static jmethodID LDKCOption_CVec_u8ZZ_Some_meth = NULL;
2071 static jclass LDKCOption_CVec_u8ZZ_None_class = NULL;
2072 static jmethodID LDKCOption_CVec_u8ZZ_None_meth = NULL;
2073 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1CVec_1u8ZZ_init (JNIEnv *env, jclass clz) {
2074         LDKCOption_CVec_u8ZZ_Some_class =
2075                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_CVec_u8ZZ$Some"));
2076         CHECK(LDKCOption_CVec_u8ZZ_Some_class != NULL);
2077         LDKCOption_CVec_u8ZZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_CVec_u8ZZ_Some_class, "<init>", "([B)V");
2078         CHECK(LDKCOption_CVec_u8ZZ_Some_meth != NULL);
2079         LDKCOption_CVec_u8ZZ_None_class =
2080                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_CVec_u8ZZ$None"));
2081         CHECK(LDKCOption_CVec_u8ZZ_None_class != NULL);
2082         LDKCOption_CVec_u8ZZ_None_meth = (*env)->GetMethodID(env, LDKCOption_CVec_u8ZZ_None_class, "<init>", "()V");
2083         CHECK(LDKCOption_CVec_u8ZZ_None_meth != NULL);
2084 }
2085 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1CVec_1u8ZZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
2086         LDKCOption_CVec_u8ZZ *obj = (LDKCOption_CVec_u8ZZ*)untag_ptr(ptr);
2087         switch(obj->tag) {
2088                 case LDKCOption_CVec_u8ZZ_Some: {
2089                         LDKCVec_u8Z some_var = obj->some;
2090                         int8_tArray some_arr = (*env)->NewByteArray(env, some_var.datalen);
2091                         (*env)->SetByteArrayRegion(env, some_arr, 0, some_var.datalen, some_var.data);
2092                         return (*env)->NewObject(env, LDKCOption_CVec_u8ZZ_Some_class, LDKCOption_CVec_u8ZZ_Some_meth, some_arr);
2093                 }
2094                 case LDKCOption_CVec_u8ZZ_None: {
2095                         return (*env)->NewObject(env, LDKCOption_CVec_u8ZZ_None_class, LDKCOption_CVec_u8ZZ_None_meth);
2096                 }
2097                 default: abort();
2098         }
2099 }
2100 static inline struct LDKRecipientOnionFields CResult_RecipientOnionFieldsDecodeErrorZ_get_ok(LDKCResult_RecipientOnionFieldsDecodeErrorZ *NONNULL_PTR owner){
2101         LDKRecipientOnionFields ret = *owner->contents.result;
2102         ret.is_owned = false;
2103         return ret;
2104 }
2105 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecipientOnionFieldsDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
2106         LDKCResult_RecipientOnionFieldsDecodeErrorZ* owner_conv = (LDKCResult_RecipientOnionFieldsDecodeErrorZ*)untag_ptr(owner);
2107         LDKRecipientOnionFields ret_var = CResult_RecipientOnionFieldsDecodeErrorZ_get_ok(owner_conv);
2108         int64_t ret_ref = 0;
2109         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2110         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2111         return ret_ref;
2112 }
2113
2114 static inline struct LDKDecodeError CResult_RecipientOnionFieldsDecodeErrorZ_get_err(LDKCResult_RecipientOnionFieldsDecodeErrorZ *NONNULL_PTR owner){
2115 CHECK(!owner->result_ok);
2116         return DecodeError_clone(&*owner->contents.err);
2117 }
2118 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecipientOnionFieldsDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
2119         LDKCResult_RecipientOnionFieldsDecodeErrorZ* owner_conv = (LDKCResult_RecipientOnionFieldsDecodeErrorZ*)untag_ptr(owner);
2120         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
2121         *ret_copy = CResult_RecipientOnionFieldsDecodeErrorZ_get_err(owner_conv);
2122         int64_t ret_ref = tag_ptr(ret_copy, true);
2123         return ret_ref;
2124 }
2125
2126 static inline uint64_t C2Tuple_u64CVec_u8ZZ_get_a(LDKC2Tuple_u64CVec_u8ZZ *NONNULL_PTR owner){
2127         return owner->a;
2128 }
2129 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64CVec_1u8ZZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
2130         LDKC2Tuple_u64CVec_u8ZZ* owner_conv = (LDKC2Tuple_u64CVec_u8ZZ*)untag_ptr(owner);
2131         int64_t ret_conv = C2Tuple_u64CVec_u8ZZ_get_a(owner_conv);
2132         return ret_conv;
2133 }
2134
2135 static inline struct LDKCVec_u8Z C2Tuple_u64CVec_u8ZZ_get_b(LDKC2Tuple_u64CVec_u8ZZ *NONNULL_PTR owner){
2136         return CVec_u8Z_clone(&owner->b);
2137 }
2138 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64CVec_1u8ZZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
2139         LDKC2Tuple_u64CVec_u8ZZ* owner_conv = (LDKC2Tuple_u64CVec_u8ZZ*)untag_ptr(owner);
2140         LDKCVec_u8Z ret_var = C2Tuple_u64CVec_u8ZZ_get_b(owner_conv);
2141         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
2142         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
2143         CVec_u8Z_free(ret_var);
2144         return ret_arr;
2145 }
2146
2147 static inline LDKCVec_C2Tuple_u64CVec_u8ZZZ CVec_C2Tuple_u64CVec_u8ZZZ_clone(const LDKCVec_C2Tuple_u64CVec_u8ZZZ *orig) {
2148         LDKCVec_C2Tuple_u64CVec_u8ZZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_u64CVec_u8ZZ) * orig->datalen, "LDKCVec_C2Tuple_u64CVec_u8ZZZ clone bytes"), .datalen = orig->datalen };
2149         for (size_t i = 0; i < ret.datalen; i++) {
2150                 ret.data[i] = C2Tuple_u64CVec_u8ZZ_clone(&orig->data[i]);
2151         }
2152         return ret;
2153 }
2154 static inline struct LDKRecipientOnionFields CResult_RecipientOnionFieldsNoneZ_get_ok(LDKCResult_RecipientOnionFieldsNoneZ *NONNULL_PTR owner){
2155         LDKRecipientOnionFields ret = *owner->contents.result;
2156         ret.is_owned = false;
2157         return ret;
2158 }
2159 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecipientOnionFieldsNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
2160         LDKCResult_RecipientOnionFieldsNoneZ* owner_conv = (LDKCResult_RecipientOnionFieldsNoneZ*)untag_ptr(owner);
2161         LDKRecipientOnionFields ret_var = CResult_RecipientOnionFieldsNoneZ_get_ok(owner_conv);
2162         int64_t ret_ref = 0;
2163         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2164         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2165         return ret_ref;
2166 }
2167
2168 static inline void CResult_RecipientOnionFieldsNoneZ_get_err(LDKCResult_RecipientOnionFieldsNoneZ *NONNULL_PTR owner){
2169 CHECK(!owner->result_ok);
2170         return *owner->contents.err;
2171 }
2172 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RecipientOnionFieldsNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
2173         LDKCResult_RecipientOnionFieldsNoneZ* owner_conv = (LDKCResult_RecipientOnionFieldsNoneZ*)untag_ptr(owner);
2174         CResult_RecipientOnionFieldsNoneZ_get_err(owner_conv);
2175 }
2176
2177 static inline struct LDKUnsignedBolt12Invoice CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ_get_ok(LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ *NONNULL_PTR owner){
2178         LDKUnsignedBolt12Invoice ret = *owner->contents.result;
2179         ret.is_owned = false;
2180         return ret;
2181 }
2182 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedBolt12InvoiceBolt12SemanticErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
2183         LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ* owner_conv = (LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ*)untag_ptr(owner);
2184         LDKUnsignedBolt12Invoice ret_var = CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ_get_ok(owner_conv);
2185         int64_t ret_ref = 0;
2186         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2187         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2188         return ret_ref;
2189 }
2190
2191 static inline enum LDKBolt12SemanticError CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ_get_err(LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ *NONNULL_PTR owner){
2192 CHECK(!owner->result_ok);
2193         return Bolt12SemanticError_clone(&*owner->contents.err);
2194 }
2195 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedBolt12InvoiceBolt12SemanticErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
2196         LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ* owner_conv = (LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ*)untag_ptr(owner);
2197         jclass ret_conv = LDKBolt12SemanticError_to_java(env, CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ_get_err(owner_conv));
2198         return ret_conv;
2199 }
2200
2201 static inline struct LDKBolt12Invoice CResult_Bolt12InvoiceBolt12SemanticErrorZ_get_ok(LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ *NONNULL_PTR owner){
2202         LDKBolt12Invoice ret = *owner->contents.result;
2203         ret.is_owned = false;
2204         return ret;
2205 }
2206 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt12InvoiceBolt12SemanticErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
2207         LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ* owner_conv = (LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ*)untag_ptr(owner);
2208         LDKBolt12Invoice ret_var = CResult_Bolt12InvoiceBolt12SemanticErrorZ_get_ok(owner_conv);
2209         int64_t ret_ref = 0;
2210         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2211         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2212         return ret_ref;
2213 }
2214
2215 static inline enum LDKBolt12SemanticError CResult_Bolt12InvoiceBolt12SemanticErrorZ_get_err(LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ *NONNULL_PTR owner){
2216 CHECK(!owner->result_ok);
2217         return Bolt12SemanticError_clone(&*owner->contents.err);
2218 }
2219 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt12InvoiceBolt12SemanticErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
2220         LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ* owner_conv = (LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ*)untag_ptr(owner);
2221         jclass ret_conv = LDKBolt12SemanticError_to_java(env, CResult_Bolt12InvoiceBolt12SemanticErrorZ_get_err(owner_conv));
2222         return ret_conv;
2223 }
2224
2225 static inline struct LDKSchnorrSignature CResult_SchnorrSignatureNoneZ_get_ok(LDKCResult_SchnorrSignatureNoneZ *NONNULL_PTR owner){
2226 CHECK(owner->result_ok);
2227         return *owner->contents.result;
2228 }
2229 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1SchnorrSignatureNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
2230         LDKCResult_SchnorrSignatureNoneZ* owner_conv = (LDKCResult_SchnorrSignatureNoneZ*)untag_ptr(owner);
2231         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
2232         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, CResult_SchnorrSignatureNoneZ_get_ok(owner_conv).compact_form);
2233         return ret_arr;
2234 }
2235
2236 static inline void CResult_SchnorrSignatureNoneZ_get_err(LDKCResult_SchnorrSignatureNoneZ *NONNULL_PTR owner){
2237 CHECK(!owner->result_ok);
2238         return *owner->contents.err;
2239 }
2240 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SchnorrSignatureNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
2241         LDKCResult_SchnorrSignatureNoneZ* owner_conv = (LDKCResult_SchnorrSignatureNoneZ*)untag_ptr(owner);
2242         CResult_SchnorrSignatureNoneZ_get_err(owner_conv);
2243 }
2244
2245 static inline LDKCVec_ThirtyTwoBytesZ CVec_ThirtyTwoBytesZ_clone(const LDKCVec_ThirtyTwoBytesZ *orig) {
2246         LDKCVec_ThirtyTwoBytesZ ret = { .data = MALLOC(sizeof(LDKThirtyTwoBytes) * orig->datalen, "LDKCVec_ThirtyTwoBytesZ clone bytes"), .datalen = orig->datalen };
2247         for (size_t i = 0; i < ret.datalen; i++) {
2248                 ret.data[i] = ThirtyTwoBytes_clone(&orig->data[i]);
2249         }
2250         return ret;
2251 }
2252 static jclass LDKCOption_CVec_ThirtyTwoBytesZZ_Some_class = NULL;
2253 static jmethodID LDKCOption_CVec_ThirtyTwoBytesZZ_Some_meth = NULL;
2254 static jclass LDKCOption_CVec_ThirtyTwoBytesZZ_None_class = NULL;
2255 static jmethodID LDKCOption_CVec_ThirtyTwoBytesZZ_None_meth = NULL;
2256 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1CVec_1ThirtyTwoBytesZZ_init (JNIEnv *env, jclass clz) {
2257         LDKCOption_CVec_ThirtyTwoBytesZZ_Some_class =
2258                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_CVec_ThirtyTwoBytesZZ$Some"));
2259         CHECK(LDKCOption_CVec_ThirtyTwoBytesZZ_Some_class != NULL);
2260         LDKCOption_CVec_ThirtyTwoBytesZZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_CVec_ThirtyTwoBytesZZ_Some_class, "<init>", "([[B)V");
2261         CHECK(LDKCOption_CVec_ThirtyTwoBytesZZ_Some_meth != NULL);
2262         LDKCOption_CVec_ThirtyTwoBytesZZ_None_class =
2263                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_CVec_ThirtyTwoBytesZZ$None"));
2264         CHECK(LDKCOption_CVec_ThirtyTwoBytesZZ_None_class != NULL);
2265         LDKCOption_CVec_ThirtyTwoBytesZZ_None_meth = (*env)->GetMethodID(env, LDKCOption_CVec_ThirtyTwoBytesZZ_None_class, "<init>", "()V");
2266         CHECK(LDKCOption_CVec_ThirtyTwoBytesZZ_None_meth != NULL);
2267 }
2268 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1CVec_1ThirtyTwoBytesZZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
2269         LDKCOption_CVec_ThirtyTwoBytesZZ *obj = (LDKCOption_CVec_ThirtyTwoBytesZZ*)untag_ptr(ptr);
2270         switch(obj->tag) {
2271                 case LDKCOption_CVec_ThirtyTwoBytesZZ_Some: {
2272                         LDKCVec_ThirtyTwoBytesZ some_var = obj->some;
2273                         jobjectArray some_arr = NULL;
2274                         some_arr = (*env)->NewObjectArray(env, some_var.datalen, arr_of_B_clz, NULL);
2275                         ;
2276                         for (size_t i = 0; i < some_var.datalen; i++) {
2277                                 int8_tArray some_conv_8_arr = (*env)->NewByteArray(env, 32);
2278                                 (*env)->SetByteArrayRegion(env, some_conv_8_arr, 0, 32, some_var.data[i].data);
2279                                 (*env)->SetObjectArrayElement(env, some_arr, i, some_conv_8_arr);
2280                         }
2281                         
2282                         return (*env)->NewObject(env, LDKCOption_CVec_ThirtyTwoBytesZZ_Some_class, LDKCOption_CVec_ThirtyTwoBytesZZ_Some_meth, some_arr);
2283                 }
2284                 case LDKCOption_CVec_ThirtyTwoBytesZZ_None: {
2285                         return (*env)->NewObject(env, LDKCOption_CVec_ThirtyTwoBytesZZ_None_class, LDKCOption_CVec_ThirtyTwoBytesZZ_None_meth);
2286                 }
2287                 default: abort();
2288         }
2289 }
2290 static jclass LDKAmount_Bitcoin_class = NULL;
2291 static jmethodID LDKAmount_Bitcoin_meth = NULL;
2292 static jclass LDKAmount_Currency_class = NULL;
2293 static jmethodID LDKAmount_Currency_meth = NULL;
2294 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKAmount_init (JNIEnv *env, jclass clz) {
2295         LDKAmount_Bitcoin_class =
2296                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKAmount$Bitcoin"));
2297         CHECK(LDKAmount_Bitcoin_class != NULL);
2298         LDKAmount_Bitcoin_meth = (*env)->GetMethodID(env, LDKAmount_Bitcoin_class, "<init>", "(J)V");
2299         CHECK(LDKAmount_Bitcoin_meth != NULL);
2300         LDKAmount_Currency_class =
2301                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKAmount$Currency"));
2302         CHECK(LDKAmount_Currency_class != NULL);
2303         LDKAmount_Currency_meth = (*env)->GetMethodID(env, LDKAmount_Currency_class, "<init>", "([BJ)V");
2304         CHECK(LDKAmount_Currency_meth != NULL);
2305 }
2306 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKAmount_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
2307         LDKAmount *obj = (LDKAmount*)untag_ptr(ptr);
2308         switch(obj->tag) {
2309                 case LDKAmount_Bitcoin: {
2310                         int64_t amount_msats_conv = obj->bitcoin.amount_msats;
2311                         return (*env)->NewObject(env, LDKAmount_Bitcoin_class, LDKAmount_Bitcoin_meth, amount_msats_conv);
2312                 }
2313                 case LDKAmount_Currency: {
2314                         int8_tArray iso4217_code_arr = (*env)->NewByteArray(env, 3);
2315                         (*env)->SetByteArrayRegion(env, iso4217_code_arr, 0, 3, obj->currency.iso4217_code.data);
2316                         int64_t amount_conv = obj->currency.amount;
2317                         return (*env)->NewObject(env, LDKAmount_Currency_class, LDKAmount_Currency_meth, iso4217_code_arr, amount_conv);
2318                 }
2319                 default: abort();
2320         }
2321 }
2322 static jclass LDKCOption_AmountZ_Some_class = NULL;
2323 static jmethodID LDKCOption_AmountZ_Some_meth = NULL;
2324 static jclass LDKCOption_AmountZ_None_class = NULL;
2325 static jmethodID LDKCOption_AmountZ_None_meth = NULL;
2326 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1AmountZ_init (JNIEnv *env, jclass clz) {
2327         LDKCOption_AmountZ_Some_class =
2328                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_AmountZ$Some"));
2329         CHECK(LDKCOption_AmountZ_Some_class != NULL);
2330         LDKCOption_AmountZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_AmountZ_Some_class, "<init>", "(J)V");
2331         CHECK(LDKCOption_AmountZ_Some_meth != NULL);
2332         LDKCOption_AmountZ_None_class =
2333                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_AmountZ$None"));
2334         CHECK(LDKCOption_AmountZ_None_class != NULL);
2335         LDKCOption_AmountZ_None_meth = (*env)->GetMethodID(env, LDKCOption_AmountZ_None_class, "<init>", "()V");
2336         CHECK(LDKCOption_AmountZ_None_meth != NULL);
2337 }
2338 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1AmountZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
2339         LDKCOption_AmountZ *obj = (LDKCOption_AmountZ*)untag_ptr(ptr);
2340         switch(obj->tag) {
2341                 case LDKCOption_AmountZ_Some: {
2342                         int64_t some_ref = tag_ptr(&obj->some, false);
2343                         return (*env)->NewObject(env, LDKCOption_AmountZ_Some_class, LDKCOption_AmountZ_Some_meth, some_ref);
2344                 }
2345                 case LDKCOption_AmountZ_None: {
2346                         return (*env)->NewObject(env, LDKCOption_AmountZ_None_class, LDKCOption_AmountZ_None_meth);
2347                 }
2348                 default: abort();
2349         }
2350 }
2351 static jclass LDKQuantity_Bounded_class = NULL;
2352 static jmethodID LDKQuantity_Bounded_meth = NULL;
2353 static jclass LDKQuantity_Unbounded_class = NULL;
2354 static jmethodID LDKQuantity_Unbounded_meth = NULL;
2355 static jclass LDKQuantity_One_class = NULL;
2356 static jmethodID LDKQuantity_One_meth = NULL;
2357 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKQuantity_init (JNIEnv *env, jclass clz) {
2358         LDKQuantity_Bounded_class =
2359                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKQuantity$Bounded"));
2360         CHECK(LDKQuantity_Bounded_class != NULL);
2361         LDKQuantity_Bounded_meth = (*env)->GetMethodID(env, LDKQuantity_Bounded_class, "<init>", "(J)V");
2362         CHECK(LDKQuantity_Bounded_meth != NULL);
2363         LDKQuantity_Unbounded_class =
2364                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKQuantity$Unbounded"));
2365         CHECK(LDKQuantity_Unbounded_class != NULL);
2366         LDKQuantity_Unbounded_meth = (*env)->GetMethodID(env, LDKQuantity_Unbounded_class, "<init>", "()V");
2367         CHECK(LDKQuantity_Unbounded_meth != NULL);
2368         LDKQuantity_One_class =
2369                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKQuantity$One"));
2370         CHECK(LDKQuantity_One_class != NULL);
2371         LDKQuantity_One_meth = (*env)->GetMethodID(env, LDKQuantity_One_class, "<init>", "()V");
2372         CHECK(LDKQuantity_One_meth != NULL);
2373 }
2374 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKQuantity_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
2375         LDKQuantity *obj = (LDKQuantity*)untag_ptr(ptr);
2376         switch(obj->tag) {
2377                 case LDKQuantity_Bounded: {
2378                         int64_t bounded_conv = obj->bounded;
2379                         return (*env)->NewObject(env, LDKQuantity_Bounded_class, LDKQuantity_Bounded_meth, bounded_conv);
2380                 }
2381                 case LDKQuantity_Unbounded: {
2382                         return (*env)->NewObject(env, LDKQuantity_Unbounded_class, LDKQuantity_Unbounded_meth);
2383                 }
2384                 case LDKQuantity_One: {
2385                         return (*env)->NewObject(env, LDKQuantity_One_class, LDKQuantity_One_meth);
2386                 }
2387                 default: abort();
2388         }
2389 }
2390 static jclass LDKCOption_QuantityZ_Some_class = NULL;
2391 static jmethodID LDKCOption_QuantityZ_Some_meth = NULL;
2392 static jclass LDKCOption_QuantityZ_None_class = NULL;
2393 static jmethodID LDKCOption_QuantityZ_None_meth = NULL;
2394 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1QuantityZ_init (JNIEnv *env, jclass clz) {
2395         LDKCOption_QuantityZ_Some_class =
2396                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_QuantityZ$Some"));
2397         CHECK(LDKCOption_QuantityZ_Some_class != NULL);
2398         LDKCOption_QuantityZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_QuantityZ_Some_class, "<init>", "(J)V");
2399         CHECK(LDKCOption_QuantityZ_Some_meth != NULL);
2400         LDKCOption_QuantityZ_None_class =
2401                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_QuantityZ$None"));
2402         CHECK(LDKCOption_QuantityZ_None_class != NULL);
2403         LDKCOption_QuantityZ_None_meth = (*env)->GetMethodID(env, LDKCOption_QuantityZ_None_class, "<init>", "()V");
2404         CHECK(LDKCOption_QuantityZ_None_meth != NULL);
2405 }
2406 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1QuantityZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
2407         LDKCOption_QuantityZ *obj = (LDKCOption_QuantityZ*)untag_ptr(ptr);
2408         switch(obj->tag) {
2409                 case LDKCOption_QuantityZ_Some: {
2410                         int64_t some_ref = tag_ptr(&obj->some, false);
2411                         return (*env)->NewObject(env, LDKCOption_QuantityZ_Some_class, LDKCOption_QuantityZ_Some_meth, some_ref);
2412                 }
2413                 case LDKCOption_QuantityZ_None: {
2414                         return (*env)->NewObject(env, LDKCOption_QuantityZ_None_class, LDKCOption_QuantityZ_None_meth);
2415                 }
2416                 default: abort();
2417         }
2418 }
2419 static inline struct LDKThirtyTwoBytes CResult_ThirtyTwoBytesNoneZ_get_ok(LDKCResult_ThirtyTwoBytesNoneZ *NONNULL_PTR owner){
2420 CHECK(owner->result_ok);
2421         return ThirtyTwoBytes_clone(&*owner->contents.result);
2422 }
2423 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
2424         LDKCResult_ThirtyTwoBytesNoneZ* owner_conv = (LDKCResult_ThirtyTwoBytesNoneZ*)untag_ptr(owner);
2425         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
2426         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, CResult_ThirtyTwoBytesNoneZ_get_ok(owner_conv).data);
2427         return ret_arr;
2428 }
2429
2430 static inline void CResult_ThirtyTwoBytesNoneZ_get_err(LDKCResult_ThirtyTwoBytesNoneZ *NONNULL_PTR owner){
2431 CHECK(!owner->result_ok);
2432         return *owner->contents.err;
2433 }
2434 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
2435         LDKCResult_ThirtyTwoBytesNoneZ* owner_conv = (LDKCResult_ThirtyTwoBytesNoneZ*)untag_ptr(owner);
2436         CResult_ThirtyTwoBytesNoneZ_get_err(owner_conv);
2437 }
2438
2439 static inline struct LDKBlindedPayInfo CResult_BlindedPayInfoDecodeErrorZ_get_ok(LDKCResult_BlindedPayInfoDecodeErrorZ *NONNULL_PTR owner){
2440         LDKBlindedPayInfo ret = *owner->contents.result;
2441         ret.is_owned = false;
2442         return ret;
2443 }
2444 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPayInfoDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
2445         LDKCResult_BlindedPayInfoDecodeErrorZ* owner_conv = (LDKCResult_BlindedPayInfoDecodeErrorZ*)untag_ptr(owner);
2446         LDKBlindedPayInfo ret_var = CResult_BlindedPayInfoDecodeErrorZ_get_ok(owner_conv);
2447         int64_t ret_ref = 0;
2448         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2449         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2450         return ret_ref;
2451 }
2452
2453 static inline struct LDKDecodeError CResult_BlindedPayInfoDecodeErrorZ_get_err(LDKCResult_BlindedPayInfoDecodeErrorZ *NONNULL_PTR owner){
2454 CHECK(!owner->result_ok);
2455         return DecodeError_clone(&*owner->contents.err);
2456 }
2457 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPayInfoDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
2458         LDKCResult_BlindedPayInfoDecodeErrorZ* owner_conv = (LDKCResult_BlindedPayInfoDecodeErrorZ*)untag_ptr(owner);
2459         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
2460         *ret_copy = CResult_BlindedPayInfoDecodeErrorZ_get_err(owner_conv);
2461         int64_t ret_ref = tag_ptr(ret_copy, true);
2462         return ret_ref;
2463 }
2464
2465 static inline struct LDKDelayedPaymentOutputDescriptor CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_ok(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
2466         LDKDelayedPaymentOutputDescriptor ret = *owner->contents.result;
2467         ret.is_owned = false;
2468         return ret;
2469 }
2470 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
2471         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(owner);
2472         LDKDelayedPaymentOutputDescriptor ret_var = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_ok(owner_conv);
2473         int64_t ret_ref = 0;
2474         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2475         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2476         return ret_ref;
2477 }
2478
2479 static inline struct LDKDecodeError CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_err(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
2480 CHECK(!owner->result_ok);
2481         return DecodeError_clone(&*owner->contents.err);
2482 }
2483 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
2484         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(owner);
2485         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
2486         *ret_copy = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_err(owner_conv);
2487         int64_t ret_ref = tag_ptr(ret_copy, true);
2488         return ret_ref;
2489 }
2490
2491 static inline struct LDKStaticPaymentOutputDescriptor CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_ok(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
2492         LDKStaticPaymentOutputDescriptor ret = *owner->contents.result;
2493         ret.is_owned = false;
2494         return ret;
2495 }
2496 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
2497         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(owner);
2498         LDKStaticPaymentOutputDescriptor ret_var = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_ok(owner_conv);
2499         int64_t ret_ref = 0;
2500         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2501         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2502         return ret_ref;
2503 }
2504
2505 static inline struct LDKDecodeError CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_err(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
2506 CHECK(!owner->result_ok);
2507         return DecodeError_clone(&*owner->contents.err);
2508 }
2509 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
2510         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(owner);
2511         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
2512         *ret_copy = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_err(owner_conv);
2513         int64_t ret_ref = tag_ptr(ret_copy, true);
2514         return ret_ref;
2515 }
2516
2517 static jclass LDKSpendableOutputDescriptor_StaticOutput_class = NULL;
2518 static jmethodID LDKSpendableOutputDescriptor_StaticOutput_meth = NULL;
2519 static jclass LDKSpendableOutputDescriptor_DelayedPaymentOutput_class = NULL;
2520 static jmethodID LDKSpendableOutputDescriptor_DelayedPaymentOutput_meth = NULL;
2521 static jclass LDKSpendableOutputDescriptor_StaticPaymentOutput_class = NULL;
2522 static jmethodID LDKSpendableOutputDescriptor_StaticPaymentOutput_meth = NULL;
2523 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKSpendableOutputDescriptor_init (JNIEnv *env, jclass clz) {
2524         LDKSpendableOutputDescriptor_StaticOutput_class =
2525                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSpendableOutputDescriptor$StaticOutput"));
2526         CHECK(LDKSpendableOutputDescriptor_StaticOutput_class != NULL);
2527         LDKSpendableOutputDescriptor_StaticOutput_meth = (*env)->GetMethodID(env, LDKSpendableOutputDescriptor_StaticOutput_class, "<init>", "(JJ[B)V");
2528         CHECK(LDKSpendableOutputDescriptor_StaticOutput_meth != NULL);
2529         LDKSpendableOutputDescriptor_DelayedPaymentOutput_class =
2530                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSpendableOutputDescriptor$DelayedPaymentOutput"));
2531         CHECK(LDKSpendableOutputDescriptor_DelayedPaymentOutput_class != NULL);
2532         LDKSpendableOutputDescriptor_DelayedPaymentOutput_meth = (*env)->GetMethodID(env, LDKSpendableOutputDescriptor_DelayedPaymentOutput_class, "<init>", "(J)V");
2533         CHECK(LDKSpendableOutputDescriptor_DelayedPaymentOutput_meth != NULL);
2534         LDKSpendableOutputDescriptor_StaticPaymentOutput_class =
2535                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSpendableOutputDescriptor$StaticPaymentOutput"));
2536         CHECK(LDKSpendableOutputDescriptor_StaticPaymentOutput_class != NULL);
2537         LDKSpendableOutputDescriptor_StaticPaymentOutput_meth = (*env)->GetMethodID(env, LDKSpendableOutputDescriptor_StaticPaymentOutput_class, "<init>", "(J)V");
2538         CHECK(LDKSpendableOutputDescriptor_StaticPaymentOutput_meth != NULL);
2539 }
2540 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKSpendableOutputDescriptor_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
2541         LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)untag_ptr(ptr);
2542         switch(obj->tag) {
2543                 case LDKSpendableOutputDescriptor_StaticOutput: {
2544                         LDKOutPoint outpoint_var = obj->static_output.outpoint;
2545                         int64_t outpoint_ref = 0;
2546                         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_var);
2547                         outpoint_ref = tag_ptr(outpoint_var.inner, false);
2548                         LDKTxOut* output_ref = &obj->static_output.output;
2549                         int8_tArray channel_keys_id_arr = (*env)->NewByteArray(env, 32);
2550                         (*env)->SetByteArrayRegion(env, channel_keys_id_arr, 0, 32, obj->static_output.channel_keys_id.data);
2551                         return (*env)->NewObject(env, LDKSpendableOutputDescriptor_StaticOutput_class, LDKSpendableOutputDescriptor_StaticOutput_meth, outpoint_ref, tag_ptr(output_ref, false), channel_keys_id_arr);
2552                 }
2553                 case LDKSpendableOutputDescriptor_DelayedPaymentOutput: {
2554                         LDKDelayedPaymentOutputDescriptor delayed_payment_output_var = obj->delayed_payment_output;
2555                         int64_t delayed_payment_output_ref = 0;
2556                         CHECK_INNER_FIELD_ACCESS_OR_NULL(delayed_payment_output_var);
2557                         delayed_payment_output_ref = tag_ptr(delayed_payment_output_var.inner, false);
2558                         return (*env)->NewObject(env, LDKSpendableOutputDescriptor_DelayedPaymentOutput_class, LDKSpendableOutputDescriptor_DelayedPaymentOutput_meth, delayed_payment_output_ref);
2559                 }
2560                 case LDKSpendableOutputDescriptor_StaticPaymentOutput: {
2561                         LDKStaticPaymentOutputDescriptor static_payment_output_var = obj->static_payment_output;
2562                         int64_t static_payment_output_ref = 0;
2563                         CHECK_INNER_FIELD_ACCESS_OR_NULL(static_payment_output_var);
2564                         static_payment_output_ref = tag_ptr(static_payment_output_var.inner, false);
2565                         return (*env)->NewObject(env, LDKSpendableOutputDescriptor_StaticPaymentOutput_class, LDKSpendableOutputDescriptor_StaticPaymentOutput_meth, static_payment_output_ref);
2566                 }
2567                 default: abort();
2568         }
2569 }
2570 static inline struct LDKSpendableOutputDescriptor CResult_SpendableOutputDescriptorDecodeErrorZ_get_ok(LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
2571 CHECK(owner->result_ok);
2572         return SpendableOutputDescriptor_clone(&*owner->contents.result);
2573 }
2574 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
2575         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)untag_ptr(owner);
2576         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
2577         *ret_copy = CResult_SpendableOutputDescriptorDecodeErrorZ_get_ok(owner_conv);
2578         int64_t ret_ref = tag_ptr(ret_copy, true);
2579         return ret_ref;
2580 }
2581
2582 static inline struct LDKDecodeError CResult_SpendableOutputDescriptorDecodeErrorZ_get_err(LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR owner){
2583 CHECK(!owner->result_ok);
2584         return DecodeError_clone(&*owner->contents.err);
2585 }
2586 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
2587         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* owner_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)untag_ptr(owner);
2588         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
2589         *ret_copy = CResult_SpendableOutputDescriptorDecodeErrorZ_get_err(owner_conv);
2590         int64_t ret_ref = tag_ptr(ret_copy, true);
2591         return ret_ref;
2592 }
2593
2594 static inline LDKCVec_SpendableOutputDescriptorZ CVec_SpendableOutputDescriptorZ_clone(const LDKCVec_SpendableOutputDescriptorZ *orig) {
2595         LDKCVec_SpendableOutputDescriptorZ ret = { .data = MALLOC(sizeof(LDKSpendableOutputDescriptor) * orig->datalen, "LDKCVec_SpendableOutputDescriptorZ clone bytes"), .datalen = orig->datalen };
2596         for (size_t i = 0; i < ret.datalen; i++) {
2597                 ret.data[i] = SpendableOutputDescriptor_clone(&orig->data[i]);
2598         }
2599         return ret;
2600 }
2601 static inline LDKCVec_TxOutZ CVec_TxOutZ_clone(const LDKCVec_TxOutZ *orig) {
2602         LDKCVec_TxOutZ ret = { .data = MALLOC(sizeof(LDKTxOut) * orig->datalen, "LDKCVec_TxOutZ clone bytes"), .datalen = orig->datalen };
2603         for (size_t i = 0; i < ret.datalen; i++) {
2604                 ret.data[i] = TxOut_clone(&orig->data[i]);
2605         }
2606         return ret;
2607 }
2608 static jclass LDKCOption_u32Z_Some_class = NULL;
2609 static jmethodID LDKCOption_u32Z_Some_meth = NULL;
2610 static jclass LDKCOption_u32Z_None_class = NULL;
2611 static jmethodID LDKCOption_u32Z_None_meth = NULL;
2612 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1u32Z_init (JNIEnv *env, jclass clz) {
2613         LDKCOption_u32Z_Some_class =
2614                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_u32Z$Some"));
2615         CHECK(LDKCOption_u32Z_Some_class != NULL);
2616         LDKCOption_u32Z_Some_meth = (*env)->GetMethodID(env, LDKCOption_u32Z_Some_class, "<init>", "(I)V");
2617         CHECK(LDKCOption_u32Z_Some_meth != NULL);
2618         LDKCOption_u32Z_None_class =
2619                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_u32Z$None"));
2620         CHECK(LDKCOption_u32Z_None_class != NULL);
2621         LDKCOption_u32Z_None_meth = (*env)->GetMethodID(env, LDKCOption_u32Z_None_class, "<init>", "()V");
2622         CHECK(LDKCOption_u32Z_None_meth != NULL);
2623 }
2624 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1u32Z_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
2625         LDKCOption_u32Z *obj = (LDKCOption_u32Z*)untag_ptr(ptr);
2626         switch(obj->tag) {
2627                 case LDKCOption_u32Z_Some: {
2628                         int32_t some_conv = obj->some;
2629                         return (*env)->NewObject(env, LDKCOption_u32Z_Some_class, LDKCOption_u32Z_Some_meth, some_conv);
2630                 }
2631                 case LDKCOption_u32Z_None: {
2632                         return (*env)->NewObject(env, LDKCOption_u32Z_None_class, LDKCOption_u32Z_None_meth);
2633                 }
2634                 default: abort();
2635         }
2636 }
2637 static inline struct LDKCVec_u8Z C2Tuple_CVec_u8Zu64Z_get_a(LDKC2Tuple_CVec_u8Zu64Z *NONNULL_PTR owner){
2638         return CVec_u8Z_clone(&owner->a);
2639 }
2640 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1CVec_1u8Zu64Z_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
2641         LDKC2Tuple_CVec_u8Zu64Z* owner_conv = (LDKC2Tuple_CVec_u8Zu64Z*)untag_ptr(owner);
2642         LDKCVec_u8Z ret_var = C2Tuple_CVec_u8Zu64Z_get_a(owner_conv);
2643         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
2644         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
2645         CVec_u8Z_free(ret_var);
2646         return ret_arr;
2647 }
2648
2649 static inline uint64_t C2Tuple_CVec_u8Zu64Z_get_b(LDKC2Tuple_CVec_u8Zu64Z *NONNULL_PTR owner){
2650         return owner->b;
2651 }
2652 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1CVec_1u8Zu64Z_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
2653         LDKC2Tuple_CVec_u8Zu64Z* owner_conv = (LDKC2Tuple_CVec_u8Zu64Z*)untag_ptr(owner);
2654         int64_t ret_conv = C2Tuple_CVec_u8Zu64Z_get_b(owner_conv);
2655         return ret_conv;
2656 }
2657
2658 static inline struct LDKC2Tuple_CVec_u8Zu64Z CResult_C2Tuple_CVec_u8Zu64ZNoneZ_get_ok(LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ *NONNULL_PTR owner){
2659 CHECK(owner->result_ok);
2660         return C2Tuple_CVec_u8Zu64Z_clone(&*owner->contents.result);
2661 }
2662 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1CVec_1u8Zu64ZNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
2663         LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ* owner_conv = (LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ*)untag_ptr(owner);
2664         LDKC2Tuple_CVec_u8Zu64Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_CVec_u8Zu64Z), "LDKC2Tuple_CVec_u8Zu64Z");
2665         *ret_conv = CResult_C2Tuple_CVec_u8Zu64ZNoneZ_get_ok(owner_conv);
2666         return tag_ptr(ret_conv, true);
2667 }
2668
2669 static inline void CResult_C2Tuple_CVec_u8Zu64ZNoneZ_get_err(LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ *NONNULL_PTR owner){
2670 CHECK(!owner->result_ok);
2671         return *owner->contents.err;
2672 }
2673 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1CVec_1u8Zu64ZNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
2674         LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ* owner_conv = (LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ*)untag_ptr(owner);
2675         CResult_C2Tuple_CVec_u8Zu64ZNoneZ_get_err(owner_conv);
2676 }
2677
2678 static inline struct LDKChannelDerivationParameters CResult_ChannelDerivationParametersDecodeErrorZ_get_ok(LDKCResult_ChannelDerivationParametersDecodeErrorZ *NONNULL_PTR owner){
2679         LDKChannelDerivationParameters ret = *owner->contents.result;
2680         ret.is_owned = false;
2681         return ret;
2682 }
2683 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDerivationParametersDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
2684         LDKCResult_ChannelDerivationParametersDecodeErrorZ* owner_conv = (LDKCResult_ChannelDerivationParametersDecodeErrorZ*)untag_ptr(owner);
2685         LDKChannelDerivationParameters ret_var = CResult_ChannelDerivationParametersDecodeErrorZ_get_ok(owner_conv);
2686         int64_t ret_ref = 0;
2687         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2688         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2689         return ret_ref;
2690 }
2691
2692 static inline struct LDKDecodeError CResult_ChannelDerivationParametersDecodeErrorZ_get_err(LDKCResult_ChannelDerivationParametersDecodeErrorZ *NONNULL_PTR owner){
2693 CHECK(!owner->result_ok);
2694         return DecodeError_clone(&*owner->contents.err);
2695 }
2696 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDerivationParametersDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
2697         LDKCResult_ChannelDerivationParametersDecodeErrorZ* owner_conv = (LDKCResult_ChannelDerivationParametersDecodeErrorZ*)untag_ptr(owner);
2698         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
2699         *ret_copy = CResult_ChannelDerivationParametersDecodeErrorZ_get_err(owner_conv);
2700         int64_t ret_ref = tag_ptr(ret_copy, true);
2701         return ret_ref;
2702 }
2703
2704 static inline struct LDKHTLCDescriptor CResult_HTLCDescriptorDecodeErrorZ_get_ok(LDKCResult_HTLCDescriptorDecodeErrorZ *NONNULL_PTR owner){
2705         LDKHTLCDescriptor ret = *owner->contents.result;
2706         ret.is_owned = false;
2707         return ret;
2708 }
2709 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCDescriptorDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
2710         LDKCResult_HTLCDescriptorDecodeErrorZ* owner_conv = (LDKCResult_HTLCDescriptorDecodeErrorZ*)untag_ptr(owner);
2711         LDKHTLCDescriptor ret_var = CResult_HTLCDescriptorDecodeErrorZ_get_ok(owner_conv);
2712         int64_t ret_ref = 0;
2713         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
2714         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
2715         return ret_ref;
2716 }
2717
2718 static inline struct LDKDecodeError CResult_HTLCDescriptorDecodeErrorZ_get_err(LDKCResult_HTLCDescriptorDecodeErrorZ *NONNULL_PTR owner){
2719 CHECK(!owner->result_ok);
2720         return DecodeError_clone(&*owner->contents.err);
2721 }
2722 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCDescriptorDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
2723         LDKCResult_HTLCDescriptorDecodeErrorZ* owner_conv = (LDKCResult_HTLCDescriptorDecodeErrorZ*)untag_ptr(owner);
2724         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
2725         *ret_copy = CResult_HTLCDescriptorDecodeErrorZ_get_err(owner_conv);
2726         int64_t ret_ref = tag_ptr(ret_copy, true);
2727         return ret_ref;
2728 }
2729
2730 static inline void CResult_NoneNoneZ_get_ok(LDKCResult_NoneNoneZ *NONNULL_PTR owner){
2731 CHECK(owner->result_ok);
2732         return *owner->contents.result;
2733 }
2734 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
2735         LDKCResult_NoneNoneZ* owner_conv = (LDKCResult_NoneNoneZ*)untag_ptr(owner);
2736         CResult_NoneNoneZ_get_ok(owner_conv);
2737 }
2738
2739 static inline void CResult_NoneNoneZ_get_err(LDKCResult_NoneNoneZ *NONNULL_PTR owner){
2740 CHECK(!owner->result_ok);
2741         return *owner->contents.err;
2742 }
2743 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
2744         LDKCResult_NoneNoneZ* owner_conv = (LDKCResult_NoneNoneZ*)untag_ptr(owner);
2745         CResult_NoneNoneZ_get_err(owner_conv);
2746 }
2747
2748 static inline struct LDKPublicKey CResult_PublicKeyNoneZ_get_ok(LDKCResult_PublicKeyNoneZ *NONNULL_PTR owner){
2749 CHECK(owner->result_ok);
2750         return *owner->contents.result;
2751 }
2752 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
2753         LDKCResult_PublicKeyNoneZ* owner_conv = (LDKCResult_PublicKeyNoneZ*)untag_ptr(owner);
2754         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
2755         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, CResult_PublicKeyNoneZ_get_ok(owner_conv).compressed_form);
2756         return ret_arr;
2757 }
2758
2759 static inline void CResult_PublicKeyNoneZ_get_err(LDKCResult_PublicKeyNoneZ *NONNULL_PTR owner){
2760 CHECK(!owner->result_ok);
2761         return *owner->contents.err;
2762 }
2763 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
2764         LDKCResult_PublicKeyNoneZ* owner_conv = (LDKCResult_PublicKeyNoneZ*)untag_ptr(owner);
2765         CResult_PublicKeyNoneZ_get_err(owner_conv);
2766 }
2767
2768 static jclass LDKCOption_BigEndianScalarZ_Some_class = NULL;
2769 static jmethodID LDKCOption_BigEndianScalarZ_Some_meth = NULL;
2770 static jclass LDKCOption_BigEndianScalarZ_None_class = NULL;
2771 static jmethodID LDKCOption_BigEndianScalarZ_None_meth = NULL;
2772 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1BigEndianScalarZ_init (JNIEnv *env, jclass clz) {
2773         LDKCOption_BigEndianScalarZ_Some_class =
2774                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_BigEndianScalarZ$Some"));
2775         CHECK(LDKCOption_BigEndianScalarZ_Some_class != NULL);
2776         LDKCOption_BigEndianScalarZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_BigEndianScalarZ_Some_class, "<init>", "(J)V");
2777         CHECK(LDKCOption_BigEndianScalarZ_Some_meth != NULL);
2778         LDKCOption_BigEndianScalarZ_None_class =
2779                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_BigEndianScalarZ$None"));
2780         CHECK(LDKCOption_BigEndianScalarZ_None_class != NULL);
2781         LDKCOption_BigEndianScalarZ_None_meth = (*env)->GetMethodID(env, LDKCOption_BigEndianScalarZ_None_class, "<init>", "()V");
2782         CHECK(LDKCOption_BigEndianScalarZ_None_meth != NULL);
2783 }
2784 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1BigEndianScalarZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
2785         LDKCOption_BigEndianScalarZ *obj = (LDKCOption_BigEndianScalarZ*)untag_ptr(ptr);
2786         switch(obj->tag) {
2787                 case LDKCOption_BigEndianScalarZ_Some: {
2788                         LDKBigEndianScalar* some_ref = &obj->some;
2789                         return (*env)->NewObject(env, LDKCOption_BigEndianScalarZ_Some_class, LDKCOption_BigEndianScalarZ_Some_meth, tag_ptr(some_ref, false));
2790                 }
2791                 case LDKCOption_BigEndianScalarZ_None: {
2792                         return (*env)->NewObject(env, LDKCOption_BigEndianScalarZ_None_class, LDKCOption_BigEndianScalarZ_None_meth);
2793                 }
2794                 default: abort();
2795         }
2796 }
2797 static inline struct LDKRecoverableSignature CResult_RecoverableSignatureNoneZ_get_ok(LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR owner){
2798 CHECK(owner->result_ok);
2799         return *owner->contents.result;
2800 }
2801 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
2802         LDKCResult_RecoverableSignatureNoneZ* owner_conv = (LDKCResult_RecoverableSignatureNoneZ*)untag_ptr(owner);
2803         int8_tArray ret_arr = (*env)->NewByteArray(env, 68);
2804         (*env)->SetByteArrayRegion(env, ret_arr, 0, 68, CResult_RecoverableSignatureNoneZ_get_ok(owner_conv).serialized_form);
2805         return ret_arr;
2806 }
2807
2808 static inline void CResult_RecoverableSignatureNoneZ_get_err(LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR owner){
2809 CHECK(!owner->result_ok);
2810         return *owner->contents.err;
2811 }
2812 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
2813         LDKCResult_RecoverableSignatureNoneZ* owner_conv = (LDKCResult_RecoverableSignatureNoneZ*)untag_ptr(owner);
2814         CResult_RecoverableSignatureNoneZ_get_err(owner_conv);
2815 }
2816
2817 static inline struct LDKECDSASignature CResult_ECDSASignatureNoneZ_get_ok(LDKCResult_ECDSASignatureNoneZ *NONNULL_PTR owner){
2818 CHECK(owner->result_ok);
2819         return *owner->contents.result;
2820 }
2821 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1ECDSASignatureNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
2822         LDKCResult_ECDSASignatureNoneZ* owner_conv = (LDKCResult_ECDSASignatureNoneZ*)untag_ptr(owner);
2823         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
2824         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, CResult_ECDSASignatureNoneZ_get_ok(owner_conv).compact_form);
2825         return ret_arr;
2826 }
2827
2828 static inline void CResult_ECDSASignatureNoneZ_get_err(LDKCResult_ECDSASignatureNoneZ *NONNULL_PTR owner){
2829 CHECK(!owner->result_ok);
2830         return *owner->contents.err;
2831 }
2832 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ECDSASignatureNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
2833         LDKCResult_ECDSASignatureNoneZ* owner_conv = (LDKCResult_ECDSASignatureNoneZ*)untag_ptr(owner);
2834         CResult_ECDSASignatureNoneZ_get_err(owner_conv);
2835 }
2836
2837 static inline struct LDKTransaction CResult_TransactionNoneZ_get_ok(LDKCResult_TransactionNoneZ *NONNULL_PTR owner){
2838 CHECK(owner->result_ok);
2839         return *owner->contents.result;
2840 }
2841 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
2842         LDKCResult_TransactionNoneZ* owner_conv = (LDKCResult_TransactionNoneZ*)untag_ptr(owner);
2843         LDKTransaction ret_var = CResult_TransactionNoneZ_get_ok(owner_conv);
2844         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
2845         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
2846         return ret_arr;
2847 }
2848
2849 static inline void CResult_TransactionNoneZ_get_err(LDKCResult_TransactionNoneZ *NONNULL_PTR owner){
2850 CHECK(!owner->result_ok);
2851         return *owner->contents.err;
2852 }
2853 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
2854         LDKCResult_TransactionNoneZ* owner_conv = (LDKCResult_TransactionNoneZ*)untag_ptr(owner);
2855         CResult_TransactionNoneZ_get_err(owner_conv);
2856 }
2857
2858 static inline struct LDKECDSASignature C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_get_a(LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ *NONNULL_PTR owner){
2859         return owner->a;
2860 }
2861 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ECDSASignatureCVec_1ECDSASignatureZZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
2862         LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ* owner_conv = (LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ*)untag_ptr(owner);
2863         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
2864         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_get_a(owner_conv).compact_form);
2865         return ret_arr;
2866 }
2867
2868 static inline struct LDKCVec_ECDSASignatureZ C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_get_b(LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ *NONNULL_PTR owner){
2869         return owner->b;
2870 }
2871 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ECDSASignatureCVec_1ECDSASignatureZZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
2872         LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ* owner_conv = (LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ*)untag_ptr(owner);
2873         LDKCVec_ECDSASignatureZ ret_var = C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_get_b(owner_conv);
2874         jobjectArray ret_arr = NULL;
2875         ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
2876         ;
2877         for (size_t i = 0; i < ret_var.datalen; i++) {
2878                 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, 64);
2879                 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, 64, ret_var.data[i].compact_form);
2880                 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
2881         }
2882         
2883         return ret_arr;
2884 }
2885
2886 static inline struct LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_get_ok(LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ *NONNULL_PTR owner){
2887 CHECK(owner->result_ok);
2888         return C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_clone(&*owner->contents.result);
2889 }
2890 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ECDSASignatureCVec_1ECDSASignatureZZNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
2891         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ* owner_conv = (LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ*)untag_ptr(owner);
2892         LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ), "LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ");
2893         *ret_conv = CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_get_ok(owner_conv);
2894         return tag_ptr(ret_conv, true);
2895 }
2896
2897 static inline void CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_get_err(LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ *NONNULL_PTR owner){
2898 CHECK(!owner->result_ok);
2899         return *owner->contents.err;
2900 }
2901 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ECDSASignatureCVec_1ECDSASignatureZZNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
2902         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ* owner_conv = (LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ*)untag_ptr(owner);
2903         CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_get_err(owner_conv);
2904 }
2905
2906 typedef struct LDKChannelSigner_JCalls {
2907         atomic_size_t refcnt;
2908         JavaVM *vm;
2909         jweak o;
2910         jmethodID get_per_commitment_point_meth;
2911         jmethodID release_commitment_secret_meth;
2912         jmethodID validate_holder_commitment_meth;
2913         jmethodID validate_counterparty_revocation_meth;
2914         jmethodID channel_keys_id_meth;
2915         jmethodID provide_channel_parameters_meth;
2916 } LDKChannelSigner_JCalls;
2917 static void LDKChannelSigner_JCalls_free(void* this_arg) {
2918         LDKChannelSigner_JCalls *j_calls = (LDKChannelSigner_JCalls*) this_arg;
2919         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2920                 JNIEnv *env;
2921                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2922                 if (get_jenv_res == JNI_EDETACHED) {
2923                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2924                 } else {
2925                         DO_ASSERT(get_jenv_res == JNI_OK);
2926                 }
2927                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
2928                 if (get_jenv_res == JNI_EDETACHED) {
2929                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2930                 }
2931                 FREE(j_calls);
2932         }
2933 }
2934 LDKPublicKey get_per_commitment_point_LDKChannelSigner_jcall(const void* this_arg, uint64_t idx) {
2935         LDKChannelSigner_JCalls *j_calls = (LDKChannelSigner_JCalls*) this_arg;
2936         JNIEnv *env;
2937         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2938         if (get_jenv_res == JNI_EDETACHED) {
2939                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2940         } else {
2941                 DO_ASSERT(get_jenv_res == JNI_OK);
2942         }
2943         int64_t idx_conv = idx;
2944         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2945         CHECK(obj != NULL);
2946         int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_per_commitment_point_meth, idx_conv);
2947         if (UNLIKELY((*env)->ExceptionCheck(env))) {
2948                 (*env)->ExceptionDescribe(env);
2949                 (*env)->FatalError(env, "A call to get_per_commitment_point in LDKChannelSigner from rust threw an exception.");
2950         }
2951         LDKPublicKey ret_ref;
2952         CHECK((*env)->GetArrayLength(env, ret) == 33);
2953         (*env)->GetByteArrayRegion(env, ret, 0, 33, ret_ref.compressed_form);
2954         if (get_jenv_res == JNI_EDETACHED) {
2955                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2956         }
2957         return ret_ref;
2958 }
2959 LDKThirtyTwoBytes release_commitment_secret_LDKChannelSigner_jcall(const void* this_arg, uint64_t idx) {
2960         LDKChannelSigner_JCalls *j_calls = (LDKChannelSigner_JCalls*) this_arg;
2961         JNIEnv *env;
2962         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2963         if (get_jenv_res == JNI_EDETACHED) {
2964                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2965         } else {
2966                 DO_ASSERT(get_jenv_res == JNI_OK);
2967         }
2968         int64_t idx_conv = idx;
2969         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2970         CHECK(obj != NULL);
2971         int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->release_commitment_secret_meth, idx_conv);
2972         if (UNLIKELY((*env)->ExceptionCheck(env))) {
2973                 (*env)->ExceptionDescribe(env);
2974                 (*env)->FatalError(env, "A call to release_commitment_secret in LDKChannelSigner from rust threw an exception.");
2975         }
2976         LDKThirtyTwoBytes ret_ref;
2977         CHECK((*env)->GetArrayLength(env, ret) == 32);
2978         (*env)->GetByteArrayRegion(env, ret, 0, 32, ret_ref.data);
2979         if (get_jenv_res == JNI_EDETACHED) {
2980                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2981         }
2982         return ret_ref;
2983 }
2984 LDKCResult_NoneNoneZ validate_holder_commitment_LDKChannelSigner_jcall(const void* this_arg, const LDKHolderCommitmentTransaction * holder_tx, LDKCVec_ThirtyTwoBytesZ outbound_htlc_preimages) {
2985         LDKChannelSigner_JCalls *j_calls = (LDKChannelSigner_JCalls*) this_arg;
2986         JNIEnv *env;
2987         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2988         if (get_jenv_res == JNI_EDETACHED) {
2989                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2990         } else {
2991                 DO_ASSERT(get_jenv_res == JNI_OK);
2992         }
2993         LDKHolderCommitmentTransaction holder_tx_var = *holder_tx;
2994         int64_t holder_tx_ref = 0;
2995         holder_tx_var = HolderCommitmentTransaction_clone(&holder_tx_var);
2996         CHECK_INNER_FIELD_ACCESS_OR_NULL(holder_tx_var);
2997         holder_tx_ref = tag_ptr(holder_tx_var.inner, holder_tx_var.is_owned);
2998         LDKCVec_ThirtyTwoBytesZ outbound_htlc_preimages_var = outbound_htlc_preimages;
2999         jobjectArray outbound_htlc_preimages_arr = NULL;
3000         outbound_htlc_preimages_arr = (*env)->NewObjectArray(env, outbound_htlc_preimages_var.datalen, arr_of_B_clz, NULL);
3001         ;
3002         for (size_t i = 0; i < outbound_htlc_preimages_var.datalen; i++) {
3003                 int8_tArray outbound_htlc_preimages_conv_8_arr = (*env)->NewByteArray(env, 32);
3004                 (*env)->SetByteArrayRegion(env, outbound_htlc_preimages_conv_8_arr, 0, 32, outbound_htlc_preimages_var.data[i].data);
3005                 (*env)->SetObjectArrayElement(env, outbound_htlc_preimages_arr, i, outbound_htlc_preimages_conv_8_arr);
3006         }
3007         
3008         FREE(outbound_htlc_preimages_var.data);
3009         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3010         CHECK(obj != NULL);
3011         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->validate_holder_commitment_meth, holder_tx_ref, outbound_htlc_preimages_arr);
3012         if (UNLIKELY((*env)->ExceptionCheck(env))) {
3013                 (*env)->ExceptionDescribe(env);
3014                 (*env)->FatalError(env, "A call to validate_holder_commitment in LDKChannelSigner from rust threw an exception.");
3015         }
3016         void* ret_ptr = untag_ptr(ret);
3017         CHECK_ACCESS(ret_ptr);
3018         LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(ret_ptr);
3019         FREE(untag_ptr(ret));
3020         if (get_jenv_res == JNI_EDETACHED) {
3021                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3022         }
3023         return ret_conv;
3024 }
3025 LDKCResult_NoneNoneZ validate_counterparty_revocation_LDKChannelSigner_jcall(const void* this_arg, uint64_t idx, const uint8_t (* secret)[32]) {
3026         LDKChannelSigner_JCalls *j_calls = (LDKChannelSigner_JCalls*) this_arg;
3027         JNIEnv *env;
3028         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3029         if (get_jenv_res == JNI_EDETACHED) {
3030                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3031         } else {
3032                 DO_ASSERT(get_jenv_res == JNI_OK);
3033         }
3034         int64_t idx_conv = idx;
3035         int8_tArray secret_arr = (*env)->NewByteArray(env, 32);
3036         (*env)->SetByteArrayRegion(env, secret_arr, 0, 32, *secret);
3037         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3038         CHECK(obj != NULL);
3039         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->validate_counterparty_revocation_meth, idx_conv, secret_arr);
3040         if (UNLIKELY((*env)->ExceptionCheck(env))) {
3041                 (*env)->ExceptionDescribe(env);
3042                 (*env)->FatalError(env, "A call to validate_counterparty_revocation in LDKChannelSigner from rust threw an exception.");
3043         }
3044         void* ret_ptr = untag_ptr(ret);
3045         CHECK_ACCESS(ret_ptr);
3046         LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(ret_ptr);
3047         FREE(untag_ptr(ret));
3048         if (get_jenv_res == JNI_EDETACHED) {
3049                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3050         }
3051         return ret_conv;
3052 }
3053 LDKThirtyTwoBytes channel_keys_id_LDKChannelSigner_jcall(const void* this_arg) {
3054         LDKChannelSigner_JCalls *j_calls = (LDKChannelSigner_JCalls*) this_arg;
3055         JNIEnv *env;
3056         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3057         if (get_jenv_res == JNI_EDETACHED) {
3058                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3059         } else {
3060                 DO_ASSERT(get_jenv_res == JNI_OK);
3061         }
3062         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3063         CHECK(obj != NULL);
3064         int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->channel_keys_id_meth);
3065         if (UNLIKELY((*env)->ExceptionCheck(env))) {
3066                 (*env)->ExceptionDescribe(env);
3067                 (*env)->FatalError(env, "A call to channel_keys_id in LDKChannelSigner from rust threw an exception.");
3068         }
3069         LDKThirtyTwoBytes ret_ref;
3070         CHECK((*env)->GetArrayLength(env, ret) == 32);
3071         (*env)->GetByteArrayRegion(env, ret, 0, 32, ret_ref.data);
3072         if (get_jenv_res == JNI_EDETACHED) {
3073                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3074         }
3075         return ret_ref;
3076 }
3077 void provide_channel_parameters_LDKChannelSigner_jcall(void* this_arg, const LDKChannelTransactionParameters * channel_parameters) {
3078         LDKChannelSigner_JCalls *j_calls = (LDKChannelSigner_JCalls*) this_arg;
3079         JNIEnv *env;
3080         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3081         if (get_jenv_res == JNI_EDETACHED) {
3082                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3083         } else {
3084                 DO_ASSERT(get_jenv_res == JNI_OK);
3085         }
3086         LDKChannelTransactionParameters channel_parameters_var = *channel_parameters;
3087         int64_t channel_parameters_ref = 0;
3088         channel_parameters_var = ChannelTransactionParameters_clone(&channel_parameters_var);
3089         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_var);
3090         channel_parameters_ref = tag_ptr(channel_parameters_var.inner, channel_parameters_var.is_owned);
3091         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3092         CHECK(obj != NULL);
3093         (*env)->CallVoidMethod(env, obj, j_calls->provide_channel_parameters_meth, channel_parameters_ref);
3094         if (UNLIKELY((*env)->ExceptionCheck(env))) {
3095                 (*env)->ExceptionDescribe(env);
3096                 (*env)->FatalError(env, "A call to provide_channel_parameters in LDKChannelSigner from rust threw an exception.");
3097         }
3098         if (get_jenv_res == JNI_EDETACHED) {
3099                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3100         }
3101 }
3102 static inline LDKChannelSigner LDKChannelSigner_init (JNIEnv *env, jclass clz, jobject o, int64_t pubkeys) {
3103         jclass c = (*env)->GetObjectClass(env, o);
3104         CHECK(c != NULL);
3105         LDKChannelSigner_JCalls *calls = MALLOC(sizeof(LDKChannelSigner_JCalls), "LDKChannelSigner_JCalls");
3106         atomic_init(&calls->refcnt, 1);
3107         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
3108         calls->o = (*env)->NewWeakGlobalRef(env, o);
3109         calls->get_per_commitment_point_meth = (*env)->GetMethodID(env, c, "get_per_commitment_point", "(J)[B");
3110         CHECK(calls->get_per_commitment_point_meth != NULL);
3111         calls->release_commitment_secret_meth = (*env)->GetMethodID(env, c, "release_commitment_secret", "(J)[B");
3112         CHECK(calls->release_commitment_secret_meth != NULL);
3113         calls->validate_holder_commitment_meth = (*env)->GetMethodID(env, c, "validate_holder_commitment", "(J[[B)J");
3114         CHECK(calls->validate_holder_commitment_meth != NULL);
3115         calls->validate_counterparty_revocation_meth = (*env)->GetMethodID(env, c, "validate_counterparty_revocation", "(J[B)J");
3116         CHECK(calls->validate_counterparty_revocation_meth != NULL);
3117         calls->channel_keys_id_meth = (*env)->GetMethodID(env, c, "channel_keys_id", "()[B");
3118         CHECK(calls->channel_keys_id_meth != NULL);
3119         calls->provide_channel_parameters_meth = (*env)->GetMethodID(env, c, "provide_channel_parameters", "(J)V");
3120         CHECK(calls->provide_channel_parameters_meth != NULL);
3121
3122         LDKChannelPublicKeys pubkeys_conv;
3123         pubkeys_conv.inner = untag_ptr(pubkeys);
3124         pubkeys_conv.is_owned = ptr_is_owned(pubkeys);
3125         CHECK_INNER_FIELD_ACCESS_OR_NULL(pubkeys_conv);
3126
3127         LDKChannelSigner ret = {
3128                 .this_arg = (void*) calls,
3129                 .get_per_commitment_point = get_per_commitment_point_LDKChannelSigner_jcall,
3130                 .release_commitment_secret = release_commitment_secret_LDKChannelSigner_jcall,
3131                 .validate_holder_commitment = validate_holder_commitment_LDKChannelSigner_jcall,
3132                 .validate_counterparty_revocation = validate_counterparty_revocation_LDKChannelSigner_jcall,
3133                 .channel_keys_id = channel_keys_id_LDKChannelSigner_jcall,
3134                 .provide_channel_parameters = provide_channel_parameters_LDKChannelSigner_jcall,
3135                 .free = LDKChannelSigner_JCalls_free,
3136                 .pubkeys = pubkeys_conv,
3137                 .set_pubkeys = NULL,
3138         };
3139         return ret;
3140 }
3141 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKChannelSigner_1new(JNIEnv *env, jclass clz, jobject o, int64_t pubkeys) {
3142         LDKChannelSigner *res_ptr = MALLOC(sizeof(LDKChannelSigner), "LDKChannelSigner");
3143         *res_ptr = LDKChannelSigner_init(env, clz, o, pubkeys);
3144         return tag_ptr(res_ptr, true);
3145 }
3146 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) {
3147         void* this_arg_ptr = untag_ptr(this_arg);
3148         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
3149         LDKChannelSigner* this_arg_conv = (LDKChannelSigner*)this_arg_ptr;
3150         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
3151         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, (this_arg_conv->get_per_commitment_point)(this_arg_conv->this_arg, idx).compressed_form);
3152         return ret_arr;
3153 }
3154
3155 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelSigner_1release_1commitment_1secret(JNIEnv *env, jclass clz, int64_t this_arg, int64_t idx) {
3156         void* this_arg_ptr = untag_ptr(this_arg);
3157         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
3158         LDKChannelSigner* this_arg_conv = (LDKChannelSigner*)this_arg_ptr;
3159         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
3160         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, (this_arg_conv->release_commitment_secret)(this_arg_conv->this_arg, idx).data);
3161         return ret_arr;
3162 }
3163
3164 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) {
3165         void* this_arg_ptr = untag_ptr(this_arg);
3166         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
3167         LDKChannelSigner* this_arg_conv = (LDKChannelSigner*)this_arg_ptr;
3168         LDKHolderCommitmentTransaction holder_tx_conv;
3169         holder_tx_conv.inner = untag_ptr(holder_tx);
3170         holder_tx_conv.is_owned = ptr_is_owned(holder_tx);
3171         CHECK_INNER_FIELD_ACCESS_OR_NULL(holder_tx_conv);
3172         holder_tx_conv.is_owned = false;
3173         LDKCVec_ThirtyTwoBytesZ outbound_htlc_preimages_constr;
3174         outbound_htlc_preimages_constr.datalen = (*env)->GetArrayLength(env, outbound_htlc_preimages);
3175         if (outbound_htlc_preimages_constr.datalen > 0)
3176                 outbound_htlc_preimages_constr.data = MALLOC(outbound_htlc_preimages_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_ThirtyTwoBytesZ Elements");
3177         else
3178                 outbound_htlc_preimages_constr.data = NULL;
3179         for (size_t i = 0; i < outbound_htlc_preimages_constr.datalen; i++) {
3180                 int8_tArray outbound_htlc_preimages_conv_8 = (*env)->GetObjectArrayElement(env, outbound_htlc_preimages, i);
3181                 LDKThirtyTwoBytes outbound_htlc_preimages_conv_8_ref;
3182                 CHECK((*env)->GetArrayLength(env, outbound_htlc_preimages_conv_8) == 32);
3183                 (*env)->GetByteArrayRegion(env, outbound_htlc_preimages_conv_8, 0, 32, outbound_htlc_preimages_conv_8_ref.data);
3184                 outbound_htlc_preimages_constr.data[i] = outbound_htlc_preimages_conv_8_ref;
3185         }
3186         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
3187         *ret_conv = (this_arg_conv->validate_holder_commitment)(this_arg_conv->this_arg, &holder_tx_conv, outbound_htlc_preimages_constr);
3188         return tag_ptr(ret_conv, true);
3189 }
3190
3191 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) {
3192         void* this_arg_ptr = untag_ptr(this_arg);
3193         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
3194         LDKChannelSigner* this_arg_conv = (LDKChannelSigner*)this_arg_ptr;
3195         uint8_t secret_arr[32];
3196         CHECK((*env)->GetArrayLength(env, secret) == 32);
3197         (*env)->GetByteArrayRegion(env, secret, 0, 32, secret_arr);
3198         uint8_t (*secret_ref)[32] = &secret_arr;
3199         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
3200         *ret_conv = (this_arg_conv->validate_counterparty_revocation)(this_arg_conv->this_arg, idx, secret_ref);
3201         return tag_ptr(ret_conv, true);
3202 }
3203
3204 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelSigner_1channel_1keys_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
3205         void* this_arg_ptr = untag_ptr(this_arg);
3206         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
3207         LDKChannelSigner* this_arg_conv = (LDKChannelSigner*)this_arg_ptr;
3208         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
3209         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, (this_arg_conv->channel_keys_id)(this_arg_conv->this_arg).data);
3210         return ret_arr;
3211 }
3212
3213 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelSigner_1provide_1channel_1parameters(JNIEnv *env, jclass clz, int64_t this_arg, int64_t channel_parameters) {
3214         void* this_arg_ptr = untag_ptr(this_arg);
3215         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
3216         LDKChannelSigner* this_arg_conv = (LDKChannelSigner*)this_arg_ptr;
3217         LDKChannelTransactionParameters channel_parameters_conv;
3218         channel_parameters_conv.inner = untag_ptr(channel_parameters);
3219         channel_parameters_conv.is_owned = ptr_is_owned(channel_parameters);
3220         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_conv);
3221         channel_parameters_conv.is_owned = false;
3222         (this_arg_conv->provide_channel_parameters)(this_arg_conv->this_arg, &channel_parameters_conv);
3223 }
3224
3225 LDKChannelPublicKeys LDKChannelSigner_set_get_pubkeys(LDKChannelSigner* this_arg) {
3226         if (this_arg->set_pubkeys != NULL)
3227                 this_arg->set_pubkeys(this_arg);
3228         return this_arg->pubkeys;
3229 }
3230 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelSigner_1get_1pubkeys(JNIEnv *env, jclass clz, int64_t this_arg) {
3231         void* this_arg_ptr = untag_ptr(this_arg);
3232         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
3233         LDKChannelSigner* this_arg_conv = (LDKChannelSigner*)this_arg_ptr;
3234         LDKChannelPublicKeys ret_var = LDKChannelSigner_set_get_pubkeys(this_arg_conv);
3235         int64_t ret_ref = 0;
3236         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3237         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3238         return ret_ref;
3239 }
3240
3241 typedef struct LDKEcdsaChannelSigner_JCalls {
3242         atomic_size_t refcnt;
3243         JavaVM *vm;
3244         jweak o;
3245         LDKChannelSigner_JCalls* ChannelSigner;
3246         jmethodID sign_counterparty_commitment_meth;
3247         jmethodID sign_holder_commitment_meth;
3248         jmethodID sign_justice_revoked_output_meth;
3249         jmethodID sign_justice_revoked_htlc_meth;
3250         jmethodID sign_holder_htlc_transaction_meth;
3251         jmethodID sign_counterparty_htlc_transaction_meth;
3252         jmethodID sign_closing_transaction_meth;
3253         jmethodID sign_holder_anchor_input_meth;
3254         jmethodID sign_channel_announcement_with_funding_key_meth;
3255 } LDKEcdsaChannelSigner_JCalls;
3256 static void LDKEcdsaChannelSigner_JCalls_free(void* this_arg) {
3257         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
3258         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3259                 JNIEnv *env;
3260                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3261                 if (get_jenv_res == JNI_EDETACHED) {
3262                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3263                 } else {
3264                         DO_ASSERT(get_jenv_res == JNI_OK);
3265                 }
3266                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
3267                 if (get_jenv_res == JNI_EDETACHED) {
3268                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3269                 }
3270                 FREE(j_calls);
3271         }
3272 }
3273 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) {
3274         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
3275         JNIEnv *env;
3276         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3277         if (get_jenv_res == JNI_EDETACHED) {
3278                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3279         } else {
3280                 DO_ASSERT(get_jenv_res == JNI_OK);
3281         }
3282         LDKCommitmentTransaction commitment_tx_var = *commitment_tx;
3283         int64_t commitment_tx_ref = 0;
3284         commitment_tx_var = CommitmentTransaction_clone(&commitment_tx_var);
3285         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_var);
3286         commitment_tx_ref = tag_ptr(commitment_tx_var.inner, commitment_tx_var.is_owned);
3287         LDKCVec_ThirtyTwoBytesZ inbound_htlc_preimages_var = inbound_htlc_preimages;
3288         jobjectArray inbound_htlc_preimages_arr = NULL;
3289         inbound_htlc_preimages_arr = (*env)->NewObjectArray(env, inbound_htlc_preimages_var.datalen, arr_of_B_clz, NULL);
3290         ;
3291         for (size_t i = 0; i < inbound_htlc_preimages_var.datalen; i++) {
3292                 int8_tArray inbound_htlc_preimages_conv_8_arr = (*env)->NewByteArray(env, 32);
3293                 (*env)->SetByteArrayRegion(env, inbound_htlc_preimages_conv_8_arr, 0, 32, inbound_htlc_preimages_var.data[i].data);
3294                 (*env)->SetObjectArrayElement(env, inbound_htlc_preimages_arr, i, inbound_htlc_preimages_conv_8_arr);
3295         }
3296         
3297         FREE(inbound_htlc_preimages_var.data);
3298         LDKCVec_ThirtyTwoBytesZ outbound_htlc_preimages_var = outbound_htlc_preimages;
3299         jobjectArray outbound_htlc_preimages_arr = NULL;
3300         outbound_htlc_preimages_arr = (*env)->NewObjectArray(env, outbound_htlc_preimages_var.datalen, arr_of_B_clz, NULL);
3301         ;
3302         for (size_t i = 0; i < outbound_htlc_preimages_var.datalen; i++) {
3303                 int8_tArray outbound_htlc_preimages_conv_8_arr = (*env)->NewByteArray(env, 32);
3304                 (*env)->SetByteArrayRegion(env, outbound_htlc_preimages_conv_8_arr, 0, 32, outbound_htlc_preimages_var.data[i].data);
3305                 (*env)->SetObjectArrayElement(env, outbound_htlc_preimages_arr, i, outbound_htlc_preimages_conv_8_arr);
3306         }
3307         
3308         FREE(outbound_htlc_preimages_var.data);
3309         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3310         CHECK(obj != NULL);
3311         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_counterparty_commitment_meth, commitment_tx_ref, inbound_htlc_preimages_arr, outbound_htlc_preimages_arr);
3312         if (UNLIKELY((*env)->ExceptionCheck(env))) {
3313                 (*env)->ExceptionDescribe(env);
3314                 (*env)->FatalError(env, "A call to sign_counterparty_commitment in LDKEcdsaChannelSigner from rust threw an exception.");
3315         }
3316         void* ret_ptr = untag_ptr(ret);
3317         CHECK_ACCESS(ret_ptr);
3318         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ ret_conv = *(LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ*)(ret_ptr);
3319         FREE(untag_ptr(ret));
3320         if (get_jenv_res == JNI_EDETACHED) {
3321                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3322         }
3323         return ret_conv;
3324 }
3325 LDKCResult_ECDSASignatureNoneZ sign_holder_commitment_LDKEcdsaChannelSigner_jcall(const void* this_arg, const LDKHolderCommitmentTransaction * commitment_tx) {
3326         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
3327         JNIEnv *env;
3328         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3329         if (get_jenv_res == JNI_EDETACHED) {
3330                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3331         } else {
3332                 DO_ASSERT(get_jenv_res == JNI_OK);
3333         }
3334         LDKHolderCommitmentTransaction commitment_tx_var = *commitment_tx;
3335         int64_t commitment_tx_ref = 0;
3336         commitment_tx_var = HolderCommitmentTransaction_clone(&commitment_tx_var);
3337         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_var);
3338         commitment_tx_ref = tag_ptr(commitment_tx_var.inner, commitment_tx_var.is_owned);
3339         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3340         CHECK(obj != NULL);
3341         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_holder_commitment_meth, commitment_tx_ref);
3342         if (UNLIKELY((*env)->ExceptionCheck(env))) {
3343                 (*env)->ExceptionDescribe(env);
3344                 (*env)->FatalError(env, "A call to sign_holder_commitment in LDKEcdsaChannelSigner from rust threw an exception.");
3345         }
3346         void* ret_ptr = untag_ptr(ret);
3347         CHECK_ACCESS(ret_ptr);
3348         LDKCResult_ECDSASignatureNoneZ ret_conv = *(LDKCResult_ECDSASignatureNoneZ*)(ret_ptr);
3349         FREE(untag_ptr(ret));
3350         if (get_jenv_res == JNI_EDETACHED) {
3351                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3352         }
3353         return ret_conv;
3354 }
3355 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]) {
3356         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
3357         JNIEnv *env;
3358         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3359         if (get_jenv_res == JNI_EDETACHED) {
3360                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3361         } else {
3362                 DO_ASSERT(get_jenv_res == JNI_OK);
3363         }
3364         LDKTransaction justice_tx_var = justice_tx;
3365         int8_tArray justice_tx_arr = (*env)->NewByteArray(env, justice_tx_var.datalen);
3366         (*env)->SetByteArrayRegion(env, justice_tx_arr, 0, justice_tx_var.datalen, justice_tx_var.data);
3367         Transaction_free(justice_tx_var);
3368         int64_t input_conv = input;
3369         int64_t amount_conv = amount;
3370         int8_tArray per_commitment_key_arr = (*env)->NewByteArray(env, 32);
3371         (*env)->SetByteArrayRegion(env, per_commitment_key_arr, 0, 32, *per_commitment_key);
3372         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3373         CHECK(obj != NULL);
3374         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);
3375         if (UNLIKELY((*env)->ExceptionCheck(env))) {
3376                 (*env)->ExceptionDescribe(env);
3377                 (*env)->FatalError(env, "A call to sign_justice_revoked_output in LDKEcdsaChannelSigner from rust threw an exception.");
3378         }
3379         void* ret_ptr = untag_ptr(ret);
3380         CHECK_ACCESS(ret_ptr);
3381         LDKCResult_ECDSASignatureNoneZ ret_conv = *(LDKCResult_ECDSASignatureNoneZ*)(ret_ptr);
3382         FREE(untag_ptr(ret));
3383         if (get_jenv_res == JNI_EDETACHED) {
3384                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3385         }
3386         return ret_conv;
3387 }
3388 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) {
3389         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
3390         JNIEnv *env;
3391         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3392         if (get_jenv_res == JNI_EDETACHED) {
3393                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3394         } else {
3395                 DO_ASSERT(get_jenv_res == JNI_OK);
3396         }
3397         LDKTransaction justice_tx_var = justice_tx;
3398         int8_tArray justice_tx_arr = (*env)->NewByteArray(env, justice_tx_var.datalen);
3399         (*env)->SetByteArrayRegion(env, justice_tx_arr, 0, justice_tx_var.datalen, justice_tx_var.data);
3400         Transaction_free(justice_tx_var);
3401         int64_t input_conv = input;
3402         int64_t amount_conv = amount;
3403         int8_tArray per_commitment_key_arr = (*env)->NewByteArray(env, 32);
3404         (*env)->SetByteArrayRegion(env, per_commitment_key_arr, 0, 32, *per_commitment_key);
3405         LDKHTLCOutputInCommitment htlc_var = *htlc;
3406         int64_t htlc_ref = 0;
3407         htlc_var = HTLCOutputInCommitment_clone(&htlc_var);
3408         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_var);
3409         htlc_ref = tag_ptr(htlc_var.inner, htlc_var.is_owned);
3410         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3411         CHECK(obj != NULL);
3412         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);
3413         if (UNLIKELY((*env)->ExceptionCheck(env))) {
3414                 (*env)->ExceptionDescribe(env);
3415                 (*env)->FatalError(env, "A call to sign_justice_revoked_htlc in LDKEcdsaChannelSigner from rust threw an exception.");
3416         }
3417         void* ret_ptr = untag_ptr(ret);
3418         CHECK_ACCESS(ret_ptr);
3419         LDKCResult_ECDSASignatureNoneZ ret_conv = *(LDKCResult_ECDSASignatureNoneZ*)(ret_ptr);
3420         FREE(untag_ptr(ret));
3421         if (get_jenv_res == JNI_EDETACHED) {
3422                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3423         }
3424         return ret_conv;
3425 }
3426 LDKCResult_ECDSASignatureNoneZ sign_holder_htlc_transaction_LDKEcdsaChannelSigner_jcall(const void* this_arg, LDKTransaction htlc_tx, uintptr_t input, const LDKHTLCDescriptor * htlc_descriptor) {
3427         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
3428         JNIEnv *env;
3429         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3430         if (get_jenv_res == JNI_EDETACHED) {
3431                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3432         } else {
3433                 DO_ASSERT(get_jenv_res == JNI_OK);
3434         }
3435         LDKTransaction htlc_tx_var = htlc_tx;
3436         int8_tArray htlc_tx_arr = (*env)->NewByteArray(env, htlc_tx_var.datalen);
3437         (*env)->SetByteArrayRegion(env, htlc_tx_arr, 0, htlc_tx_var.datalen, htlc_tx_var.data);
3438         Transaction_free(htlc_tx_var);
3439         int64_t input_conv = input;
3440         LDKHTLCDescriptor htlc_descriptor_var = *htlc_descriptor;
3441         int64_t htlc_descriptor_ref = 0;
3442         htlc_descriptor_var = HTLCDescriptor_clone(&htlc_descriptor_var);
3443         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_descriptor_var);
3444         htlc_descriptor_ref = tag_ptr(htlc_descriptor_var.inner, htlc_descriptor_var.is_owned);
3445         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3446         CHECK(obj != NULL);
3447         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_holder_htlc_transaction_meth, htlc_tx_arr, input_conv, htlc_descriptor_ref);
3448         if (UNLIKELY((*env)->ExceptionCheck(env))) {
3449                 (*env)->ExceptionDescribe(env);
3450                 (*env)->FatalError(env, "A call to sign_holder_htlc_transaction in LDKEcdsaChannelSigner from rust threw an exception.");
3451         }
3452         void* ret_ptr = untag_ptr(ret);
3453         CHECK_ACCESS(ret_ptr);
3454         LDKCResult_ECDSASignatureNoneZ ret_conv = *(LDKCResult_ECDSASignatureNoneZ*)(ret_ptr);
3455         FREE(untag_ptr(ret));
3456         if (get_jenv_res == JNI_EDETACHED) {
3457                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3458         }
3459         return ret_conv;
3460 }
3461 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) {
3462         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
3463         JNIEnv *env;
3464         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3465         if (get_jenv_res == JNI_EDETACHED) {
3466                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3467         } else {
3468                 DO_ASSERT(get_jenv_res == JNI_OK);
3469         }
3470         LDKTransaction htlc_tx_var = htlc_tx;
3471         int8_tArray htlc_tx_arr = (*env)->NewByteArray(env, htlc_tx_var.datalen);
3472         (*env)->SetByteArrayRegion(env, htlc_tx_arr, 0, htlc_tx_var.datalen, htlc_tx_var.data);
3473         Transaction_free(htlc_tx_var);
3474         int64_t input_conv = input;
3475         int64_t amount_conv = amount;
3476         int8_tArray per_commitment_point_arr = (*env)->NewByteArray(env, 33);
3477         (*env)->SetByteArrayRegion(env, per_commitment_point_arr, 0, 33, per_commitment_point.compressed_form);
3478         LDKHTLCOutputInCommitment htlc_var = *htlc;
3479         int64_t htlc_ref = 0;
3480         htlc_var = HTLCOutputInCommitment_clone(&htlc_var);
3481         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_var);
3482         htlc_ref = tag_ptr(htlc_var.inner, htlc_var.is_owned);
3483         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3484         CHECK(obj != NULL);
3485         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);
3486         if (UNLIKELY((*env)->ExceptionCheck(env))) {
3487                 (*env)->ExceptionDescribe(env);
3488                 (*env)->FatalError(env, "A call to sign_counterparty_htlc_transaction in LDKEcdsaChannelSigner from rust threw an exception.");
3489         }
3490         void* ret_ptr = untag_ptr(ret);
3491         CHECK_ACCESS(ret_ptr);
3492         LDKCResult_ECDSASignatureNoneZ ret_conv = *(LDKCResult_ECDSASignatureNoneZ*)(ret_ptr);
3493         FREE(untag_ptr(ret));
3494         if (get_jenv_res == JNI_EDETACHED) {
3495                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3496         }
3497         return ret_conv;
3498 }
3499 LDKCResult_ECDSASignatureNoneZ sign_closing_transaction_LDKEcdsaChannelSigner_jcall(const void* this_arg, const LDKClosingTransaction * closing_tx) {
3500         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
3501         JNIEnv *env;
3502         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3503         if (get_jenv_res == JNI_EDETACHED) {
3504                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3505         } else {
3506                 DO_ASSERT(get_jenv_res == JNI_OK);
3507         }
3508         LDKClosingTransaction closing_tx_var = *closing_tx;
3509         int64_t closing_tx_ref = 0;
3510         closing_tx_var = ClosingTransaction_clone(&closing_tx_var);
3511         CHECK_INNER_FIELD_ACCESS_OR_NULL(closing_tx_var);
3512         closing_tx_ref = tag_ptr(closing_tx_var.inner, closing_tx_var.is_owned);
3513         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3514         CHECK(obj != NULL);
3515         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_closing_transaction_meth, closing_tx_ref);
3516         if (UNLIKELY((*env)->ExceptionCheck(env))) {
3517                 (*env)->ExceptionDescribe(env);
3518                 (*env)->FatalError(env, "A call to sign_closing_transaction in LDKEcdsaChannelSigner from rust threw an exception.");
3519         }
3520         void* ret_ptr = untag_ptr(ret);
3521         CHECK_ACCESS(ret_ptr);
3522         LDKCResult_ECDSASignatureNoneZ ret_conv = *(LDKCResult_ECDSASignatureNoneZ*)(ret_ptr);
3523         FREE(untag_ptr(ret));
3524         if (get_jenv_res == JNI_EDETACHED) {
3525                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3526         }
3527         return ret_conv;
3528 }
3529 LDKCResult_ECDSASignatureNoneZ sign_holder_anchor_input_LDKEcdsaChannelSigner_jcall(const void* this_arg, LDKTransaction anchor_tx, uintptr_t input) {
3530         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
3531         JNIEnv *env;
3532         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3533         if (get_jenv_res == JNI_EDETACHED) {
3534                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3535         } else {
3536                 DO_ASSERT(get_jenv_res == JNI_OK);
3537         }
3538         LDKTransaction anchor_tx_var = anchor_tx;
3539         int8_tArray anchor_tx_arr = (*env)->NewByteArray(env, anchor_tx_var.datalen);
3540         (*env)->SetByteArrayRegion(env, anchor_tx_arr, 0, anchor_tx_var.datalen, anchor_tx_var.data);
3541         Transaction_free(anchor_tx_var);
3542         int64_t input_conv = input;
3543         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3544         CHECK(obj != NULL);
3545         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_holder_anchor_input_meth, anchor_tx_arr, input_conv);
3546         if (UNLIKELY((*env)->ExceptionCheck(env))) {
3547                 (*env)->ExceptionDescribe(env);
3548                 (*env)->FatalError(env, "A call to sign_holder_anchor_input in LDKEcdsaChannelSigner from rust threw an exception.");
3549         }
3550         void* ret_ptr = untag_ptr(ret);
3551         CHECK_ACCESS(ret_ptr);
3552         LDKCResult_ECDSASignatureNoneZ ret_conv = *(LDKCResult_ECDSASignatureNoneZ*)(ret_ptr);
3553         FREE(untag_ptr(ret));
3554         if (get_jenv_res == JNI_EDETACHED) {
3555                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3556         }
3557         return ret_conv;
3558 }
3559 LDKCResult_ECDSASignatureNoneZ sign_channel_announcement_with_funding_key_LDKEcdsaChannelSigner_jcall(const void* this_arg, const LDKUnsignedChannelAnnouncement * msg) {
3560         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg;
3561         JNIEnv *env;
3562         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3563         if (get_jenv_res == JNI_EDETACHED) {
3564                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3565         } else {
3566                 DO_ASSERT(get_jenv_res == JNI_OK);
3567         }
3568         LDKUnsignedChannelAnnouncement msg_var = *msg;
3569         int64_t msg_ref = 0;
3570         msg_var = UnsignedChannelAnnouncement_clone(&msg_var);
3571         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
3572         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
3573         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3574         CHECK(obj != NULL);
3575         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_channel_announcement_with_funding_key_meth, msg_ref);
3576         if (UNLIKELY((*env)->ExceptionCheck(env))) {
3577                 (*env)->ExceptionDescribe(env);
3578                 (*env)->FatalError(env, "A call to sign_channel_announcement_with_funding_key in LDKEcdsaChannelSigner from rust threw an exception.");
3579         }
3580         void* ret_ptr = untag_ptr(ret);
3581         CHECK_ACCESS(ret_ptr);
3582         LDKCResult_ECDSASignatureNoneZ ret_conv = *(LDKCResult_ECDSASignatureNoneZ*)(ret_ptr);
3583         FREE(untag_ptr(ret));
3584         if (get_jenv_res == JNI_EDETACHED) {
3585                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3586         }
3587         return ret_conv;
3588 }
3589 static void LDKEcdsaChannelSigner_JCalls_cloned(LDKEcdsaChannelSigner* new_obj) {
3590         LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) new_obj->this_arg;
3591         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3592         atomic_fetch_add_explicit(&j_calls->ChannelSigner->refcnt, 1, memory_order_release);
3593 }
3594 static inline LDKEcdsaChannelSigner LDKEcdsaChannelSigner_init (JNIEnv *env, jclass clz, jobject o, jobject ChannelSigner, int64_t pubkeys) {
3595         jclass c = (*env)->GetObjectClass(env, o);
3596         CHECK(c != NULL);
3597         LDKEcdsaChannelSigner_JCalls *calls = MALLOC(sizeof(LDKEcdsaChannelSigner_JCalls), "LDKEcdsaChannelSigner_JCalls");
3598         atomic_init(&calls->refcnt, 1);
3599         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
3600         calls->o = (*env)->NewWeakGlobalRef(env, o);
3601         calls->sign_counterparty_commitment_meth = (*env)->GetMethodID(env, c, "sign_counterparty_commitment", "(J[[B[[B)J");
3602         CHECK(calls->sign_counterparty_commitment_meth != NULL);
3603         calls->sign_holder_commitment_meth = (*env)->GetMethodID(env, c, "sign_holder_commitment", "(J)J");
3604         CHECK(calls->sign_holder_commitment_meth != NULL);
3605         calls->sign_justice_revoked_output_meth = (*env)->GetMethodID(env, c, "sign_justice_revoked_output", "([BJJ[B)J");
3606         CHECK(calls->sign_justice_revoked_output_meth != NULL);
3607         calls->sign_justice_revoked_htlc_meth = (*env)->GetMethodID(env, c, "sign_justice_revoked_htlc", "([BJJ[BJ)J");
3608         CHECK(calls->sign_justice_revoked_htlc_meth != NULL);
3609         calls->sign_holder_htlc_transaction_meth = (*env)->GetMethodID(env, c, "sign_holder_htlc_transaction", "([BJJ)J");
3610         CHECK(calls->sign_holder_htlc_transaction_meth != NULL);
3611         calls->sign_counterparty_htlc_transaction_meth = (*env)->GetMethodID(env, c, "sign_counterparty_htlc_transaction", "([BJJ[BJ)J");
3612         CHECK(calls->sign_counterparty_htlc_transaction_meth != NULL);
3613         calls->sign_closing_transaction_meth = (*env)->GetMethodID(env, c, "sign_closing_transaction", "(J)J");
3614         CHECK(calls->sign_closing_transaction_meth != NULL);
3615         calls->sign_holder_anchor_input_meth = (*env)->GetMethodID(env, c, "sign_holder_anchor_input", "([BJ)J");
3616         CHECK(calls->sign_holder_anchor_input_meth != NULL);
3617         calls->sign_channel_announcement_with_funding_key_meth = (*env)->GetMethodID(env, c, "sign_channel_announcement_with_funding_key", "(J)J");
3618         CHECK(calls->sign_channel_announcement_with_funding_key_meth != NULL);
3619
3620         LDKChannelPublicKeys pubkeys_conv;
3621         pubkeys_conv.inner = untag_ptr(pubkeys);
3622         pubkeys_conv.is_owned = ptr_is_owned(pubkeys);
3623         CHECK_INNER_FIELD_ACCESS_OR_NULL(pubkeys_conv);
3624
3625         LDKEcdsaChannelSigner ret = {
3626                 .this_arg = (void*) calls,
3627                 .sign_counterparty_commitment = sign_counterparty_commitment_LDKEcdsaChannelSigner_jcall,
3628                 .sign_holder_commitment = sign_holder_commitment_LDKEcdsaChannelSigner_jcall,
3629                 .sign_justice_revoked_output = sign_justice_revoked_output_LDKEcdsaChannelSigner_jcall,
3630                 .sign_justice_revoked_htlc = sign_justice_revoked_htlc_LDKEcdsaChannelSigner_jcall,
3631                 .sign_holder_htlc_transaction = sign_holder_htlc_transaction_LDKEcdsaChannelSigner_jcall,
3632                 .sign_counterparty_htlc_transaction = sign_counterparty_htlc_transaction_LDKEcdsaChannelSigner_jcall,
3633                 .sign_closing_transaction = sign_closing_transaction_LDKEcdsaChannelSigner_jcall,
3634                 .sign_holder_anchor_input = sign_holder_anchor_input_LDKEcdsaChannelSigner_jcall,
3635                 .sign_channel_announcement_with_funding_key = sign_channel_announcement_with_funding_key_LDKEcdsaChannelSigner_jcall,
3636                 .free = LDKEcdsaChannelSigner_JCalls_free,
3637                 .ChannelSigner = LDKChannelSigner_init(env, clz, ChannelSigner, pubkeys),
3638         };
3639         calls->ChannelSigner = ret.ChannelSigner.this_arg;
3640         return ret;
3641 }
3642 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKEcdsaChannelSigner_1new(JNIEnv *env, jclass clz, jobject o, jobject ChannelSigner, int64_t pubkeys) {
3643         LDKEcdsaChannelSigner *res_ptr = MALLOC(sizeof(LDKEcdsaChannelSigner), "LDKEcdsaChannelSigner");
3644         *res_ptr = LDKEcdsaChannelSigner_init(env, clz, o, ChannelSigner, pubkeys);
3645         return tag_ptr(res_ptr, true);
3646 }
3647 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKEcdsaChannelSigner_1get_1ChannelSigner(JNIEnv *env, jclass clz, int64_t arg) {
3648         LDKEcdsaChannelSigner *inp = (LDKEcdsaChannelSigner *)untag_ptr(arg);
3649         return tag_ptr(&inp->ChannelSigner, false);
3650 }
3651 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) {
3652         void* this_arg_ptr = untag_ptr(this_arg);
3653         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
3654         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
3655         LDKCommitmentTransaction commitment_tx_conv;
3656         commitment_tx_conv.inner = untag_ptr(commitment_tx);
3657         commitment_tx_conv.is_owned = ptr_is_owned(commitment_tx);
3658         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_conv);
3659         commitment_tx_conv.is_owned = false;
3660         LDKCVec_ThirtyTwoBytesZ inbound_htlc_preimages_constr;
3661         inbound_htlc_preimages_constr.datalen = (*env)->GetArrayLength(env, inbound_htlc_preimages);
3662         if (inbound_htlc_preimages_constr.datalen > 0)
3663                 inbound_htlc_preimages_constr.data = MALLOC(inbound_htlc_preimages_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_ThirtyTwoBytesZ Elements");
3664         else
3665                 inbound_htlc_preimages_constr.data = NULL;
3666         for (size_t i = 0; i < inbound_htlc_preimages_constr.datalen; i++) {
3667                 int8_tArray inbound_htlc_preimages_conv_8 = (*env)->GetObjectArrayElement(env, inbound_htlc_preimages, i);
3668                 LDKThirtyTwoBytes inbound_htlc_preimages_conv_8_ref;
3669                 CHECK((*env)->GetArrayLength(env, inbound_htlc_preimages_conv_8) == 32);
3670                 (*env)->GetByteArrayRegion(env, inbound_htlc_preimages_conv_8, 0, 32, inbound_htlc_preimages_conv_8_ref.data);
3671                 inbound_htlc_preimages_constr.data[i] = inbound_htlc_preimages_conv_8_ref;
3672         }
3673         LDKCVec_ThirtyTwoBytesZ outbound_htlc_preimages_constr;
3674         outbound_htlc_preimages_constr.datalen = (*env)->GetArrayLength(env, outbound_htlc_preimages);
3675         if (outbound_htlc_preimages_constr.datalen > 0)
3676                 outbound_htlc_preimages_constr.data = MALLOC(outbound_htlc_preimages_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_ThirtyTwoBytesZ Elements");
3677         else
3678                 outbound_htlc_preimages_constr.data = NULL;
3679         for (size_t i = 0; i < outbound_htlc_preimages_constr.datalen; i++) {
3680                 int8_tArray outbound_htlc_preimages_conv_8 = (*env)->GetObjectArrayElement(env, outbound_htlc_preimages, i);
3681                 LDKThirtyTwoBytes outbound_htlc_preimages_conv_8_ref;
3682                 CHECK((*env)->GetArrayLength(env, outbound_htlc_preimages_conv_8) == 32);
3683                 (*env)->GetByteArrayRegion(env, outbound_htlc_preimages_conv_8, 0, 32, outbound_htlc_preimages_conv_8_ref.data);
3684                 outbound_htlc_preimages_constr.data[i] = outbound_htlc_preimages_conv_8_ref;
3685         }
3686         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ), "LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ");
3687         *ret_conv = (this_arg_conv->sign_counterparty_commitment)(this_arg_conv->this_arg, &commitment_tx_conv, inbound_htlc_preimages_constr, outbound_htlc_preimages_constr);
3688         return tag_ptr(ret_conv, true);
3689 }
3690
3691 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) {
3692         void* this_arg_ptr = untag_ptr(this_arg);
3693         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
3694         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
3695         LDKHolderCommitmentTransaction commitment_tx_conv;
3696         commitment_tx_conv.inner = untag_ptr(commitment_tx);
3697         commitment_tx_conv.is_owned = ptr_is_owned(commitment_tx);
3698         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_conv);
3699         commitment_tx_conv.is_owned = false;
3700         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
3701         *ret_conv = (this_arg_conv->sign_holder_commitment)(this_arg_conv->this_arg, &commitment_tx_conv);
3702         return tag_ptr(ret_conv, true);
3703 }
3704
3705 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) {
3706         void* this_arg_ptr = untag_ptr(this_arg);
3707         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
3708         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
3709         LDKTransaction justice_tx_ref;
3710         justice_tx_ref.datalen = (*env)->GetArrayLength(env, justice_tx);
3711         justice_tx_ref.data = MALLOC(justice_tx_ref.datalen, "LDKTransaction Bytes");
3712         (*env)->GetByteArrayRegion(env, justice_tx, 0, justice_tx_ref.datalen, justice_tx_ref.data);
3713         justice_tx_ref.data_is_owned = true;
3714         uint8_t per_commitment_key_arr[32];
3715         CHECK((*env)->GetArrayLength(env, per_commitment_key) == 32);
3716         (*env)->GetByteArrayRegion(env, per_commitment_key, 0, 32, per_commitment_key_arr);
3717         uint8_t (*per_commitment_key_ref)[32] = &per_commitment_key_arr;
3718         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
3719         *ret_conv = (this_arg_conv->sign_justice_revoked_output)(this_arg_conv->this_arg, justice_tx_ref, input, amount, per_commitment_key_ref);
3720         return tag_ptr(ret_conv, true);
3721 }
3722
3723 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) {
3724         void* this_arg_ptr = untag_ptr(this_arg);
3725         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
3726         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
3727         LDKTransaction justice_tx_ref;
3728         justice_tx_ref.datalen = (*env)->GetArrayLength(env, justice_tx);
3729         justice_tx_ref.data = MALLOC(justice_tx_ref.datalen, "LDKTransaction Bytes");
3730         (*env)->GetByteArrayRegion(env, justice_tx, 0, justice_tx_ref.datalen, justice_tx_ref.data);
3731         justice_tx_ref.data_is_owned = true;
3732         uint8_t per_commitment_key_arr[32];
3733         CHECK((*env)->GetArrayLength(env, per_commitment_key) == 32);
3734         (*env)->GetByteArrayRegion(env, per_commitment_key, 0, 32, per_commitment_key_arr);
3735         uint8_t (*per_commitment_key_ref)[32] = &per_commitment_key_arr;
3736         LDKHTLCOutputInCommitment htlc_conv;
3737         htlc_conv.inner = untag_ptr(htlc);
3738         htlc_conv.is_owned = ptr_is_owned(htlc);
3739         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
3740         htlc_conv.is_owned = false;
3741         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
3742         *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);
3743         return tag_ptr(ret_conv, true);
3744 }
3745
3746 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) {
3747         void* this_arg_ptr = untag_ptr(this_arg);
3748         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
3749         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
3750         LDKTransaction htlc_tx_ref;
3751         htlc_tx_ref.datalen = (*env)->GetArrayLength(env, htlc_tx);
3752         htlc_tx_ref.data = MALLOC(htlc_tx_ref.datalen, "LDKTransaction Bytes");
3753         (*env)->GetByteArrayRegion(env, htlc_tx, 0, htlc_tx_ref.datalen, htlc_tx_ref.data);
3754         htlc_tx_ref.data_is_owned = true;
3755         LDKHTLCDescriptor htlc_descriptor_conv;
3756         htlc_descriptor_conv.inner = untag_ptr(htlc_descriptor);
3757         htlc_descriptor_conv.is_owned = ptr_is_owned(htlc_descriptor);
3758         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_descriptor_conv);
3759         htlc_descriptor_conv.is_owned = false;
3760         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
3761         *ret_conv = (this_arg_conv->sign_holder_htlc_transaction)(this_arg_conv->this_arg, htlc_tx_ref, input, &htlc_descriptor_conv);
3762         return tag_ptr(ret_conv, true);
3763 }
3764
3765 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) {
3766         void* this_arg_ptr = untag_ptr(this_arg);
3767         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
3768         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
3769         LDKTransaction htlc_tx_ref;
3770         htlc_tx_ref.datalen = (*env)->GetArrayLength(env, htlc_tx);
3771         htlc_tx_ref.data = MALLOC(htlc_tx_ref.datalen, "LDKTransaction Bytes");
3772         (*env)->GetByteArrayRegion(env, htlc_tx, 0, htlc_tx_ref.datalen, htlc_tx_ref.data);
3773         htlc_tx_ref.data_is_owned = true;
3774         LDKPublicKey per_commitment_point_ref;
3775         CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
3776         (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
3777         LDKHTLCOutputInCommitment htlc_conv;
3778         htlc_conv.inner = untag_ptr(htlc);
3779         htlc_conv.is_owned = ptr_is_owned(htlc);
3780         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
3781         htlc_conv.is_owned = false;
3782         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
3783         *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);
3784         return tag_ptr(ret_conv, true);
3785 }
3786
3787 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) {
3788         void* this_arg_ptr = untag_ptr(this_arg);
3789         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
3790         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
3791         LDKClosingTransaction closing_tx_conv;
3792         closing_tx_conv.inner = untag_ptr(closing_tx);
3793         closing_tx_conv.is_owned = ptr_is_owned(closing_tx);
3794         CHECK_INNER_FIELD_ACCESS_OR_NULL(closing_tx_conv);
3795         closing_tx_conv.is_owned = false;
3796         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
3797         *ret_conv = (this_arg_conv->sign_closing_transaction)(this_arg_conv->this_arg, &closing_tx_conv);
3798         return tag_ptr(ret_conv, true);
3799 }
3800
3801 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) {
3802         void* this_arg_ptr = untag_ptr(this_arg);
3803         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
3804         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
3805         LDKTransaction anchor_tx_ref;
3806         anchor_tx_ref.datalen = (*env)->GetArrayLength(env, anchor_tx);
3807         anchor_tx_ref.data = MALLOC(anchor_tx_ref.datalen, "LDKTransaction Bytes");
3808         (*env)->GetByteArrayRegion(env, anchor_tx, 0, anchor_tx_ref.datalen, anchor_tx_ref.data);
3809         anchor_tx_ref.data_is_owned = true;
3810         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
3811         *ret_conv = (this_arg_conv->sign_holder_anchor_input)(this_arg_conv->this_arg, anchor_tx_ref, input);
3812         return tag_ptr(ret_conv, true);
3813 }
3814
3815 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) {
3816         void* this_arg_ptr = untag_ptr(this_arg);
3817         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
3818         LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr;
3819         LDKUnsignedChannelAnnouncement msg_conv;
3820         msg_conv.inner = untag_ptr(msg);
3821         msg_conv.is_owned = ptr_is_owned(msg);
3822         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
3823         msg_conv.is_owned = false;
3824         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
3825         *ret_conv = (this_arg_conv->sign_channel_announcement_with_funding_key)(this_arg_conv->this_arg, &msg_conv);
3826         return tag_ptr(ret_conv, true);
3827 }
3828
3829 typedef struct LDKWriteableEcdsaChannelSigner_JCalls {
3830         atomic_size_t refcnt;
3831         JavaVM *vm;
3832         jweak o;
3833         LDKEcdsaChannelSigner_JCalls* EcdsaChannelSigner;
3834         LDKChannelSigner_JCalls* ChannelSigner;
3835         jmethodID write_meth;
3836 } LDKWriteableEcdsaChannelSigner_JCalls;
3837 static void LDKWriteableEcdsaChannelSigner_JCalls_free(void* this_arg) {
3838         LDKWriteableEcdsaChannelSigner_JCalls *j_calls = (LDKWriteableEcdsaChannelSigner_JCalls*) this_arg;
3839         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3840                 JNIEnv *env;
3841                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3842                 if (get_jenv_res == JNI_EDETACHED) {
3843                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3844                 } else {
3845                         DO_ASSERT(get_jenv_res == JNI_OK);
3846                 }
3847                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
3848                 if (get_jenv_res == JNI_EDETACHED) {
3849                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3850                 }
3851                 FREE(j_calls);
3852         }
3853 }
3854 LDKCVec_u8Z write_LDKWriteableEcdsaChannelSigner_jcall(const void* this_arg) {
3855         LDKWriteableEcdsaChannelSigner_JCalls *j_calls = (LDKWriteableEcdsaChannelSigner_JCalls*) this_arg;
3856         JNIEnv *env;
3857         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3858         if (get_jenv_res == JNI_EDETACHED) {
3859                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3860         } else {
3861                 DO_ASSERT(get_jenv_res == JNI_OK);
3862         }
3863         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3864         CHECK(obj != NULL);
3865         int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->write_meth);
3866         if (UNLIKELY((*env)->ExceptionCheck(env))) {
3867                 (*env)->ExceptionDescribe(env);
3868                 (*env)->FatalError(env, "A call to write in LDKWriteableEcdsaChannelSigner from rust threw an exception.");
3869         }
3870         LDKCVec_u8Z ret_ref;
3871         ret_ref.datalen = (*env)->GetArrayLength(env, ret);
3872         ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
3873         (*env)->GetByteArrayRegion(env, ret, 0, ret_ref.datalen, ret_ref.data);
3874         if (get_jenv_res == JNI_EDETACHED) {
3875                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3876         }
3877         return ret_ref;
3878 }
3879 static void LDKWriteableEcdsaChannelSigner_JCalls_cloned(LDKWriteableEcdsaChannelSigner* new_obj) {
3880         LDKWriteableEcdsaChannelSigner_JCalls *j_calls = (LDKWriteableEcdsaChannelSigner_JCalls*) new_obj->this_arg;
3881         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3882         atomic_fetch_add_explicit(&j_calls->EcdsaChannelSigner->refcnt, 1, memory_order_release);
3883         atomic_fetch_add_explicit(&j_calls->EcdsaChannelSigner->ChannelSigner->refcnt, 1, memory_order_release);
3884 }
3885 static inline LDKWriteableEcdsaChannelSigner LDKWriteableEcdsaChannelSigner_init (JNIEnv *env, jclass clz, jobject o, jobject EcdsaChannelSigner, jobject ChannelSigner, int64_t pubkeys) {
3886         jclass c = (*env)->GetObjectClass(env, o);
3887         CHECK(c != NULL);
3888         LDKWriteableEcdsaChannelSigner_JCalls *calls = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner_JCalls), "LDKWriteableEcdsaChannelSigner_JCalls");
3889         atomic_init(&calls->refcnt, 1);
3890         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
3891         calls->o = (*env)->NewWeakGlobalRef(env, o);
3892         calls->write_meth = (*env)->GetMethodID(env, c, "write", "()[B");
3893         CHECK(calls->write_meth != NULL);
3894
3895         LDKChannelPublicKeys pubkeys_conv;
3896         pubkeys_conv.inner = untag_ptr(pubkeys);
3897         pubkeys_conv.is_owned = ptr_is_owned(pubkeys);
3898         CHECK_INNER_FIELD_ACCESS_OR_NULL(pubkeys_conv);
3899
3900         LDKWriteableEcdsaChannelSigner ret = {
3901                 .this_arg = (void*) calls,
3902                 .write = write_LDKWriteableEcdsaChannelSigner_jcall,
3903                 .cloned = LDKWriteableEcdsaChannelSigner_JCalls_cloned,
3904                 .free = LDKWriteableEcdsaChannelSigner_JCalls_free,
3905                 .EcdsaChannelSigner = LDKEcdsaChannelSigner_init(env, clz, EcdsaChannelSigner, ChannelSigner, pubkeys),
3906         };
3907         calls->EcdsaChannelSigner = ret.EcdsaChannelSigner.this_arg;
3908         calls->ChannelSigner = ret.EcdsaChannelSigner.ChannelSigner.this_arg;
3909         return ret;
3910 }
3911 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKWriteableEcdsaChannelSigner_1new(JNIEnv *env, jclass clz, jobject o, jobject EcdsaChannelSigner, jobject ChannelSigner, int64_t pubkeys) {
3912         LDKWriteableEcdsaChannelSigner *res_ptr = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner");
3913         *res_ptr = LDKWriteableEcdsaChannelSigner_init(env, clz, o, EcdsaChannelSigner, ChannelSigner, pubkeys);
3914         return tag_ptr(res_ptr, true);
3915 }
3916 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKWriteableEcdsaChannelSigner_1get_1EcdsaChannelSigner(JNIEnv *env, jclass clz, int64_t arg) {
3917         LDKWriteableEcdsaChannelSigner *inp = (LDKWriteableEcdsaChannelSigner *)untag_ptr(arg);
3918         return tag_ptr(&inp->EcdsaChannelSigner, false);
3919 }
3920 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKWriteableEcdsaChannelSigner_1get_1ChannelSigner(JNIEnv *env, jclass clz, int64_t arg) {
3921         LDKWriteableEcdsaChannelSigner *inp = (LDKWriteableEcdsaChannelSigner *)untag_ptr(arg);
3922         return tag_ptr(&inp->EcdsaChannelSigner.ChannelSigner, false);
3923 }
3924 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_WriteableEcdsaChannelSigner_1write(JNIEnv *env, jclass clz, int64_t this_arg) {
3925         void* this_arg_ptr = untag_ptr(this_arg);
3926         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
3927         LDKWriteableEcdsaChannelSigner* this_arg_conv = (LDKWriteableEcdsaChannelSigner*)this_arg_ptr;
3928         LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
3929         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
3930         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
3931         CVec_u8Z_free(ret_var);
3932         return ret_arr;
3933 }
3934
3935 static inline struct LDKWriteableEcdsaChannelSigner CResult_WriteableEcdsaChannelSignerDecodeErrorZ_get_ok(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ *NONNULL_PTR owner){
3936 CHECK(owner->result_ok);
3937         return WriteableEcdsaChannelSigner_clone(&*owner->contents.result);
3938 }
3939 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1WriteableEcdsaChannelSignerDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
3940         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* owner_conv = (LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ*)untag_ptr(owner);
3941         LDKWriteableEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner");
3942         *ret_ret = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_get_ok(owner_conv);
3943         return tag_ptr(ret_ret, true);
3944 }
3945
3946 static inline struct LDKDecodeError CResult_WriteableEcdsaChannelSignerDecodeErrorZ_get_err(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ *NONNULL_PTR owner){
3947 CHECK(!owner->result_ok);
3948         return DecodeError_clone(&*owner->contents.err);
3949 }
3950 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1WriteableEcdsaChannelSignerDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
3951         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* owner_conv = (LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ*)untag_ptr(owner);
3952         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
3953         *ret_copy = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_get_err(owner_conv);
3954         int64_t ret_ref = tag_ptr(ret_copy, true);
3955         return ret_ref;
3956 }
3957
3958 static inline struct LDKCVec_u8Z CResult_CVec_u8ZNoneZ_get_ok(LDKCResult_CVec_u8ZNoneZ *NONNULL_PTR owner){
3959 CHECK(owner->result_ok);
3960         return CVec_u8Z_clone(&*owner->contents.result);
3961 }
3962 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
3963         LDKCResult_CVec_u8ZNoneZ* owner_conv = (LDKCResult_CVec_u8ZNoneZ*)untag_ptr(owner);
3964         LDKCVec_u8Z ret_var = CResult_CVec_u8ZNoneZ_get_ok(owner_conv);
3965         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
3966         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
3967         CVec_u8Z_free(ret_var);
3968         return ret_arr;
3969 }
3970
3971 static inline void CResult_CVec_u8ZNoneZ_get_err(LDKCResult_CVec_u8ZNoneZ *NONNULL_PTR owner){
3972 CHECK(!owner->result_ok);
3973         return *owner->contents.err;
3974 }
3975 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
3976         LDKCResult_CVec_u8ZNoneZ* owner_conv = (LDKCResult_CVec_u8ZNoneZ*)untag_ptr(owner);
3977         CResult_CVec_u8ZNoneZ_get_err(owner_conv);
3978 }
3979
3980 static inline struct LDKShutdownScript CResult_ShutdownScriptNoneZ_get_ok(LDKCResult_ShutdownScriptNoneZ *NONNULL_PTR owner){
3981         LDKShutdownScript ret = *owner->contents.result;
3982         ret.is_owned = false;
3983         return ret;
3984 }
3985 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
3986         LDKCResult_ShutdownScriptNoneZ* owner_conv = (LDKCResult_ShutdownScriptNoneZ*)untag_ptr(owner);
3987         LDKShutdownScript ret_var = CResult_ShutdownScriptNoneZ_get_ok(owner_conv);
3988         int64_t ret_ref = 0;
3989         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
3990         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
3991         return ret_ref;
3992 }
3993
3994 static inline void CResult_ShutdownScriptNoneZ_get_err(LDKCResult_ShutdownScriptNoneZ *NONNULL_PTR owner){
3995 CHECK(!owner->result_ok);
3996         return *owner->contents.err;
3997 }
3998 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
3999         LDKCResult_ShutdownScriptNoneZ* owner_conv = (LDKCResult_ShutdownScriptNoneZ*)untag_ptr(owner);
4000         CResult_ShutdownScriptNoneZ_get_err(owner_conv);
4001 }
4002
4003 static jclass LDKCOption_u16Z_Some_class = NULL;
4004 static jmethodID LDKCOption_u16Z_Some_meth = NULL;
4005 static jclass LDKCOption_u16Z_None_class = NULL;
4006 static jmethodID LDKCOption_u16Z_None_meth = NULL;
4007 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1u16Z_init (JNIEnv *env, jclass clz) {
4008         LDKCOption_u16Z_Some_class =
4009                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_u16Z$Some"));
4010         CHECK(LDKCOption_u16Z_Some_class != NULL);
4011         LDKCOption_u16Z_Some_meth = (*env)->GetMethodID(env, LDKCOption_u16Z_Some_class, "<init>", "(S)V");
4012         CHECK(LDKCOption_u16Z_Some_meth != NULL);
4013         LDKCOption_u16Z_None_class =
4014                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_u16Z$None"));
4015         CHECK(LDKCOption_u16Z_None_class != NULL);
4016         LDKCOption_u16Z_None_meth = (*env)->GetMethodID(env, LDKCOption_u16Z_None_class, "<init>", "()V");
4017         CHECK(LDKCOption_u16Z_None_meth != NULL);
4018 }
4019 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1u16Z_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
4020         LDKCOption_u16Z *obj = (LDKCOption_u16Z*)untag_ptr(ptr);
4021         switch(obj->tag) {
4022                 case LDKCOption_u16Z_Some: {
4023                         int16_t some_conv = obj->some;
4024                         return (*env)->NewObject(env, LDKCOption_u16Z_Some_class, LDKCOption_u16Z_Some_meth, some_conv);
4025                 }
4026                 case LDKCOption_u16Z_None: {
4027                         return (*env)->NewObject(env, LDKCOption_u16Z_None_class, LDKCOption_u16Z_None_meth);
4028                 }
4029                 default: abort();
4030         }
4031 }
4032 static jclass LDKCOption_boolZ_Some_class = NULL;
4033 static jmethodID LDKCOption_boolZ_Some_meth = NULL;
4034 static jclass LDKCOption_boolZ_None_class = NULL;
4035 static jmethodID LDKCOption_boolZ_None_meth = NULL;
4036 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1boolZ_init (JNIEnv *env, jclass clz) {
4037         LDKCOption_boolZ_Some_class =
4038                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_boolZ$Some"));
4039         CHECK(LDKCOption_boolZ_Some_class != NULL);
4040         LDKCOption_boolZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_boolZ_Some_class, "<init>", "(Z)V");
4041         CHECK(LDKCOption_boolZ_Some_meth != NULL);
4042         LDKCOption_boolZ_None_class =
4043                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_boolZ$None"));
4044         CHECK(LDKCOption_boolZ_None_class != NULL);
4045         LDKCOption_boolZ_None_meth = (*env)->GetMethodID(env, LDKCOption_boolZ_None_class, "<init>", "()V");
4046         CHECK(LDKCOption_boolZ_None_meth != NULL);
4047 }
4048 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1boolZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
4049         LDKCOption_boolZ *obj = (LDKCOption_boolZ*)untag_ptr(ptr);
4050         switch(obj->tag) {
4051                 case LDKCOption_boolZ_Some: {
4052                         jboolean some_conv = obj->some;
4053                         return (*env)->NewObject(env, LDKCOption_boolZ_Some_class, LDKCOption_boolZ_Some_meth, some_conv);
4054                 }
4055                 case LDKCOption_boolZ_None: {
4056                         return (*env)->NewObject(env, LDKCOption_boolZ_None_class, LDKCOption_boolZ_None_meth);
4057                 }
4058                 default: abort();
4059         }
4060 }
4061 static inline struct LDKWitness CResult_WitnessNoneZ_get_ok(LDKCResult_WitnessNoneZ *NONNULL_PTR owner){
4062 CHECK(owner->result_ok);
4063         return Witness_clone(&*owner->contents.result);
4064 }
4065 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1WitnessNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4066         LDKCResult_WitnessNoneZ* owner_conv = (LDKCResult_WitnessNoneZ*)untag_ptr(owner);
4067         LDKWitness ret_var = CResult_WitnessNoneZ_get_ok(owner_conv);
4068         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
4069         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
4070         Witness_free(ret_var);
4071         return ret_arr;
4072 }
4073
4074 static inline void CResult_WitnessNoneZ_get_err(LDKCResult_WitnessNoneZ *NONNULL_PTR owner){
4075 CHECK(!owner->result_ok);
4076         return *owner->contents.err;
4077 }
4078 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1WitnessNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4079         LDKCResult_WitnessNoneZ* owner_conv = (LDKCResult_WitnessNoneZ*)untag_ptr(owner);
4080         CResult_WitnessNoneZ_get_err(owner_conv);
4081 }
4082
4083 static inline struct LDKInMemorySigner CResult_InMemorySignerDecodeErrorZ_get_ok(LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR owner){
4084         LDKInMemorySigner ret = *owner->contents.result;
4085         ret.is_owned = false;
4086         return ret;
4087 }
4088 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4089         LDKCResult_InMemorySignerDecodeErrorZ* owner_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)untag_ptr(owner);
4090         LDKInMemorySigner ret_var = CResult_InMemorySignerDecodeErrorZ_get_ok(owner_conv);
4091         int64_t ret_ref = 0;
4092         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4093         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4094         return ret_ref;
4095 }
4096
4097 static inline struct LDKDecodeError CResult_InMemorySignerDecodeErrorZ_get_err(LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR owner){
4098 CHECK(!owner->result_ok);
4099         return DecodeError_clone(&*owner->contents.err);
4100 }
4101 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4102         LDKCResult_InMemorySignerDecodeErrorZ* owner_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)untag_ptr(owner);
4103         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
4104         *ret_copy = CResult_InMemorySignerDecodeErrorZ_get_err(owner_conv);
4105         int64_t ret_ref = tag_ptr(ret_copy, true);
4106         return ret_ref;
4107 }
4108
4109 static jclass LDKCandidateRouteHop_FirstHop_class = NULL;
4110 static jmethodID LDKCandidateRouteHop_FirstHop_meth = NULL;
4111 static jclass LDKCandidateRouteHop_PublicHop_class = NULL;
4112 static jmethodID LDKCandidateRouteHop_PublicHop_meth = NULL;
4113 static jclass LDKCandidateRouteHop_PrivateHop_class = NULL;
4114 static jmethodID LDKCandidateRouteHop_PrivateHop_meth = NULL;
4115 static jclass LDKCandidateRouteHop_Blinded_class = NULL;
4116 static jmethodID LDKCandidateRouteHop_Blinded_meth = NULL;
4117 static jclass LDKCandidateRouteHop_OneHopBlinded_class = NULL;
4118 static jmethodID LDKCandidateRouteHop_OneHopBlinded_meth = NULL;
4119 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCandidateRouteHop_init (JNIEnv *env, jclass clz) {
4120         LDKCandidateRouteHop_FirstHop_class =
4121                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCandidateRouteHop$FirstHop"));
4122         CHECK(LDKCandidateRouteHop_FirstHop_class != NULL);
4123         LDKCandidateRouteHop_FirstHop_meth = (*env)->GetMethodID(env, LDKCandidateRouteHop_FirstHop_class, "<init>", "(J)V");
4124         CHECK(LDKCandidateRouteHop_FirstHop_meth != NULL);
4125         LDKCandidateRouteHop_PublicHop_class =
4126                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCandidateRouteHop$PublicHop"));
4127         CHECK(LDKCandidateRouteHop_PublicHop_class != NULL);
4128         LDKCandidateRouteHop_PublicHop_meth = (*env)->GetMethodID(env, LDKCandidateRouteHop_PublicHop_class, "<init>", "(J)V");
4129         CHECK(LDKCandidateRouteHop_PublicHop_meth != NULL);
4130         LDKCandidateRouteHop_PrivateHop_class =
4131                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCandidateRouteHop$PrivateHop"));
4132         CHECK(LDKCandidateRouteHop_PrivateHop_class != NULL);
4133         LDKCandidateRouteHop_PrivateHop_meth = (*env)->GetMethodID(env, LDKCandidateRouteHop_PrivateHop_class, "<init>", "(J)V");
4134         CHECK(LDKCandidateRouteHop_PrivateHop_meth != NULL);
4135         LDKCandidateRouteHop_Blinded_class =
4136                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCandidateRouteHop$Blinded"));
4137         CHECK(LDKCandidateRouteHop_Blinded_class != NULL);
4138         LDKCandidateRouteHop_Blinded_meth = (*env)->GetMethodID(env, LDKCandidateRouteHop_Blinded_class, "<init>", "(J)V");
4139         CHECK(LDKCandidateRouteHop_Blinded_meth != NULL);
4140         LDKCandidateRouteHop_OneHopBlinded_class =
4141                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCandidateRouteHop$OneHopBlinded"));
4142         CHECK(LDKCandidateRouteHop_OneHopBlinded_class != NULL);
4143         LDKCandidateRouteHop_OneHopBlinded_meth = (*env)->GetMethodID(env, LDKCandidateRouteHop_OneHopBlinded_class, "<init>", "(J)V");
4144         CHECK(LDKCandidateRouteHop_OneHopBlinded_meth != NULL);
4145 }
4146 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCandidateRouteHop_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
4147         LDKCandidateRouteHop *obj = (LDKCandidateRouteHop*)untag_ptr(ptr);
4148         switch(obj->tag) {
4149                 case LDKCandidateRouteHop_FirstHop: {
4150                         LDKFirstHopCandidate first_hop_var = obj->first_hop;
4151                         int64_t first_hop_ref = 0;
4152                         CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hop_var);
4153                         first_hop_ref = tag_ptr(first_hop_var.inner, false);
4154                         return (*env)->NewObject(env, LDKCandidateRouteHop_FirstHop_class, LDKCandidateRouteHop_FirstHop_meth, first_hop_ref);
4155                 }
4156                 case LDKCandidateRouteHop_PublicHop: {
4157                         LDKPublicHopCandidate public_hop_var = obj->public_hop;
4158                         int64_t public_hop_ref = 0;
4159                         CHECK_INNER_FIELD_ACCESS_OR_NULL(public_hop_var);
4160                         public_hop_ref = tag_ptr(public_hop_var.inner, false);
4161                         return (*env)->NewObject(env, LDKCandidateRouteHop_PublicHop_class, LDKCandidateRouteHop_PublicHop_meth, public_hop_ref);
4162                 }
4163                 case LDKCandidateRouteHop_PrivateHop: {
4164                         LDKPrivateHopCandidate private_hop_var = obj->private_hop;
4165                         int64_t private_hop_ref = 0;
4166                         CHECK_INNER_FIELD_ACCESS_OR_NULL(private_hop_var);
4167                         private_hop_ref = tag_ptr(private_hop_var.inner, false);
4168                         return (*env)->NewObject(env, LDKCandidateRouteHop_PrivateHop_class, LDKCandidateRouteHop_PrivateHop_meth, private_hop_ref);
4169                 }
4170                 case LDKCandidateRouteHop_Blinded: {
4171                         LDKBlindedPathCandidate blinded_var = obj->blinded;
4172                         int64_t blinded_ref = 0;
4173                         CHECK_INNER_FIELD_ACCESS_OR_NULL(blinded_var);
4174                         blinded_ref = tag_ptr(blinded_var.inner, false);
4175                         return (*env)->NewObject(env, LDKCandidateRouteHop_Blinded_class, LDKCandidateRouteHop_Blinded_meth, blinded_ref);
4176                 }
4177                 case LDKCandidateRouteHop_OneHopBlinded: {
4178                         LDKOneHopBlindedPathCandidate one_hop_blinded_var = obj->one_hop_blinded;
4179                         int64_t one_hop_blinded_ref = 0;
4180                         CHECK_INNER_FIELD_ACCESS_OR_NULL(one_hop_blinded_var);
4181                         one_hop_blinded_ref = tag_ptr(one_hop_blinded_var.inner, false);
4182                         return (*env)->NewObject(env, LDKCandidateRouteHop_OneHopBlinded_class, LDKCandidateRouteHop_OneHopBlinded_meth, one_hop_blinded_ref);
4183                 }
4184                 default: abort();
4185         }
4186 }
4187 typedef struct LDKScoreLookUp_JCalls {
4188         atomic_size_t refcnt;
4189         JavaVM *vm;
4190         jweak o;
4191         jmethodID channel_penalty_msat_meth;
4192 } LDKScoreLookUp_JCalls;
4193 static void LDKScoreLookUp_JCalls_free(void* this_arg) {
4194         LDKScoreLookUp_JCalls *j_calls = (LDKScoreLookUp_JCalls*) this_arg;
4195         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
4196                 JNIEnv *env;
4197                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4198                 if (get_jenv_res == JNI_EDETACHED) {
4199                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4200                 } else {
4201                         DO_ASSERT(get_jenv_res == JNI_OK);
4202                 }
4203                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
4204                 if (get_jenv_res == JNI_EDETACHED) {
4205                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4206                 }
4207                 FREE(j_calls);
4208         }
4209 }
4210 uint64_t channel_penalty_msat_LDKScoreLookUp_jcall(const void* this_arg, const LDKCandidateRouteHop * candidate, LDKChannelUsage usage, const LDKProbabilisticScoringFeeParameters * score_params) {
4211         LDKScoreLookUp_JCalls *j_calls = (LDKScoreLookUp_JCalls*) this_arg;
4212         JNIEnv *env;
4213         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4214         if (get_jenv_res == JNI_EDETACHED) {
4215                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4216         } else {
4217                 DO_ASSERT(get_jenv_res == JNI_OK);
4218         }
4219         LDKCandidateRouteHop *ret_candidate = MALLOC(sizeof(LDKCandidateRouteHop), "LDKCandidateRouteHop ret conversion");
4220         *ret_candidate = CandidateRouteHop_clone(candidate);
4221         int64_t ref_candidate = tag_ptr(ret_candidate, true);
4222         LDKChannelUsage usage_var = usage;
4223         int64_t usage_ref = 0;
4224         CHECK_INNER_FIELD_ACCESS_OR_NULL(usage_var);
4225         usage_ref = tag_ptr(usage_var.inner, usage_var.is_owned);
4226         LDKProbabilisticScoringFeeParameters score_params_var = *score_params;
4227         int64_t score_params_ref = 0;
4228         score_params_var = ProbabilisticScoringFeeParameters_clone(&score_params_var);
4229         CHECK_INNER_FIELD_ACCESS_OR_NULL(score_params_var);
4230         score_params_ref = tag_ptr(score_params_var.inner, score_params_var.is_owned);
4231         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4232         CHECK(obj != NULL);
4233         int64_t ret = (*env)->CallLongMethod(env, obj, j_calls->channel_penalty_msat_meth, ref_candidate, usage_ref, score_params_ref);
4234         if (UNLIKELY((*env)->ExceptionCheck(env))) {
4235                 (*env)->ExceptionDescribe(env);
4236                 (*env)->FatalError(env, "A call to channel_penalty_msat in LDKScoreLookUp from rust threw an exception.");
4237         }
4238         if (get_jenv_res == JNI_EDETACHED) {
4239                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4240         }
4241         return ret;
4242 }
4243 static void LDKScoreLookUp_JCalls_cloned(LDKScoreLookUp* new_obj) {
4244         LDKScoreLookUp_JCalls *j_calls = (LDKScoreLookUp_JCalls*) new_obj->this_arg;
4245         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
4246 }
4247 static inline LDKScoreLookUp LDKScoreLookUp_init (JNIEnv *env, jclass clz, jobject o) {
4248         jclass c = (*env)->GetObjectClass(env, o);
4249         CHECK(c != NULL);
4250         LDKScoreLookUp_JCalls *calls = MALLOC(sizeof(LDKScoreLookUp_JCalls), "LDKScoreLookUp_JCalls");
4251         atomic_init(&calls->refcnt, 1);
4252         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
4253         calls->o = (*env)->NewWeakGlobalRef(env, o);
4254         calls->channel_penalty_msat_meth = (*env)->GetMethodID(env, c, "channel_penalty_msat", "(JJJ)J");
4255         CHECK(calls->channel_penalty_msat_meth != NULL);
4256
4257         LDKScoreLookUp ret = {
4258                 .this_arg = (void*) calls,
4259                 .channel_penalty_msat = channel_penalty_msat_LDKScoreLookUp_jcall,
4260                 .free = LDKScoreLookUp_JCalls_free,
4261         };
4262         return ret;
4263 }
4264 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKScoreLookUp_1new(JNIEnv *env, jclass clz, jobject o) {
4265         LDKScoreLookUp *res_ptr = MALLOC(sizeof(LDKScoreLookUp), "LDKScoreLookUp");
4266         *res_ptr = LDKScoreLookUp_init(env, clz, o);
4267         return tag_ptr(res_ptr, true);
4268 }
4269 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) {
4270         void* this_arg_ptr = untag_ptr(this_arg);
4271         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4272         LDKScoreLookUp* this_arg_conv = (LDKScoreLookUp*)this_arg_ptr;
4273         LDKCandidateRouteHop* candidate_conv = (LDKCandidateRouteHop*)untag_ptr(candidate);
4274         LDKChannelUsage usage_conv;
4275         usage_conv.inner = untag_ptr(usage);
4276         usage_conv.is_owned = ptr_is_owned(usage);
4277         CHECK_INNER_FIELD_ACCESS_OR_NULL(usage_conv);
4278         usage_conv = ChannelUsage_clone(&usage_conv);
4279         LDKProbabilisticScoringFeeParameters score_params_conv;
4280         score_params_conv.inner = untag_ptr(score_params);
4281         score_params_conv.is_owned = ptr_is_owned(score_params);
4282         CHECK_INNER_FIELD_ACCESS_OR_NULL(score_params_conv);
4283         score_params_conv.is_owned = false;
4284         int64_t ret_conv = (this_arg_conv->channel_penalty_msat)(this_arg_conv->this_arg, candidate_conv, usage_conv, &score_params_conv);
4285         return ret_conv;
4286 }
4287
4288 typedef struct LDKScoreUpdate_JCalls {
4289         atomic_size_t refcnt;
4290         JavaVM *vm;
4291         jweak o;
4292         jmethodID payment_path_failed_meth;
4293         jmethodID payment_path_successful_meth;
4294         jmethodID probe_failed_meth;
4295         jmethodID probe_successful_meth;
4296         jmethodID time_passed_meth;
4297 } LDKScoreUpdate_JCalls;
4298 static void LDKScoreUpdate_JCalls_free(void* this_arg) {
4299         LDKScoreUpdate_JCalls *j_calls = (LDKScoreUpdate_JCalls*) this_arg;
4300         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
4301                 JNIEnv *env;
4302                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4303                 if (get_jenv_res == JNI_EDETACHED) {
4304                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4305                 } else {
4306                         DO_ASSERT(get_jenv_res == JNI_OK);
4307                 }
4308                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
4309                 if (get_jenv_res == JNI_EDETACHED) {
4310                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4311                 }
4312                 FREE(j_calls);
4313         }
4314 }
4315 void payment_path_failed_LDKScoreUpdate_jcall(void* this_arg, const LDKPath * path, uint64_t short_channel_id, uint64_t duration_since_epoch) {
4316         LDKScoreUpdate_JCalls *j_calls = (LDKScoreUpdate_JCalls*) this_arg;
4317         JNIEnv *env;
4318         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4319         if (get_jenv_res == JNI_EDETACHED) {
4320                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4321         } else {
4322                 DO_ASSERT(get_jenv_res == JNI_OK);
4323         }
4324         LDKPath path_var = *path;
4325         int64_t path_ref = 0;
4326         path_var = Path_clone(&path_var);
4327         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_var);
4328         path_ref = tag_ptr(path_var.inner, path_var.is_owned);
4329         int64_t short_channel_id_conv = short_channel_id;
4330         int64_t duration_since_epoch_conv = duration_since_epoch;
4331         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4332         CHECK(obj != NULL);
4333         (*env)->CallVoidMethod(env, obj, j_calls->payment_path_failed_meth, path_ref, short_channel_id_conv, duration_since_epoch_conv);
4334         if (UNLIKELY((*env)->ExceptionCheck(env))) {
4335                 (*env)->ExceptionDescribe(env);
4336                 (*env)->FatalError(env, "A call to payment_path_failed in LDKScoreUpdate from rust threw an exception.");
4337         }
4338         if (get_jenv_res == JNI_EDETACHED) {
4339                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4340         }
4341 }
4342 void payment_path_successful_LDKScoreUpdate_jcall(void* this_arg, const LDKPath * path, uint64_t duration_since_epoch) {
4343         LDKScoreUpdate_JCalls *j_calls = (LDKScoreUpdate_JCalls*) this_arg;
4344         JNIEnv *env;
4345         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4346         if (get_jenv_res == JNI_EDETACHED) {
4347                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4348         } else {
4349                 DO_ASSERT(get_jenv_res == JNI_OK);
4350         }
4351         LDKPath path_var = *path;
4352         int64_t path_ref = 0;
4353         path_var = Path_clone(&path_var);
4354         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_var);
4355         path_ref = tag_ptr(path_var.inner, path_var.is_owned);
4356         int64_t duration_since_epoch_conv = duration_since_epoch;
4357         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4358         CHECK(obj != NULL);
4359         (*env)->CallVoidMethod(env, obj, j_calls->payment_path_successful_meth, path_ref, duration_since_epoch_conv);
4360         if (UNLIKELY((*env)->ExceptionCheck(env))) {
4361                 (*env)->ExceptionDescribe(env);
4362                 (*env)->FatalError(env, "A call to payment_path_successful in LDKScoreUpdate from rust threw an exception.");
4363         }
4364         if (get_jenv_res == JNI_EDETACHED) {
4365                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4366         }
4367 }
4368 void probe_failed_LDKScoreUpdate_jcall(void* this_arg, const LDKPath * path, uint64_t short_channel_id, uint64_t duration_since_epoch) {
4369         LDKScoreUpdate_JCalls *j_calls = (LDKScoreUpdate_JCalls*) this_arg;
4370         JNIEnv *env;
4371         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4372         if (get_jenv_res == JNI_EDETACHED) {
4373                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4374         } else {
4375                 DO_ASSERT(get_jenv_res == JNI_OK);
4376         }
4377         LDKPath path_var = *path;
4378         int64_t path_ref = 0;
4379         path_var = Path_clone(&path_var);
4380         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_var);
4381         path_ref = tag_ptr(path_var.inner, path_var.is_owned);
4382         int64_t short_channel_id_conv = short_channel_id;
4383         int64_t duration_since_epoch_conv = duration_since_epoch;
4384         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4385         CHECK(obj != NULL);
4386         (*env)->CallVoidMethod(env, obj, j_calls->probe_failed_meth, path_ref, short_channel_id_conv, duration_since_epoch_conv);
4387         if (UNLIKELY((*env)->ExceptionCheck(env))) {
4388                 (*env)->ExceptionDescribe(env);
4389                 (*env)->FatalError(env, "A call to probe_failed in LDKScoreUpdate from rust threw an exception.");
4390         }
4391         if (get_jenv_res == JNI_EDETACHED) {
4392                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4393         }
4394 }
4395 void probe_successful_LDKScoreUpdate_jcall(void* this_arg, const LDKPath * path, uint64_t duration_since_epoch) {
4396         LDKScoreUpdate_JCalls *j_calls = (LDKScoreUpdate_JCalls*) this_arg;
4397         JNIEnv *env;
4398         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4399         if (get_jenv_res == JNI_EDETACHED) {
4400                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4401         } else {
4402                 DO_ASSERT(get_jenv_res == JNI_OK);
4403         }
4404         LDKPath path_var = *path;
4405         int64_t path_ref = 0;
4406         path_var = Path_clone(&path_var);
4407         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_var);
4408         path_ref = tag_ptr(path_var.inner, path_var.is_owned);
4409         int64_t duration_since_epoch_conv = duration_since_epoch;
4410         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4411         CHECK(obj != NULL);
4412         (*env)->CallVoidMethod(env, obj, j_calls->probe_successful_meth, path_ref, duration_since_epoch_conv);
4413         if (UNLIKELY((*env)->ExceptionCheck(env))) {
4414                 (*env)->ExceptionDescribe(env);
4415                 (*env)->FatalError(env, "A call to probe_successful in LDKScoreUpdate from rust threw an exception.");
4416         }
4417         if (get_jenv_res == JNI_EDETACHED) {
4418                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4419         }
4420 }
4421 void time_passed_LDKScoreUpdate_jcall(void* this_arg, uint64_t duration_since_epoch) {
4422         LDKScoreUpdate_JCalls *j_calls = (LDKScoreUpdate_JCalls*) this_arg;
4423         JNIEnv *env;
4424         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4425         if (get_jenv_res == JNI_EDETACHED) {
4426                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4427         } else {
4428                 DO_ASSERT(get_jenv_res == JNI_OK);
4429         }
4430         int64_t duration_since_epoch_conv = duration_since_epoch;
4431         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4432         CHECK(obj != NULL);
4433         (*env)->CallVoidMethod(env, obj, j_calls->time_passed_meth, duration_since_epoch_conv);
4434         if (UNLIKELY((*env)->ExceptionCheck(env))) {
4435                 (*env)->ExceptionDescribe(env);
4436                 (*env)->FatalError(env, "A call to time_passed in LDKScoreUpdate from rust threw an exception.");
4437         }
4438         if (get_jenv_res == JNI_EDETACHED) {
4439                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4440         }
4441 }
4442 static void LDKScoreUpdate_JCalls_cloned(LDKScoreUpdate* new_obj) {
4443         LDKScoreUpdate_JCalls *j_calls = (LDKScoreUpdate_JCalls*) new_obj->this_arg;
4444         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
4445 }
4446 static inline LDKScoreUpdate LDKScoreUpdate_init (JNIEnv *env, jclass clz, jobject o) {
4447         jclass c = (*env)->GetObjectClass(env, o);
4448         CHECK(c != NULL);
4449         LDKScoreUpdate_JCalls *calls = MALLOC(sizeof(LDKScoreUpdate_JCalls), "LDKScoreUpdate_JCalls");
4450         atomic_init(&calls->refcnt, 1);
4451         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
4452         calls->o = (*env)->NewWeakGlobalRef(env, o);
4453         calls->payment_path_failed_meth = (*env)->GetMethodID(env, c, "payment_path_failed", "(JJJ)V");
4454         CHECK(calls->payment_path_failed_meth != NULL);
4455         calls->payment_path_successful_meth = (*env)->GetMethodID(env, c, "payment_path_successful", "(JJ)V");
4456         CHECK(calls->payment_path_successful_meth != NULL);
4457         calls->probe_failed_meth = (*env)->GetMethodID(env, c, "probe_failed", "(JJJ)V");
4458         CHECK(calls->probe_failed_meth != NULL);
4459         calls->probe_successful_meth = (*env)->GetMethodID(env, c, "probe_successful", "(JJ)V");
4460         CHECK(calls->probe_successful_meth != NULL);
4461         calls->time_passed_meth = (*env)->GetMethodID(env, c, "time_passed", "(J)V");
4462         CHECK(calls->time_passed_meth != NULL);
4463
4464         LDKScoreUpdate ret = {
4465                 .this_arg = (void*) calls,
4466                 .payment_path_failed = payment_path_failed_LDKScoreUpdate_jcall,
4467                 .payment_path_successful = payment_path_successful_LDKScoreUpdate_jcall,
4468                 .probe_failed = probe_failed_LDKScoreUpdate_jcall,
4469                 .probe_successful = probe_successful_LDKScoreUpdate_jcall,
4470                 .time_passed = time_passed_LDKScoreUpdate_jcall,
4471                 .free = LDKScoreUpdate_JCalls_free,
4472         };
4473         return ret;
4474 }
4475 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKScoreUpdate_1new(JNIEnv *env, jclass clz, jobject o) {
4476         LDKScoreUpdate *res_ptr = MALLOC(sizeof(LDKScoreUpdate), "LDKScoreUpdate");
4477         *res_ptr = LDKScoreUpdate_init(env, clz, o);
4478         return tag_ptr(res_ptr, true);
4479 }
4480 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) {
4481         void* this_arg_ptr = untag_ptr(this_arg);
4482         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4483         LDKScoreUpdate* this_arg_conv = (LDKScoreUpdate*)this_arg_ptr;
4484         LDKPath path_conv;
4485         path_conv.inner = untag_ptr(path);
4486         path_conv.is_owned = ptr_is_owned(path);
4487         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
4488         path_conv.is_owned = false;
4489         (this_arg_conv->payment_path_failed)(this_arg_conv->this_arg, &path_conv, short_channel_id, duration_since_epoch);
4490 }
4491
4492 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) {
4493         void* this_arg_ptr = untag_ptr(this_arg);
4494         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4495         LDKScoreUpdate* this_arg_conv = (LDKScoreUpdate*)this_arg_ptr;
4496         LDKPath path_conv;
4497         path_conv.inner = untag_ptr(path);
4498         path_conv.is_owned = ptr_is_owned(path);
4499         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
4500         path_conv.is_owned = false;
4501         (this_arg_conv->payment_path_successful)(this_arg_conv->this_arg, &path_conv, duration_since_epoch);
4502 }
4503
4504 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) {
4505         void* this_arg_ptr = untag_ptr(this_arg);
4506         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4507         LDKScoreUpdate* this_arg_conv = (LDKScoreUpdate*)this_arg_ptr;
4508         LDKPath path_conv;
4509         path_conv.inner = untag_ptr(path);
4510         path_conv.is_owned = ptr_is_owned(path);
4511         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
4512         path_conv.is_owned = false;
4513         (this_arg_conv->probe_failed)(this_arg_conv->this_arg, &path_conv, short_channel_id, duration_since_epoch);
4514 }
4515
4516 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) {
4517         void* this_arg_ptr = untag_ptr(this_arg);
4518         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4519         LDKScoreUpdate* this_arg_conv = (LDKScoreUpdate*)this_arg_ptr;
4520         LDKPath path_conv;
4521         path_conv.inner = untag_ptr(path);
4522         path_conv.is_owned = ptr_is_owned(path);
4523         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
4524         path_conv.is_owned = false;
4525         (this_arg_conv->probe_successful)(this_arg_conv->this_arg, &path_conv, duration_since_epoch);
4526 }
4527
4528 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ScoreUpdate_1time_1passed(JNIEnv *env, jclass clz, int64_t this_arg, int64_t duration_since_epoch) {
4529         void* this_arg_ptr = untag_ptr(this_arg);
4530         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4531         LDKScoreUpdate* this_arg_conv = (LDKScoreUpdate*)this_arg_ptr;
4532         (this_arg_conv->time_passed)(this_arg_conv->this_arg, duration_since_epoch);
4533 }
4534
4535 typedef struct LDKLockableScore_JCalls {
4536         atomic_size_t refcnt;
4537         JavaVM *vm;
4538         jweak o;
4539         jmethodID read_lock_meth;
4540         jmethodID write_lock_meth;
4541 } LDKLockableScore_JCalls;
4542 static void LDKLockableScore_JCalls_free(void* this_arg) {
4543         LDKLockableScore_JCalls *j_calls = (LDKLockableScore_JCalls*) this_arg;
4544         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
4545                 JNIEnv *env;
4546                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4547                 if (get_jenv_res == JNI_EDETACHED) {
4548                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4549                 } else {
4550                         DO_ASSERT(get_jenv_res == JNI_OK);
4551                 }
4552                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
4553                 if (get_jenv_res == JNI_EDETACHED) {
4554                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4555                 }
4556                 FREE(j_calls);
4557         }
4558 }
4559 LDKScoreLookUp read_lock_LDKLockableScore_jcall(const void* this_arg) {
4560         LDKLockableScore_JCalls *j_calls = (LDKLockableScore_JCalls*) this_arg;
4561         JNIEnv *env;
4562         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4563         if (get_jenv_res == JNI_EDETACHED) {
4564                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4565         } else {
4566                 DO_ASSERT(get_jenv_res == JNI_OK);
4567         }
4568         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4569         CHECK(obj != NULL);
4570         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->read_lock_meth);
4571         if (UNLIKELY((*env)->ExceptionCheck(env))) {
4572                 (*env)->ExceptionDescribe(env);
4573                 (*env)->FatalError(env, "A call to read_lock in LDKLockableScore from rust threw an exception.");
4574         }
4575         void* ret_ptr = untag_ptr(ret);
4576         CHECK_ACCESS(ret_ptr);
4577         LDKScoreLookUp ret_conv = *(LDKScoreLookUp*)(ret_ptr);
4578         if (ret_conv.free == LDKScoreLookUp_JCalls_free) {
4579                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
4580                 LDKScoreLookUp_JCalls_cloned(&ret_conv);
4581         }// WARNING: we may need a move here but no clone is available for LDKScoreLookUp
4582         
4583         if (get_jenv_res == JNI_EDETACHED) {
4584                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4585         }
4586         return ret_conv;
4587 }
4588 LDKScoreUpdate write_lock_LDKLockableScore_jcall(const void* this_arg) {
4589         LDKLockableScore_JCalls *j_calls = (LDKLockableScore_JCalls*) this_arg;
4590         JNIEnv *env;
4591         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4592         if (get_jenv_res == JNI_EDETACHED) {
4593                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4594         } else {
4595                 DO_ASSERT(get_jenv_res == JNI_OK);
4596         }
4597         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4598         CHECK(obj != NULL);
4599         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->write_lock_meth);
4600         if (UNLIKELY((*env)->ExceptionCheck(env))) {
4601                 (*env)->ExceptionDescribe(env);
4602                 (*env)->FatalError(env, "A call to write_lock in LDKLockableScore from rust threw an exception.");
4603         }
4604         void* ret_ptr = untag_ptr(ret);
4605         CHECK_ACCESS(ret_ptr);
4606         LDKScoreUpdate ret_conv = *(LDKScoreUpdate*)(ret_ptr);
4607         if (ret_conv.free == LDKScoreUpdate_JCalls_free) {
4608                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
4609                 LDKScoreUpdate_JCalls_cloned(&ret_conv);
4610         }// WARNING: we may need a move here but no clone is available for LDKScoreUpdate
4611         
4612         if (get_jenv_res == JNI_EDETACHED) {
4613                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4614         }
4615         return ret_conv;
4616 }
4617 static void LDKLockableScore_JCalls_cloned(LDKLockableScore* new_obj) {
4618         LDKLockableScore_JCalls *j_calls = (LDKLockableScore_JCalls*) new_obj->this_arg;
4619         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
4620 }
4621 static inline LDKLockableScore LDKLockableScore_init (JNIEnv *env, jclass clz, jobject o) {
4622         jclass c = (*env)->GetObjectClass(env, o);
4623         CHECK(c != NULL);
4624         LDKLockableScore_JCalls *calls = MALLOC(sizeof(LDKLockableScore_JCalls), "LDKLockableScore_JCalls");
4625         atomic_init(&calls->refcnt, 1);
4626         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
4627         calls->o = (*env)->NewWeakGlobalRef(env, o);
4628         calls->read_lock_meth = (*env)->GetMethodID(env, c, "read_lock", "()J");
4629         CHECK(calls->read_lock_meth != NULL);
4630         calls->write_lock_meth = (*env)->GetMethodID(env, c, "write_lock", "()J");
4631         CHECK(calls->write_lock_meth != NULL);
4632
4633         LDKLockableScore ret = {
4634                 .this_arg = (void*) calls,
4635                 .read_lock = read_lock_LDKLockableScore_jcall,
4636                 .write_lock = write_lock_LDKLockableScore_jcall,
4637                 .free = LDKLockableScore_JCalls_free,
4638         };
4639         return ret;
4640 }
4641 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKLockableScore_1new(JNIEnv *env, jclass clz, jobject o) {
4642         LDKLockableScore *res_ptr = MALLOC(sizeof(LDKLockableScore), "LDKLockableScore");
4643         *res_ptr = LDKLockableScore_init(env, clz, o);
4644         return tag_ptr(res_ptr, true);
4645 }
4646 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LockableScore_1read_1lock(JNIEnv *env, jclass clz, int64_t this_arg) {
4647         void* this_arg_ptr = untag_ptr(this_arg);
4648         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4649         LDKLockableScore* this_arg_conv = (LDKLockableScore*)this_arg_ptr;
4650         LDKScoreLookUp* ret_ret = MALLOC(sizeof(LDKScoreLookUp), "LDKScoreLookUp");
4651         *ret_ret = (this_arg_conv->read_lock)(this_arg_conv->this_arg);
4652         return tag_ptr(ret_ret, true);
4653 }
4654
4655 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LockableScore_1write_1lock(JNIEnv *env, jclass clz, int64_t this_arg) {
4656         void* this_arg_ptr = untag_ptr(this_arg);
4657         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4658         LDKLockableScore* this_arg_conv = (LDKLockableScore*)this_arg_ptr;
4659         LDKScoreUpdate* ret_ret = MALLOC(sizeof(LDKScoreUpdate), "LDKScoreUpdate");
4660         *ret_ret = (this_arg_conv->write_lock)(this_arg_conv->this_arg);
4661         return tag_ptr(ret_ret, true);
4662 }
4663
4664 typedef struct LDKWriteableScore_JCalls {
4665         atomic_size_t refcnt;
4666         JavaVM *vm;
4667         jweak o;
4668         LDKLockableScore_JCalls* LockableScore;
4669         jmethodID write_meth;
4670 } LDKWriteableScore_JCalls;
4671 static void LDKWriteableScore_JCalls_free(void* this_arg) {
4672         LDKWriteableScore_JCalls *j_calls = (LDKWriteableScore_JCalls*) this_arg;
4673         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
4674                 JNIEnv *env;
4675                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4676                 if (get_jenv_res == JNI_EDETACHED) {
4677                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4678                 } else {
4679                         DO_ASSERT(get_jenv_res == JNI_OK);
4680                 }
4681                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
4682                 if (get_jenv_res == JNI_EDETACHED) {
4683                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4684                 }
4685                 FREE(j_calls);
4686         }
4687 }
4688 LDKCVec_u8Z write_LDKWriteableScore_jcall(const void* this_arg) {
4689         LDKWriteableScore_JCalls *j_calls = (LDKWriteableScore_JCalls*) this_arg;
4690         JNIEnv *env;
4691         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4692         if (get_jenv_res == JNI_EDETACHED) {
4693                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4694         } else {
4695                 DO_ASSERT(get_jenv_res == JNI_OK);
4696         }
4697         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4698         CHECK(obj != NULL);
4699         int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->write_meth);
4700         if (UNLIKELY((*env)->ExceptionCheck(env))) {
4701                 (*env)->ExceptionDescribe(env);
4702                 (*env)->FatalError(env, "A call to write in LDKWriteableScore from rust threw an exception.");
4703         }
4704         LDKCVec_u8Z ret_ref;
4705         ret_ref.datalen = (*env)->GetArrayLength(env, ret);
4706         ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
4707         (*env)->GetByteArrayRegion(env, ret, 0, ret_ref.datalen, ret_ref.data);
4708         if (get_jenv_res == JNI_EDETACHED) {
4709                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4710         }
4711         return ret_ref;
4712 }
4713 static void LDKWriteableScore_JCalls_cloned(LDKWriteableScore* new_obj) {
4714         LDKWriteableScore_JCalls *j_calls = (LDKWriteableScore_JCalls*) new_obj->this_arg;
4715         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
4716         atomic_fetch_add_explicit(&j_calls->LockableScore->refcnt, 1, memory_order_release);
4717 }
4718 static inline LDKWriteableScore LDKWriteableScore_init (JNIEnv *env, jclass clz, jobject o, jobject LockableScore) {
4719         jclass c = (*env)->GetObjectClass(env, o);
4720         CHECK(c != NULL);
4721         LDKWriteableScore_JCalls *calls = MALLOC(sizeof(LDKWriteableScore_JCalls), "LDKWriteableScore_JCalls");
4722         atomic_init(&calls->refcnt, 1);
4723         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
4724         calls->o = (*env)->NewWeakGlobalRef(env, o);
4725         calls->write_meth = (*env)->GetMethodID(env, c, "write", "()[B");
4726         CHECK(calls->write_meth != NULL);
4727
4728         LDKWriteableScore ret = {
4729                 .this_arg = (void*) calls,
4730                 .write = write_LDKWriteableScore_jcall,
4731                 .free = LDKWriteableScore_JCalls_free,
4732                 .LockableScore = LDKLockableScore_init(env, clz, LockableScore),
4733         };
4734         calls->LockableScore = ret.LockableScore.this_arg;
4735         return ret;
4736 }
4737 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKWriteableScore_1new(JNIEnv *env, jclass clz, jobject o, jobject LockableScore) {
4738         LDKWriteableScore *res_ptr = MALLOC(sizeof(LDKWriteableScore), "LDKWriteableScore");
4739         *res_ptr = LDKWriteableScore_init(env, clz, o, LockableScore);
4740         return tag_ptr(res_ptr, true);
4741 }
4742 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKWriteableScore_1get_1LockableScore(JNIEnv *env, jclass clz, int64_t arg) {
4743         LDKWriteableScore *inp = (LDKWriteableScore *)untag_ptr(arg);
4744         return tag_ptr(&inp->LockableScore, false);
4745 }
4746 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_WriteableScore_1write(JNIEnv *env, jclass clz, int64_t this_arg) {
4747         void* this_arg_ptr = untag_ptr(this_arg);
4748         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
4749         LDKWriteableScore* this_arg_conv = (LDKWriteableScore*)this_arg_ptr;
4750         LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
4751         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
4752         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
4753         CVec_u8Z_free(ret_var);
4754         return ret_arr;
4755 }
4756
4757 static jclass LDKCOption_WriteableScoreZ_Some_class = NULL;
4758 static jmethodID LDKCOption_WriteableScoreZ_Some_meth = NULL;
4759 static jclass LDKCOption_WriteableScoreZ_None_class = NULL;
4760 static jmethodID LDKCOption_WriteableScoreZ_None_meth = NULL;
4761 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1WriteableScoreZ_init (JNIEnv *env, jclass clz) {
4762         LDKCOption_WriteableScoreZ_Some_class =
4763                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_WriteableScoreZ$Some"));
4764         CHECK(LDKCOption_WriteableScoreZ_Some_class != NULL);
4765         LDKCOption_WriteableScoreZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_WriteableScoreZ_Some_class, "<init>", "(J)V");
4766         CHECK(LDKCOption_WriteableScoreZ_Some_meth != NULL);
4767         LDKCOption_WriteableScoreZ_None_class =
4768                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_WriteableScoreZ$None"));
4769         CHECK(LDKCOption_WriteableScoreZ_None_class != NULL);
4770         LDKCOption_WriteableScoreZ_None_meth = (*env)->GetMethodID(env, LDKCOption_WriteableScoreZ_None_class, "<init>", "()V");
4771         CHECK(LDKCOption_WriteableScoreZ_None_meth != NULL);
4772 }
4773 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1WriteableScoreZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
4774         LDKCOption_WriteableScoreZ *obj = (LDKCOption_WriteableScoreZ*)untag_ptr(ptr);
4775         switch(obj->tag) {
4776                 case LDKCOption_WriteableScoreZ_Some: {
4777                         LDKWriteableScore* some_ret = MALLOC(sizeof(LDKWriteableScore), "LDKWriteableScore");
4778                         *some_ret = obj->some;
4779                         // WARNING: We likely need to clone here, but no clone is available, so we just do it for Java instances
4780                         if ((*some_ret).free == LDKWriteableScore_JCalls_free) {
4781                                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
4782                                 LDKWriteableScore_JCalls_cloned(&(*some_ret));
4783                         }
4784                         return (*env)->NewObject(env, LDKCOption_WriteableScoreZ_Some_class, LDKCOption_WriteableScoreZ_Some_meth, tag_ptr(some_ret, true));
4785                 }
4786                 case LDKCOption_WriteableScoreZ_None: {
4787                         return (*env)->NewObject(env, LDKCOption_WriteableScoreZ_None_class, LDKCOption_WriteableScoreZ_None_meth);
4788                 }
4789                 default: abort();
4790         }
4791 }
4792 static inline void CResult_NoneIOErrorZ_get_ok(LDKCResult_NoneIOErrorZ *NONNULL_PTR owner){
4793 CHECK(owner->result_ok);
4794         return *owner->contents.result;
4795 }
4796 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneIOErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4797         LDKCResult_NoneIOErrorZ* owner_conv = (LDKCResult_NoneIOErrorZ*)untag_ptr(owner);
4798         CResult_NoneIOErrorZ_get_ok(owner_conv);
4799 }
4800
4801 static inline enum LDKIOError CResult_NoneIOErrorZ_get_err(LDKCResult_NoneIOErrorZ *NONNULL_PTR owner){
4802 CHECK(!owner->result_ok);
4803         return *owner->contents.err;
4804 }
4805 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1NoneIOErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4806         LDKCResult_NoneIOErrorZ* owner_conv = (LDKCResult_NoneIOErrorZ*)untag_ptr(owner);
4807         jclass ret_conv = LDKIOError_to_java(env, CResult_NoneIOErrorZ_get_err(owner_conv));
4808         return ret_conv;
4809 }
4810
4811 static inline LDKCVec_ChannelDetailsZ CVec_ChannelDetailsZ_clone(const LDKCVec_ChannelDetailsZ *orig) {
4812         LDKCVec_ChannelDetailsZ ret = { .data = MALLOC(sizeof(LDKChannelDetails) * orig->datalen, "LDKCVec_ChannelDetailsZ clone bytes"), .datalen = orig->datalen };
4813         for (size_t i = 0; i < ret.datalen; i++) {
4814                 ret.data[i] = ChannelDetails_clone(&orig->data[i]);
4815         }
4816         return ret;
4817 }
4818 static inline struct LDKRoute CResult_RouteLightningErrorZ_get_ok(LDKCResult_RouteLightningErrorZ *NONNULL_PTR owner){
4819         LDKRoute ret = *owner->contents.result;
4820         ret.is_owned = false;
4821         return ret;
4822 }
4823 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4824         LDKCResult_RouteLightningErrorZ* owner_conv = (LDKCResult_RouteLightningErrorZ*)untag_ptr(owner);
4825         LDKRoute ret_var = CResult_RouteLightningErrorZ_get_ok(owner_conv);
4826         int64_t ret_ref = 0;
4827         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4828         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4829         return ret_ref;
4830 }
4831
4832 static inline struct LDKLightningError CResult_RouteLightningErrorZ_get_err(LDKCResult_RouteLightningErrorZ *NONNULL_PTR owner){
4833         LDKLightningError ret = *owner->contents.err;
4834         ret.is_owned = false;
4835         return ret;
4836 }
4837 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4838         LDKCResult_RouteLightningErrorZ* owner_conv = (LDKCResult_RouteLightningErrorZ*)untag_ptr(owner);
4839         LDKLightningError ret_var = CResult_RouteLightningErrorZ_get_err(owner_conv);
4840         int64_t ret_ref = 0;
4841         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4842         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4843         return ret_ref;
4844 }
4845
4846 static inline struct LDKBlindedPayInfo C2Tuple_BlindedPayInfoBlindedPathZ_get_a(LDKC2Tuple_BlindedPayInfoBlindedPathZ *NONNULL_PTR owner){
4847         LDKBlindedPayInfo ret = owner->a;
4848         ret.is_owned = false;
4849         return ret;
4850 }
4851 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlindedPayInfoBlindedPathZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
4852         LDKC2Tuple_BlindedPayInfoBlindedPathZ* owner_conv = (LDKC2Tuple_BlindedPayInfoBlindedPathZ*)untag_ptr(owner);
4853         LDKBlindedPayInfo ret_var = C2Tuple_BlindedPayInfoBlindedPathZ_get_a(owner_conv);
4854         int64_t ret_ref = 0;
4855         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4856         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4857         return ret_ref;
4858 }
4859
4860 static inline struct LDKBlindedPath C2Tuple_BlindedPayInfoBlindedPathZ_get_b(LDKC2Tuple_BlindedPayInfoBlindedPathZ *NONNULL_PTR owner){
4861         LDKBlindedPath ret = owner->b;
4862         ret.is_owned = false;
4863         return ret;
4864 }
4865 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlindedPayInfoBlindedPathZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
4866         LDKC2Tuple_BlindedPayInfoBlindedPathZ* owner_conv = (LDKC2Tuple_BlindedPayInfoBlindedPathZ*)untag_ptr(owner);
4867         LDKBlindedPath ret_var = C2Tuple_BlindedPayInfoBlindedPathZ_get_b(owner_conv);
4868         int64_t ret_ref = 0;
4869         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4870         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4871         return ret_ref;
4872 }
4873
4874 static inline LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ CVec_C2Tuple_BlindedPayInfoBlindedPathZZ_clone(const LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ *orig) {
4875         LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ) * orig->datalen, "LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ clone bytes"), .datalen = orig->datalen };
4876         for (size_t i = 0; i < ret.datalen; i++) {
4877                 ret.data[i] = C2Tuple_BlindedPayInfoBlindedPathZ_clone(&orig->data[i]);
4878         }
4879         return ret;
4880 }
4881 static inline struct LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_get_ok(LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ *NONNULL_PTR owner){
4882 CHECK(owner->result_ok);
4883         return CVec_C2Tuple_BlindedPayInfoBlindedPathZZ_clone(&*owner->contents.result);
4884 }
4885 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1BlindedPayInfoBlindedPathZZNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4886         LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ* owner_conv = (LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ*)untag_ptr(owner);
4887         LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ ret_var = CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_get_ok(owner_conv);
4888         int64_tArray ret_arr = NULL;
4889         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
4890         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
4891         for (size_t l = 0; l < ret_var.datalen; l++) {
4892                 LDKC2Tuple_BlindedPayInfoBlindedPathZ* ret_conv_37_conv = MALLOC(sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKC2Tuple_BlindedPayInfoBlindedPathZ");
4893                 *ret_conv_37_conv = ret_var.data[l];
4894                 ret_arr_ptr[l] = tag_ptr(ret_conv_37_conv, true);
4895         }
4896         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
4897         FREE(ret_var.data);
4898         return ret_arr;
4899 }
4900
4901 static inline void CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_get_err(LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ *NONNULL_PTR owner){
4902 CHECK(!owner->result_ok);
4903         return *owner->contents.err;
4904 }
4905 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1BlindedPayInfoBlindedPathZZNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4906         LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ* owner_conv = (LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ*)untag_ptr(owner);
4907         CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_get_err(owner_conv);
4908 }
4909
4910 static inline struct LDKOnionMessagePath CResult_OnionMessagePathNoneZ_get_ok(LDKCResult_OnionMessagePathNoneZ *NONNULL_PTR owner){
4911         LDKOnionMessagePath ret = *owner->contents.result;
4912         ret.is_owned = false;
4913         return ret;
4914 }
4915 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OnionMessagePathNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4916         LDKCResult_OnionMessagePathNoneZ* owner_conv = (LDKCResult_OnionMessagePathNoneZ*)untag_ptr(owner);
4917         LDKOnionMessagePath ret_var = CResult_OnionMessagePathNoneZ_get_ok(owner_conv);
4918         int64_t ret_ref = 0;
4919         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4920         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4921         return ret_ref;
4922 }
4923
4924 static inline void CResult_OnionMessagePathNoneZ_get_err(LDKCResult_OnionMessagePathNoneZ *NONNULL_PTR owner){
4925 CHECK(!owner->result_ok);
4926         return *owner->contents.err;
4927 }
4928 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1OnionMessagePathNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4929         LDKCResult_OnionMessagePathNoneZ* owner_conv = (LDKCResult_OnionMessagePathNoneZ*)untag_ptr(owner);
4930         CResult_OnionMessagePathNoneZ_get_err(owner_conv);
4931 }
4932
4933 static inline struct LDKCVec_BlindedPathZ CResult_CVec_BlindedPathZNoneZ_get_ok(LDKCResult_CVec_BlindedPathZNoneZ *NONNULL_PTR owner){
4934 CHECK(owner->result_ok);
4935         return CVec_BlindedPathZ_clone(&*owner->contents.result);
4936 }
4937 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1BlindedPathZNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4938         LDKCResult_CVec_BlindedPathZNoneZ* owner_conv = (LDKCResult_CVec_BlindedPathZNoneZ*)untag_ptr(owner);
4939         LDKCVec_BlindedPathZ ret_var = CResult_CVec_BlindedPathZNoneZ_get_ok(owner_conv);
4940         int64_tArray ret_arr = NULL;
4941         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
4942         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
4943         for (size_t n = 0; n < ret_var.datalen; n++) {
4944                 LDKBlindedPath ret_conv_13_var = ret_var.data[n];
4945                 int64_t ret_conv_13_ref = 0;
4946                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_13_var);
4947                 ret_conv_13_ref = tag_ptr(ret_conv_13_var.inner, ret_conv_13_var.is_owned);
4948                 ret_arr_ptr[n] = ret_conv_13_ref;
4949         }
4950         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
4951         FREE(ret_var.data);
4952         return ret_arr;
4953 }
4954
4955 static inline void CResult_CVec_BlindedPathZNoneZ_get_err(LDKCResult_CVec_BlindedPathZNoneZ *NONNULL_PTR owner){
4956 CHECK(!owner->result_ok);
4957         return *owner->contents.err;
4958 }
4959 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1BlindedPathZNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4960         LDKCResult_CVec_BlindedPathZNoneZ* owner_conv = (LDKCResult_CVec_BlindedPathZNoneZ*)untag_ptr(owner);
4961         CResult_CVec_BlindedPathZNoneZ_get_err(owner_conv);
4962 }
4963
4964 static inline struct LDKInFlightHtlcs CResult_InFlightHtlcsDecodeErrorZ_get_ok(LDKCResult_InFlightHtlcsDecodeErrorZ *NONNULL_PTR owner){
4965         LDKInFlightHtlcs ret = *owner->contents.result;
4966         ret.is_owned = false;
4967         return ret;
4968 }
4969 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InFlightHtlcsDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4970         LDKCResult_InFlightHtlcsDecodeErrorZ* owner_conv = (LDKCResult_InFlightHtlcsDecodeErrorZ*)untag_ptr(owner);
4971         LDKInFlightHtlcs ret_var = CResult_InFlightHtlcsDecodeErrorZ_get_ok(owner_conv);
4972         int64_t ret_ref = 0;
4973         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
4974         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
4975         return ret_ref;
4976 }
4977
4978 static inline struct LDKDecodeError CResult_InFlightHtlcsDecodeErrorZ_get_err(LDKCResult_InFlightHtlcsDecodeErrorZ *NONNULL_PTR owner){
4979 CHECK(!owner->result_ok);
4980         return DecodeError_clone(&*owner->contents.err);
4981 }
4982 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InFlightHtlcsDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
4983         LDKCResult_InFlightHtlcsDecodeErrorZ* owner_conv = (LDKCResult_InFlightHtlcsDecodeErrorZ*)untag_ptr(owner);
4984         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
4985         *ret_copy = CResult_InFlightHtlcsDecodeErrorZ_get_err(owner_conv);
4986         int64_t ret_ref = tag_ptr(ret_copy, true);
4987         return ret_ref;
4988 }
4989
4990 static inline struct LDKRouteHop CResult_RouteHopDecodeErrorZ_get_ok(LDKCResult_RouteHopDecodeErrorZ *NONNULL_PTR owner){
4991         LDKRouteHop ret = *owner->contents.result;
4992         ret.is_owned = false;
4993         return ret;
4994 }
4995 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
4996         LDKCResult_RouteHopDecodeErrorZ* owner_conv = (LDKCResult_RouteHopDecodeErrorZ*)untag_ptr(owner);
4997         LDKRouteHop ret_var = CResult_RouteHopDecodeErrorZ_get_ok(owner_conv);
4998         int64_t ret_ref = 0;
4999         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5000         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5001         return ret_ref;
5002 }
5003
5004 static inline struct LDKDecodeError CResult_RouteHopDecodeErrorZ_get_err(LDKCResult_RouteHopDecodeErrorZ *NONNULL_PTR owner){
5005 CHECK(!owner->result_ok);
5006         return DecodeError_clone(&*owner->contents.err);
5007 }
5008 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5009         LDKCResult_RouteHopDecodeErrorZ* owner_conv = (LDKCResult_RouteHopDecodeErrorZ*)untag_ptr(owner);
5010         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
5011         *ret_copy = CResult_RouteHopDecodeErrorZ_get_err(owner_conv);
5012         int64_t ret_ref = tag_ptr(ret_copy, true);
5013         return ret_ref;
5014 }
5015
5016 static inline LDKCVec_BlindedHopZ CVec_BlindedHopZ_clone(const LDKCVec_BlindedHopZ *orig) {
5017         LDKCVec_BlindedHopZ ret = { .data = MALLOC(sizeof(LDKBlindedHop) * orig->datalen, "LDKCVec_BlindedHopZ clone bytes"), .datalen = orig->datalen };
5018         for (size_t i = 0; i < ret.datalen; i++) {
5019                 ret.data[i] = BlindedHop_clone(&orig->data[i]);
5020         }
5021         return ret;
5022 }
5023 static inline struct LDKBlindedTail CResult_BlindedTailDecodeErrorZ_get_ok(LDKCResult_BlindedTailDecodeErrorZ *NONNULL_PTR owner){
5024         LDKBlindedTail ret = *owner->contents.result;
5025         ret.is_owned = false;
5026         return ret;
5027 }
5028 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedTailDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5029         LDKCResult_BlindedTailDecodeErrorZ* owner_conv = (LDKCResult_BlindedTailDecodeErrorZ*)untag_ptr(owner);
5030         LDKBlindedTail ret_var = CResult_BlindedTailDecodeErrorZ_get_ok(owner_conv);
5031         int64_t ret_ref = 0;
5032         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5033         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5034         return ret_ref;
5035 }
5036
5037 static inline struct LDKDecodeError CResult_BlindedTailDecodeErrorZ_get_err(LDKCResult_BlindedTailDecodeErrorZ *NONNULL_PTR owner){
5038 CHECK(!owner->result_ok);
5039         return DecodeError_clone(&*owner->contents.err);
5040 }
5041 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedTailDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5042         LDKCResult_BlindedTailDecodeErrorZ* owner_conv = (LDKCResult_BlindedTailDecodeErrorZ*)untag_ptr(owner);
5043         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
5044         *ret_copy = CResult_BlindedTailDecodeErrorZ_get_err(owner_conv);
5045         int64_t ret_ref = tag_ptr(ret_copy, true);
5046         return ret_ref;
5047 }
5048
5049 static inline LDKCVec_RouteHopZ CVec_RouteHopZ_clone(const LDKCVec_RouteHopZ *orig) {
5050         LDKCVec_RouteHopZ ret = { .data = MALLOC(sizeof(LDKRouteHop) * orig->datalen, "LDKCVec_RouteHopZ clone bytes"), .datalen = orig->datalen };
5051         for (size_t i = 0; i < ret.datalen; i++) {
5052                 ret.data[i] = RouteHop_clone(&orig->data[i]);
5053         }
5054         return ret;
5055 }
5056 static inline LDKCVec_PathZ CVec_PathZ_clone(const LDKCVec_PathZ *orig) {
5057         LDKCVec_PathZ ret = { .data = MALLOC(sizeof(LDKPath) * orig->datalen, "LDKCVec_PathZ clone bytes"), .datalen = orig->datalen };
5058         for (size_t i = 0; i < ret.datalen; i++) {
5059                 ret.data[i] = Path_clone(&orig->data[i]);
5060         }
5061         return ret;
5062 }
5063 static inline struct LDKRoute CResult_RouteDecodeErrorZ_get_ok(LDKCResult_RouteDecodeErrorZ *NONNULL_PTR owner){
5064         LDKRoute ret = *owner->contents.result;
5065         ret.is_owned = false;
5066         return ret;
5067 }
5068 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5069         LDKCResult_RouteDecodeErrorZ* owner_conv = (LDKCResult_RouteDecodeErrorZ*)untag_ptr(owner);
5070         LDKRoute ret_var = CResult_RouteDecodeErrorZ_get_ok(owner_conv);
5071         int64_t ret_ref = 0;
5072         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5073         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5074         return ret_ref;
5075 }
5076
5077 static inline struct LDKDecodeError CResult_RouteDecodeErrorZ_get_err(LDKCResult_RouteDecodeErrorZ *NONNULL_PTR owner){
5078 CHECK(!owner->result_ok);
5079         return DecodeError_clone(&*owner->contents.err);
5080 }
5081 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5082         LDKCResult_RouteDecodeErrorZ* owner_conv = (LDKCResult_RouteDecodeErrorZ*)untag_ptr(owner);
5083         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
5084         *ret_copy = CResult_RouteDecodeErrorZ_get_err(owner_conv);
5085         int64_t ret_ref = tag_ptr(ret_copy, true);
5086         return ret_ref;
5087 }
5088
5089 static inline struct LDKRouteParameters CResult_RouteParametersDecodeErrorZ_get_ok(LDKCResult_RouteParametersDecodeErrorZ *NONNULL_PTR owner){
5090         LDKRouteParameters ret = *owner->contents.result;
5091         ret.is_owned = false;
5092         return ret;
5093 }
5094 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteParametersDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5095         LDKCResult_RouteParametersDecodeErrorZ* owner_conv = (LDKCResult_RouteParametersDecodeErrorZ*)untag_ptr(owner);
5096         LDKRouteParameters ret_var = CResult_RouteParametersDecodeErrorZ_get_ok(owner_conv);
5097         int64_t ret_ref = 0;
5098         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5099         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5100         return ret_ref;
5101 }
5102
5103 static inline struct LDKDecodeError CResult_RouteParametersDecodeErrorZ_get_err(LDKCResult_RouteParametersDecodeErrorZ *NONNULL_PTR owner){
5104 CHECK(!owner->result_ok);
5105         return DecodeError_clone(&*owner->contents.err);
5106 }
5107 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteParametersDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5108         LDKCResult_RouteParametersDecodeErrorZ* owner_conv = (LDKCResult_RouteParametersDecodeErrorZ*)untag_ptr(owner);
5109         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
5110         *ret_copy = CResult_RouteParametersDecodeErrorZ_get_err(owner_conv);
5111         int64_t ret_ref = tag_ptr(ret_copy, true);
5112         return ret_ref;
5113 }
5114
5115 static inline LDKCVec_u64Z CVec_u64Z_clone(const LDKCVec_u64Z *orig) {
5116         LDKCVec_u64Z ret = { .data = MALLOC(sizeof(int64_t) * orig->datalen, "LDKCVec_u64Z clone bytes"), .datalen = orig->datalen };
5117         memcpy(ret.data, orig->data, sizeof(int64_t) * ret.datalen);
5118         return ret;
5119 }
5120 static inline struct LDKPaymentParameters CResult_PaymentParametersDecodeErrorZ_get_ok(LDKCResult_PaymentParametersDecodeErrorZ *NONNULL_PTR owner){
5121         LDKPaymentParameters ret = *owner->contents.result;
5122         ret.is_owned = false;
5123         return ret;
5124 }
5125 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentParametersDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5126         LDKCResult_PaymentParametersDecodeErrorZ* owner_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)untag_ptr(owner);
5127         LDKPaymentParameters ret_var = CResult_PaymentParametersDecodeErrorZ_get_ok(owner_conv);
5128         int64_t ret_ref = 0;
5129         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5130         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5131         return ret_ref;
5132 }
5133
5134 static inline struct LDKDecodeError CResult_PaymentParametersDecodeErrorZ_get_err(LDKCResult_PaymentParametersDecodeErrorZ *NONNULL_PTR owner){
5135 CHECK(!owner->result_ok);
5136         return DecodeError_clone(&*owner->contents.err);
5137 }
5138 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentParametersDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5139         LDKCResult_PaymentParametersDecodeErrorZ* owner_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)untag_ptr(owner);
5140         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
5141         *ret_copy = CResult_PaymentParametersDecodeErrorZ_get_err(owner_conv);
5142         int64_t ret_ref = tag_ptr(ret_copy, true);
5143         return ret_ref;
5144 }
5145
5146 static inline LDKCVec_RouteHintZ CVec_RouteHintZ_clone(const LDKCVec_RouteHintZ *orig) {
5147         LDKCVec_RouteHintZ ret = { .data = MALLOC(sizeof(LDKRouteHint) * orig->datalen, "LDKCVec_RouteHintZ clone bytes"), .datalen = orig->datalen };
5148         for (size_t i = 0; i < ret.datalen; i++) {
5149                 ret.data[i] = RouteHint_clone(&orig->data[i]);
5150         }
5151         return ret;
5152 }
5153 static inline LDKCVec_RouteHintHopZ CVec_RouteHintHopZ_clone(const LDKCVec_RouteHintHopZ *orig) {
5154         LDKCVec_RouteHintHopZ ret = { .data = MALLOC(sizeof(LDKRouteHintHop) * orig->datalen, "LDKCVec_RouteHintHopZ clone bytes"), .datalen = orig->datalen };
5155         for (size_t i = 0; i < ret.datalen; i++) {
5156                 ret.data[i] = RouteHintHop_clone(&orig->data[i]);
5157         }
5158         return ret;
5159 }
5160 static inline struct LDKRouteHint CResult_RouteHintDecodeErrorZ_get_ok(LDKCResult_RouteHintDecodeErrorZ *NONNULL_PTR owner){
5161         LDKRouteHint ret = *owner->contents.result;
5162         ret.is_owned = false;
5163         return ret;
5164 }
5165 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5166         LDKCResult_RouteHintDecodeErrorZ* owner_conv = (LDKCResult_RouteHintDecodeErrorZ*)untag_ptr(owner);
5167         LDKRouteHint ret_var = CResult_RouteHintDecodeErrorZ_get_ok(owner_conv);
5168         int64_t ret_ref = 0;
5169         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5170         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5171         return ret_ref;
5172 }
5173
5174 static inline struct LDKDecodeError CResult_RouteHintDecodeErrorZ_get_err(LDKCResult_RouteHintDecodeErrorZ *NONNULL_PTR owner){
5175 CHECK(!owner->result_ok);
5176         return DecodeError_clone(&*owner->contents.err);
5177 }
5178 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5179         LDKCResult_RouteHintDecodeErrorZ* owner_conv = (LDKCResult_RouteHintDecodeErrorZ*)untag_ptr(owner);
5180         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
5181         *ret_copy = CResult_RouteHintDecodeErrorZ_get_err(owner_conv);
5182         int64_t ret_ref = tag_ptr(ret_copy, true);
5183         return ret_ref;
5184 }
5185
5186 static inline struct LDKRouteHintHop CResult_RouteHintHopDecodeErrorZ_get_ok(LDKCResult_RouteHintHopDecodeErrorZ *NONNULL_PTR owner){
5187         LDKRouteHintHop ret = *owner->contents.result;
5188         ret.is_owned = false;
5189         return ret;
5190 }
5191 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintHopDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5192         LDKCResult_RouteHintHopDecodeErrorZ* owner_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)untag_ptr(owner);
5193         LDKRouteHintHop ret_var = CResult_RouteHintHopDecodeErrorZ_get_ok(owner_conv);
5194         int64_t ret_ref = 0;
5195         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5196         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5197         return ret_ref;
5198 }
5199
5200 static inline struct LDKDecodeError CResult_RouteHintHopDecodeErrorZ_get_err(LDKCResult_RouteHintHopDecodeErrorZ *NONNULL_PTR owner){
5201 CHECK(!owner->result_ok);
5202         return DecodeError_clone(&*owner->contents.err);
5203 }
5204 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintHopDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5205         LDKCResult_RouteHintHopDecodeErrorZ* owner_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)untag_ptr(owner);
5206         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
5207         *ret_copy = CResult_RouteHintHopDecodeErrorZ_get_err(owner_conv);
5208         int64_t ret_ref = tag_ptr(ret_copy, true);
5209         return ret_ref;
5210 }
5211
5212 static inline struct LDKFixedPenaltyScorer CResult_FixedPenaltyScorerDecodeErrorZ_get_ok(LDKCResult_FixedPenaltyScorerDecodeErrorZ *NONNULL_PTR owner){
5213         LDKFixedPenaltyScorer ret = *owner->contents.result;
5214         ret.is_owned = false;
5215         return ret;
5216 }
5217 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FixedPenaltyScorerDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5218         LDKCResult_FixedPenaltyScorerDecodeErrorZ* owner_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)untag_ptr(owner);
5219         LDKFixedPenaltyScorer ret_var = CResult_FixedPenaltyScorerDecodeErrorZ_get_ok(owner_conv);
5220         int64_t ret_ref = 0;
5221         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5222         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5223         return ret_ref;
5224 }
5225
5226 static inline struct LDKDecodeError CResult_FixedPenaltyScorerDecodeErrorZ_get_err(LDKCResult_FixedPenaltyScorerDecodeErrorZ *NONNULL_PTR owner){
5227 CHECK(!owner->result_ok);
5228         return DecodeError_clone(&*owner->contents.err);
5229 }
5230 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FixedPenaltyScorerDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5231         LDKCResult_FixedPenaltyScorerDecodeErrorZ* owner_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)untag_ptr(owner);
5232         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
5233         *ret_copy = CResult_FixedPenaltyScorerDecodeErrorZ_get_err(owner_conv);
5234         int64_t ret_ref = tag_ptr(ret_copy, true);
5235         return ret_ref;
5236 }
5237
5238 static inline LDKCVec_NodeIdZ CVec_NodeIdZ_clone(const LDKCVec_NodeIdZ *orig) {
5239         LDKCVec_NodeIdZ ret = { .data = MALLOC(sizeof(LDKNodeId) * orig->datalen, "LDKCVec_NodeIdZ clone bytes"), .datalen = orig->datalen };
5240         for (size_t i = 0; i < ret.datalen; i++) {
5241                 ret.data[i] = NodeId_clone(&orig->data[i]);
5242         }
5243         return ret;
5244 }
5245 static inline uint64_t C2Tuple_u64u64Z_get_a(LDKC2Tuple_u64u64Z *NONNULL_PTR owner){
5246         return owner->a;
5247 }
5248 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64u64Z_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
5249         LDKC2Tuple_u64u64Z* owner_conv = (LDKC2Tuple_u64u64Z*)untag_ptr(owner);
5250         int64_t ret_conv = C2Tuple_u64u64Z_get_a(owner_conv);
5251         return ret_conv;
5252 }
5253
5254 static inline uint64_t C2Tuple_u64u64Z_get_b(LDKC2Tuple_u64u64Z *NONNULL_PTR owner){
5255         return owner->b;
5256 }
5257 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64u64Z_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
5258         LDKC2Tuple_u64u64Z* owner_conv = (LDKC2Tuple_u64u64Z*)untag_ptr(owner);
5259         int64_t ret_conv = C2Tuple_u64u64Z_get_b(owner_conv);
5260         return ret_conv;
5261 }
5262
5263 static jclass LDKCOption_C2Tuple_u64u64ZZ_Some_class = NULL;
5264 static jmethodID LDKCOption_C2Tuple_u64u64ZZ_Some_meth = NULL;
5265 static jclass LDKCOption_C2Tuple_u64u64ZZ_None_class = NULL;
5266 static jmethodID LDKCOption_C2Tuple_u64u64ZZ_None_meth = NULL;
5267 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1C2Tuple_1u64u64ZZ_init (JNIEnv *env, jclass clz) {
5268         LDKCOption_C2Tuple_u64u64ZZ_Some_class =
5269                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_C2Tuple_u64u64ZZ$Some"));
5270         CHECK(LDKCOption_C2Tuple_u64u64ZZ_Some_class != NULL);
5271         LDKCOption_C2Tuple_u64u64ZZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_C2Tuple_u64u64ZZ_Some_class, "<init>", "(J)V");
5272         CHECK(LDKCOption_C2Tuple_u64u64ZZ_Some_meth != NULL);
5273         LDKCOption_C2Tuple_u64u64ZZ_None_class =
5274                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_C2Tuple_u64u64ZZ$None"));
5275         CHECK(LDKCOption_C2Tuple_u64u64ZZ_None_class != NULL);
5276         LDKCOption_C2Tuple_u64u64ZZ_None_meth = (*env)->GetMethodID(env, LDKCOption_C2Tuple_u64u64ZZ_None_class, "<init>", "()V");
5277         CHECK(LDKCOption_C2Tuple_u64u64ZZ_None_meth != NULL);
5278 }
5279 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1C2Tuple_1u64u64ZZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
5280         LDKCOption_C2Tuple_u64u64ZZ *obj = (LDKCOption_C2Tuple_u64u64ZZ*)untag_ptr(ptr);
5281         switch(obj->tag) {
5282                 case LDKCOption_C2Tuple_u64u64ZZ_Some: {
5283                         LDKC2Tuple_u64u64Z* some_conv = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
5284                         *some_conv = obj->some;
5285                         *some_conv = C2Tuple_u64u64Z_clone(some_conv);
5286                         return (*env)->NewObject(env, LDKCOption_C2Tuple_u64u64ZZ_Some_class, LDKCOption_C2Tuple_u64u64ZZ_Some_meth, tag_ptr(some_conv, true));
5287                 }
5288                 case LDKCOption_C2Tuple_u64u64ZZ_None: {
5289                         return (*env)->NewObject(env, LDKCOption_C2Tuple_u64u64ZZ_None_class, LDKCOption_C2Tuple_u64u64ZZ_None_meth);
5290                 }
5291                 default: abort();
5292         }
5293 }
5294 static inline struct LDKThirtyTwoU16s C2Tuple_Z_get_a(LDKC2Tuple_Z *NONNULL_PTR owner){
5295         return owner->a;
5296 }
5297 JNIEXPORT int16_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1Z_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
5298         LDKC2Tuple_Z* owner_conv = (LDKC2Tuple_Z*)untag_ptr(owner);
5299         int16_tArray ret_arr = (*env)->NewShortArray(env, 32);
5300         (*env)->SetShortArrayRegion(env, ret_arr, 0, 32, C2Tuple_Z_get_a(owner_conv).data);
5301         return ret_arr;
5302 }
5303
5304 static inline struct LDKThirtyTwoU16s C2Tuple_Z_get_b(LDKC2Tuple_Z *NONNULL_PTR owner){
5305         return owner->b;
5306 }
5307 JNIEXPORT int16_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1Z_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
5308         LDKC2Tuple_Z* owner_conv = (LDKC2Tuple_Z*)untag_ptr(owner);
5309         int16_tArray ret_arr = (*env)->NewShortArray(env, 32);
5310         (*env)->SetShortArrayRegion(env, ret_arr, 0, 32, C2Tuple_Z_get_b(owner_conv).data);
5311         return ret_arr;
5312 }
5313
5314 static inline struct LDKThirtyTwoU16s C2Tuple__u1632_u1632Z_get_a(LDKC2Tuple__u1632_u1632Z *NONNULL_PTR owner){
5315         return owner->a;
5316 }
5317 JNIEXPORT int16_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1_1u1632_1u1632Z_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
5318         LDKC2Tuple__u1632_u1632Z* owner_conv = (LDKC2Tuple__u1632_u1632Z*)untag_ptr(owner);
5319         int16_tArray ret_arr = (*env)->NewShortArray(env, 32);
5320         (*env)->SetShortArrayRegion(env, ret_arr, 0, 32, C2Tuple__u1632_u1632Z_get_a(owner_conv).data);
5321         return ret_arr;
5322 }
5323
5324 static inline struct LDKThirtyTwoU16s C2Tuple__u1632_u1632Z_get_b(LDKC2Tuple__u1632_u1632Z *NONNULL_PTR owner){
5325         return owner->b;
5326 }
5327 JNIEXPORT int16_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1_1u1632_1u1632Z_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
5328         LDKC2Tuple__u1632_u1632Z* owner_conv = (LDKC2Tuple__u1632_u1632Z*)untag_ptr(owner);
5329         int16_tArray ret_arr = (*env)->NewShortArray(env, 32);
5330         (*env)->SetShortArrayRegion(env, ret_arr, 0, 32, C2Tuple__u1632_u1632Z_get_b(owner_conv).data);
5331         return ret_arr;
5332 }
5333
5334 static jclass LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_Some_class = NULL;
5335 static jmethodID LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_Some_meth = NULL;
5336 static jclass LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_None_class = NULL;
5337 static jmethodID LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_None_meth = NULL;
5338 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1C2Tuple_1ThirtyTwoU16sThirtyTwoU16sZZ_init (JNIEnv *env, jclass clz) {
5339         LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_Some_class =
5340                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ$Some"));
5341         CHECK(LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_Some_class != NULL);
5342         LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_Some_class, "<init>", "(J)V");
5343         CHECK(LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_Some_meth != NULL);
5344         LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_None_class =
5345                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ$None"));
5346         CHECK(LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_None_class != NULL);
5347         LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_None_meth = (*env)->GetMethodID(env, LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_None_class, "<init>", "()V");
5348         CHECK(LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_None_meth != NULL);
5349 }
5350 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1C2Tuple_1ThirtyTwoU16sThirtyTwoU16sZZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
5351         LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ *obj = (LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ*)untag_ptr(ptr);
5352         switch(obj->tag) {
5353                 case LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_Some: {
5354                         LDKC2Tuple__u1632_u1632Z* some_conv = &obj->some;
5355                         // WARNING: we really need to clone here, but no clone is available for LDKC2Tuple__u1632_u1632Z
5356                         return (*env)->NewObject(env, LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_Some_class, LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_Some_meth, tag_ptr(some_conv, false));
5357                 }
5358                 case LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_None: {
5359                         return (*env)->NewObject(env, LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_None_class, LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_None_meth);
5360                 }
5361                 default: abort();
5362         }
5363 }
5364 static jclass LDKCOption_f64Z_Some_class = NULL;
5365 static jmethodID LDKCOption_f64Z_Some_meth = NULL;
5366 static jclass LDKCOption_f64Z_None_class = NULL;
5367 static jmethodID LDKCOption_f64Z_None_meth = NULL;
5368 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1f64Z_init (JNIEnv *env, jclass clz) {
5369         LDKCOption_f64Z_Some_class =
5370                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_f64Z$Some"));
5371         CHECK(LDKCOption_f64Z_Some_class != NULL);
5372         LDKCOption_f64Z_Some_meth = (*env)->GetMethodID(env, LDKCOption_f64Z_Some_class, "<init>", "(D)V");
5373         CHECK(LDKCOption_f64Z_Some_meth != NULL);
5374         LDKCOption_f64Z_None_class =
5375                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_f64Z$None"));
5376         CHECK(LDKCOption_f64Z_None_class != NULL);
5377         LDKCOption_f64Z_None_meth = (*env)->GetMethodID(env, LDKCOption_f64Z_None_class, "<init>", "()V");
5378         CHECK(LDKCOption_f64Z_None_meth != NULL);
5379 }
5380 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1f64Z_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
5381         LDKCOption_f64Z *obj = (LDKCOption_f64Z*)untag_ptr(ptr);
5382         switch(obj->tag) {
5383                 case LDKCOption_f64Z_Some: {
5384                         double some_conv = obj->some;
5385                         return (*env)->NewObject(env, LDKCOption_f64Z_Some_class, LDKCOption_f64Z_Some_meth, some_conv);
5386                 }
5387                 case LDKCOption_f64Z_None: {
5388                         return (*env)->NewObject(env, LDKCOption_f64Z_None_class, LDKCOption_f64Z_None_meth);
5389                 }
5390                 default: abort();
5391         }
5392 }
5393 typedef struct LDKLogger_JCalls {
5394         atomic_size_t refcnt;
5395         JavaVM *vm;
5396         jweak o;
5397         jmethodID log_meth;
5398 } LDKLogger_JCalls;
5399 static void LDKLogger_JCalls_free(void* this_arg) {
5400         LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
5401         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5402                 JNIEnv *env;
5403                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
5404                 if (get_jenv_res == JNI_EDETACHED) {
5405                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
5406                 } else {
5407                         DO_ASSERT(get_jenv_res == JNI_OK);
5408                 }
5409                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
5410                 if (get_jenv_res == JNI_EDETACHED) {
5411                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
5412                 }
5413                 FREE(j_calls);
5414         }
5415 }
5416 void log_LDKLogger_jcall(const void* this_arg, LDKRecord record) {
5417         LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
5418         JNIEnv *env;
5419         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
5420         if (get_jenv_res == JNI_EDETACHED) {
5421                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
5422         } else {
5423                 DO_ASSERT(get_jenv_res == JNI_OK);
5424         }
5425         LDKRecord record_var = record;
5426         int64_t record_ref = 0;
5427         CHECK_INNER_FIELD_ACCESS_OR_NULL(record_var);
5428         record_ref = tag_ptr(record_var.inner, record_var.is_owned);
5429         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5430         CHECK(obj != NULL);
5431         (*env)->CallVoidMethod(env, obj, j_calls->log_meth, record_ref);
5432         if (UNLIKELY((*env)->ExceptionCheck(env))) {
5433                 (*env)->ExceptionDescribe(env);
5434                 (*env)->FatalError(env, "A call to log in LDKLogger from rust threw an exception.");
5435         }
5436         if (get_jenv_res == JNI_EDETACHED) {
5437                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
5438         }
5439 }
5440 static void LDKLogger_JCalls_cloned(LDKLogger* new_obj) {
5441         LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) new_obj->this_arg;
5442         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5443 }
5444 static inline LDKLogger LDKLogger_init (JNIEnv *env, jclass clz, jobject o) {
5445         jclass c = (*env)->GetObjectClass(env, o);
5446         CHECK(c != NULL);
5447         LDKLogger_JCalls *calls = MALLOC(sizeof(LDKLogger_JCalls), "LDKLogger_JCalls");
5448         atomic_init(&calls->refcnt, 1);
5449         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
5450         calls->o = (*env)->NewWeakGlobalRef(env, o);
5451         calls->log_meth = (*env)->GetMethodID(env, c, "log", "(J)V");
5452         CHECK(calls->log_meth != NULL);
5453
5454         LDKLogger ret = {
5455                 .this_arg = (void*) calls,
5456                 .log = log_LDKLogger_jcall,
5457                 .free = LDKLogger_JCalls_free,
5458         };
5459         return ret;
5460 }
5461 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKLogger_1new(JNIEnv *env, jclass clz, jobject o) {
5462         LDKLogger *res_ptr = MALLOC(sizeof(LDKLogger), "LDKLogger");
5463         *res_ptr = LDKLogger_init(env, clz, o);
5464         return tag_ptr(res_ptr, true);
5465 }
5466 static inline struct LDKProbabilisticScorer CResult_ProbabilisticScorerDecodeErrorZ_get_ok(LDKCResult_ProbabilisticScorerDecodeErrorZ *NONNULL_PTR owner){
5467         LDKProbabilisticScorer ret = *owner->contents.result;
5468         ret.is_owned = false;
5469         return ret;
5470 }
5471 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ProbabilisticScorerDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5472         LDKCResult_ProbabilisticScorerDecodeErrorZ* owner_conv = (LDKCResult_ProbabilisticScorerDecodeErrorZ*)untag_ptr(owner);
5473         LDKProbabilisticScorer ret_var = CResult_ProbabilisticScorerDecodeErrorZ_get_ok(owner_conv);
5474         int64_t ret_ref = 0;
5475         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5476         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5477         return ret_ref;
5478 }
5479
5480 static inline struct LDKDecodeError CResult_ProbabilisticScorerDecodeErrorZ_get_err(LDKCResult_ProbabilisticScorerDecodeErrorZ *NONNULL_PTR owner){
5481 CHECK(!owner->result_ok);
5482         return DecodeError_clone(&*owner->contents.err);
5483 }
5484 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ProbabilisticScorerDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5485         LDKCResult_ProbabilisticScorerDecodeErrorZ* owner_conv = (LDKCResult_ProbabilisticScorerDecodeErrorZ*)untag_ptr(owner);
5486         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
5487         *ret_copy = CResult_ProbabilisticScorerDecodeErrorZ_get_err(owner_conv);
5488         int64_t ret_ref = tag_ptr(ret_copy, true);
5489         return ret_ref;
5490 }
5491
5492 static inline struct LDKBestBlock CResult_BestBlockDecodeErrorZ_get_ok(LDKCResult_BestBlockDecodeErrorZ *NONNULL_PTR owner){
5493         LDKBestBlock ret = *owner->contents.result;
5494         ret.is_owned = false;
5495         return ret;
5496 }
5497 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BestBlockDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5498         LDKCResult_BestBlockDecodeErrorZ* owner_conv = (LDKCResult_BestBlockDecodeErrorZ*)untag_ptr(owner);
5499         LDKBestBlock ret_var = CResult_BestBlockDecodeErrorZ_get_ok(owner_conv);
5500         int64_t ret_ref = 0;
5501         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5502         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5503         return ret_ref;
5504 }
5505
5506 static inline struct LDKDecodeError CResult_BestBlockDecodeErrorZ_get_err(LDKCResult_BestBlockDecodeErrorZ *NONNULL_PTR owner){
5507 CHECK(!owner->result_ok);
5508         return DecodeError_clone(&*owner->contents.err);
5509 }
5510 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BestBlockDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5511         LDKCResult_BestBlockDecodeErrorZ* owner_conv = (LDKCResult_BestBlockDecodeErrorZ*)untag_ptr(owner);
5512         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
5513         *ret_copy = CResult_BestBlockDecodeErrorZ_get_err(owner_conv);
5514         int64_t ret_ref = tag_ptr(ret_copy, true);
5515         return ret_ref;
5516 }
5517
5518 static inline uintptr_t C2Tuple_usizeTransactionZ_get_a(LDKC2Tuple_usizeTransactionZ *NONNULL_PTR owner){
5519         return owner->a;
5520 }
5521 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
5522         LDKC2Tuple_usizeTransactionZ* owner_conv = (LDKC2Tuple_usizeTransactionZ*)untag_ptr(owner);
5523         int64_t ret_conv = C2Tuple_usizeTransactionZ_get_a(owner_conv);
5524         return ret_conv;
5525 }
5526
5527 static inline struct LDKTransaction C2Tuple_usizeTransactionZ_get_b(LDKC2Tuple_usizeTransactionZ *NONNULL_PTR owner){
5528         return owner->b;
5529 }
5530 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
5531         LDKC2Tuple_usizeTransactionZ* owner_conv = (LDKC2Tuple_usizeTransactionZ*)untag_ptr(owner);
5532         LDKTransaction ret_var = C2Tuple_usizeTransactionZ_get_b(owner_conv);
5533         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
5534         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
5535         return ret_arr;
5536 }
5537
5538 static inline LDKCVec_C2Tuple_usizeTransactionZZ CVec_C2Tuple_usizeTransactionZZ_clone(const LDKCVec_C2Tuple_usizeTransactionZZ *orig) {
5539         LDKCVec_C2Tuple_usizeTransactionZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ) * orig->datalen, "LDKCVec_C2Tuple_usizeTransactionZZ clone bytes"), .datalen = orig->datalen };
5540         for (size_t i = 0; i < ret.datalen; i++) {
5541                 ret.data[i] = C2Tuple_usizeTransactionZ_clone(&orig->data[i]);
5542         }
5543         return ret;
5544 }
5545 static inline struct LDKThirtyTwoBytes C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_get_a(LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ *NONNULL_PTR owner){
5546         return ThirtyTwoBytes_clone(&owner->a);
5547 }
5548 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ThirtyTwoBytesu32COption_1ThirtyTwoBytesZZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
5549         LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ* owner_conv = (LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ*)untag_ptr(owner);
5550         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
5551         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_get_a(owner_conv).data);
5552         return ret_arr;
5553 }
5554
5555 static inline uint32_t C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_get_b(LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ *NONNULL_PTR owner){
5556         return owner->b;
5557 }
5558 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ThirtyTwoBytesu32COption_1ThirtyTwoBytesZZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
5559         LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ* owner_conv = (LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ*)untag_ptr(owner);
5560         int32_t ret_conv = C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_get_b(owner_conv);
5561         return ret_conv;
5562 }
5563
5564 static inline struct LDKCOption_ThirtyTwoBytesZ C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_get_c(LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ *NONNULL_PTR owner){
5565         return COption_ThirtyTwoBytesZ_clone(&owner->c);
5566 }
5567 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ThirtyTwoBytesu32COption_1ThirtyTwoBytesZZ_1get_1c(JNIEnv *env, jclass clz, int64_t owner) {
5568         LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ* owner_conv = (LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ*)untag_ptr(owner);
5569         LDKCOption_ThirtyTwoBytesZ *ret_copy = MALLOC(sizeof(LDKCOption_ThirtyTwoBytesZ), "LDKCOption_ThirtyTwoBytesZ");
5570         *ret_copy = C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_get_c(owner_conv);
5571         int64_t ret_ref = tag_ptr(ret_copy, true);
5572         return ret_ref;
5573 }
5574
5575 static inline LDKCVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ CVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ_clone(const LDKCVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ *orig) {
5576         LDKCVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ ret = { .data = MALLOC(sizeof(LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ) * orig->datalen, "LDKCVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ clone bytes"), .datalen = orig->datalen };
5577         for (size_t i = 0; i < ret.datalen; i++) {
5578                 ret.data[i] = C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_clone(&orig->data[i]);
5579         }
5580         return ret;
5581 }
5582 static inline enum LDKChannelMonitorUpdateStatus CResult_ChannelMonitorUpdateStatusNoneZ_get_ok(LDKCResult_ChannelMonitorUpdateStatusNoneZ *NONNULL_PTR owner){
5583 CHECK(owner->result_ok);
5584         return ChannelMonitorUpdateStatus_clone(&*owner->contents.result);
5585 }
5586 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateStatusNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5587         LDKCResult_ChannelMonitorUpdateStatusNoneZ* owner_conv = (LDKCResult_ChannelMonitorUpdateStatusNoneZ*)untag_ptr(owner);
5588         jclass ret_conv = LDKChannelMonitorUpdateStatus_to_java(env, CResult_ChannelMonitorUpdateStatusNoneZ_get_ok(owner_conv));
5589         return ret_conv;
5590 }
5591
5592 static inline void CResult_ChannelMonitorUpdateStatusNoneZ_get_err(LDKCResult_ChannelMonitorUpdateStatusNoneZ *NONNULL_PTR owner){
5593 CHECK(!owner->result_ok);
5594         return *owner->contents.err;
5595 }
5596 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateStatusNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5597         LDKCResult_ChannelMonitorUpdateStatusNoneZ* owner_conv = (LDKCResult_ChannelMonitorUpdateStatusNoneZ*)untag_ptr(owner);
5598         CResult_ChannelMonitorUpdateStatusNoneZ_get_err(owner_conv);
5599 }
5600
5601 static jclass LDKClosureReason_CounterpartyForceClosed_class = NULL;
5602 static jmethodID LDKClosureReason_CounterpartyForceClosed_meth = NULL;
5603 static jclass LDKClosureReason_HolderForceClosed_class = NULL;
5604 static jmethodID LDKClosureReason_HolderForceClosed_meth = NULL;
5605 static jclass LDKClosureReason_LegacyCooperativeClosure_class = NULL;
5606 static jmethodID LDKClosureReason_LegacyCooperativeClosure_meth = NULL;
5607 static jclass LDKClosureReason_CounterpartyInitiatedCooperativeClosure_class = NULL;
5608 static jmethodID LDKClosureReason_CounterpartyInitiatedCooperativeClosure_meth = NULL;
5609 static jclass LDKClosureReason_LocallyInitiatedCooperativeClosure_class = NULL;
5610 static jmethodID LDKClosureReason_LocallyInitiatedCooperativeClosure_meth = NULL;
5611 static jclass LDKClosureReason_CommitmentTxConfirmed_class = NULL;
5612 static jmethodID LDKClosureReason_CommitmentTxConfirmed_meth = NULL;
5613 static jclass LDKClosureReason_FundingTimedOut_class = NULL;
5614 static jmethodID LDKClosureReason_FundingTimedOut_meth = NULL;
5615 static jclass LDKClosureReason_ProcessingError_class = NULL;
5616 static jmethodID LDKClosureReason_ProcessingError_meth = NULL;
5617 static jclass LDKClosureReason_DisconnectedPeer_class = NULL;
5618 static jmethodID LDKClosureReason_DisconnectedPeer_meth = NULL;
5619 static jclass LDKClosureReason_OutdatedChannelManager_class = NULL;
5620 static jmethodID LDKClosureReason_OutdatedChannelManager_meth = NULL;
5621 static jclass LDKClosureReason_CounterpartyCoopClosedUnfundedChannel_class = NULL;
5622 static jmethodID LDKClosureReason_CounterpartyCoopClosedUnfundedChannel_meth = NULL;
5623 static jclass LDKClosureReason_FundingBatchClosure_class = NULL;
5624 static jmethodID LDKClosureReason_FundingBatchClosure_meth = NULL;
5625 static jclass LDKClosureReason_HTLCsTimedOut_class = NULL;
5626 static jmethodID LDKClosureReason_HTLCsTimedOut_meth = NULL;
5627 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKClosureReason_init (JNIEnv *env, jclass clz) {
5628         LDKClosureReason_CounterpartyForceClosed_class =
5629                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKClosureReason$CounterpartyForceClosed"));
5630         CHECK(LDKClosureReason_CounterpartyForceClosed_class != NULL);
5631         LDKClosureReason_CounterpartyForceClosed_meth = (*env)->GetMethodID(env, LDKClosureReason_CounterpartyForceClosed_class, "<init>", "(J)V");
5632         CHECK(LDKClosureReason_CounterpartyForceClosed_meth != NULL);
5633         LDKClosureReason_HolderForceClosed_class =
5634                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKClosureReason$HolderForceClosed"));
5635         CHECK(LDKClosureReason_HolderForceClosed_class != NULL);
5636         LDKClosureReason_HolderForceClosed_meth = (*env)->GetMethodID(env, LDKClosureReason_HolderForceClosed_class, "<init>", "()V");
5637         CHECK(LDKClosureReason_HolderForceClosed_meth != NULL);
5638         LDKClosureReason_LegacyCooperativeClosure_class =
5639                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKClosureReason$LegacyCooperativeClosure"));
5640         CHECK(LDKClosureReason_LegacyCooperativeClosure_class != NULL);
5641         LDKClosureReason_LegacyCooperativeClosure_meth = (*env)->GetMethodID(env, LDKClosureReason_LegacyCooperativeClosure_class, "<init>", "()V");
5642         CHECK(LDKClosureReason_LegacyCooperativeClosure_meth != NULL);
5643         LDKClosureReason_CounterpartyInitiatedCooperativeClosure_class =
5644                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKClosureReason$CounterpartyInitiatedCooperativeClosure"));
5645         CHECK(LDKClosureReason_CounterpartyInitiatedCooperativeClosure_class != NULL);
5646         LDKClosureReason_CounterpartyInitiatedCooperativeClosure_meth = (*env)->GetMethodID(env, LDKClosureReason_CounterpartyInitiatedCooperativeClosure_class, "<init>", "()V");
5647         CHECK(LDKClosureReason_CounterpartyInitiatedCooperativeClosure_meth != NULL);
5648         LDKClosureReason_LocallyInitiatedCooperativeClosure_class =
5649                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKClosureReason$LocallyInitiatedCooperativeClosure"));
5650         CHECK(LDKClosureReason_LocallyInitiatedCooperativeClosure_class != NULL);
5651         LDKClosureReason_LocallyInitiatedCooperativeClosure_meth = (*env)->GetMethodID(env, LDKClosureReason_LocallyInitiatedCooperativeClosure_class, "<init>", "()V");
5652         CHECK(LDKClosureReason_LocallyInitiatedCooperativeClosure_meth != NULL);
5653         LDKClosureReason_CommitmentTxConfirmed_class =
5654                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKClosureReason$CommitmentTxConfirmed"));
5655         CHECK(LDKClosureReason_CommitmentTxConfirmed_class != NULL);
5656         LDKClosureReason_CommitmentTxConfirmed_meth = (*env)->GetMethodID(env, LDKClosureReason_CommitmentTxConfirmed_class, "<init>", "()V");
5657         CHECK(LDKClosureReason_CommitmentTxConfirmed_meth != NULL);
5658         LDKClosureReason_FundingTimedOut_class =
5659                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKClosureReason$FundingTimedOut"));
5660         CHECK(LDKClosureReason_FundingTimedOut_class != NULL);
5661         LDKClosureReason_FundingTimedOut_meth = (*env)->GetMethodID(env, LDKClosureReason_FundingTimedOut_class, "<init>", "()V");
5662         CHECK(LDKClosureReason_FundingTimedOut_meth != NULL);
5663         LDKClosureReason_ProcessingError_class =
5664                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKClosureReason$ProcessingError"));
5665         CHECK(LDKClosureReason_ProcessingError_class != NULL);
5666         LDKClosureReason_ProcessingError_meth = (*env)->GetMethodID(env, LDKClosureReason_ProcessingError_class, "<init>", "(Ljava/lang/String;)V");
5667         CHECK(LDKClosureReason_ProcessingError_meth != NULL);
5668         LDKClosureReason_DisconnectedPeer_class =
5669                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKClosureReason$DisconnectedPeer"));
5670         CHECK(LDKClosureReason_DisconnectedPeer_class != NULL);
5671         LDKClosureReason_DisconnectedPeer_meth = (*env)->GetMethodID(env, LDKClosureReason_DisconnectedPeer_class, "<init>", "()V");
5672         CHECK(LDKClosureReason_DisconnectedPeer_meth != NULL);
5673         LDKClosureReason_OutdatedChannelManager_class =
5674                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKClosureReason$OutdatedChannelManager"));
5675         CHECK(LDKClosureReason_OutdatedChannelManager_class != NULL);
5676         LDKClosureReason_OutdatedChannelManager_meth = (*env)->GetMethodID(env, LDKClosureReason_OutdatedChannelManager_class, "<init>", "()V");
5677         CHECK(LDKClosureReason_OutdatedChannelManager_meth != NULL);
5678         LDKClosureReason_CounterpartyCoopClosedUnfundedChannel_class =
5679                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKClosureReason$CounterpartyCoopClosedUnfundedChannel"));
5680         CHECK(LDKClosureReason_CounterpartyCoopClosedUnfundedChannel_class != NULL);
5681         LDKClosureReason_CounterpartyCoopClosedUnfundedChannel_meth = (*env)->GetMethodID(env, LDKClosureReason_CounterpartyCoopClosedUnfundedChannel_class, "<init>", "()V");
5682         CHECK(LDKClosureReason_CounterpartyCoopClosedUnfundedChannel_meth != NULL);
5683         LDKClosureReason_FundingBatchClosure_class =
5684                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKClosureReason$FundingBatchClosure"));
5685         CHECK(LDKClosureReason_FundingBatchClosure_class != NULL);
5686         LDKClosureReason_FundingBatchClosure_meth = (*env)->GetMethodID(env, LDKClosureReason_FundingBatchClosure_class, "<init>", "()V");
5687         CHECK(LDKClosureReason_FundingBatchClosure_meth != NULL);
5688         LDKClosureReason_HTLCsTimedOut_class =
5689                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKClosureReason$HTLCsTimedOut"));
5690         CHECK(LDKClosureReason_HTLCsTimedOut_class != NULL);
5691         LDKClosureReason_HTLCsTimedOut_meth = (*env)->GetMethodID(env, LDKClosureReason_HTLCsTimedOut_class, "<init>", "()V");
5692         CHECK(LDKClosureReason_HTLCsTimedOut_meth != NULL);
5693 }
5694 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKClosureReason_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
5695         LDKClosureReason *obj = (LDKClosureReason*)untag_ptr(ptr);
5696         switch(obj->tag) {
5697                 case LDKClosureReason_CounterpartyForceClosed: {
5698                         LDKUntrustedString peer_msg_var = obj->counterparty_force_closed.peer_msg;
5699                         int64_t peer_msg_ref = 0;
5700                         CHECK_INNER_FIELD_ACCESS_OR_NULL(peer_msg_var);
5701                         peer_msg_ref = tag_ptr(peer_msg_var.inner, false);
5702                         return (*env)->NewObject(env, LDKClosureReason_CounterpartyForceClosed_class, LDKClosureReason_CounterpartyForceClosed_meth, peer_msg_ref);
5703                 }
5704                 case LDKClosureReason_HolderForceClosed: {
5705                         return (*env)->NewObject(env, LDKClosureReason_HolderForceClosed_class, LDKClosureReason_HolderForceClosed_meth);
5706                 }
5707                 case LDKClosureReason_LegacyCooperativeClosure: {
5708                         return (*env)->NewObject(env, LDKClosureReason_LegacyCooperativeClosure_class, LDKClosureReason_LegacyCooperativeClosure_meth);
5709                 }
5710                 case LDKClosureReason_CounterpartyInitiatedCooperativeClosure: {
5711                         return (*env)->NewObject(env, LDKClosureReason_CounterpartyInitiatedCooperativeClosure_class, LDKClosureReason_CounterpartyInitiatedCooperativeClosure_meth);
5712                 }
5713                 case LDKClosureReason_LocallyInitiatedCooperativeClosure: {
5714                         return (*env)->NewObject(env, LDKClosureReason_LocallyInitiatedCooperativeClosure_class, LDKClosureReason_LocallyInitiatedCooperativeClosure_meth);
5715                 }
5716                 case LDKClosureReason_CommitmentTxConfirmed: {
5717                         return (*env)->NewObject(env, LDKClosureReason_CommitmentTxConfirmed_class, LDKClosureReason_CommitmentTxConfirmed_meth);
5718                 }
5719                 case LDKClosureReason_FundingTimedOut: {
5720                         return (*env)->NewObject(env, LDKClosureReason_FundingTimedOut_class, LDKClosureReason_FundingTimedOut_meth);
5721                 }
5722                 case LDKClosureReason_ProcessingError: {
5723                         LDKStr err_str = obj->processing_error.err;
5724                         jstring err_conv = str_ref_to_java(env, err_str.chars, err_str.len);
5725                         return (*env)->NewObject(env, LDKClosureReason_ProcessingError_class, LDKClosureReason_ProcessingError_meth, err_conv);
5726                 }
5727                 case LDKClosureReason_DisconnectedPeer: {
5728                         return (*env)->NewObject(env, LDKClosureReason_DisconnectedPeer_class, LDKClosureReason_DisconnectedPeer_meth);
5729                 }
5730                 case LDKClosureReason_OutdatedChannelManager: {
5731                         return (*env)->NewObject(env, LDKClosureReason_OutdatedChannelManager_class, LDKClosureReason_OutdatedChannelManager_meth);
5732                 }
5733                 case LDKClosureReason_CounterpartyCoopClosedUnfundedChannel: {
5734                         return (*env)->NewObject(env, LDKClosureReason_CounterpartyCoopClosedUnfundedChannel_class, LDKClosureReason_CounterpartyCoopClosedUnfundedChannel_meth);
5735                 }
5736                 case LDKClosureReason_FundingBatchClosure: {
5737                         return (*env)->NewObject(env, LDKClosureReason_FundingBatchClosure_class, LDKClosureReason_FundingBatchClosure_meth);
5738                 }
5739                 case LDKClosureReason_HTLCsTimedOut: {
5740                         return (*env)->NewObject(env, LDKClosureReason_HTLCsTimedOut_class, LDKClosureReason_HTLCsTimedOut_meth);
5741                 }
5742                 default: abort();
5743         }
5744 }
5745 static jclass LDKMonitorEvent_HTLCEvent_class = NULL;
5746 static jmethodID LDKMonitorEvent_HTLCEvent_meth = NULL;
5747 static jclass LDKMonitorEvent_HolderForceClosedWithInfo_class = NULL;
5748 static jmethodID LDKMonitorEvent_HolderForceClosedWithInfo_meth = NULL;
5749 static jclass LDKMonitorEvent_HolderForceClosed_class = NULL;
5750 static jmethodID LDKMonitorEvent_HolderForceClosed_meth = NULL;
5751 static jclass LDKMonitorEvent_Completed_class = NULL;
5752 static jmethodID LDKMonitorEvent_Completed_meth = NULL;
5753 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKMonitorEvent_init (JNIEnv *env, jclass clz) {
5754         LDKMonitorEvent_HTLCEvent_class =
5755                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMonitorEvent$HTLCEvent"));
5756         CHECK(LDKMonitorEvent_HTLCEvent_class != NULL);
5757         LDKMonitorEvent_HTLCEvent_meth = (*env)->GetMethodID(env, LDKMonitorEvent_HTLCEvent_class, "<init>", "(J)V");
5758         CHECK(LDKMonitorEvent_HTLCEvent_meth != NULL);
5759         LDKMonitorEvent_HolderForceClosedWithInfo_class =
5760                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMonitorEvent$HolderForceClosedWithInfo"));
5761         CHECK(LDKMonitorEvent_HolderForceClosedWithInfo_class != NULL);
5762         LDKMonitorEvent_HolderForceClosedWithInfo_meth = (*env)->GetMethodID(env, LDKMonitorEvent_HolderForceClosedWithInfo_class, "<init>", "(JJJ)V");
5763         CHECK(LDKMonitorEvent_HolderForceClosedWithInfo_meth != NULL);
5764         LDKMonitorEvent_HolderForceClosed_class =
5765                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMonitorEvent$HolderForceClosed"));
5766         CHECK(LDKMonitorEvent_HolderForceClosed_class != NULL);
5767         LDKMonitorEvent_HolderForceClosed_meth = (*env)->GetMethodID(env, LDKMonitorEvent_HolderForceClosed_class, "<init>", "(J)V");
5768         CHECK(LDKMonitorEvent_HolderForceClosed_meth != NULL);
5769         LDKMonitorEvent_Completed_class =
5770                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMonitorEvent$Completed"));
5771         CHECK(LDKMonitorEvent_Completed_class != NULL);
5772         LDKMonitorEvent_Completed_meth = (*env)->GetMethodID(env, LDKMonitorEvent_Completed_class, "<init>", "(JJJ)V");
5773         CHECK(LDKMonitorEvent_Completed_meth != NULL);
5774 }
5775 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKMonitorEvent_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
5776         LDKMonitorEvent *obj = (LDKMonitorEvent*)untag_ptr(ptr);
5777         switch(obj->tag) {
5778                 case LDKMonitorEvent_HTLCEvent: {
5779                         LDKHTLCUpdate htlc_event_var = obj->htlc_event;
5780                         int64_t htlc_event_ref = 0;
5781                         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_event_var);
5782                         htlc_event_ref = tag_ptr(htlc_event_var.inner, false);
5783                         return (*env)->NewObject(env, LDKMonitorEvent_HTLCEvent_class, LDKMonitorEvent_HTLCEvent_meth, htlc_event_ref);
5784                 }
5785                 case LDKMonitorEvent_HolderForceClosedWithInfo: {
5786                         int64_t reason_ref = tag_ptr(&obj->holder_force_closed_with_info.reason, false);
5787                         LDKOutPoint outpoint_var = obj->holder_force_closed_with_info.outpoint;
5788                         int64_t outpoint_ref = 0;
5789                         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_var);
5790                         outpoint_ref = tag_ptr(outpoint_var.inner, false);
5791                         LDKChannelId channel_id_var = obj->holder_force_closed_with_info.channel_id;
5792                         int64_t channel_id_ref = 0;
5793                         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_var);
5794                         channel_id_ref = tag_ptr(channel_id_var.inner, false);
5795                         return (*env)->NewObject(env, LDKMonitorEvent_HolderForceClosedWithInfo_class, LDKMonitorEvent_HolderForceClosedWithInfo_meth, reason_ref, outpoint_ref, channel_id_ref);
5796                 }
5797                 case LDKMonitorEvent_HolderForceClosed: {
5798                         LDKOutPoint holder_force_closed_var = obj->holder_force_closed;
5799                         int64_t holder_force_closed_ref = 0;
5800                         CHECK_INNER_FIELD_ACCESS_OR_NULL(holder_force_closed_var);
5801                         holder_force_closed_ref = tag_ptr(holder_force_closed_var.inner, false);
5802                         return (*env)->NewObject(env, LDKMonitorEvent_HolderForceClosed_class, LDKMonitorEvent_HolderForceClosed_meth, holder_force_closed_ref);
5803                 }
5804                 case LDKMonitorEvent_Completed: {
5805                         LDKOutPoint funding_txo_var = obj->completed.funding_txo;
5806                         int64_t funding_txo_ref = 0;
5807                         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_var);
5808                         funding_txo_ref = tag_ptr(funding_txo_var.inner, false);
5809                         LDKChannelId channel_id_var = obj->completed.channel_id;
5810                         int64_t channel_id_ref = 0;
5811                         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_var);
5812                         channel_id_ref = tag_ptr(channel_id_var.inner, false);
5813                         int64_t monitor_update_id_conv = obj->completed.monitor_update_id;
5814                         return (*env)->NewObject(env, LDKMonitorEvent_Completed_class, LDKMonitorEvent_Completed_meth, funding_txo_ref, channel_id_ref, monitor_update_id_conv);
5815                 }
5816                 default: abort();
5817         }
5818 }
5819 static inline LDKCVec_MonitorEventZ CVec_MonitorEventZ_clone(const LDKCVec_MonitorEventZ *orig) {
5820         LDKCVec_MonitorEventZ ret = { .data = MALLOC(sizeof(LDKMonitorEvent) * orig->datalen, "LDKCVec_MonitorEventZ clone bytes"), .datalen = orig->datalen };
5821         for (size_t i = 0; i < ret.datalen; i++) {
5822                 ret.data[i] = MonitorEvent_clone(&orig->data[i]);
5823         }
5824         return ret;
5825 }
5826 static inline struct LDKOutPoint C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ_get_a(LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ *NONNULL_PTR owner){
5827         LDKOutPoint ret = owner->a;
5828         ret.is_owned = false;
5829         return ret;
5830 }
5831 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C4Tuple_1OutPointChannelIdCVec_1MonitorEventZPublicKeyZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
5832         LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ* owner_conv = (LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ*)untag_ptr(owner);
5833         LDKOutPoint ret_var = C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ_get_a(owner_conv);
5834         int64_t ret_ref = 0;
5835         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5836         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5837         return ret_ref;
5838 }
5839
5840 static inline struct LDKChannelId C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ_get_b(LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ *NONNULL_PTR owner){
5841         LDKChannelId ret = owner->b;
5842         ret.is_owned = false;
5843         return ret;
5844 }
5845 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C4Tuple_1OutPointChannelIdCVec_1MonitorEventZPublicKeyZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
5846         LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ* owner_conv = (LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ*)untag_ptr(owner);
5847         LDKChannelId ret_var = C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ_get_b(owner_conv);
5848         int64_t ret_ref = 0;
5849         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5850         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5851         return ret_ref;
5852 }
5853
5854 static inline struct LDKCVec_MonitorEventZ C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ_get_c(LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ *NONNULL_PTR owner){
5855         return CVec_MonitorEventZ_clone(&owner->c);
5856 }
5857 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_C4Tuple_1OutPointChannelIdCVec_1MonitorEventZPublicKeyZ_1get_1c(JNIEnv *env, jclass clz, int64_t owner) {
5858         LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ* owner_conv = (LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ*)untag_ptr(owner);
5859         LDKCVec_MonitorEventZ ret_var = C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ_get_c(owner_conv);
5860         int64_tArray ret_arr = NULL;
5861         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
5862         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
5863         for (size_t o = 0; o < ret_var.datalen; o++) {
5864                 LDKMonitorEvent *ret_conv_14_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
5865                 *ret_conv_14_copy = ret_var.data[o];
5866                 int64_t ret_conv_14_ref = tag_ptr(ret_conv_14_copy, true);
5867                 ret_arr_ptr[o] = ret_conv_14_ref;
5868         }
5869         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
5870         FREE(ret_var.data);
5871         return ret_arr;
5872 }
5873
5874 static inline struct LDKPublicKey C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ_get_d(LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ *NONNULL_PTR owner){
5875         return owner->d;
5876 }
5877 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C4Tuple_1OutPointChannelIdCVec_1MonitorEventZPublicKeyZ_1get_1d(JNIEnv *env, jclass clz, int64_t owner) {
5878         LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ* owner_conv = (LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ*)untag_ptr(owner);
5879         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
5880         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ_get_d(owner_conv).compressed_form);
5881         return ret_arr;
5882 }
5883
5884 static inline LDKCVec_C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZZ CVec_C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZZ_clone(const LDKCVec_C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZZ *orig) {
5885         LDKCVec_C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZZ ret = { .data = MALLOC(sizeof(LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ) * orig->datalen, "LDKCVec_C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZZ clone bytes"), .datalen = orig->datalen };
5886         for (size_t i = 0; i < ret.datalen; i++) {
5887                 ret.data[i] = C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ_clone(&orig->data[i]);
5888         }
5889         return ret;
5890 }
5891 static inline struct LDKInitFeatures CResult_InitFeaturesDecodeErrorZ_get_ok(LDKCResult_InitFeaturesDecodeErrorZ *NONNULL_PTR owner){
5892         LDKInitFeatures ret = *owner->contents.result;
5893         ret.is_owned = false;
5894         return ret;
5895 }
5896 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5897         LDKCResult_InitFeaturesDecodeErrorZ* owner_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)untag_ptr(owner);
5898         LDKInitFeatures ret_var = CResult_InitFeaturesDecodeErrorZ_get_ok(owner_conv);
5899         int64_t ret_ref = 0;
5900         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5901         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5902         return ret_ref;
5903 }
5904
5905 static inline struct LDKDecodeError CResult_InitFeaturesDecodeErrorZ_get_err(LDKCResult_InitFeaturesDecodeErrorZ *NONNULL_PTR owner){
5906 CHECK(!owner->result_ok);
5907         return DecodeError_clone(&*owner->contents.err);
5908 }
5909 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5910         LDKCResult_InitFeaturesDecodeErrorZ* owner_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)untag_ptr(owner);
5911         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
5912         *ret_copy = CResult_InitFeaturesDecodeErrorZ_get_err(owner_conv);
5913         int64_t ret_ref = tag_ptr(ret_copy, true);
5914         return ret_ref;
5915 }
5916
5917 static inline struct LDKChannelFeatures CResult_ChannelFeaturesDecodeErrorZ_get_ok(LDKCResult_ChannelFeaturesDecodeErrorZ *NONNULL_PTR owner){
5918         LDKChannelFeatures ret = *owner->contents.result;
5919         ret.is_owned = false;
5920         return ret;
5921 }
5922 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5923         LDKCResult_ChannelFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)untag_ptr(owner);
5924         LDKChannelFeatures ret_var = CResult_ChannelFeaturesDecodeErrorZ_get_ok(owner_conv);
5925         int64_t ret_ref = 0;
5926         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5927         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5928         return ret_ref;
5929 }
5930
5931 static inline struct LDKDecodeError CResult_ChannelFeaturesDecodeErrorZ_get_err(LDKCResult_ChannelFeaturesDecodeErrorZ *NONNULL_PTR owner){
5932 CHECK(!owner->result_ok);
5933         return DecodeError_clone(&*owner->contents.err);
5934 }
5935 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5936         LDKCResult_ChannelFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)untag_ptr(owner);
5937         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
5938         *ret_copy = CResult_ChannelFeaturesDecodeErrorZ_get_err(owner_conv);
5939         int64_t ret_ref = tag_ptr(ret_copy, true);
5940         return ret_ref;
5941 }
5942
5943 static inline struct LDKNodeFeatures CResult_NodeFeaturesDecodeErrorZ_get_ok(LDKCResult_NodeFeaturesDecodeErrorZ *NONNULL_PTR owner){
5944         LDKNodeFeatures ret = *owner->contents.result;
5945         ret.is_owned = false;
5946         return ret;
5947 }
5948 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5949         LDKCResult_NodeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)untag_ptr(owner);
5950         LDKNodeFeatures ret_var = CResult_NodeFeaturesDecodeErrorZ_get_ok(owner_conv);
5951         int64_t ret_ref = 0;
5952         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5953         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5954         return ret_ref;
5955 }
5956
5957 static inline struct LDKDecodeError CResult_NodeFeaturesDecodeErrorZ_get_err(LDKCResult_NodeFeaturesDecodeErrorZ *NONNULL_PTR owner){
5958 CHECK(!owner->result_ok);
5959         return DecodeError_clone(&*owner->contents.err);
5960 }
5961 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5962         LDKCResult_NodeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)untag_ptr(owner);
5963         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
5964         *ret_copy = CResult_NodeFeaturesDecodeErrorZ_get_err(owner_conv);
5965         int64_t ret_ref = tag_ptr(ret_copy, true);
5966         return ret_ref;
5967 }
5968
5969 static inline struct LDKBolt11InvoiceFeatures CResult_Bolt11InvoiceFeaturesDecodeErrorZ_get_ok(LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ *NONNULL_PTR owner){
5970         LDKBolt11InvoiceFeatures ret = *owner->contents.result;
5971         ret.is_owned = false;
5972         return ret;
5973 }
5974 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceFeaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
5975         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* owner_conv = (LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ*)untag_ptr(owner);
5976         LDKBolt11InvoiceFeatures ret_var = CResult_Bolt11InvoiceFeaturesDecodeErrorZ_get_ok(owner_conv);
5977         int64_t ret_ref = 0;
5978         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
5979         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
5980         return ret_ref;
5981 }
5982
5983 static inline struct LDKDecodeError CResult_Bolt11InvoiceFeaturesDecodeErrorZ_get_err(LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ *NONNULL_PTR owner){
5984 CHECK(!owner->result_ok);
5985         return DecodeError_clone(&*owner->contents.err);
5986 }
5987 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
5988         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* owner_conv = (LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ*)untag_ptr(owner);
5989         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
5990         *ret_copy = CResult_Bolt11InvoiceFeaturesDecodeErrorZ_get_err(owner_conv);
5991         int64_t ret_ref = tag_ptr(ret_copy, true);
5992         return ret_ref;
5993 }
5994
5995 static inline struct LDKBolt12InvoiceFeatures CResult_Bolt12InvoiceFeaturesDecodeErrorZ_get_ok(LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ *NONNULL_PTR owner){
5996         LDKBolt12InvoiceFeatures ret = *owner->contents.result;
5997         ret.is_owned = false;
5998         return ret;
5999 }
6000 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt12InvoiceFeaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6001         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* owner_conv = (LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ*)untag_ptr(owner);
6002         LDKBolt12InvoiceFeatures ret_var = CResult_Bolt12InvoiceFeaturesDecodeErrorZ_get_ok(owner_conv);
6003         int64_t ret_ref = 0;
6004         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6005         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6006         return ret_ref;
6007 }
6008
6009 static inline struct LDKDecodeError CResult_Bolt12InvoiceFeaturesDecodeErrorZ_get_err(LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ *NONNULL_PTR owner){
6010 CHECK(!owner->result_ok);
6011         return DecodeError_clone(&*owner->contents.err);
6012 }
6013 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt12InvoiceFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6014         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* owner_conv = (LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ*)untag_ptr(owner);
6015         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
6016         *ret_copy = CResult_Bolt12InvoiceFeaturesDecodeErrorZ_get_err(owner_conv);
6017         int64_t ret_ref = tag_ptr(ret_copy, true);
6018         return ret_ref;
6019 }
6020
6021 static inline struct LDKBlindedHopFeatures CResult_BlindedHopFeaturesDecodeErrorZ_get_ok(LDKCResult_BlindedHopFeaturesDecodeErrorZ *NONNULL_PTR owner){
6022         LDKBlindedHopFeatures ret = *owner->contents.result;
6023         ret.is_owned = false;
6024         return ret;
6025 }
6026 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedHopFeaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6027         LDKCResult_BlindedHopFeaturesDecodeErrorZ* owner_conv = (LDKCResult_BlindedHopFeaturesDecodeErrorZ*)untag_ptr(owner);
6028         LDKBlindedHopFeatures ret_var = CResult_BlindedHopFeaturesDecodeErrorZ_get_ok(owner_conv);
6029         int64_t ret_ref = 0;
6030         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6031         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6032         return ret_ref;
6033 }
6034
6035 static inline struct LDKDecodeError CResult_BlindedHopFeaturesDecodeErrorZ_get_err(LDKCResult_BlindedHopFeaturesDecodeErrorZ *NONNULL_PTR owner){
6036 CHECK(!owner->result_ok);
6037         return DecodeError_clone(&*owner->contents.err);
6038 }
6039 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedHopFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6040         LDKCResult_BlindedHopFeaturesDecodeErrorZ* owner_conv = (LDKCResult_BlindedHopFeaturesDecodeErrorZ*)untag_ptr(owner);
6041         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
6042         *ret_copy = CResult_BlindedHopFeaturesDecodeErrorZ_get_err(owner_conv);
6043         int64_t ret_ref = tag_ptr(ret_copy, true);
6044         return ret_ref;
6045 }
6046
6047 static inline struct LDKChannelTypeFeatures CResult_ChannelTypeFeaturesDecodeErrorZ_get_ok(LDKCResult_ChannelTypeFeaturesDecodeErrorZ *NONNULL_PTR owner){
6048         LDKChannelTypeFeatures ret = *owner->contents.result;
6049         ret.is_owned = false;
6050         return ret;
6051 }
6052 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTypeFeaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6053         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)untag_ptr(owner);
6054         LDKChannelTypeFeatures ret_var = CResult_ChannelTypeFeaturesDecodeErrorZ_get_ok(owner_conv);
6055         int64_t ret_ref = 0;
6056         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6057         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6058         return ret_ref;
6059 }
6060
6061 static inline struct LDKDecodeError CResult_ChannelTypeFeaturesDecodeErrorZ_get_err(LDKCResult_ChannelTypeFeaturesDecodeErrorZ *NONNULL_PTR owner){
6062 CHECK(!owner->result_ok);
6063         return DecodeError_clone(&*owner->contents.err);
6064 }
6065 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTypeFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6066         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)untag_ptr(owner);
6067         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
6068         *ret_copy = CResult_ChannelTypeFeaturesDecodeErrorZ_get_err(owner_conv);
6069         int64_t ret_ref = tag_ptr(ret_copy, true);
6070         return ret_ref;
6071 }
6072
6073 static inline struct LDKOfferId CResult_OfferIdDecodeErrorZ_get_ok(LDKCResult_OfferIdDecodeErrorZ *NONNULL_PTR owner){
6074         LDKOfferId ret = *owner->contents.result;
6075         ret.is_owned = false;
6076         return ret;
6077 }
6078 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OfferIdDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6079         LDKCResult_OfferIdDecodeErrorZ* owner_conv = (LDKCResult_OfferIdDecodeErrorZ*)untag_ptr(owner);
6080         LDKOfferId ret_var = CResult_OfferIdDecodeErrorZ_get_ok(owner_conv);
6081         int64_t ret_ref = 0;
6082         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6083         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6084         return ret_ref;
6085 }
6086
6087 static inline struct LDKDecodeError CResult_OfferIdDecodeErrorZ_get_err(LDKCResult_OfferIdDecodeErrorZ *NONNULL_PTR owner){
6088 CHECK(!owner->result_ok);
6089         return DecodeError_clone(&*owner->contents.err);
6090 }
6091 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OfferIdDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6092         LDKCResult_OfferIdDecodeErrorZ* owner_conv = (LDKCResult_OfferIdDecodeErrorZ*)untag_ptr(owner);
6093         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
6094         *ret_copy = CResult_OfferIdDecodeErrorZ_get_err(owner_conv);
6095         int64_t ret_ref = tag_ptr(ret_copy, true);
6096         return ret_ref;
6097 }
6098
6099 static inline void CResult_NoneBolt12SemanticErrorZ_get_ok(LDKCResult_NoneBolt12SemanticErrorZ *NONNULL_PTR owner){
6100 CHECK(owner->result_ok);
6101         return *owner->contents.result;
6102 }
6103 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneBolt12SemanticErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6104         LDKCResult_NoneBolt12SemanticErrorZ* owner_conv = (LDKCResult_NoneBolt12SemanticErrorZ*)untag_ptr(owner);
6105         CResult_NoneBolt12SemanticErrorZ_get_ok(owner_conv);
6106 }
6107
6108 static inline enum LDKBolt12SemanticError CResult_NoneBolt12SemanticErrorZ_get_err(LDKCResult_NoneBolt12SemanticErrorZ *NONNULL_PTR owner){
6109 CHECK(!owner->result_ok);
6110         return Bolt12SemanticError_clone(&*owner->contents.err);
6111 }
6112 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1NoneBolt12SemanticErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6113         LDKCResult_NoneBolt12SemanticErrorZ* owner_conv = (LDKCResult_NoneBolt12SemanticErrorZ*)untag_ptr(owner);
6114         jclass ret_conv = LDKBolt12SemanticError_to_java(env, CResult_NoneBolt12SemanticErrorZ_get_err(owner_conv));
6115         return ret_conv;
6116 }
6117
6118 static inline struct LDKOffer CResult_OfferBolt12SemanticErrorZ_get_ok(LDKCResult_OfferBolt12SemanticErrorZ *NONNULL_PTR owner){
6119         LDKOffer ret = *owner->contents.result;
6120         ret.is_owned = false;
6121         return ret;
6122 }
6123 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OfferBolt12SemanticErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6124         LDKCResult_OfferBolt12SemanticErrorZ* owner_conv = (LDKCResult_OfferBolt12SemanticErrorZ*)untag_ptr(owner);
6125         LDKOffer ret_var = CResult_OfferBolt12SemanticErrorZ_get_ok(owner_conv);
6126         int64_t ret_ref = 0;
6127         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6128         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6129         return ret_ref;
6130 }
6131
6132 static inline enum LDKBolt12SemanticError CResult_OfferBolt12SemanticErrorZ_get_err(LDKCResult_OfferBolt12SemanticErrorZ *NONNULL_PTR owner){
6133 CHECK(!owner->result_ok);
6134         return Bolt12SemanticError_clone(&*owner->contents.err);
6135 }
6136 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1OfferBolt12SemanticErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6137         LDKCResult_OfferBolt12SemanticErrorZ* owner_conv = (LDKCResult_OfferBolt12SemanticErrorZ*)untag_ptr(owner);
6138         jclass ret_conv = LDKBolt12SemanticError_to_java(env, CResult_OfferBolt12SemanticErrorZ_get_err(owner_conv));
6139         return ret_conv;
6140 }
6141
6142 static inline struct LDKInvoiceRequestWithDerivedPayerIdBuilder CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ_get_ok(LDKCResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ *NONNULL_PTR owner){
6143         LDKInvoiceRequestWithDerivedPayerIdBuilder ret = *owner->contents.result;
6144         ret.is_owned = false;
6145         return ret;
6146 }
6147 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6148         LDKCResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ* owner_conv = (LDKCResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ*)untag_ptr(owner);
6149         LDKInvoiceRequestWithDerivedPayerIdBuilder ret_var = CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ_get_ok(owner_conv);
6150         int64_t ret_ref = 0;
6151         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6152         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6153         return ret_ref;
6154 }
6155
6156 static inline enum LDKBolt12SemanticError CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ_get_err(LDKCResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ *NONNULL_PTR owner){
6157 CHECK(!owner->result_ok);
6158         return Bolt12SemanticError_clone(&*owner->contents.err);
6159 }
6160 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6161         LDKCResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ* owner_conv = (LDKCResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ*)untag_ptr(owner);
6162         jclass ret_conv = LDKBolt12SemanticError_to_java(env, CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ_get_err(owner_conv));
6163         return ret_conv;
6164 }
6165
6166 static inline struct LDKInvoiceRequestWithExplicitPayerIdBuilder CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ_get_ok(LDKCResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ *NONNULL_PTR owner){
6167         LDKInvoiceRequestWithExplicitPayerIdBuilder ret = *owner->contents.result;
6168         ret.is_owned = false;
6169         return ret;
6170 }
6171 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6172         LDKCResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ* owner_conv = (LDKCResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ*)untag_ptr(owner);
6173         LDKInvoiceRequestWithExplicitPayerIdBuilder ret_var = CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ_get_ok(owner_conv);
6174         int64_t ret_ref = 0;
6175         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6176         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6177         return ret_ref;
6178 }
6179
6180 static inline enum LDKBolt12SemanticError CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ_get_err(LDKCResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ *NONNULL_PTR owner){
6181 CHECK(!owner->result_ok);
6182         return Bolt12SemanticError_clone(&*owner->contents.err);
6183 }
6184 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6185         LDKCResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ* owner_conv = (LDKCResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ*)untag_ptr(owner);
6186         jclass ret_conv = LDKBolt12SemanticError_to_java(env, CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ_get_err(owner_conv));
6187         return ret_conv;
6188 }
6189
6190 static inline struct LDKOffer CResult_OfferBolt12ParseErrorZ_get_ok(LDKCResult_OfferBolt12ParseErrorZ *NONNULL_PTR owner){
6191         LDKOffer ret = *owner->contents.result;
6192         ret.is_owned = false;
6193         return ret;
6194 }
6195 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OfferBolt12ParseErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6196         LDKCResult_OfferBolt12ParseErrorZ* owner_conv = (LDKCResult_OfferBolt12ParseErrorZ*)untag_ptr(owner);
6197         LDKOffer ret_var = CResult_OfferBolt12ParseErrorZ_get_ok(owner_conv);
6198         int64_t ret_ref = 0;
6199         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6200         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6201         return ret_ref;
6202 }
6203
6204 static inline struct LDKBolt12ParseError CResult_OfferBolt12ParseErrorZ_get_err(LDKCResult_OfferBolt12ParseErrorZ *NONNULL_PTR owner){
6205         LDKBolt12ParseError ret = *owner->contents.err;
6206         ret.is_owned = false;
6207         return ret;
6208 }
6209 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OfferBolt12ParseErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6210         LDKCResult_OfferBolt12ParseErrorZ* owner_conv = (LDKCResult_OfferBolt12ParseErrorZ*)untag_ptr(owner);
6211         LDKBolt12ParseError ret_var = CResult_OfferBolt12ParseErrorZ_get_err(owner_conv);
6212         int64_t ret_ref = 0;
6213         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6214         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6215         return ret_ref;
6216 }
6217
6218 static inline struct LDKNodeId CResult_NodeIdDecodeErrorZ_get_ok(LDKCResult_NodeIdDecodeErrorZ *NONNULL_PTR owner){
6219         LDKNodeId ret = *owner->contents.result;
6220         ret.is_owned = false;
6221         return ret;
6222 }
6223 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeIdDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6224         LDKCResult_NodeIdDecodeErrorZ* owner_conv = (LDKCResult_NodeIdDecodeErrorZ*)untag_ptr(owner);
6225         LDKNodeId ret_var = CResult_NodeIdDecodeErrorZ_get_ok(owner_conv);
6226         int64_t ret_ref = 0;
6227         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6228         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6229         return ret_ref;
6230 }
6231
6232 static inline struct LDKDecodeError CResult_NodeIdDecodeErrorZ_get_err(LDKCResult_NodeIdDecodeErrorZ *NONNULL_PTR owner){
6233 CHECK(!owner->result_ok);
6234         return DecodeError_clone(&*owner->contents.err);
6235 }
6236 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeIdDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6237         LDKCResult_NodeIdDecodeErrorZ* owner_conv = (LDKCResult_NodeIdDecodeErrorZ*)untag_ptr(owner);
6238         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
6239         *ret_copy = CResult_NodeIdDecodeErrorZ_get_err(owner_conv);
6240         int64_t ret_ref = tag_ptr(ret_copy, true);
6241         return ret_ref;
6242 }
6243
6244 static inline struct LDKPublicKey CResult_PublicKeySecp256k1ErrorZ_get_ok(LDKCResult_PublicKeySecp256k1ErrorZ *NONNULL_PTR owner){
6245 CHECK(owner->result_ok);
6246         return *owner->contents.result;
6247 }
6248 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeySecp256k1ErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6249         LDKCResult_PublicKeySecp256k1ErrorZ* owner_conv = (LDKCResult_PublicKeySecp256k1ErrorZ*)untag_ptr(owner);
6250         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
6251         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, CResult_PublicKeySecp256k1ErrorZ_get_ok(owner_conv).compressed_form);
6252         return ret_arr;
6253 }
6254
6255 static inline enum LDKSecp256k1Error CResult_PublicKeySecp256k1ErrorZ_get_err(LDKCResult_PublicKeySecp256k1ErrorZ *NONNULL_PTR owner){
6256 CHECK(!owner->result_ok);
6257         return *owner->contents.err;
6258 }
6259 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeySecp256k1ErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6260         LDKCResult_PublicKeySecp256k1ErrorZ* owner_conv = (LDKCResult_PublicKeySecp256k1ErrorZ*)untag_ptr(owner);
6261         jclass ret_conv = LDKSecp256k1Error_to_java(env, CResult_PublicKeySecp256k1ErrorZ_get_err(owner_conv));
6262         return ret_conv;
6263 }
6264
6265 static jclass LDKNetworkUpdate_ChannelUpdateMessage_class = NULL;
6266 static jmethodID LDKNetworkUpdate_ChannelUpdateMessage_meth = NULL;
6267 static jclass LDKNetworkUpdate_ChannelFailure_class = NULL;
6268 static jmethodID LDKNetworkUpdate_ChannelFailure_meth = NULL;
6269 static jclass LDKNetworkUpdate_NodeFailure_class = NULL;
6270 static jmethodID LDKNetworkUpdate_NodeFailure_meth = NULL;
6271 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKNetworkUpdate_init (JNIEnv *env, jclass clz) {
6272         LDKNetworkUpdate_ChannelUpdateMessage_class =
6273                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKNetworkUpdate$ChannelUpdateMessage"));
6274         CHECK(LDKNetworkUpdate_ChannelUpdateMessage_class != NULL);
6275         LDKNetworkUpdate_ChannelUpdateMessage_meth = (*env)->GetMethodID(env, LDKNetworkUpdate_ChannelUpdateMessage_class, "<init>", "(J)V");
6276         CHECK(LDKNetworkUpdate_ChannelUpdateMessage_meth != NULL);
6277         LDKNetworkUpdate_ChannelFailure_class =
6278                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKNetworkUpdate$ChannelFailure"));
6279         CHECK(LDKNetworkUpdate_ChannelFailure_class != NULL);
6280         LDKNetworkUpdate_ChannelFailure_meth = (*env)->GetMethodID(env, LDKNetworkUpdate_ChannelFailure_class, "<init>", "(JZ)V");
6281         CHECK(LDKNetworkUpdate_ChannelFailure_meth != NULL);
6282         LDKNetworkUpdate_NodeFailure_class =
6283                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKNetworkUpdate$NodeFailure"));
6284         CHECK(LDKNetworkUpdate_NodeFailure_class != NULL);
6285         LDKNetworkUpdate_NodeFailure_meth = (*env)->GetMethodID(env, LDKNetworkUpdate_NodeFailure_class, "<init>", "([BZ)V");
6286         CHECK(LDKNetworkUpdate_NodeFailure_meth != NULL);
6287 }
6288 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKNetworkUpdate_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
6289         LDKNetworkUpdate *obj = (LDKNetworkUpdate*)untag_ptr(ptr);
6290         switch(obj->tag) {
6291                 case LDKNetworkUpdate_ChannelUpdateMessage: {
6292                         LDKChannelUpdate msg_var = obj->channel_update_message.msg;
6293                         int64_t msg_ref = 0;
6294                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6295                         msg_ref = tag_ptr(msg_var.inner, false);
6296                         return (*env)->NewObject(env, LDKNetworkUpdate_ChannelUpdateMessage_class, LDKNetworkUpdate_ChannelUpdateMessage_meth, msg_ref);
6297                 }
6298                 case LDKNetworkUpdate_ChannelFailure: {
6299                         int64_t short_channel_id_conv = obj->channel_failure.short_channel_id;
6300                         jboolean is_permanent_conv = obj->channel_failure.is_permanent;
6301                         return (*env)->NewObject(env, LDKNetworkUpdate_ChannelFailure_class, LDKNetworkUpdate_ChannelFailure_meth, short_channel_id_conv, is_permanent_conv);
6302                 }
6303                 case LDKNetworkUpdate_NodeFailure: {
6304                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
6305                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->node_failure.node_id.compressed_form);
6306                         jboolean is_permanent_conv = obj->node_failure.is_permanent;
6307                         return (*env)->NewObject(env, LDKNetworkUpdate_NodeFailure_class, LDKNetworkUpdate_NodeFailure_meth, node_id_arr, is_permanent_conv);
6308                 }
6309                 default: abort();
6310         }
6311 }
6312 static jclass LDKCOption_NetworkUpdateZ_Some_class = NULL;
6313 static jmethodID LDKCOption_NetworkUpdateZ_Some_meth = NULL;
6314 static jclass LDKCOption_NetworkUpdateZ_None_class = NULL;
6315 static jmethodID LDKCOption_NetworkUpdateZ_None_meth = NULL;
6316 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1NetworkUpdateZ_init (JNIEnv *env, jclass clz) {
6317         LDKCOption_NetworkUpdateZ_Some_class =
6318                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_NetworkUpdateZ$Some"));
6319         CHECK(LDKCOption_NetworkUpdateZ_Some_class != NULL);
6320         LDKCOption_NetworkUpdateZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_NetworkUpdateZ_Some_class, "<init>", "(J)V");
6321         CHECK(LDKCOption_NetworkUpdateZ_Some_meth != NULL);
6322         LDKCOption_NetworkUpdateZ_None_class =
6323                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_NetworkUpdateZ$None"));
6324         CHECK(LDKCOption_NetworkUpdateZ_None_class != NULL);
6325         LDKCOption_NetworkUpdateZ_None_meth = (*env)->GetMethodID(env, LDKCOption_NetworkUpdateZ_None_class, "<init>", "()V");
6326         CHECK(LDKCOption_NetworkUpdateZ_None_meth != NULL);
6327 }
6328 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1NetworkUpdateZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
6329         LDKCOption_NetworkUpdateZ *obj = (LDKCOption_NetworkUpdateZ*)untag_ptr(ptr);
6330         switch(obj->tag) {
6331                 case LDKCOption_NetworkUpdateZ_Some: {
6332                         int64_t some_ref = tag_ptr(&obj->some, false);
6333                         return (*env)->NewObject(env, LDKCOption_NetworkUpdateZ_Some_class, LDKCOption_NetworkUpdateZ_Some_meth, some_ref);
6334                 }
6335                 case LDKCOption_NetworkUpdateZ_None: {
6336                         return (*env)->NewObject(env, LDKCOption_NetworkUpdateZ_None_class, LDKCOption_NetworkUpdateZ_None_meth);
6337                 }
6338                 default: abort();
6339         }
6340 }
6341 static inline struct LDKCOption_NetworkUpdateZ CResult_COption_NetworkUpdateZDecodeErrorZ_get_ok(LDKCResult_COption_NetworkUpdateZDecodeErrorZ *NONNULL_PTR owner){
6342 CHECK(owner->result_ok);
6343         return COption_NetworkUpdateZ_clone(&*owner->contents.result);
6344 }
6345 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1NetworkUpdateZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6346         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* owner_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)untag_ptr(owner);
6347         LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
6348         *ret_copy = CResult_COption_NetworkUpdateZDecodeErrorZ_get_ok(owner_conv);
6349         int64_t ret_ref = tag_ptr(ret_copy, true);
6350         return ret_ref;
6351 }
6352
6353 static inline struct LDKDecodeError CResult_COption_NetworkUpdateZDecodeErrorZ_get_err(LDKCResult_COption_NetworkUpdateZDecodeErrorZ *NONNULL_PTR owner){
6354 CHECK(!owner->result_ok);
6355         return DecodeError_clone(&*owner->contents.err);
6356 }
6357 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1NetworkUpdateZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6358         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* owner_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)untag_ptr(owner);
6359         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
6360         *ret_copy = CResult_COption_NetworkUpdateZDecodeErrorZ_get_err(owner_conv);
6361         int64_t ret_ref = tag_ptr(ret_copy, true);
6362         return ret_ref;
6363 }
6364
6365 static inline struct LDKTxOut CResult_TxOutUtxoLookupErrorZ_get_ok(LDKCResult_TxOutUtxoLookupErrorZ *NONNULL_PTR owner){
6366 CHECK(owner->result_ok);
6367         return TxOut_clone(&*owner->contents.result);
6368 }
6369 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutUtxoLookupErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6370         LDKCResult_TxOutUtxoLookupErrorZ* owner_conv = (LDKCResult_TxOutUtxoLookupErrorZ*)untag_ptr(owner);
6371         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
6372         *ret_ref = CResult_TxOutUtxoLookupErrorZ_get_ok(owner_conv);
6373         return tag_ptr(ret_ref, true);
6374 }
6375
6376 static inline enum LDKUtxoLookupError CResult_TxOutUtxoLookupErrorZ_get_err(LDKCResult_TxOutUtxoLookupErrorZ *NONNULL_PTR owner){
6377 CHECK(!owner->result_ok);
6378         return UtxoLookupError_clone(&*owner->contents.err);
6379 }
6380 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutUtxoLookupErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6381         LDKCResult_TxOutUtxoLookupErrorZ* owner_conv = (LDKCResult_TxOutUtxoLookupErrorZ*)untag_ptr(owner);
6382         jclass ret_conv = LDKUtxoLookupError_to_java(env, CResult_TxOutUtxoLookupErrorZ_get_err(owner_conv));
6383         return ret_conv;
6384 }
6385
6386 static jclass LDKUtxoResult_Sync_class = NULL;
6387 static jmethodID LDKUtxoResult_Sync_meth = NULL;
6388 static jclass LDKUtxoResult_Async_class = NULL;
6389 static jmethodID LDKUtxoResult_Async_meth = NULL;
6390 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKUtxoResult_init (JNIEnv *env, jclass clz) {
6391         LDKUtxoResult_Sync_class =
6392                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKUtxoResult$Sync"));
6393         CHECK(LDKUtxoResult_Sync_class != NULL);
6394         LDKUtxoResult_Sync_meth = (*env)->GetMethodID(env, LDKUtxoResult_Sync_class, "<init>", "(J)V");
6395         CHECK(LDKUtxoResult_Sync_meth != NULL);
6396         LDKUtxoResult_Async_class =
6397                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKUtxoResult$Async"));
6398         CHECK(LDKUtxoResult_Async_class != NULL);
6399         LDKUtxoResult_Async_meth = (*env)->GetMethodID(env, LDKUtxoResult_Async_class, "<init>", "(J)V");
6400         CHECK(LDKUtxoResult_Async_meth != NULL);
6401 }
6402 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKUtxoResult_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
6403         LDKUtxoResult *obj = (LDKUtxoResult*)untag_ptr(ptr);
6404         switch(obj->tag) {
6405                 case LDKUtxoResult_Sync: {
6406                         LDKCResult_TxOutUtxoLookupErrorZ* sync_conv = MALLOC(sizeof(LDKCResult_TxOutUtxoLookupErrorZ), "LDKCResult_TxOutUtxoLookupErrorZ");
6407                         *sync_conv = obj->sync;
6408                         *sync_conv = CResult_TxOutUtxoLookupErrorZ_clone(sync_conv);
6409                         return (*env)->NewObject(env, LDKUtxoResult_Sync_class, LDKUtxoResult_Sync_meth, tag_ptr(sync_conv, true));
6410                 }
6411                 case LDKUtxoResult_Async: {
6412                         LDKUtxoFuture async_var = obj->async;
6413                         int64_t async_ref = 0;
6414                         CHECK_INNER_FIELD_ACCESS_OR_NULL(async_var);
6415                         async_ref = tag_ptr(async_var.inner, false);
6416                         return (*env)->NewObject(env, LDKUtxoResult_Async_class, LDKUtxoResult_Async_meth, async_ref);
6417                 }
6418                 default: abort();
6419         }
6420 }
6421 typedef struct LDKUtxoLookup_JCalls {
6422         atomic_size_t refcnt;
6423         JavaVM *vm;
6424         jweak o;
6425         jmethodID get_utxo_meth;
6426 } LDKUtxoLookup_JCalls;
6427 static void LDKUtxoLookup_JCalls_free(void* this_arg) {
6428         LDKUtxoLookup_JCalls *j_calls = (LDKUtxoLookup_JCalls*) this_arg;
6429         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6430                 JNIEnv *env;
6431                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6432                 if (get_jenv_res == JNI_EDETACHED) {
6433                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6434                 } else {
6435                         DO_ASSERT(get_jenv_res == JNI_OK);
6436                 }
6437                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
6438                 if (get_jenv_res == JNI_EDETACHED) {
6439                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6440                 }
6441                 FREE(j_calls);
6442         }
6443 }
6444 LDKUtxoResult get_utxo_LDKUtxoLookup_jcall(const void* this_arg, const uint8_t (* chain_hash)[32], uint64_t short_channel_id) {
6445         LDKUtxoLookup_JCalls *j_calls = (LDKUtxoLookup_JCalls*) this_arg;
6446         JNIEnv *env;
6447         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6448         if (get_jenv_res == JNI_EDETACHED) {
6449                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6450         } else {
6451                 DO_ASSERT(get_jenv_res == JNI_OK);
6452         }
6453         int8_tArray chain_hash_arr = (*env)->NewByteArray(env, 32);
6454         (*env)->SetByteArrayRegion(env, chain_hash_arr, 0, 32, *chain_hash);
6455         int64_t short_channel_id_conv = short_channel_id;
6456         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6457         CHECK(obj != NULL);
6458         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->get_utxo_meth, chain_hash_arr, short_channel_id_conv);
6459         if (UNLIKELY((*env)->ExceptionCheck(env))) {
6460                 (*env)->ExceptionDescribe(env);
6461                 (*env)->FatalError(env, "A call to get_utxo in LDKUtxoLookup from rust threw an exception.");
6462         }
6463         void* ret_ptr = untag_ptr(ret);
6464         CHECK_ACCESS(ret_ptr);
6465         LDKUtxoResult ret_conv = *(LDKUtxoResult*)(ret_ptr);
6466         FREE(untag_ptr(ret));
6467         if (get_jenv_res == JNI_EDETACHED) {
6468                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6469         }
6470         return ret_conv;
6471 }
6472 static void LDKUtxoLookup_JCalls_cloned(LDKUtxoLookup* new_obj) {
6473         LDKUtxoLookup_JCalls *j_calls = (LDKUtxoLookup_JCalls*) new_obj->this_arg;
6474         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6475 }
6476 static inline LDKUtxoLookup LDKUtxoLookup_init (JNIEnv *env, jclass clz, jobject o) {
6477         jclass c = (*env)->GetObjectClass(env, o);
6478         CHECK(c != NULL);
6479         LDKUtxoLookup_JCalls *calls = MALLOC(sizeof(LDKUtxoLookup_JCalls), "LDKUtxoLookup_JCalls");
6480         atomic_init(&calls->refcnt, 1);
6481         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
6482         calls->o = (*env)->NewWeakGlobalRef(env, o);
6483         calls->get_utxo_meth = (*env)->GetMethodID(env, c, "get_utxo", "([BJ)J");
6484         CHECK(calls->get_utxo_meth != NULL);
6485
6486         LDKUtxoLookup ret = {
6487                 .this_arg = (void*) calls,
6488                 .get_utxo = get_utxo_LDKUtxoLookup_jcall,
6489                 .free = LDKUtxoLookup_JCalls_free,
6490         };
6491         return ret;
6492 }
6493 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKUtxoLookup_1new(JNIEnv *env, jclass clz, jobject o) {
6494         LDKUtxoLookup *res_ptr = MALLOC(sizeof(LDKUtxoLookup), "LDKUtxoLookup");
6495         *res_ptr = LDKUtxoLookup_init(env, clz, o);
6496         return tag_ptr(res_ptr, true);
6497 }
6498 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) {
6499         void* this_arg_ptr = untag_ptr(this_arg);
6500         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
6501         LDKUtxoLookup* this_arg_conv = (LDKUtxoLookup*)this_arg_ptr;
6502         uint8_t chain_hash_arr[32];
6503         CHECK((*env)->GetArrayLength(env, chain_hash) == 32);
6504         (*env)->GetByteArrayRegion(env, chain_hash, 0, 32, chain_hash_arr);
6505         uint8_t (*chain_hash_ref)[32] = &chain_hash_arr;
6506         LDKUtxoResult *ret_copy = MALLOC(sizeof(LDKUtxoResult), "LDKUtxoResult");
6507         *ret_copy = (this_arg_conv->get_utxo)(this_arg_conv->this_arg, chain_hash_ref, short_channel_id);
6508         int64_t ret_ref = tag_ptr(ret_copy, true);
6509         return ret_ref;
6510 }
6511
6512 static jclass LDKCOption_UtxoLookupZ_Some_class = NULL;
6513 static jmethodID LDKCOption_UtxoLookupZ_Some_meth = NULL;
6514 static jclass LDKCOption_UtxoLookupZ_None_class = NULL;
6515 static jmethodID LDKCOption_UtxoLookupZ_None_meth = NULL;
6516 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1UtxoLookupZ_init (JNIEnv *env, jclass clz) {
6517         LDKCOption_UtxoLookupZ_Some_class =
6518                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_UtxoLookupZ$Some"));
6519         CHECK(LDKCOption_UtxoLookupZ_Some_class != NULL);
6520         LDKCOption_UtxoLookupZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_UtxoLookupZ_Some_class, "<init>", "(J)V");
6521         CHECK(LDKCOption_UtxoLookupZ_Some_meth != NULL);
6522         LDKCOption_UtxoLookupZ_None_class =
6523                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_UtxoLookupZ$None"));
6524         CHECK(LDKCOption_UtxoLookupZ_None_class != NULL);
6525         LDKCOption_UtxoLookupZ_None_meth = (*env)->GetMethodID(env, LDKCOption_UtxoLookupZ_None_class, "<init>", "()V");
6526         CHECK(LDKCOption_UtxoLookupZ_None_meth != NULL);
6527 }
6528 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1UtxoLookupZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
6529         LDKCOption_UtxoLookupZ *obj = (LDKCOption_UtxoLookupZ*)untag_ptr(ptr);
6530         switch(obj->tag) {
6531                 case LDKCOption_UtxoLookupZ_Some: {
6532                         LDKUtxoLookup* some_ret = MALLOC(sizeof(LDKUtxoLookup), "LDKUtxoLookup");
6533                         *some_ret = obj->some;
6534                         // WARNING: We likely need to clone here, but no clone is available, so we just do it for Java instances
6535                         if ((*some_ret).free == LDKUtxoLookup_JCalls_free) {
6536                                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6537                                 LDKUtxoLookup_JCalls_cloned(&(*some_ret));
6538                         }
6539                         return (*env)->NewObject(env, LDKCOption_UtxoLookupZ_Some_class, LDKCOption_UtxoLookupZ_Some_meth, tag_ptr(some_ret, true));
6540                 }
6541                 case LDKCOption_UtxoLookupZ_None: {
6542                         return (*env)->NewObject(env, LDKCOption_UtxoLookupZ_None_class, LDKCOption_UtxoLookupZ_None_meth);
6543                 }
6544                 default: abort();
6545         }
6546 }
6547 static inline void CResult_NoneLightningErrorZ_get_ok(LDKCResult_NoneLightningErrorZ *NONNULL_PTR owner){
6548 CHECK(owner->result_ok);
6549         return *owner->contents.result;
6550 }
6551 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6552         LDKCResult_NoneLightningErrorZ* owner_conv = (LDKCResult_NoneLightningErrorZ*)untag_ptr(owner);
6553         CResult_NoneLightningErrorZ_get_ok(owner_conv);
6554 }
6555
6556 static inline struct LDKLightningError CResult_NoneLightningErrorZ_get_err(LDKCResult_NoneLightningErrorZ *NONNULL_PTR owner){
6557         LDKLightningError ret = *owner->contents.err;
6558         ret.is_owned = false;
6559         return ret;
6560 }
6561 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6562         LDKCResult_NoneLightningErrorZ* owner_conv = (LDKCResult_NoneLightningErrorZ*)untag_ptr(owner);
6563         LDKLightningError ret_var = CResult_NoneLightningErrorZ_get_err(owner_conv);
6564         int64_t ret_ref = 0;
6565         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6566         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6567         return ret_ref;
6568 }
6569
6570 static inline bool CResult_boolLightningErrorZ_get_ok(LDKCResult_boolLightningErrorZ *NONNULL_PTR owner){
6571 CHECK(owner->result_ok);
6572         return *owner->contents.result;
6573 }
6574 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
6575         LDKCResult_boolLightningErrorZ* owner_conv = (LDKCResult_boolLightningErrorZ*)untag_ptr(owner);
6576         jboolean ret_conv = CResult_boolLightningErrorZ_get_ok(owner_conv);
6577         return ret_conv;
6578 }
6579
6580 static inline struct LDKLightningError CResult_boolLightningErrorZ_get_err(LDKCResult_boolLightningErrorZ *NONNULL_PTR owner){
6581         LDKLightningError ret = *owner->contents.err;
6582         ret.is_owned = false;
6583         return ret;
6584 }
6585 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
6586         LDKCResult_boolLightningErrorZ* owner_conv = (LDKCResult_boolLightningErrorZ*)untag_ptr(owner);
6587         LDKLightningError ret_var = CResult_boolLightningErrorZ_get_err(owner_conv);
6588         int64_t ret_ref = 0;
6589         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6590         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6591         return ret_ref;
6592 }
6593
6594 static inline struct LDKChannelAnnouncement C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_a(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR owner){
6595         LDKChannelAnnouncement ret = owner->a;
6596         ret.is_owned = false;
6597         return ret;
6598 }
6599 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
6600         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* owner_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)untag_ptr(owner);
6601         LDKChannelAnnouncement ret_var = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_a(owner_conv);
6602         int64_t ret_ref = 0;
6603         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6604         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6605         return ret_ref;
6606 }
6607
6608 static inline struct LDKChannelUpdate C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_b(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR owner){
6609         LDKChannelUpdate ret = owner->b;
6610         ret.is_owned = false;
6611         return ret;
6612 }
6613 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
6614         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* owner_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)untag_ptr(owner);
6615         LDKChannelUpdate ret_var = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_b(owner_conv);
6616         int64_t ret_ref = 0;
6617         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6618         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6619         return ret_ref;
6620 }
6621
6622 static inline struct LDKChannelUpdate C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_c(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR owner){
6623         LDKChannelUpdate ret = owner->c;
6624         ret.is_owned = false;
6625         return ret;
6626 }
6627 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1get_1c(JNIEnv *env, jclass clz, int64_t owner) {
6628         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* owner_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)untag_ptr(owner);
6629         LDKChannelUpdate ret_var = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_c(owner_conv);
6630         int64_t ret_ref = 0;
6631         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
6632         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
6633         return ret_ref;
6634 }
6635
6636 static jclass LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Some_class = NULL;
6637 static jmethodID LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Some_meth = NULL;
6638 static jclass LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_None_class = NULL;
6639 static jmethodID LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_None_meth = NULL;
6640 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZZ_init (JNIEnv *env, jclass clz) {
6641         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Some_class =
6642                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ$Some"));
6643         CHECK(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Some_class != NULL);
6644         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Some_class, "<init>", "(J)V");
6645         CHECK(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Some_meth != NULL);
6646         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_None_class =
6647                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ$None"));
6648         CHECK(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_None_class != NULL);
6649         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_None_meth = (*env)->GetMethodID(env, LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_None_class, "<init>", "()V");
6650         CHECK(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_None_meth != NULL);
6651 }
6652 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
6653         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *obj = (LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ*)untag_ptr(ptr);
6654         switch(obj->tag) {
6655                 case LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Some: {
6656                         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* some_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
6657                         *some_conv = obj->some;
6658                         *some_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(some_conv);
6659                         return (*env)->NewObject(env, LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Some_class, LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Some_meth, tag_ptr(some_conv, true));
6660                 }
6661                 case LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_None: {
6662                         return (*env)->NewObject(env, LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_None_class, LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_None_meth);
6663                 }
6664                 default: abort();
6665         }
6666 }
6667 static jclass LDKErrorAction_DisconnectPeer_class = NULL;
6668 static jmethodID LDKErrorAction_DisconnectPeer_meth = NULL;
6669 static jclass LDKErrorAction_DisconnectPeerWithWarning_class = NULL;
6670 static jmethodID LDKErrorAction_DisconnectPeerWithWarning_meth = NULL;
6671 static jclass LDKErrorAction_IgnoreError_class = NULL;
6672 static jmethodID LDKErrorAction_IgnoreError_meth = NULL;
6673 static jclass LDKErrorAction_IgnoreAndLog_class = NULL;
6674 static jmethodID LDKErrorAction_IgnoreAndLog_meth = NULL;
6675 static jclass LDKErrorAction_IgnoreDuplicateGossip_class = NULL;
6676 static jmethodID LDKErrorAction_IgnoreDuplicateGossip_meth = NULL;
6677 static jclass LDKErrorAction_SendErrorMessage_class = NULL;
6678 static jmethodID LDKErrorAction_SendErrorMessage_meth = NULL;
6679 static jclass LDKErrorAction_SendWarningMessage_class = NULL;
6680 static jmethodID LDKErrorAction_SendWarningMessage_meth = NULL;
6681 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKErrorAction_init (JNIEnv *env, jclass clz) {
6682         LDKErrorAction_DisconnectPeer_class =
6683                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKErrorAction$DisconnectPeer"));
6684         CHECK(LDKErrorAction_DisconnectPeer_class != NULL);
6685         LDKErrorAction_DisconnectPeer_meth = (*env)->GetMethodID(env, LDKErrorAction_DisconnectPeer_class, "<init>", "(J)V");
6686         CHECK(LDKErrorAction_DisconnectPeer_meth != NULL);
6687         LDKErrorAction_DisconnectPeerWithWarning_class =
6688                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKErrorAction$DisconnectPeerWithWarning"));
6689         CHECK(LDKErrorAction_DisconnectPeerWithWarning_class != NULL);
6690         LDKErrorAction_DisconnectPeerWithWarning_meth = (*env)->GetMethodID(env, LDKErrorAction_DisconnectPeerWithWarning_class, "<init>", "(J)V");
6691         CHECK(LDKErrorAction_DisconnectPeerWithWarning_meth != NULL);
6692         LDKErrorAction_IgnoreError_class =
6693                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKErrorAction$IgnoreError"));
6694         CHECK(LDKErrorAction_IgnoreError_class != NULL);
6695         LDKErrorAction_IgnoreError_meth = (*env)->GetMethodID(env, LDKErrorAction_IgnoreError_class, "<init>", "()V");
6696         CHECK(LDKErrorAction_IgnoreError_meth != NULL);
6697         LDKErrorAction_IgnoreAndLog_class =
6698                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKErrorAction$IgnoreAndLog"));
6699         CHECK(LDKErrorAction_IgnoreAndLog_class != NULL);
6700         LDKErrorAction_IgnoreAndLog_meth = (*env)->GetMethodID(env, LDKErrorAction_IgnoreAndLog_class, "<init>", "(Lorg/ldk/enums/Level;)V");
6701         CHECK(LDKErrorAction_IgnoreAndLog_meth != NULL);
6702         LDKErrorAction_IgnoreDuplicateGossip_class =
6703                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKErrorAction$IgnoreDuplicateGossip"));
6704         CHECK(LDKErrorAction_IgnoreDuplicateGossip_class != NULL);
6705         LDKErrorAction_IgnoreDuplicateGossip_meth = (*env)->GetMethodID(env, LDKErrorAction_IgnoreDuplicateGossip_class, "<init>", "()V");
6706         CHECK(LDKErrorAction_IgnoreDuplicateGossip_meth != NULL);
6707         LDKErrorAction_SendErrorMessage_class =
6708                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKErrorAction$SendErrorMessage"));
6709         CHECK(LDKErrorAction_SendErrorMessage_class != NULL);
6710         LDKErrorAction_SendErrorMessage_meth = (*env)->GetMethodID(env, LDKErrorAction_SendErrorMessage_class, "<init>", "(J)V");
6711         CHECK(LDKErrorAction_SendErrorMessage_meth != NULL);
6712         LDKErrorAction_SendWarningMessage_class =
6713                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKErrorAction$SendWarningMessage"));
6714         CHECK(LDKErrorAction_SendWarningMessage_class != NULL);
6715         LDKErrorAction_SendWarningMessage_meth = (*env)->GetMethodID(env, LDKErrorAction_SendWarningMessage_class, "<init>", "(JLorg/ldk/enums/Level;)V");
6716         CHECK(LDKErrorAction_SendWarningMessage_meth != NULL);
6717 }
6718 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKErrorAction_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
6719         LDKErrorAction *obj = (LDKErrorAction*)untag_ptr(ptr);
6720         switch(obj->tag) {
6721                 case LDKErrorAction_DisconnectPeer: {
6722                         LDKErrorMessage msg_var = obj->disconnect_peer.msg;
6723                         int64_t msg_ref = 0;
6724                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6725                         msg_ref = tag_ptr(msg_var.inner, false);
6726                         return (*env)->NewObject(env, LDKErrorAction_DisconnectPeer_class, LDKErrorAction_DisconnectPeer_meth, msg_ref);
6727                 }
6728                 case LDKErrorAction_DisconnectPeerWithWarning: {
6729                         LDKWarningMessage msg_var = obj->disconnect_peer_with_warning.msg;
6730                         int64_t msg_ref = 0;
6731                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6732                         msg_ref = tag_ptr(msg_var.inner, false);
6733                         return (*env)->NewObject(env, LDKErrorAction_DisconnectPeerWithWarning_class, LDKErrorAction_DisconnectPeerWithWarning_meth, msg_ref);
6734                 }
6735                 case LDKErrorAction_IgnoreError: {
6736                         return (*env)->NewObject(env, LDKErrorAction_IgnoreError_class, LDKErrorAction_IgnoreError_meth);
6737                 }
6738                 case LDKErrorAction_IgnoreAndLog: {
6739                         jclass ignore_and_log_conv = LDKLevel_to_java(env, obj->ignore_and_log);
6740                         return (*env)->NewObject(env, LDKErrorAction_IgnoreAndLog_class, LDKErrorAction_IgnoreAndLog_meth, ignore_and_log_conv);
6741                 }
6742                 case LDKErrorAction_IgnoreDuplicateGossip: {
6743                         return (*env)->NewObject(env, LDKErrorAction_IgnoreDuplicateGossip_class, LDKErrorAction_IgnoreDuplicateGossip_meth);
6744                 }
6745                 case LDKErrorAction_SendErrorMessage: {
6746                         LDKErrorMessage msg_var = obj->send_error_message.msg;
6747                         int64_t msg_ref = 0;
6748                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6749                         msg_ref = tag_ptr(msg_var.inner, false);
6750                         return (*env)->NewObject(env, LDKErrorAction_SendErrorMessage_class, LDKErrorAction_SendErrorMessage_meth, msg_ref);
6751                 }
6752                 case LDKErrorAction_SendWarningMessage: {
6753                         LDKWarningMessage msg_var = obj->send_warning_message.msg;
6754                         int64_t msg_ref = 0;
6755                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
6756                         msg_ref = tag_ptr(msg_var.inner, false);
6757                         jclass log_level_conv = LDKLevel_to_java(env, obj->send_warning_message.log_level);
6758                         return (*env)->NewObject(env, LDKErrorAction_SendWarningMessage_class, LDKErrorAction_SendWarningMessage_meth, msg_ref, log_level_conv);
6759                 }
6760                 default: abort();
6761         }
6762 }
6763 static jclass LDKMessageSendEvent_SendAcceptChannel_class = NULL;
6764 static jmethodID LDKMessageSendEvent_SendAcceptChannel_meth = NULL;
6765 static jclass LDKMessageSendEvent_SendAcceptChannelV2_class = NULL;
6766 static jmethodID LDKMessageSendEvent_SendAcceptChannelV2_meth = NULL;
6767 static jclass LDKMessageSendEvent_SendOpenChannel_class = NULL;
6768 static jmethodID LDKMessageSendEvent_SendOpenChannel_meth = NULL;
6769 static jclass LDKMessageSendEvent_SendOpenChannelV2_class = NULL;
6770 static jmethodID LDKMessageSendEvent_SendOpenChannelV2_meth = NULL;
6771 static jclass LDKMessageSendEvent_SendFundingCreated_class = NULL;
6772 static jmethodID LDKMessageSendEvent_SendFundingCreated_meth = NULL;
6773 static jclass LDKMessageSendEvent_SendFundingSigned_class = NULL;
6774 static jmethodID LDKMessageSendEvent_SendFundingSigned_meth = NULL;
6775 static jclass LDKMessageSendEvent_SendStfu_class = NULL;
6776 static jmethodID LDKMessageSendEvent_SendStfu_meth = NULL;
6777 static jclass LDKMessageSendEvent_SendSplice_class = NULL;
6778 static jmethodID LDKMessageSendEvent_SendSplice_meth = NULL;
6779 static jclass LDKMessageSendEvent_SendSpliceAck_class = NULL;
6780 static jmethodID LDKMessageSendEvent_SendSpliceAck_meth = NULL;
6781 static jclass LDKMessageSendEvent_SendSpliceLocked_class = NULL;
6782 static jmethodID LDKMessageSendEvent_SendSpliceLocked_meth = NULL;
6783 static jclass LDKMessageSendEvent_SendTxAddInput_class = NULL;
6784 static jmethodID LDKMessageSendEvent_SendTxAddInput_meth = NULL;
6785 static jclass LDKMessageSendEvent_SendTxAddOutput_class = NULL;
6786 static jmethodID LDKMessageSendEvent_SendTxAddOutput_meth = NULL;
6787 static jclass LDKMessageSendEvent_SendTxRemoveInput_class = NULL;
6788 static jmethodID LDKMessageSendEvent_SendTxRemoveInput_meth = NULL;
6789 static jclass LDKMessageSendEvent_SendTxRemoveOutput_class = NULL;
6790 static jmethodID LDKMessageSendEvent_SendTxRemoveOutput_meth = NULL;
6791 static jclass LDKMessageSendEvent_SendTxComplete_class = NULL;
6792 static jmethodID LDKMessageSendEvent_SendTxComplete_meth = NULL;
6793 static jclass LDKMessageSendEvent_SendTxSignatures_class = NULL;
6794 static jmethodID LDKMessageSendEvent_SendTxSignatures_meth = NULL;
6795 static jclass LDKMessageSendEvent_SendTxInitRbf_class = NULL;
6796 static jmethodID LDKMessageSendEvent_SendTxInitRbf_meth = NULL;
6797 static jclass LDKMessageSendEvent_SendTxAckRbf_class = NULL;
6798 static jmethodID LDKMessageSendEvent_SendTxAckRbf_meth = NULL;
6799 static jclass LDKMessageSendEvent_SendTxAbort_class = NULL;
6800 static jmethodID LDKMessageSendEvent_SendTxAbort_meth = NULL;
6801 static jclass LDKMessageSendEvent_SendChannelReady_class = NULL;
6802 static jmethodID LDKMessageSendEvent_SendChannelReady_meth = NULL;
6803 static jclass LDKMessageSendEvent_SendAnnouncementSignatures_class = NULL;
6804 static jmethodID LDKMessageSendEvent_SendAnnouncementSignatures_meth = NULL;
6805 static jclass LDKMessageSendEvent_UpdateHTLCs_class = NULL;
6806 static jmethodID LDKMessageSendEvent_UpdateHTLCs_meth = NULL;
6807 static jclass LDKMessageSendEvent_SendRevokeAndACK_class = NULL;
6808 static jmethodID LDKMessageSendEvent_SendRevokeAndACK_meth = NULL;
6809 static jclass LDKMessageSendEvent_SendClosingSigned_class = NULL;
6810 static jmethodID LDKMessageSendEvent_SendClosingSigned_meth = NULL;
6811 static jclass LDKMessageSendEvent_SendShutdown_class = NULL;
6812 static jmethodID LDKMessageSendEvent_SendShutdown_meth = NULL;
6813 static jclass LDKMessageSendEvent_SendChannelReestablish_class = NULL;
6814 static jmethodID LDKMessageSendEvent_SendChannelReestablish_meth = NULL;
6815 static jclass LDKMessageSendEvent_SendChannelAnnouncement_class = NULL;
6816 static jmethodID LDKMessageSendEvent_SendChannelAnnouncement_meth = NULL;
6817 static jclass LDKMessageSendEvent_BroadcastChannelAnnouncement_class = NULL;
6818 static jmethodID LDKMessageSendEvent_BroadcastChannelAnnouncement_meth = NULL;
6819 static jclass LDKMessageSendEvent_BroadcastChannelUpdate_class = NULL;
6820 static jmethodID LDKMessageSendEvent_BroadcastChannelUpdate_meth = NULL;
6821 static jclass LDKMessageSendEvent_BroadcastNodeAnnouncement_class = NULL;
6822 static jmethodID LDKMessageSendEvent_BroadcastNodeAnnouncement_meth = NULL;
6823 static jclass LDKMessageSendEvent_SendChannelUpdate_class = NULL;
6824 static jmethodID LDKMessageSendEvent_SendChannelUpdate_meth = NULL;
6825 static jclass LDKMessageSendEvent_HandleError_class = NULL;
6826 static jmethodID LDKMessageSendEvent_HandleError_meth = NULL;
6827 static jclass LDKMessageSendEvent_SendChannelRangeQuery_class = NULL;
6828 static jmethodID LDKMessageSendEvent_SendChannelRangeQuery_meth = NULL;
6829 static jclass LDKMessageSendEvent_SendShortIdsQuery_class = NULL;
6830 static jmethodID LDKMessageSendEvent_SendShortIdsQuery_meth = NULL;
6831 static jclass LDKMessageSendEvent_SendReplyChannelRange_class = NULL;
6832 static jmethodID LDKMessageSendEvent_SendReplyChannelRange_meth = NULL;
6833 static jclass LDKMessageSendEvent_SendGossipTimestampFilter_class = NULL;
6834 static jmethodID LDKMessageSendEvent_SendGossipTimestampFilter_meth = NULL;
6835 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKMessageSendEvent_init (JNIEnv *env, jclass clz) {
6836         LDKMessageSendEvent_SendAcceptChannel_class =
6837                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendAcceptChannel"));
6838         CHECK(LDKMessageSendEvent_SendAcceptChannel_class != NULL);
6839         LDKMessageSendEvent_SendAcceptChannel_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendAcceptChannel_class, "<init>", "([BJ)V");
6840         CHECK(LDKMessageSendEvent_SendAcceptChannel_meth != NULL);
6841         LDKMessageSendEvent_SendAcceptChannelV2_class =
6842                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendAcceptChannelV2"));
6843         CHECK(LDKMessageSendEvent_SendAcceptChannelV2_class != NULL);
6844         LDKMessageSendEvent_SendAcceptChannelV2_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendAcceptChannelV2_class, "<init>", "([BJ)V");
6845         CHECK(LDKMessageSendEvent_SendAcceptChannelV2_meth != NULL);
6846         LDKMessageSendEvent_SendOpenChannel_class =
6847                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendOpenChannel"));
6848         CHECK(LDKMessageSendEvent_SendOpenChannel_class != NULL);
6849         LDKMessageSendEvent_SendOpenChannel_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendOpenChannel_class, "<init>", "([BJ)V");
6850         CHECK(LDKMessageSendEvent_SendOpenChannel_meth != NULL);
6851         LDKMessageSendEvent_SendOpenChannelV2_class =
6852                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendOpenChannelV2"));
6853         CHECK(LDKMessageSendEvent_SendOpenChannelV2_class != NULL);
6854         LDKMessageSendEvent_SendOpenChannelV2_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendOpenChannelV2_class, "<init>", "([BJ)V");
6855         CHECK(LDKMessageSendEvent_SendOpenChannelV2_meth != NULL);
6856         LDKMessageSendEvent_SendFundingCreated_class =
6857                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendFundingCreated"));
6858         CHECK(LDKMessageSendEvent_SendFundingCreated_class != NULL);
6859         LDKMessageSendEvent_SendFundingCreated_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendFundingCreated_class, "<init>", "([BJ)V");
6860         CHECK(LDKMessageSendEvent_SendFundingCreated_meth != NULL);
6861         LDKMessageSendEvent_SendFundingSigned_class =
6862                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendFundingSigned"));
6863         CHECK(LDKMessageSendEvent_SendFundingSigned_class != NULL);
6864         LDKMessageSendEvent_SendFundingSigned_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendFundingSigned_class, "<init>", "([BJ)V");
6865         CHECK(LDKMessageSendEvent_SendFundingSigned_meth != NULL);
6866         LDKMessageSendEvent_SendStfu_class =
6867                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendStfu"));
6868         CHECK(LDKMessageSendEvent_SendStfu_class != NULL);
6869         LDKMessageSendEvent_SendStfu_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendStfu_class, "<init>", "([BJ)V");
6870         CHECK(LDKMessageSendEvent_SendStfu_meth != NULL);
6871         LDKMessageSendEvent_SendSplice_class =
6872                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendSplice"));
6873         CHECK(LDKMessageSendEvent_SendSplice_class != NULL);
6874         LDKMessageSendEvent_SendSplice_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendSplice_class, "<init>", "([BJ)V");
6875         CHECK(LDKMessageSendEvent_SendSplice_meth != NULL);
6876         LDKMessageSendEvent_SendSpliceAck_class =
6877                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendSpliceAck"));
6878         CHECK(LDKMessageSendEvent_SendSpliceAck_class != NULL);
6879         LDKMessageSendEvent_SendSpliceAck_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendSpliceAck_class, "<init>", "([BJ)V");
6880         CHECK(LDKMessageSendEvent_SendSpliceAck_meth != NULL);
6881         LDKMessageSendEvent_SendSpliceLocked_class =
6882                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendSpliceLocked"));
6883         CHECK(LDKMessageSendEvent_SendSpliceLocked_class != NULL);
6884         LDKMessageSendEvent_SendSpliceLocked_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendSpliceLocked_class, "<init>", "([BJ)V");
6885         CHECK(LDKMessageSendEvent_SendSpliceLocked_meth != NULL);
6886         LDKMessageSendEvent_SendTxAddInput_class =
6887                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendTxAddInput"));
6888         CHECK(LDKMessageSendEvent_SendTxAddInput_class != NULL);
6889         LDKMessageSendEvent_SendTxAddInput_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendTxAddInput_class, "<init>", "([BJ)V");
6890         CHECK(LDKMessageSendEvent_SendTxAddInput_meth != NULL);
6891         LDKMessageSendEvent_SendTxAddOutput_class =
6892                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendTxAddOutput"));
6893         CHECK(LDKMessageSendEvent_SendTxAddOutput_class != NULL);
6894         LDKMessageSendEvent_SendTxAddOutput_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendTxAddOutput_class, "<init>", "([BJ)V");
6895         CHECK(LDKMessageSendEvent_SendTxAddOutput_meth != NULL);
6896         LDKMessageSendEvent_SendTxRemoveInput_class =
6897                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendTxRemoveInput"));
6898         CHECK(LDKMessageSendEvent_SendTxRemoveInput_class != NULL);
6899         LDKMessageSendEvent_SendTxRemoveInput_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendTxRemoveInput_class, "<init>", "([BJ)V");
6900         CHECK(LDKMessageSendEvent_SendTxRemoveInput_meth != NULL);
6901         LDKMessageSendEvent_SendTxRemoveOutput_class =
6902                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendTxRemoveOutput"));
6903         CHECK(LDKMessageSendEvent_SendTxRemoveOutput_class != NULL);
6904         LDKMessageSendEvent_SendTxRemoveOutput_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendTxRemoveOutput_class, "<init>", "([BJ)V");
6905         CHECK(LDKMessageSendEvent_SendTxRemoveOutput_meth != NULL);
6906         LDKMessageSendEvent_SendTxComplete_class =
6907                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendTxComplete"));
6908         CHECK(LDKMessageSendEvent_SendTxComplete_class != NULL);
6909         LDKMessageSendEvent_SendTxComplete_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendTxComplete_class, "<init>", "([BJ)V");
6910         CHECK(LDKMessageSendEvent_SendTxComplete_meth != NULL);
6911         LDKMessageSendEvent_SendTxSignatures_class =
6912                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendTxSignatures"));
6913         CHECK(LDKMessageSendEvent_SendTxSignatures_class != NULL);
6914         LDKMessageSendEvent_SendTxSignatures_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendTxSignatures_class, "<init>", "([BJ)V");
6915         CHECK(LDKMessageSendEvent_SendTxSignatures_meth != NULL);
6916         LDKMessageSendEvent_SendTxInitRbf_class =
6917                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendTxInitRbf"));
6918         CHECK(LDKMessageSendEvent_SendTxInitRbf_class != NULL);
6919         LDKMessageSendEvent_SendTxInitRbf_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendTxInitRbf_class, "<init>", "([BJ)V");
6920         CHECK(LDKMessageSendEvent_SendTxInitRbf_meth != NULL);
6921         LDKMessageSendEvent_SendTxAckRbf_class =
6922                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendTxAckRbf"));
6923         CHECK(LDKMessageSendEvent_SendTxAckRbf_class != NULL);
6924         LDKMessageSendEvent_SendTxAckRbf_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendTxAckRbf_class, "<init>", "([BJ)V");
6925         CHECK(LDKMessageSendEvent_SendTxAckRbf_meth != NULL);
6926         LDKMessageSendEvent_SendTxAbort_class =
6927                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendTxAbort"));
6928         CHECK(LDKMessageSendEvent_SendTxAbort_class != NULL);
6929         LDKMessageSendEvent_SendTxAbort_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendTxAbort_class, "<init>", "([BJ)V");
6930         CHECK(LDKMessageSendEvent_SendTxAbort_meth != NULL);
6931         LDKMessageSendEvent_SendChannelReady_class =
6932                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendChannelReady"));
6933         CHECK(LDKMessageSendEvent_SendChannelReady_class != NULL);
6934         LDKMessageSendEvent_SendChannelReady_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendChannelReady_class, "<init>", "([BJ)V");
6935         CHECK(LDKMessageSendEvent_SendChannelReady_meth != NULL);
6936         LDKMessageSendEvent_SendAnnouncementSignatures_class =
6937                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendAnnouncementSignatures"));
6938         CHECK(LDKMessageSendEvent_SendAnnouncementSignatures_class != NULL);
6939         LDKMessageSendEvent_SendAnnouncementSignatures_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendAnnouncementSignatures_class, "<init>", "([BJ)V");
6940         CHECK(LDKMessageSendEvent_SendAnnouncementSignatures_meth != NULL);
6941         LDKMessageSendEvent_UpdateHTLCs_class =
6942                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$UpdateHTLCs"));
6943         CHECK(LDKMessageSendEvent_UpdateHTLCs_class != NULL);
6944         LDKMessageSendEvent_UpdateHTLCs_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_UpdateHTLCs_class, "<init>", "([BJ)V");
6945         CHECK(LDKMessageSendEvent_UpdateHTLCs_meth != NULL);
6946         LDKMessageSendEvent_SendRevokeAndACK_class =
6947                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendRevokeAndACK"));
6948         CHECK(LDKMessageSendEvent_SendRevokeAndACK_class != NULL);
6949         LDKMessageSendEvent_SendRevokeAndACK_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendRevokeAndACK_class, "<init>", "([BJ)V");
6950         CHECK(LDKMessageSendEvent_SendRevokeAndACK_meth != NULL);
6951         LDKMessageSendEvent_SendClosingSigned_class =
6952                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendClosingSigned"));
6953         CHECK(LDKMessageSendEvent_SendClosingSigned_class != NULL);
6954         LDKMessageSendEvent_SendClosingSigned_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendClosingSigned_class, "<init>", "([BJ)V");
6955         CHECK(LDKMessageSendEvent_SendClosingSigned_meth != NULL);
6956         LDKMessageSendEvent_SendShutdown_class =
6957                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendShutdown"));
6958         CHECK(LDKMessageSendEvent_SendShutdown_class != NULL);
6959         LDKMessageSendEvent_SendShutdown_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendShutdown_class, "<init>", "([BJ)V");
6960         CHECK(LDKMessageSendEvent_SendShutdown_meth != NULL);
6961         LDKMessageSendEvent_SendChannelReestablish_class =
6962                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendChannelReestablish"));
6963         CHECK(LDKMessageSendEvent_SendChannelReestablish_class != NULL);
6964         LDKMessageSendEvent_SendChannelReestablish_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendChannelReestablish_class, "<init>", "([BJ)V");
6965         CHECK(LDKMessageSendEvent_SendChannelReestablish_meth != NULL);
6966         LDKMessageSendEvent_SendChannelAnnouncement_class =
6967                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendChannelAnnouncement"));
6968         CHECK(LDKMessageSendEvent_SendChannelAnnouncement_class != NULL);
6969         LDKMessageSendEvent_SendChannelAnnouncement_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendChannelAnnouncement_class, "<init>", "([BJJ)V");
6970         CHECK(LDKMessageSendEvent_SendChannelAnnouncement_meth != NULL);
6971         LDKMessageSendEvent_BroadcastChannelAnnouncement_class =
6972                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$BroadcastChannelAnnouncement"));
6973         CHECK(LDKMessageSendEvent_BroadcastChannelAnnouncement_class != NULL);
6974         LDKMessageSendEvent_BroadcastChannelAnnouncement_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_BroadcastChannelAnnouncement_class, "<init>", "(JJ)V");
6975         CHECK(LDKMessageSendEvent_BroadcastChannelAnnouncement_meth != NULL);
6976         LDKMessageSendEvent_BroadcastChannelUpdate_class =
6977                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$BroadcastChannelUpdate"));
6978         CHECK(LDKMessageSendEvent_BroadcastChannelUpdate_class != NULL);
6979         LDKMessageSendEvent_BroadcastChannelUpdate_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_BroadcastChannelUpdate_class, "<init>", "(J)V");
6980         CHECK(LDKMessageSendEvent_BroadcastChannelUpdate_meth != NULL);
6981         LDKMessageSendEvent_BroadcastNodeAnnouncement_class =
6982                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$BroadcastNodeAnnouncement"));
6983         CHECK(LDKMessageSendEvent_BroadcastNodeAnnouncement_class != NULL);
6984         LDKMessageSendEvent_BroadcastNodeAnnouncement_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_BroadcastNodeAnnouncement_class, "<init>", "(J)V");
6985         CHECK(LDKMessageSendEvent_BroadcastNodeAnnouncement_meth != NULL);
6986         LDKMessageSendEvent_SendChannelUpdate_class =
6987                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendChannelUpdate"));
6988         CHECK(LDKMessageSendEvent_SendChannelUpdate_class != NULL);
6989         LDKMessageSendEvent_SendChannelUpdate_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendChannelUpdate_class, "<init>", "([BJ)V");
6990         CHECK(LDKMessageSendEvent_SendChannelUpdate_meth != NULL);
6991         LDKMessageSendEvent_HandleError_class =
6992                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$HandleError"));
6993         CHECK(LDKMessageSendEvent_HandleError_class != NULL);
6994         LDKMessageSendEvent_HandleError_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_HandleError_class, "<init>", "([BJ)V");
6995         CHECK(LDKMessageSendEvent_HandleError_meth != NULL);
6996         LDKMessageSendEvent_SendChannelRangeQuery_class =
6997                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendChannelRangeQuery"));
6998         CHECK(LDKMessageSendEvent_SendChannelRangeQuery_class != NULL);
6999         LDKMessageSendEvent_SendChannelRangeQuery_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendChannelRangeQuery_class, "<init>", "([BJ)V");
7000         CHECK(LDKMessageSendEvent_SendChannelRangeQuery_meth != NULL);
7001         LDKMessageSendEvent_SendShortIdsQuery_class =
7002                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendShortIdsQuery"));
7003         CHECK(LDKMessageSendEvent_SendShortIdsQuery_class != NULL);
7004         LDKMessageSendEvent_SendShortIdsQuery_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendShortIdsQuery_class, "<init>", "([BJ)V");
7005         CHECK(LDKMessageSendEvent_SendShortIdsQuery_meth != NULL);
7006         LDKMessageSendEvent_SendReplyChannelRange_class =
7007                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendReplyChannelRange"));
7008         CHECK(LDKMessageSendEvent_SendReplyChannelRange_class != NULL);
7009         LDKMessageSendEvent_SendReplyChannelRange_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendReplyChannelRange_class, "<init>", "([BJ)V");
7010         CHECK(LDKMessageSendEvent_SendReplyChannelRange_meth != NULL);
7011         LDKMessageSendEvent_SendGossipTimestampFilter_class =
7012                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendGossipTimestampFilter"));
7013         CHECK(LDKMessageSendEvent_SendGossipTimestampFilter_class != NULL);
7014         LDKMessageSendEvent_SendGossipTimestampFilter_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendGossipTimestampFilter_class, "<init>", "([BJ)V");
7015         CHECK(LDKMessageSendEvent_SendGossipTimestampFilter_meth != NULL);
7016 }
7017 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKMessageSendEvent_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
7018         LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr);
7019         switch(obj->tag) {
7020                 case LDKMessageSendEvent_SendAcceptChannel: {
7021                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
7022                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_accept_channel.node_id.compressed_form);
7023                         LDKAcceptChannel msg_var = obj->send_accept_channel.msg;
7024                         int64_t msg_ref = 0;
7025                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
7026                         msg_ref = tag_ptr(msg_var.inner, false);
7027                         return (*env)->NewObject(env, LDKMessageSendEvent_SendAcceptChannel_class, LDKMessageSendEvent_SendAcceptChannel_meth, node_id_arr, msg_ref);
7028                 }
7029                 case LDKMessageSendEvent_SendAcceptChannelV2: {
7030                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
7031                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_accept_channel_v2.node_id.compressed_form);
7032                         LDKAcceptChannelV2 msg_var = obj->send_accept_channel_v2.msg;
7033                         int64_t msg_ref = 0;
7034                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
7035                         msg_ref = tag_ptr(msg_var.inner, false);
7036                         return (*env)->NewObject(env, LDKMessageSendEvent_SendAcceptChannelV2_class, LDKMessageSendEvent_SendAcceptChannelV2_meth, node_id_arr, msg_ref);
7037                 }
7038                 case LDKMessageSendEvent_SendOpenChannel: {
7039                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
7040                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_open_channel.node_id.compressed_form);
7041                         LDKOpenChannel msg_var = obj->send_open_channel.msg;
7042                         int64_t msg_ref = 0;
7043                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
7044                         msg_ref = tag_ptr(msg_var.inner, false);
7045                         return (*env)->NewObject(env, LDKMessageSendEvent_SendOpenChannel_class, LDKMessageSendEvent_SendOpenChannel_meth, node_id_arr, msg_ref);
7046                 }
7047                 case LDKMessageSendEvent_SendOpenChannelV2: {
7048                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
7049                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_open_channel_v2.node_id.compressed_form);
7050                         LDKOpenChannelV2 msg_var = obj->send_open_channel_v2.msg;
7051                         int64_t msg_ref = 0;
7052                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
7053                         msg_ref = tag_ptr(msg_var.inner, false);
7054                         return (*env)->NewObject(env, LDKMessageSendEvent_SendOpenChannelV2_class, LDKMessageSendEvent_SendOpenChannelV2_meth, node_id_arr, msg_ref);
7055                 }
7056                 case LDKMessageSendEvent_SendFundingCreated: {
7057                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
7058                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_funding_created.node_id.compressed_form);
7059                         LDKFundingCreated msg_var = obj->send_funding_created.msg;
7060                         int64_t msg_ref = 0;
7061                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
7062                         msg_ref = tag_ptr(msg_var.inner, false);
7063                         return (*env)->NewObject(env, LDKMessageSendEvent_SendFundingCreated_class, LDKMessageSendEvent_SendFundingCreated_meth, node_id_arr, msg_ref);
7064                 }
7065                 case LDKMessageSendEvent_SendFundingSigned: {
7066                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
7067                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_funding_signed.node_id.compressed_form);
7068                         LDKFundingSigned msg_var = obj->send_funding_signed.msg;
7069                         int64_t msg_ref = 0;
7070                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
7071                         msg_ref = tag_ptr(msg_var.inner, false);
7072                         return (*env)->NewObject(env, LDKMessageSendEvent_SendFundingSigned_class, LDKMessageSendEvent_SendFundingSigned_meth, node_id_arr, msg_ref);
7073                 }
7074                 case LDKMessageSendEvent_SendStfu: {
7075                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
7076                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_stfu.node_id.compressed_form);
7077                         LDKStfu msg_var = obj->send_stfu.msg;
7078                         int64_t msg_ref = 0;
7079                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
7080                         msg_ref = tag_ptr(msg_var.inner, false);
7081                         return (*env)->NewObject(env, LDKMessageSendEvent_SendStfu_class, LDKMessageSendEvent_SendStfu_meth, node_id_arr, msg_ref);
7082                 }
7083                 case LDKMessageSendEvent_SendSplice: {
7084                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
7085                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_splice.node_id.compressed_form);
7086                         LDKSplice msg_var = obj->send_splice.msg;
7087                         int64_t msg_ref = 0;
7088                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
7089                         msg_ref = tag_ptr(msg_var.inner, false);
7090                         return (*env)->NewObject(env, LDKMessageSendEvent_SendSplice_class, LDKMessageSendEvent_SendSplice_meth, node_id_arr, msg_ref);
7091                 }
7092                 case LDKMessageSendEvent_SendSpliceAck: {
7093                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
7094                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_splice_ack.node_id.compressed_form);
7095                         LDKSpliceAck msg_var = obj->send_splice_ack.msg;
7096                         int64_t msg_ref = 0;
7097                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
7098                         msg_ref = tag_ptr(msg_var.inner, false);
7099                         return (*env)->NewObject(env, LDKMessageSendEvent_SendSpliceAck_class, LDKMessageSendEvent_SendSpliceAck_meth, node_id_arr, msg_ref);
7100                 }
7101                 case LDKMessageSendEvent_SendSpliceLocked: {
7102                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
7103                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_splice_locked.node_id.compressed_form);
7104                         LDKSpliceLocked msg_var = obj->send_splice_locked.msg;
7105                         int64_t msg_ref = 0;
7106                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
7107                         msg_ref = tag_ptr(msg_var.inner, false);
7108                         return (*env)->NewObject(env, LDKMessageSendEvent_SendSpliceLocked_class, LDKMessageSendEvent_SendSpliceLocked_meth, node_id_arr, msg_ref);
7109                 }
7110                 case LDKMessageSendEvent_SendTxAddInput: {
7111                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
7112                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_tx_add_input.node_id.compressed_form);
7113                         LDKTxAddInput msg_var = obj->send_tx_add_input.msg;
7114                         int64_t msg_ref = 0;
7115                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
7116                         msg_ref = tag_ptr(msg_var.inner, false);
7117                         return (*env)->NewObject(env, LDKMessageSendEvent_SendTxAddInput_class, LDKMessageSendEvent_SendTxAddInput_meth, node_id_arr, msg_ref);
7118                 }
7119                 case LDKMessageSendEvent_SendTxAddOutput: {
7120                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
7121                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_tx_add_output.node_id.compressed_form);
7122                         LDKTxAddOutput msg_var = obj->send_tx_add_output.msg;
7123                         int64_t msg_ref = 0;
7124                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
7125                         msg_ref = tag_ptr(msg_var.inner, false);
7126                         return (*env)->NewObject(env, LDKMessageSendEvent_SendTxAddOutput_class, LDKMessageSendEvent_SendTxAddOutput_meth, node_id_arr, msg_ref);
7127                 }
7128                 case LDKMessageSendEvent_SendTxRemoveInput: {
7129                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
7130                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_tx_remove_input.node_id.compressed_form);
7131                         LDKTxRemoveInput msg_var = obj->send_tx_remove_input.msg;
7132                         int64_t msg_ref = 0;
7133                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
7134                         msg_ref = tag_ptr(msg_var.inner, false);
7135                         return (*env)->NewObject(env, LDKMessageSendEvent_SendTxRemoveInput_class, LDKMessageSendEvent_SendTxRemoveInput_meth, node_id_arr, msg_ref);
7136                 }
7137                 case LDKMessageSendEvent_SendTxRemoveOutput: {
7138                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
7139                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_tx_remove_output.node_id.compressed_form);
7140                         LDKTxRemoveOutput msg_var = obj->send_tx_remove_output.msg;
7141                         int64_t msg_ref = 0;
7142                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
7143                         msg_ref = tag_ptr(msg_var.inner, false);
7144                         return (*env)->NewObject(env, LDKMessageSendEvent_SendTxRemoveOutput_class, LDKMessageSendEvent_SendTxRemoveOutput_meth, node_id_arr, msg_ref);
7145                 }
7146                 case LDKMessageSendEvent_SendTxComplete: {
7147                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
7148                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_tx_complete.node_id.compressed_form);
7149                         LDKTxComplete msg_var = obj->send_tx_complete.msg;
7150                         int64_t msg_ref = 0;
7151                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
7152                         msg_ref = tag_ptr(msg_var.inner, false);
7153                         return (*env)->NewObject(env, LDKMessageSendEvent_SendTxComplete_class, LDKMessageSendEvent_SendTxComplete_meth, node_id_arr, msg_ref);
7154                 }
7155                 case LDKMessageSendEvent_SendTxSignatures: {
7156                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
7157                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_tx_signatures.node_id.compressed_form);
7158                         LDKTxSignatures msg_var = obj->send_tx_signatures.msg;
7159                         int64_t msg_ref = 0;
7160                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
7161                         msg_ref = tag_ptr(msg_var.inner, false);
7162                         return (*env)->NewObject(env, LDKMessageSendEvent_SendTxSignatures_class, LDKMessageSendEvent_SendTxSignatures_meth, node_id_arr, msg_ref);
7163                 }
7164                 case LDKMessageSendEvent_SendTxInitRbf: {
7165                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
7166                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_tx_init_rbf.node_id.compressed_form);
7167                         LDKTxInitRbf msg_var = obj->send_tx_init_rbf.msg;
7168                         int64_t msg_ref = 0;
7169                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
7170                         msg_ref = tag_ptr(msg_var.inner, false);
7171                         return (*env)->NewObject(env, LDKMessageSendEvent_SendTxInitRbf_class, LDKMessageSendEvent_SendTxInitRbf_meth, node_id_arr, msg_ref);
7172                 }
7173                 case LDKMessageSendEvent_SendTxAckRbf: {
7174                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
7175                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_tx_ack_rbf.node_id.compressed_form);
7176                         LDKTxAckRbf msg_var = obj->send_tx_ack_rbf.msg;
7177                         int64_t msg_ref = 0;
7178                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
7179                         msg_ref = tag_ptr(msg_var.inner, false);
7180                         return (*env)->NewObject(env, LDKMessageSendEvent_SendTxAckRbf_class, LDKMessageSendEvent_SendTxAckRbf_meth, node_id_arr, msg_ref);
7181                 }
7182                 case LDKMessageSendEvent_SendTxAbort: {
7183                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
7184                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_tx_abort.node_id.compressed_form);
7185                         LDKTxAbort msg_var = obj->send_tx_abort.msg;
7186                         int64_t msg_ref = 0;
7187                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
7188                         msg_ref = tag_ptr(msg_var.inner, false);
7189                         return (*env)->NewObject(env, LDKMessageSendEvent_SendTxAbort_class, LDKMessageSendEvent_SendTxAbort_meth, node_id_arr, msg_ref);
7190                 }
7191                 case LDKMessageSendEvent_SendChannelReady: {
7192                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
7193                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_channel_ready.node_id.compressed_form);
7194                         LDKChannelReady msg_var = obj->send_channel_ready.msg;
7195                         int64_t msg_ref = 0;
7196                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
7197                         msg_ref = tag_ptr(msg_var.inner, false);
7198                         return (*env)->NewObject(env, LDKMessageSendEvent_SendChannelReady_class, LDKMessageSendEvent_SendChannelReady_meth, node_id_arr, msg_ref);
7199                 }
7200                 case LDKMessageSendEvent_SendAnnouncementSignatures: {
7201                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
7202                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_announcement_signatures.node_id.compressed_form);
7203                         LDKAnnouncementSignatures msg_var = obj->send_announcement_signatures.msg;
7204                         int64_t msg_ref = 0;
7205                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
7206                         msg_ref = tag_ptr(msg_var.inner, false);
7207                         return (*env)->NewObject(env, LDKMessageSendEvent_SendAnnouncementSignatures_class, LDKMessageSendEvent_SendAnnouncementSignatures_meth, node_id_arr, msg_ref);
7208                 }
7209                 case LDKMessageSendEvent_UpdateHTLCs: {
7210                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
7211                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->update_htl_cs.node_id.compressed_form);
7212                         LDKCommitmentUpdate updates_var = obj->update_htl_cs.updates;
7213                         int64_t updates_ref = 0;
7214                         CHECK_INNER_FIELD_ACCESS_OR_NULL(updates_var);
7215                         updates_ref = tag_ptr(updates_var.inner, false);
7216                         return (*env)->NewObject(env, LDKMessageSendEvent_UpdateHTLCs_class, LDKMessageSendEvent_UpdateHTLCs_meth, node_id_arr, updates_ref);
7217                 }
7218                 case LDKMessageSendEvent_SendRevokeAndACK: {
7219                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
7220                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_revoke_and_ack.node_id.compressed_form);
7221                         LDKRevokeAndACK msg_var = obj->send_revoke_and_ack.msg;
7222                         int64_t msg_ref = 0;
7223                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
7224                         msg_ref = tag_ptr(msg_var.inner, false);
7225                         return (*env)->NewObject(env, LDKMessageSendEvent_SendRevokeAndACK_class, LDKMessageSendEvent_SendRevokeAndACK_meth, node_id_arr, msg_ref);
7226                 }
7227                 case LDKMessageSendEvent_SendClosingSigned: {
7228                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
7229                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_closing_signed.node_id.compressed_form);
7230                         LDKClosingSigned msg_var = obj->send_closing_signed.msg;
7231                         int64_t msg_ref = 0;
7232                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
7233                         msg_ref = tag_ptr(msg_var.inner, false);
7234                         return (*env)->NewObject(env, LDKMessageSendEvent_SendClosingSigned_class, LDKMessageSendEvent_SendClosingSigned_meth, node_id_arr, msg_ref);
7235                 }
7236                 case LDKMessageSendEvent_SendShutdown: {
7237                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
7238                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_shutdown.node_id.compressed_form);
7239                         LDKShutdown msg_var = obj->send_shutdown.msg;
7240                         int64_t msg_ref = 0;
7241                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
7242                         msg_ref = tag_ptr(msg_var.inner, false);
7243                         return (*env)->NewObject(env, LDKMessageSendEvent_SendShutdown_class, LDKMessageSendEvent_SendShutdown_meth, node_id_arr, msg_ref);
7244                 }
7245                 case LDKMessageSendEvent_SendChannelReestablish: {
7246                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
7247                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_channel_reestablish.node_id.compressed_form);
7248                         LDKChannelReestablish msg_var = obj->send_channel_reestablish.msg;
7249                         int64_t msg_ref = 0;
7250                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
7251                         msg_ref = tag_ptr(msg_var.inner, false);
7252                         return (*env)->NewObject(env, LDKMessageSendEvent_SendChannelReestablish_class, LDKMessageSendEvent_SendChannelReestablish_meth, node_id_arr, msg_ref);
7253                 }
7254                 case LDKMessageSendEvent_SendChannelAnnouncement: {
7255                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
7256                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_channel_announcement.node_id.compressed_form);
7257                         LDKChannelAnnouncement msg_var = obj->send_channel_announcement.msg;
7258                         int64_t msg_ref = 0;
7259                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
7260                         msg_ref = tag_ptr(msg_var.inner, false);
7261                         LDKChannelUpdate update_msg_var = obj->send_channel_announcement.update_msg;
7262                         int64_t update_msg_ref = 0;
7263                         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_msg_var);
7264                         update_msg_ref = tag_ptr(update_msg_var.inner, false);
7265                         return (*env)->NewObject(env, LDKMessageSendEvent_SendChannelAnnouncement_class, LDKMessageSendEvent_SendChannelAnnouncement_meth, node_id_arr, msg_ref, update_msg_ref);
7266                 }
7267                 case LDKMessageSendEvent_BroadcastChannelAnnouncement: {
7268                         LDKChannelAnnouncement msg_var = obj->broadcast_channel_announcement.msg;
7269                         int64_t msg_ref = 0;
7270                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
7271                         msg_ref = tag_ptr(msg_var.inner, false);
7272                         LDKChannelUpdate update_msg_var = obj->broadcast_channel_announcement.update_msg;
7273                         int64_t update_msg_ref = 0;
7274                         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_msg_var);
7275                         update_msg_ref = tag_ptr(update_msg_var.inner, false);
7276                         return (*env)->NewObject(env, LDKMessageSendEvent_BroadcastChannelAnnouncement_class, LDKMessageSendEvent_BroadcastChannelAnnouncement_meth, msg_ref, update_msg_ref);
7277                 }
7278                 case LDKMessageSendEvent_BroadcastChannelUpdate: {
7279                         LDKChannelUpdate msg_var = obj->broadcast_channel_update.msg;
7280                         int64_t msg_ref = 0;
7281                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
7282                         msg_ref = tag_ptr(msg_var.inner, false);
7283                         return (*env)->NewObject(env, LDKMessageSendEvent_BroadcastChannelUpdate_class, LDKMessageSendEvent_BroadcastChannelUpdate_meth, msg_ref);
7284                 }
7285                 case LDKMessageSendEvent_BroadcastNodeAnnouncement: {
7286                         LDKNodeAnnouncement msg_var = obj->broadcast_node_announcement.msg;
7287                         int64_t msg_ref = 0;
7288                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
7289                         msg_ref = tag_ptr(msg_var.inner, false);
7290                         return (*env)->NewObject(env, LDKMessageSendEvent_BroadcastNodeAnnouncement_class, LDKMessageSendEvent_BroadcastNodeAnnouncement_meth, msg_ref);
7291                 }
7292                 case LDKMessageSendEvent_SendChannelUpdate: {
7293                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
7294                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_channel_update.node_id.compressed_form);
7295                         LDKChannelUpdate msg_var = obj->send_channel_update.msg;
7296                         int64_t msg_ref = 0;
7297                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
7298                         msg_ref = tag_ptr(msg_var.inner, false);
7299                         return (*env)->NewObject(env, LDKMessageSendEvent_SendChannelUpdate_class, LDKMessageSendEvent_SendChannelUpdate_meth, node_id_arr, msg_ref);
7300                 }
7301                 case LDKMessageSendEvent_HandleError: {
7302                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
7303                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->handle_error.node_id.compressed_form);
7304                         int64_t action_ref = tag_ptr(&obj->handle_error.action, false);
7305                         return (*env)->NewObject(env, LDKMessageSendEvent_HandleError_class, LDKMessageSendEvent_HandleError_meth, node_id_arr, action_ref);
7306                 }
7307                 case LDKMessageSendEvent_SendChannelRangeQuery: {
7308                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
7309                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_channel_range_query.node_id.compressed_form);
7310                         LDKQueryChannelRange msg_var = obj->send_channel_range_query.msg;
7311                         int64_t msg_ref = 0;
7312                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
7313                         msg_ref = tag_ptr(msg_var.inner, false);
7314                         return (*env)->NewObject(env, LDKMessageSendEvent_SendChannelRangeQuery_class, LDKMessageSendEvent_SendChannelRangeQuery_meth, node_id_arr, msg_ref);
7315                 }
7316                 case LDKMessageSendEvent_SendShortIdsQuery: {
7317                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
7318                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_short_ids_query.node_id.compressed_form);
7319                         LDKQueryShortChannelIds msg_var = obj->send_short_ids_query.msg;
7320                         int64_t msg_ref = 0;
7321                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
7322                         msg_ref = tag_ptr(msg_var.inner, false);
7323                         return (*env)->NewObject(env, LDKMessageSendEvent_SendShortIdsQuery_class, LDKMessageSendEvent_SendShortIdsQuery_meth, node_id_arr, msg_ref);
7324                 }
7325                 case LDKMessageSendEvent_SendReplyChannelRange: {
7326                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
7327                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_reply_channel_range.node_id.compressed_form);
7328                         LDKReplyChannelRange msg_var = obj->send_reply_channel_range.msg;
7329                         int64_t msg_ref = 0;
7330                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
7331                         msg_ref = tag_ptr(msg_var.inner, false);
7332                         return (*env)->NewObject(env, LDKMessageSendEvent_SendReplyChannelRange_class, LDKMessageSendEvent_SendReplyChannelRange_meth, node_id_arr, msg_ref);
7333                 }
7334                 case LDKMessageSendEvent_SendGossipTimestampFilter: {
7335                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
7336                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_gossip_timestamp_filter.node_id.compressed_form);
7337                         LDKGossipTimestampFilter msg_var = obj->send_gossip_timestamp_filter.msg;
7338                         int64_t msg_ref = 0;
7339                         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
7340                         msg_ref = tag_ptr(msg_var.inner, false);
7341                         return (*env)->NewObject(env, LDKMessageSendEvent_SendGossipTimestampFilter_class, LDKMessageSendEvent_SendGossipTimestampFilter_meth, node_id_arr, msg_ref);
7342                 }
7343                 default: abort();
7344         }
7345 }
7346 static inline LDKCVec_MessageSendEventZ CVec_MessageSendEventZ_clone(const LDKCVec_MessageSendEventZ *orig) {
7347         LDKCVec_MessageSendEventZ ret = { .data = MALLOC(sizeof(LDKMessageSendEvent) * orig->datalen, "LDKCVec_MessageSendEventZ clone bytes"), .datalen = orig->datalen };
7348         for (size_t i = 0; i < ret.datalen; i++) {
7349                 ret.data[i] = MessageSendEvent_clone(&orig->data[i]);
7350         }
7351         return ret;
7352 }
7353 static inline struct LDKChannelUpdateInfo CResult_ChannelUpdateInfoDecodeErrorZ_get_ok(LDKCResult_ChannelUpdateInfoDecodeErrorZ *NONNULL_PTR owner){
7354         LDKChannelUpdateInfo ret = *owner->contents.result;
7355         ret.is_owned = false;
7356         return ret;
7357 }
7358 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateInfoDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7359         LDKCResult_ChannelUpdateInfoDecodeErrorZ* owner_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)untag_ptr(owner);
7360         LDKChannelUpdateInfo ret_var = CResult_ChannelUpdateInfoDecodeErrorZ_get_ok(owner_conv);
7361         int64_t ret_ref = 0;
7362         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7363         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7364         return ret_ref;
7365 }
7366
7367 static inline struct LDKDecodeError CResult_ChannelUpdateInfoDecodeErrorZ_get_err(LDKCResult_ChannelUpdateInfoDecodeErrorZ *NONNULL_PTR owner){
7368 CHECK(!owner->result_ok);
7369         return DecodeError_clone(&*owner->contents.err);
7370 }
7371 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateInfoDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7372         LDKCResult_ChannelUpdateInfoDecodeErrorZ* owner_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)untag_ptr(owner);
7373         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7374         *ret_copy = CResult_ChannelUpdateInfoDecodeErrorZ_get_err(owner_conv);
7375         int64_t ret_ref = tag_ptr(ret_copy, true);
7376         return ret_ref;
7377 }
7378
7379 static inline struct LDKChannelInfo CResult_ChannelInfoDecodeErrorZ_get_ok(LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR owner){
7380         LDKChannelInfo ret = *owner->contents.result;
7381         ret.is_owned = false;
7382         return ret;
7383 }
7384 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7385         LDKCResult_ChannelInfoDecodeErrorZ* owner_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)untag_ptr(owner);
7386         LDKChannelInfo ret_var = CResult_ChannelInfoDecodeErrorZ_get_ok(owner_conv);
7387         int64_t ret_ref = 0;
7388         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7389         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7390         return ret_ref;
7391 }
7392
7393 static inline struct LDKDecodeError CResult_ChannelInfoDecodeErrorZ_get_err(LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR owner){
7394 CHECK(!owner->result_ok);
7395         return DecodeError_clone(&*owner->contents.err);
7396 }
7397 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7398         LDKCResult_ChannelInfoDecodeErrorZ* owner_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)untag_ptr(owner);
7399         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7400         *ret_copy = CResult_ChannelInfoDecodeErrorZ_get_err(owner_conv);
7401         int64_t ret_ref = tag_ptr(ret_copy, true);
7402         return ret_ref;
7403 }
7404
7405 static inline struct LDKRoutingFees CResult_RoutingFeesDecodeErrorZ_get_ok(LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR owner){
7406         LDKRoutingFees ret = *owner->contents.result;
7407         ret.is_owned = false;
7408         return ret;
7409 }
7410 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7411         LDKCResult_RoutingFeesDecodeErrorZ* owner_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)untag_ptr(owner);
7412         LDKRoutingFees ret_var = CResult_RoutingFeesDecodeErrorZ_get_ok(owner_conv);
7413         int64_t ret_ref = 0;
7414         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7415         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7416         return ret_ref;
7417 }
7418
7419 static inline struct LDKDecodeError CResult_RoutingFeesDecodeErrorZ_get_err(LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR owner){
7420 CHECK(!owner->result_ok);
7421         return DecodeError_clone(&*owner->contents.err);
7422 }
7423 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7424         LDKCResult_RoutingFeesDecodeErrorZ* owner_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)untag_ptr(owner);
7425         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7426         *ret_copy = CResult_RoutingFeesDecodeErrorZ_get_err(owner_conv);
7427         int64_t ret_ref = tag_ptr(ret_copy, true);
7428         return ret_ref;
7429 }
7430
7431 static jclass LDKSocketAddress_TcpIpV4_class = NULL;
7432 static jmethodID LDKSocketAddress_TcpIpV4_meth = NULL;
7433 static jclass LDKSocketAddress_TcpIpV6_class = NULL;
7434 static jmethodID LDKSocketAddress_TcpIpV6_meth = NULL;
7435 static jclass LDKSocketAddress_OnionV2_class = NULL;
7436 static jmethodID LDKSocketAddress_OnionV2_meth = NULL;
7437 static jclass LDKSocketAddress_OnionV3_class = NULL;
7438 static jmethodID LDKSocketAddress_OnionV3_meth = NULL;
7439 static jclass LDKSocketAddress_Hostname_class = NULL;
7440 static jmethodID LDKSocketAddress_Hostname_meth = NULL;
7441 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKSocketAddress_init (JNIEnv *env, jclass clz) {
7442         LDKSocketAddress_TcpIpV4_class =
7443                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSocketAddress$TcpIpV4"));
7444         CHECK(LDKSocketAddress_TcpIpV4_class != NULL);
7445         LDKSocketAddress_TcpIpV4_meth = (*env)->GetMethodID(env, LDKSocketAddress_TcpIpV4_class, "<init>", "([BS)V");
7446         CHECK(LDKSocketAddress_TcpIpV4_meth != NULL);
7447         LDKSocketAddress_TcpIpV6_class =
7448                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSocketAddress$TcpIpV6"));
7449         CHECK(LDKSocketAddress_TcpIpV6_class != NULL);
7450         LDKSocketAddress_TcpIpV6_meth = (*env)->GetMethodID(env, LDKSocketAddress_TcpIpV6_class, "<init>", "([BS)V");
7451         CHECK(LDKSocketAddress_TcpIpV6_meth != NULL);
7452         LDKSocketAddress_OnionV2_class =
7453                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSocketAddress$OnionV2"));
7454         CHECK(LDKSocketAddress_OnionV2_class != NULL);
7455         LDKSocketAddress_OnionV2_meth = (*env)->GetMethodID(env, LDKSocketAddress_OnionV2_class, "<init>", "([B)V");
7456         CHECK(LDKSocketAddress_OnionV2_meth != NULL);
7457         LDKSocketAddress_OnionV3_class =
7458                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSocketAddress$OnionV3"));
7459         CHECK(LDKSocketAddress_OnionV3_class != NULL);
7460         LDKSocketAddress_OnionV3_meth = (*env)->GetMethodID(env, LDKSocketAddress_OnionV3_class, "<init>", "([BSBS)V");
7461         CHECK(LDKSocketAddress_OnionV3_meth != NULL);
7462         LDKSocketAddress_Hostname_class =
7463                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSocketAddress$Hostname"));
7464         CHECK(LDKSocketAddress_Hostname_class != NULL);
7465         LDKSocketAddress_Hostname_meth = (*env)->GetMethodID(env, LDKSocketAddress_Hostname_class, "<init>", "(JS)V");
7466         CHECK(LDKSocketAddress_Hostname_meth != NULL);
7467 }
7468 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKSocketAddress_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
7469         LDKSocketAddress *obj = (LDKSocketAddress*)untag_ptr(ptr);
7470         switch(obj->tag) {
7471                 case LDKSocketAddress_TcpIpV4: {
7472                         int8_tArray addr_arr = (*env)->NewByteArray(env, 4);
7473                         (*env)->SetByteArrayRegion(env, addr_arr, 0, 4, obj->tcp_ip_v4.addr.data);
7474                         int16_t port_conv = obj->tcp_ip_v4.port;
7475                         return (*env)->NewObject(env, LDKSocketAddress_TcpIpV4_class, LDKSocketAddress_TcpIpV4_meth, addr_arr, port_conv);
7476                 }
7477                 case LDKSocketAddress_TcpIpV6: {
7478                         int8_tArray addr_arr = (*env)->NewByteArray(env, 16);
7479                         (*env)->SetByteArrayRegion(env, addr_arr, 0, 16, obj->tcp_ip_v6.addr.data);
7480                         int16_t port_conv = obj->tcp_ip_v6.port;
7481                         return (*env)->NewObject(env, LDKSocketAddress_TcpIpV6_class, LDKSocketAddress_TcpIpV6_meth, addr_arr, port_conv);
7482                 }
7483                 case LDKSocketAddress_OnionV2: {
7484                         int8_tArray onion_v2_arr = (*env)->NewByteArray(env, 12);
7485                         (*env)->SetByteArrayRegion(env, onion_v2_arr, 0, 12, obj->onion_v2.data);
7486                         return (*env)->NewObject(env, LDKSocketAddress_OnionV2_class, LDKSocketAddress_OnionV2_meth, onion_v2_arr);
7487                 }
7488                 case LDKSocketAddress_OnionV3: {
7489                         int8_tArray ed25519_pubkey_arr = (*env)->NewByteArray(env, 32);
7490                         (*env)->SetByteArrayRegion(env, ed25519_pubkey_arr, 0, 32, obj->onion_v3.ed25519_pubkey.data);
7491                         int16_t checksum_conv = obj->onion_v3.checksum;
7492                         int8_t version_conv = obj->onion_v3.version;
7493                         int16_t port_conv = obj->onion_v3.port;
7494                         return (*env)->NewObject(env, LDKSocketAddress_OnionV3_class, LDKSocketAddress_OnionV3_meth, ed25519_pubkey_arr, checksum_conv, version_conv, port_conv);
7495                 }
7496                 case LDKSocketAddress_Hostname: {
7497                         LDKHostname hostname_var = obj->hostname.hostname;
7498                         int64_t hostname_ref = 0;
7499                         CHECK_INNER_FIELD_ACCESS_OR_NULL(hostname_var);
7500                         hostname_ref = tag_ptr(hostname_var.inner, false);
7501                         int16_t port_conv = obj->hostname.port;
7502                         return (*env)->NewObject(env, LDKSocketAddress_Hostname_class, LDKSocketAddress_Hostname_meth, hostname_ref, port_conv);
7503                 }
7504                 default: abort();
7505         }
7506 }
7507 static inline LDKCVec_SocketAddressZ CVec_SocketAddressZ_clone(const LDKCVec_SocketAddressZ *orig) {
7508         LDKCVec_SocketAddressZ ret = { .data = MALLOC(sizeof(LDKSocketAddress) * orig->datalen, "LDKCVec_SocketAddressZ clone bytes"), .datalen = orig->datalen };
7509         for (size_t i = 0; i < ret.datalen; i++) {
7510                 ret.data[i] = SocketAddress_clone(&orig->data[i]);
7511         }
7512         return ret;
7513 }
7514 static inline struct LDKNodeAnnouncementInfo CResult_NodeAnnouncementInfoDecodeErrorZ_get_ok(LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR owner){
7515         LDKNodeAnnouncementInfo ret = *owner->contents.result;
7516         ret.is_owned = false;
7517         return ret;
7518 }
7519 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7520         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* owner_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)untag_ptr(owner);
7521         LDKNodeAnnouncementInfo ret_var = CResult_NodeAnnouncementInfoDecodeErrorZ_get_ok(owner_conv);
7522         int64_t ret_ref = 0;
7523         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7524         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7525         return ret_ref;
7526 }
7527
7528 static inline struct LDKDecodeError CResult_NodeAnnouncementInfoDecodeErrorZ_get_err(LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR owner){
7529 CHECK(!owner->result_ok);
7530         return DecodeError_clone(&*owner->contents.err);
7531 }
7532 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7533         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* owner_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)untag_ptr(owner);
7534         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7535         *ret_copy = CResult_NodeAnnouncementInfoDecodeErrorZ_get_err(owner_conv);
7536         int64_t ret_ref = tag_ptr(ret_copy, true);
7537         return ret_ref;
7538 }
7539
7540 static inline struct LDKNodeAlias CResult_NodeAliasDecodeErrorZ_get_ok(LDKCResult_NodeAliasDecodeErrorZ *NONNULL_PTR owner){
7541         LDKNodeAlias ret = *owner->contents.result;
7542         ret.is_owned = false;
7543         return ret;
7544 }
7545 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAliasDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7546         LDKCResult_NodeAliasDecodeErrorZ* owner_conv = (LDKCResult_NodeAliasDecodeErrorZ*)untag_ptr(owner);
7547         LDKNodeAlias ret_var = CResult_NodeAliasDecodeErrorZ_get_ok(owner_conv);
7548         int64_t ret_ref = 0;
7549         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7550         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7551         return ret_ref;
7552 }
7553
7554 static inline struct LDKDecodeError CResult_NodeAliasDecodeErrorZ_get_err(LDKCResult_NodeAliasDecodeErrorZ *NONNULL_PTR owner){
7555 CHECK(!owner->result_ok);
7556         return DecodeError_clone(&*owner->contents.err);
7557 }
7558 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAliasDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7559         LDKCResult_NodeAliasDecodeErrorZ* owner_conv = (LDKCResult_NodeAliasDecodeErrorZ*)untag_ptr(owner);
7560         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7561         *ret_copy = CResult_NodeAliasDecodeErrorZ_get_err(owner_conv);
7562         int64_t ret_ref = tag_ptr(ret_copy, true);
7563         return ret_ref;
7564 }
7565
7566 static inline struct LDKNodeInfo CResult_NodeInfoDecodeErrorZ_get_ok(LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR owner){
7567         LDKNodeInfo ret = *owner->contents.result;
7568         ret.is_owned = false;
7569         return ret;
7570 }
7571 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7572         LDKCResult_NodeInfoDecodeErrorZ* owner_conv = (LDKCResult_NodeInfoDecodeErrorZ*)untag_ptr(owner);
7573         LDKNodeInfo ret_var = CResult_NodeInfoDecodeErrorZ_get_ok(owner_conv);
7574         int64_t ret_ref = 0;
7575         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7576         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7577         return ret_ref;
7578 }
7579
7580 static inline struct LDKDecodeError CResult_NodeInfoDecodeErrorZ_get_err(LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR owner){
7581 CHECK(!owner->result_ok);
7582         return DecodeError_clone(&*owner->contents.err);
7583 }
7584 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7585         LDKCResult_NodeInfoDecodeErrorZ* owner_conv = (LDKCResult_NodeInfoDecodeErrorZ*)untag_ptr(owner);
7586         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7587         *ret_copy = CResult_NodeInfoDecodeErrorZ_get_err(owner_conv);
7588         int64_t ret_ref = tag_ptr(ret_copy, true);
7589         return ret_ref;
7590 }
7591
7592 static inline struct LDKNetworkGraph CResult_NetworkGraphDecodeErrorZ_get_ok(LDKCResult_NetworkGraphDecodeErrorZ *NONNULL_PTR owner){
7593         LDKNetworkGraph ret = *owner->contents.result;
7594         ret.is_owned = false;
7595         return ret;
7596 }
7597 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7598         LDKCResult_NetworkGraphDecodeErrorZ* owner_conv = (LDKCResult_NetworkGraphDecodeErrorZ*)untag_ptr(owner);
7599         LDKNetworkGraph ret_var = CResult_NetworkGraphDecodeErrorZ_get_ok(owner_conv);
7600         int64_t ret_ref = 0;
7601         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7602         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7603         return ret_ref;
7604 }
7605
7606 static inline struct LDKDecodeError CResult_NetworkGraphDecodeErrorZ_get_err(LDKCResult_NetworkGraphDecodeErrorZ *NONNULL_PTR owner){
7607 CHECK(!owner->result_ok);
7608         return DecodeError_clone(&*owner->contents.err);
7609 }
7610 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7611         LDKCResult_NetworkGraphDecodeErrorZ* owner_conv = (LDKCResult_NetworkGraphDecodeErrorZ*)untag_ptr(owner);
7612         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
7613         *ret_copy = CResult_NetworkGraphDecodeErrorZ_get_err(owner_conv);
7614         int64_t ret_ref = tag_ptr(ret_copy, true);
7615         return ret_ref;
7616 }
7617
7618 static jclass LDKCOption_CVec_SocketAddressZZ_Some_class = NULL;
7619 static jmethodID LDKCOption_CVec_SocketAddressZZ_Some_meth = NULL;
7620 static jclass LDKCOption_CVec_SocketAddressZZ_None_class = NULL;
7621 static jmethodID LDKCOption_CVec_SocketAddressZZ_None_meth = NULL;
7622 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1CVec_1SocketAddressZZ_init (JNIEnv *env, jclass clz) {
7623         LDKCOption_CVec_SocketAddressZZ_Some_class =
7624                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_CVec_SocketAddressZZ$Some"));
7625         CHECK(LDKCOption_CVec_SocketAddressZZ_Some_class != NULL);
7626         LDKCOption_CVec_SocketAddressZZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_CVec_SocketAddressZZ_Some_class, "<init>", "([J)V");
7627         CHECK(LDKCOption_CVec_SocketAddressZZ_Some_meth != NULL);
7628         LDKCOption_CVec_SocketAddressZZ_None_class =
7629                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_CVec_SocketAddressZZ$None"));
7630         CHECK(LDKCOption_CVec_SocketAddressZZ_None_class != NULL);
7631         LDKCOption_CVec_SocketAddressZZ_None_meth = (*env)->GetMethodID(env, LDKCOption_CVec_SocketAddressZZ_None_class, "<init>", "()V");
7632         CHECK(LDKCOption_CVec_SocketAddressZZ_None_meth != NULL);
7633 }
7634 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1CVec_1SocketAddressZZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
7635         LDKCOption_CVec_SocketAddressZZ *obj = (LDKCOption_CVec_SocketAddressZZ*)untag_ptr(ptr);
7636         switch(obj->tag) {
7637                 case LDKCOption_CVec_SocketAddressZZ_Some: {
7638                         LDKCVec_SocketAddressZ some_var = obj->some;
7639                         int64_tArray some_arr = NULL;
7640                         some_arr = (*env)->NewLongArray(env, some_var.datalen);
7641                         int64_t *some_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, some_arr, NULL);
7642                         for (size_t p = 0; p < some_var.datalen; p++) {
7643                                 int64_t some_conv_15_ref = tag_ptr(&some_var.data[p], false);
7644                                 some_arr_ptr[p] = some_conv_15_ref;
7645                         }
7646                         (*env)->ReleasePrimitiveArrayCritical(env, some_arr, some_arr_ptr, 0);
7647                         return (*env)->NewObject(env, LDKCOption_CVec_SocketAddressZZ_Some_class, LDKCOption_CVec_SocketAddressZZ_Some_meth, some_arr);
7648                 }
7649                 case LDKCOption_CVec_SocketAddressZZ_None: {
7650                         return (*env)->NewObject(env, LDKCOption_CVec_SocketAddressZZ_None_class, LDKCOption_CVec_SocketAddressZZ_None_meth);
7651                 }
7652                 default: abort();
7653         }
7654 }
7655 static inline uint64_t CResult_u64ShortChannelIdErrorZ_get_ok(LDKCResult_u64ShortChannelIdErrorZ *NONNULL_PTR owner){
7656 CHECK(owner->result_ok);
7657         return *owner->contents.result;
7658 }
7659 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1u64ShortChannelIdErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7660         LDKCResult_u64ShortChannelIdErrorZ* owner_conv = (LDKCResult_u64ShortChannelIdErrorZ*)untag_ptr(owner);
7661         int64_t ret_conv = CResult_u64ShortChannelIdErrorZ_get_ok(owner_conv);
7662         return ret_conv;
7663 }
7664
7665 static inline enum LDKShortChannelIdError CResult_u64ShortChannelIdErrorZ_get_err(LDKCResult_u64ShortChannelIdErrorZ *NONNULL_PTR owner){
7666 CHECK(!owner->result_ok);
7667         return ShortChannelIdError_clone(&*owner->contents.err);
7668 }
7669 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1u64ShortChannelIdErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7670         LDKCResult_u64ShortChannelIdErrorZ* owner_conv = (LDKCResult_u64ShortChannelIdErrorZ*)untag_ptr(owner);
7671         jclass ret_conv = LDKShortChannelIdError_to_java(env, CResult_u64ShortChannelIdErrorZ_get_err(owner_conv));
7672         return ret_conv;
7673 }
7674
7675 static inline struct LDKPendingHTLCInfo CResult_PendingHTLCInfoInboundHTLCErrZ_get_ok(LDKCResult_PendingHTLCInfoInboundHTLCErrZ *NONNULL_PTR owner){
7676         LDKPendingHTLCInfo ret = *owner->contents.result;
7677         ret.is_owned = false;
7678         return ret;
7679 }
7680 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PendingHTLCInfoInboundHTLCErrZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7681         LDKCResult_PendingHTLCInfoInboundHTLCErrZ* owner_conv = (LDKCResult_PendingHTLCInfoInboundHTLCErrZ*)untag_ptr(owner);
7682         LDKPendingHTLCInfo ret_var = CResult_PendingHTLCInfoInboundHTLCErrZ_get_ok(owner_conv);
7683         int64_t ret_ref = 0;
7684         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7685         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7686         return ret_ref;
7687 }
7688
7689 static inline struct LDKInboundHTLCErr CResult_PendingHTLCInfoInboundHTLCErrZ_get_err(LDKCResult_PendingHTLCInfoInboundHTLCErrZ *NONNULL_PTR owner){
7690         LDKInboundHTLCErr ret = *owner->contents.err;
7691         ret.is_owned = false;
7692         return ret;
7693 }
7694 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PendingHTLCInfoInboundHTLCErrZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7695         LDKCResult_PendingHTLCInfoInboundHTLCErrZ* owner_conv = (LDKCResult_PendingHTLCInfoInboundHTLCErrZ*)untag_ptr(owner);
7696         LDKInboundHTLCErr ret_var = CResult_PendingHTLCInfoInboundHTLCErrZ_get_err(owner_conv);
7697         int64_t ret_ref = 0;
7698         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7699         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7700         return ret_ref;
7701 }
7702
7703 static inline LDKCVec_HTLCOutputInCommitmentZ CVec_HTLCOutputInCommitmentZ_clone(const LDKCVec_HTLCOutputInCommitmentZ *orig) {
7704         LDKCVec_HTLCOutputInCommitmentZ ret = { .data = MALLOC(sizeof(LDKHTLCOutputInCommitment) * orig->datalen, "LDKCVec_HTLCOutputInCommitmentZ clone bytes"), .datalen = orig->datalen };
7705         for (size_t i = 0; i < ret.datalen; i++) {
7706                 ret.data[i] = HTLCOutputInCommitment_clone(&orig->data[i]);
7707         }
7708         return ret;
7709 }
7710 static inline LDKCVec_HTLCDescriptorZ CVec_HTLCDescriptorZ_clone(const LDKCVec_HTLCDescriptorZ *orig) {
7711         LDKCVec_HTLCDescriptorZ ret = { .data = MALLOC(sizeof(LDKHTLCDescriptor) * orig->datalen, "LDKCVec_HTLCDescriptorZ clone bytes"), .datalen = orig->datalen };
7712         for (size_t i = 0; i < ret.datalen; i++) {
7713                 ret.data[i] = HTLCDescriptor_clone(&orig->data[i]);
7714         }
7715         return ret;
7716 }
7717 static inline LDKCVec_UtxoZ CVec_UtxoZ_clone(const LDKCVec_UtxoZ *orig) {
7718         LDKCVec_UtxoZ ret = { .data = MALLOC(sizeof(LDKUtxo) * orig->datalen, "LDKCVec_UtxoZ clone bytes"), .datalen = orig->datalen };
7719         for (size_t i = 0; i < ret.datalen; i++) {
7720                 ret.data[i] = Utxo_clone(&orig->data[i]);
7721         }
7722         return ret;
7723 }
7724 static jclass LDKCOption_TxOutZ_Some_class = NULL;
7725 static jmethodID LDKCOption_TxOutZ_Some_meth = NULL;
7726 static jclass LDKCOption_TxOutZ_None_class = NULL;
7727 static jmethodID LDKCOption_TxOutZ_None_meth = NULL;
7728 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1TxOutZ_init (JNIEnv *env, jclass clz) {
7729         LDKCOption_TxOutZ_Some_class =
7730                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_TxOutZ$Some"));
7731         CHECK(LDKCOption_TxOutZ_Some_class != NULL);
7732         LDKCOption_TxOutZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_TxOutZ_Some_class, "<init>", "(J)V");
7733         CHECK(LDKCOption_TxOutZ_Some_meth != NULL);
7734         LDKCOption_TxOutZ_None_class =
7735                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_TxOutZ$None"));
7736         CHECK(LDKCOption_TxOutZ_None_class != NULL);
7737         LDKCOption_TxOutZ_None_meth = (*env)->GetMethodID(env, LDKCOption_TxOutZ_None_class, "<init>", "()V");
7738         CHECK(LDKCOption_TxOutZ_None_meth != NULL);
7739 }
7740 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1TxOutZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
7741         LDKCOption_TxOutZ *obj = (LDKCOption_TxOutZ*)untag_ptr(ptr);
7742         switch(obj->tag) {
7743                 case LDKCOption_TxOutZ_Some: {
7744                         LDKTxOut* some_ref = &obj->some;
7745                         return (*env)->NewObject(env, LDKCOption_TxOutZ_Some_class, LDKCOption_TxOutZ_Some_meth, tag_ptr(some_ref, false));
7746                 }
7747                 case LDKCOption_TxOutZ_None: {
7748                         return (*env)->NewObject(env, LDKCOption_TxOutZ_None_class, LDKCOption_TxOutZ_None_meth);
7749                 }
7750                 default: abort();
7751         }
7752 }
7753 static inline LDKCVec_InputZ CVec_InputZ_clone(const LDKCVec_InputZ *orig) {
7754         LDKCVec_InputZ ret = { .data = MALLOC(sizeof(LDKInput) * orig->datalen, "LDKCVec_InputZ clone bytes"), .datalen = orig->datalen };
7755         for (size_t i = 0; i < ret.datalen; i++) {
7756                 ret.data[i] = Input_clone(&orig->data[i]);
7757         }
7758         return ret;
7759 }
7760 static inline struct LDKCoinSelection CResult_CoinSelectionNoneZ_get_ok(LDKCResult_CoinSelectionNoneZ *NONNULL_PTR owner){
7761         LDKCoinSelection ret = *owner->contents.result;
7762         ret.is_owned = false;
7763         return ret;
7764 }
7765 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CoinSelectionNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7766         LDKCResult_CoinSelectionNoneZ* owner_conv = (LDKCResult_CoinSelectionNoneZ*)untag_ptr(owner);
7767         LDKCoinSelection ret_var = CResult_CoinSelectionNoneZ_get_ok(owner_conv);
7768         int64_t ret_ref = 0;
7769         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7770         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7771         return ret_ref;
7772 }
7773
7774 static inline void CResult_CoinSelectionNoneZ_get_err(LDKCResult_CoinSelectionNoneZ *NONNULL_PTR owner){
7775 CHECK(!owner->result_ok);
7776         return *owner->contents.err;
7777 }
7778 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CoinSelectionNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7779         LDKCResult_CoinSelectionNoneZ* owner_conv = (LDKCResult_CoinSelectionNoneZ*)untag_ptr(owner);
7780         CResult_CoinSelectionNoneZ_get_err(owner_conv);
7781 }
7782
7783 static inline struct LDKCVec_UtxoZ CResult_CVec_UtxoZNoneZ_get_ok(LDKCResult_CVec_UtxoZNoneZ *NONNULL_PTR owner){
7784 CHECK(owner->result_ok);
7785         return CVec_UtxoZ_clone(&*owner->contents.result);
7786 }
7787 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1UtxoZNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7788         LDKCResult_CVec_UtxoZNoneZ* owner_conv = (LDKCResult_CVec_UtxoZNoneZ*)untag_ptr(owner);
7789         LDKCVec_UtxoZ ret_var = CResult_CVec_UtxoZNoneZ_get_ok(owner_conv);
7790         int64_tArray ret_arr = NULL;
7791         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
7792         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
7793         for (size_t g = 0; g < ret_var.datalen; g++) {
7794                 LDKUtxo ret_conv_6_var = ret_var.data[g];
7795                 int64_t ret_conv_6_ref = 0;
7796                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_6_var);
7797                 ret_conv_6_ref = tag_ptr(ret_conv_6_var.inner, ret_conv_6_var.is_owned);
7798                 ret_arr_ptr[g] = ret_conv_6_ref;
7799         }
7800         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
7801         FREE(ret_var.data);
7802         return ret_arr;
7803 }
7804
7805 static inline void CResult_CVec_UtxoZNoneZ_get_err(LDKCResult_CVec_UtxoZNoneZ *NONNULL_PTR owner){
7806 CHECK(!owner->result_ok);
7807         return *owner->contents.err;
7808 }
7809 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1UtxoZNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7810         LDKCResult_CVec_UtxoZNoneZ* owner_conv = (LDKCResult_CVec_UtxoZNoneZ*)untag_ptr(owner);
7811         CResult_CVec_UtxoZNoneZ_get_err(owner_conv);
7812 }
7813
7814 static jclass LDKPaymentContext_Unknown_class = NULL;
7815 static jmethodID LDKPaymentContext_Unknown_meth = NULL;
7816 static jclass LDKPaymentContext_Bolt12Offer_class = NULL;
7817 static jmethodID LDKPaymentContext_Bolt12Offer_meth = NULL;
7818 static jclass LDKPaymentContext_Bolt12Refund_class = NULL;
7819 static jmethodID LDKPaymentContext_Bolt12Refund_meth = NULL;
7820 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKPaymentContext_init (JNIEnv *env, jclass clz) {
7821         LDKPaymentContext_Unknown_class =
7822                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentContext$Unknown"));
7823         CHECK(LDKPaymentContext_Unknown_class != NULL);
7824         LDKPaymentContext_Unknown_meth = (*env)->GetMethodID(env, LDKPaymentContext_Unknown_class, "<init>", "(J)V");
7825         CHECK(LDKPaymentContext_Unknown_meth != NULL);
7826         LDKPaymentContext_Bolt12Offer_class =
7827                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentContext$Bolt12Offer"));
7828         CHECK(LDKPaymentContext_Bolt12Offer_class != NULL);
7829         LDKPaymentContext_Bolt12Offer_meth = (*env)->GetMethodID(env, LDKPaymentContext_Bolt12Offer_class, "<init>", "(J)V");
7830         CHECK(LDKPaymentContext_Bolt12Offer_meth != NULL);
7831         LDKPaymentContext_Bolt12Refund_class =
7832                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentContext$Bolt12Refund"));
7833         CHECK(LDKPaymentContext_Bolt12Refund_class != NULL);
7834         LDKPaymentContext_Bolt12Refund_meth = (*env)->GetMethodID(env, LDKPaymentContext_Bolt12Refund_class, "<init>", "(J)V");
7835         CHECK(LDKPaymentContext_Bolt12Refund_meth != NULL);
7836 }
7837 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKPaymentContext_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
7838         LDKPaymentContext *obj = (LDKPaymentContext*)untag_ptr(ptr);
7839         switch(obj->tag) {
7840                 case LDKPaymentContext_Unknown: {
7841                         LDKUnknownPaymentContext unknown_var = obj->unknown;
7842                         int64_t unknown_ref = 0;
7843                         CHECK_INNER_FIELD_ACCESS_OR_NULL(unknown_var);
7844                         unknown_ref = tag_ptr(unknown_var.inner, false);
7845                         return (*env)->NewObject(env, LDKPaymentContext_Unknown_class, LDKPaymentContext_Unknown_meth, unknown_ref);
7846                 }
7847                 case LDKPaymentContext_Bolt12Offer: {
7848                         LDKBolt12OfferContext bolt12_offer_var = obj->bolt12_offer;
7849                         int64_t bolt12_offer_ref = 0;
7850                         CHECK_INNER_FIELD_ACCESS_OR_NULL(bolt12_offer_var);
7851                         bolt12_offer_ref = tag_ptr(bolt12_offer_var.inner, false);
7852                         return (*env)->NewObject(env, LDKPaymentContext_Bolt12Offer_class, LDKPaymentContext_Bolt12Offer_meth, bolt12_offer_ref);
7853                 }
7854                 case LDKPaymentContext_Bolt12Refund: {
7855                         LDKBolt12RefundContext bolt12_refund_var = obj->bolt12_refund;
7856                         int64_t bolt12_refund_ref = 0;
7857                         CHECK_INNER_FIELD_ACCESS_OR_NULL(bolt12_refund_var);
7858                         bolt12_refund_ref = tag_ptr(bolt12_refund_var.inner, false);
7859                         return (*env)->NewObject(env, LDKPaymentContext_Bolt12Refund_class, LDKPaymentContext_Bolt12Refund_meth, bolt12_refund_ref);
7860                 }
7861                 default: abort();
7862         }
7863 }
7864 static jclass LDKCOption_PaymentContextZ_Some_class = NULL;
7865 static jmethodID LDKCOption_PaymentContextZ_Some_meth = NULL;
7866 static jclass LDKCOption_PaymentContextZ_None_class = NULL;
7867 static jmethodID LDKCOption_PaymentContextZ_None_meth = NULL;
7868 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1PaymentContextZ_init (JNIEnv *env, jclass clz) {
7869         LDKCOption_PaymentContextZ_Some_class =
7870                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_PaymentContextZ$Some"));
7871         CHECK(LDKCOption_PaymentContextZ_Some_class != NULL);
7872         LDKCOption_PaymentContextZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_PaymentContextZ_Some_class, "<init>", "(J)V");
7873         CHECK(LDKCOption_PaymentContextZ_Some_meth != NULL);
7874         LDKCOption_PaymentContextZ_None_class =
7875                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_PaymentContextZ$None"));
7876         CHECK(LDKCOption_PaymentContextZ_None_class != NULL);
7877         LDKCOption_PaymentContextZ_None_meth = (*env)->GetMethodID(env, LDKCOption_PaymentContextZ_None_class, "<init>", "()V");
7878         CHECK(LDKCOption_PaymentContextZ_None_meth != NULL);
7879 }
7880 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1PaymentContextZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
7881         LDKCOption_PaymentContextZ *obj = (LDKCOption_PaymentContextZ*)untag_ptr(ptr);
7882         switch(obj->tag) {
7883                 case LDKCOption_PaymentContextZ_Some: {
7884                         int64_t some_ref = tag_ptr(&obj->some, false);
7885                         return (*env)->NewObject(env, LDKCOption_PaymentContextZ_Some_class, LDKCOption_PaymentContextZ_Some_meth, some_ref);
7886                 }
7887                 case LDKCOption_PaymentContextZ_None: {
7888                         return (*env)->NewObject(env, LDKCOption_PaymentContextZ_None_class, LDKCOption_PaymentContextZ_None_meth);
7889                 }
7890                 default: abort();
7891         }
7892 }
7893 static inline uint64_t C2Tuple_u64u16Z_get_a(LDKC2Tuple_u64u16Z *NONNULL_PTR owner){
7894         return owner->a;
7895 }
7896 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64u16Z_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
7897         LDKC2Tuple_u64u16Z* owner_conv = (LDKC2Tuple_u64u16Z*)untag_ptr(owner);
7898         int64_t ret_conv = C2Tuple_u64u16Z_get_a(owner_conv);
7899         return ret_conv;
7900 }
7901
7902 static inline uint16_t C2Tuple_u64u16Z_get_b(LDKC2Tuple_u64u16Z *NONNULL_PTR owner){
7903         return owner->b;
7904 }
7905 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64u16Z_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
7906         LDKC2Tuple_u64u16Z* owner_conv = (LDKC2Tuple_u64u16Z*)untag_ptr(owner);
7907         int16_t ret_conv = C2Tuple_u64u16Z_get_b(owner_conv);
7908         return ret_conv;
7909 }
7910
7911 static jclass LDKCOption_C2Tuple_u64u16ZZ_Some_class = NULL;
7912 static jmethodID LDKCOption_C2Tuple_u64u16ZZ_Some_meth = NULL;
7913 static jclass LDKCOption_C2Tuple_u64u16ZZ_None_class = NULL;
7914 static jmethodID LDKCOption_C2Tuple_u64u16ZZ_None_meth = NULL;
7915 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1C2Tuple_1u64u16ZZ_init (JNIEnv *env, jclass clz) {
7916         LDKCOption_C2Tuple_u64u16ZZ_Some_class =
7917                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_C2Tuple_u64u16ZZ$Some"));
7918         CHECK(LDKCOption_C2Tuple_u64u16ZZ_Some_class != NULL);
7919         LDKCOption_C2Tuple_u64u16ZZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_C2Tuple_u64u16ZZ_Some_class, "<init>", "(J)V");
7920         CHECK(LDKCOption_C2Tuple_u64u16ZZ_Some_meth != NULL);
7921         LDKCOption_C2Tuple_u64u16ZZ_None_class =
7922                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_C2Tuple_u64u16ZZ$None"));
7923         CHECK(LDKCOption_C2Tuple_u64u16ZZ_None_class != NULL);
7924         LDKCOption_C2Tuple_u64u16ZZ_None_meth = (*env)->GetMethodID(env, LDKCOption_C2Tuple_u64u16ZZ_None_class, "<init>", "()V");
7925         CHECK(LDKCOption_C2Tuple_u64u16ZZ_None_meth != NULL);
7926 }
7927 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1C2Tuple_1u64u16ZZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
7928         LDKCOption_C2Tuple_u64u16ZZ *obj = (LDKCOption_C2Tuple_u64u16ZZ*)untag_ptr(ptr);
7929         switch(obj->tag) {
7930                 case LDKCOption_C2Tuple_u64u16ZZ_Some: {
7931                         LDKC2Tuple_u64u16Z* some_conv = MALLOC(sizeof(LDKC2Tuple_u64u16Z), "LDKC2Tuple_u64u16Z");
7932                         *some_conv = obj->some;
7933                         *some_conv = C2Tuple_u64u16Z_clone(some_conv);
7934                         return (*env)->NewObject(env, LDKCOption_C2Tuple_u64u16ZZ_Some_class, LDKCOption_C2Tuple_u64u16ZZ_Some_meth, tag_ptr(some_conv, true));
7935                 }
7936                 case LDKCOption_C2Tuple_u64u16ZZ_None: {
7937                         return (*env)->NewObject(env, LDKCOption_C2Tuple_u64u16ZZ_None_class, LDKCOption_C2Tuple_u64u16ZZ_None_meth);
7938                 }
7939                 default: abort();
7940         }
7941 }
7942 static jclass LDKCOption_ChannelShutdownStateZ_Some_class = NULL;
7943 static jmethodID LDKCOption_ChannelShutdownStateZ_Some_meth = NULL;
7944 static jclass LDKCOption_ChannelShutdownStateZ_None_class = NULL;
7945 static jmethodID LDKCOption_ChannelShutdownStateZ_None_meth = NULL;
7946 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1ChannelShutdownStateZ_init (JNIEnv *env, jclass clz) {
7947         LDKCOption_ChannelShutdownStateZ_Some_class =
7948                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_ChannelShutdownStateZ$Some"));
7949         CHECK(LDKCOption_ChannelShutdownStateZ_Some_class != NULL);
7950         LDKCOption_ChannelShutdownStateZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_ChannelShutdownStateZ_Some_class, "<init>", "(Lorg/ldk/enums/ChannelShutdownState;)V");
7951         CHECK(LDKCOption_ChannelShutdownStateZ_Some_meth != NULL);
7952         LDKCOption_ChannelShutdownStateZ_None_class =
7953                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_ChannelShutdownStateZ$None"));
7954         CHECK(LDKCOption_ChannelShutdownStateZ_None_class != NULL);
7955         LDKCOption_ChannelShutdownStateZ_None_meth = (*env)->GetMethodID(env, LDKCOption_ChannelShutdownStateZ_None_class, "<init>", "()V");
7956         CHECK(LDKCOption_ChannelShutdownStateZ_None_meth != NULL);
7957 }
7958 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1ChannelShutdownStateZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
7959         LDKCOption_ChannelShutdownStateZ *obj = (LDKCOption_ChannelShutdownStateZ*)untag_ptr(ptr);
7960         switch(obj->tag) {
7961                 case LDKCOption_ChannelShutdownStateZ_Some: {
7962                         jclass some_conv = LDKChannelShutdownState_to_java(env, obj->some);
7963                         return (*env)->NewObject(env, LDKCOption_ChannelShutdownStateZ_Some_class, LDKCOption_ChannelShutdownStateZ_Some_meth, some_conv);
7964                 }
7965                 case LDKCOption_ChannelShutdownStateZ_None: {
7966                         return (*env)->NewObject(env, LDKCOption_ChannelShutdownStateZ_None_class, LDKCOption_ChannelShutdownStateZ_None_meth);
7967                 }
7968                 default: abort();
7969         }
7970 }
7971 static inline struct LDKChannelId CResult_ChannelIdAPIErrorZ_get_ok(LDKCResult_ChannelIdAPIErrorZ *NONNULL_PTR owner){
7972         LDKChannelId ret = *owner->contents.result;
7973         ret.is_owned = false;
7974         return ret;
7975 }
7976 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelIdAPIErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
7977         LDKCResult_ChannelIdAPIErrorZ* owner_conv = (LDKCResult_ChannelIdAPIErrorZ*)untag_ptr(owner);
7978         LDKChannelId ret_var = CResult_ChannelIdAPIErrorZ_get_ok(owner_conv);
7979         int64_t ret_ref = 0;
7980         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
7981         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
7982         return ret_ref;
7983 }
7984
7985 static inline struct LDKAPIError CResult_ChannelIdAPIErrorZ_get_err(LDKCResult_ChannelIdAPIErrorZ *NONNULL_PTR owner){
7986 CHECK(!owner->result_ok);
7987         return APIError_clone(&*owner->contents.err);
7988 }
7989 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelIdAPIErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
7990         LDKCResult_ChannelIdAPIErrorZ* owner_conv = (LDKCResult_ChannelIdAPIErrorZ*)untag_ptr(owner);
7991         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
7992         *ret_copy = CResult_ChannelIdAPIErrorZ_get_err(owner_conv);
7993         int64_t ret_ref = tag_ptr(ret_copy, true);
7994         return ret_ref;
7995 }
7996
7997 static jclass LDKRecentPaymentDetails_AwaitingInvoice_class = NULL;
7998 static jmethodID LDKRecentPaymentDetails_AwaitingInvoice_meth = NULL;
7999 static jclass LDKRecentPaymentDetails_Pending_class = NULL;
8000 static jmethodID LDKRecentPaymentDetails_Pending_meth = NULL;
8001 static jclass LDKRecentPaymentDetails_Fulfilled_class = NULL;
8002 static jmethodID LDKRecentPaymentDetails_Fulfilled_meth = NULL;
8003 static jclass LDKRecentPaymentDetails_Abandoned_class = NULL;
8004 static jmethodID LDKRecentPaymentDetails_Abandoned_meth = NULL;
8005 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKRecentPaymentDetails_init (JNIEnv *env, jclass clz) {
8006         LDKRecentPaymentDetails_AwaitingInvoice_class =
8007                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKRecentPaymentDetails$AwaitingInvoice"));
8008         CHECK(LDKRecentPaymentDetails_AwaitingInvoice_class != NULL);
8009         LDKRecentPaymentDetails_AwaitingInvoice_meth = (*env)->GetMethodID(env, LDKRecentPaymentDetails_AwaitingInvoice_class, "<init>", "([B)V");
8010         CHECK(LDKRecentPaymentDetails_AwaitingInvoice_meth != NULL);
8011         LDKRecentPaymentDetails_Pending_class =
8012                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKRecentPaymentDetails$Pending"));
8013         CHECK(LDKRecentPaymentDetails_Pending_class != NULL);
8014         LDKRecentPaymentDetails_Pending_meth = (*env)->GetMethodID(env, LDKRecentPaymentDetails_Pending_class, "<init>", "([B[BJ)V");
8015         CHECK(LDKRecentPaymentDetails_Pending_meth != NULL);
8016         LDKRecentPaymentDetails_Fulfilled_class =
8017                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKRecentPaymentDetails$Fulfilled"));
8018         CHECK(LDKRecentPaymentDetails_Fulfilled_class != NULL);
8019         LDKRecentPaymentDetails_Fulfilled_meth = (*env)->GetMethodID(env, LDKRecentPaymentDetails_Fulfilled_class, "<init>", "([BJ)V");
8020         CHECK(LDKRecentPaymentDetails_Fulfilled_meth != NULL);
8021         LDKRecentPaymentDetails_Abandoned_class =
8022                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKRecentPaymentDetails$Abandoned"));
8023         CHECK(LDKRecentPaymentDetails_Abandoned_class != NULL);
8024         LDKRecentPaymentDetails_Abandoned_meth = (*env)->GetMethodID(env, LDKRecentPaymentDetails_Abandoned_class, "<init>", "([B[B)V");
8025         CHECK(LDKRecentPaymentDetails_Abandoned_meth != NULL);
8026 }
8027 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKRecentPaymentDetails_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
8028         LDKRecentPaymentDetails *obj = (LDKRecentPaymentDetails*)untag_ptr(ptr);
8029         switch(obj->tag) {
8030                 case LDKRecentPaymentDetails_AwaitingInvoice: {
8031                         int8_tArray payment_id_arr = (*env)->NewByteArray(env, 32);
8032                         (*env)->SetByteArrayRegion(env, payment_id_arr, 0, 32, obj->awaiting_invoice.payment_id.data);
8033                         return (*env)->NewObject(env, LDKRecentPaymentDetails_AwaitingInvoice_class, LDKRecentPaymentDetails_AwaitingInvoice_meth, payment_id_arr);
8034                 }
8035                 case LDKRecentPaymentDetails_Pending: {
8036                         int8_tArray payment_id_arr = (*env)->NewByteArray(env, 32);
8037                         (*env)->SetByteArrayRegion(env, payment_id_arr, 0, 32, obj->pending.payment_id.data);
8038                         int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
8039                         (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->pending.payment_hash.data);
8040                         int64_t total_msat_conv = obj->pending.total_msat;
8041                         return (*env)->NewObject(env, LDKRecentPaymentDetails_Pending_class, LDKRecentPaymentDetails_Pending_meth, payment_id_arr, payment_hash_arr, total_msat_conv);
8042                 }
8043                 case LDKRecentPaymentDetails_Fulfilled: {
8044                         int8_tArray payment_id_arr = (*env)->NewByteArray(env, 32);
8045                         (*env)->SetByteArrayRegion(env, payment_id_arr, 0, 32, obj->fulfilled.payment_id.data);
8046                         int64_t payment_hash_ref = tag_ptr(&obj->fulfilled.payment_hash, false);
8047                         return (*env)->NewObject(env, LDKRecentPaymentDetails_Fulfilled_class, LDKRecentPaymentDetails_Fulfilled_meth, payment_id_arr, payment_hash_ref);
8048                 }
8049                 case LDKRecentPaymentDetails_Abandoned: {
8050                         int8_tArray payment_id_arr = (*env)->NewByteArray(env, 32);
8051                         (*env)->SetByteArrayRegion(env, payment_id_arr, 0, 32, obj->abandoned.payment_id.data);
8052                         int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
8053                         (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->abandoned.payment_hash.data);
8054                         return (*env)->NewObject(env, LDKRecentPaymentDetails_Abandoned_class, LDKRecentPaymentDetails_Abandoned_meth, payment_id_arr, payment_hash_arr);
8055                 }
8056                 default: abort();
8057         }
8058 }
8059 static inline LDKCVec_RecentPaymentDetailsZ CVec_RecentPaymentDetailsZ_clone(const LDKCVec_RecentPaymentDetailsZ *orig) {
8060         LDKCVec_RecentPaymentDetailsZ ret = { .data = MALLOC(sizeof(LDKRecentPaymentDetails) * orig->datalen, "LDKCVec_RecentPaymentDetailsZ clone bytes"), .datalen = orig->datalen };
8061         for (size_t i = 0; i < ret.datalen; i++) {
8062                 ret.data[i] = RecentPaymentDetails_clone(&orig->data[i]);
8063         }
8064         return ret;
8065 }
8066 static jclass LDKPaymentSendFailure_ParameterError_class = NULL;
8067 static jmethodID LDKPaymentSendFailure_ParameterError_meth = NULL;
8068 static jclass LDKPaymentSendFailure_PathParameterError_class = NULL;
8069 static jmethodID LDKPaymentSendFailure_PathParameterError_meth = NULL;
8070 static jclass LDKPaymentSendFailure_AllFailedResendSafe_class = NULL;
8071 static jmethodID LDKPaymentSendFailure_AllFailedResendSafe_meth = NULL;
8072 static jclass LDKPaymentSendFailure_DuplicatePayment_class = NULL;
8073 static jmethodID LDKPaymentSendFailure_DuplicatePayment_meth = NULL;
8074 static jclass LDKPaymentSendFailure_PartialFailure_class = NULL;
8075 static jmethodID LDKPaymentSendFailure_PartialFailure_meth = NULL;
8076 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKPaymentSendFailure_init (JNIEnv *env, jclass clz) {
8077         LDKPaymentSendFailure_ParameterError_class =
8078                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentSendFailure$ParameterError"));
8079         CHECK(LDKPaymentSendFailure_ParameterError_class != NULL);
8080         LDKPaymentSendFailure_ParameterError_meth = (*env)->GetMethodID(env, LDKPaymentSendFailure_ParameterError_class, "<init>", "(J)V");
8081         CHECK(LDKPaymentSendFailure_ParameterError_meth != NULL);
8082         LDKPaymentSendFailure_PathParameterError_class =
8083                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentSendFailure$PathParameterError"));
8084         CHECK(LDKPaymentSendFailure_PathParameterError_class != NULL);
8085         LDKPaymentSendFailure_PathParameterError_meth = (*env)->GetMethodID(env, LDKPaymentSendFailure_PathParameterError_class, "<init>", "([J)V");
8086         CHECK(LDKPaymentSendFailure_PathParameterError_meth != NULL);
8087         LDKPaymentSendFailure_AllFailedResendSafe_class =
8088                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentSendFailure$AllFailedResendSafe"));
8089         CHECK(LDKPaymentSendFailure_AllFailedResendSafe_class != NULL);
8090         LDKPaymentSendFailure_AllFailedResendSafe_meth = (*env)->GetMethodID(env, LDKPaymentSendFailure_AllFailedResendSafe_class, "<init>", "([J)V");
8091         CHECK(LDKPaymentSendFailure_AllFailedResendSafe_meth != NULL);
8092         LDKPaymentSendFailure_DuplicatePayment_class =
8093                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentSendFailure$DuplicatePayment"));
8094         CHECK(LDKPaymentSendFailure_DuplicatePayment_class != NULL);
8095         LDKPaymentSendFailure_DuplicatePayment_meth = (*env)->GetMethodID(env, LDKPaymentSendFailure_DuplicatePayment_class, "<init>", "()V");
8096         CHECK(LDKPaymentSendFailure_DuplicatePayment_meth != NULL);
8097         LDKPaymentSendFailure_PartialFailure_class =
8098                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentSendFailure$PartialFailure"));
8099         CHECK(LDKPaymentSendFailure_PartialFailure_class != NULL);
8100         LDKPaymentSendFailure_PartialFailure_meth = (*env)->GetMethodID(env, LDKPaymentSendFailure_PartialFailure_class, "<init>", "([JJ[B)V");
8101         CHECK(LDKPaymentSendFailure_PartialFailure_meth != NULL);
8102 }
8103 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKPaymentSendFailure_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
8104         LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)untag_ptr(ptr);
8105         switch(obj->tag) {
8106                 case LDKPaymentSendFailure_ParameterError: {
8107                         int64_t parameter_error_ref = tag_ptr(&obj->parameter_error, false);
8108                         return (*env)->NewObject(env, LDKPaymentSendFailure_ParameterError_class, LDKPaymentSendFailure_ParameterError_meth, parameter_error_ref);
8109                 }
8110                 case LDKPaymentSendFailure_PathParameterError: {
8111                         LDKCVec_CResult_NoneAPIErrorZZ path_parameter_error_var = obj->path_parameter_error;
8112                         int64_tArray path_parameter_error_arr = NULL;
8113                         path_parameter_error_arr = (*env)->NewLongArray(env, path_parameter_error_var.datalen);
8114                         int64_t *path_parameter_error_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, path_parameter_error_arr, NULL);
8115                         for (size_t w = 0; w < path_parameter_error_var.datalen; w++) {
8116                                 LDKCResult_NoneAPIErrorZ* path_parameter_error_conv_22_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
8117                                 *path_parameter_error_conv_22_conv = path_parameter_error_var.data[w];
8118                                 *path_parameter_error_conv_22_conv = CResult_NoneAPIErrorZ_clone(path_parameter_error_conv_22_conv);
8119                                 path_parameter_error_arr_ptr[w] = tag_ptr(path_parameter_error_conv_22_conv, true);
8120                         }
8121                         (*env)->ReleasePrimitiveArrayCritical(env, path_parameter_error_arr, path_parameter_error_arr_ptr, 0);
8122                         return (*env)->NewObject(env, LDKPaymentSendFailure_PathParameterError_class, LDKPaymentSendFailure_PathParameterError_meth, path_parameter_error_arr);
8123                 }
8124                 case LDKPaymentSendFailure_AllFailedResendSafe: {
8125                         LDKCVec_APIErrorZ all_failed_resend_safe_var = obj->all_failed_resend_safe;
8126                         int64_tArray all_failed_resend_safe_arr = NULL;
8127                         all_failed_resend_safe_arr = (*env)->NewLongArray(env, all_failed_resend_safe_var.datalen);
8128                         int64_t *all_failed_resend_safe_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, all_failed_resend_safe_arr, NULL);
8129                         for (size_t k = 0; k < all_failed_resend_safe_var.datalen; k++) {
8130                                 int64_t all_failed_resend_safe_conv_10_ref = tag_ptr(&all_failed_resend_safe_var.data[k], false);
8131                                 all_failed_resend_safe_arr_ptr[k] = all_failed_resend_safe_conv_10_ref;
8132                         }
8133                         (*env)->ReleasePrimitiveArrayCritical(env, all_failed_resend_safe_arr, all_failed_resend_safe_arr_ptr, 0);
8134                         return (*env)->NewObject(env, LDKPaymentSendFailure_AllFailedResendSafe_class, LDKPaymentSendFailure_AllFailedResendSafe_meth, all_failed_resend_safe_arr);
8135                 }
8136                 case LDKPaymentSendFailure_DuplicatePayment: {
8137                         return (*env)->NewObject(env, LDKPaymentSendFailure_DuplicatePayment_class, LDKPaymentSendFailure_DuplicatePayment_meth);
8138                 }
8139                 case LDKPaymentSendFailure_PartialFailure: {
8140                         LDKCVec_CResult_NoneAPIErrorZZ results_var = obj->partial_failure.results;
8141                         int64_tArray results_arr = NULL;
8142                         results_arr = (*env)->NewLongArray(env, results_var.datalen);
8143                         int64_t *results_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, results_arr, NULL);
8144                         for (size_t w = 0; w < results_var.datalen; w++) {
8145                                 LDKCResult_NoneAPIErrorZ* results_conv_22_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
8146                                 *results_conv_22_conv = results_var.data[w];
8147                                 *results_conv_22_conv = CResult_NoneAPIErrorZ_clone(results_conv_22_conv);
8148                                 results_arr_ptr[w] = tag_ptr(results_conv_22_conv, true);
8149                         }
8150                         (*env)->ReleasePrimitiveArrayCritical(env, results_arr, results_arr_ptr, 0);
8151                         LDKRouteParameters failed_paths_retry_var = obj->partial_failure.failed_paths_retry;
8152                         int64_t failed_paths_retry_ref = 0;
8153                         CHECK_INNER_FIELD_ACCESS_OR_NULL(failed_paths_retry_var);
8154                         failed_paths_retry_ref = tag_ptr(failed_paths_retry_var.inner, false);
8155                         int8_tArray payment_id_arr = (*env)->NewByteArray(env, 32);
8156                         (*env)->SetByteArrayRegion(env, payment_id_arr, 0, 32, obj->partial_failure.payment_id.data);
8157                         return (*env)->NewObject(env, LDKPaymentSendFailure_PartialFailure_class, LDKPaymentSendFailure_PartialFailure_meth, results_arr, failed_paths_retry_ref, payment_id_arr);
8158                 }
8159                 default: abort();
8160         }
8161 }
8162 static inline void CResult_NonePaymentSendFailureZ_get_ok(LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR owner){
8163 CHECK(owner->result_ok);
8164         return *owner->contents.result;
8165 }
8166 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8167         LDKCResult_NonePaymentSendFailureZ* owner_conv = (LDKCResult_NonePaymentSendFailureZ*)untag_ptr(owner);
8168         CResult_NonePaymentSendFailureZ_get_ok(owner_conv);
8169 }
8170
8171 static inline struct LDKPaymentSendFailure CResult_NonePaymentSendFailureZ_get_err(LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR owner){
8172 CHECK(!owner->result_ok);
8173         return PaymentSendFailure_clone(&*owner->contents.err);
8174 }
8175 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8176         LDKCResult_NonePaymentSendFailureZ* owner_conv = (LDKCResult_NonePaymentSendFailureZ*)untag_ptr(owner);
8177         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
8178         *ret_copy = CResult_NonePaymentSendFailureZ_get_err(owner_conv);
8179         int64_t ret_ref = tag_ptr(ret_copy, true);
8180         return ret_ref;
8181 }
8182
8183 static inline void CResult_NoneRetryableSendFailureZ_get_ok(LDKCResult_NoneRetryableSendFailureZ *NONNULL_PTR owner){
8184 CHECK(owner->result_ok);
8185         return *owner->contents.result;
8186 }
8187 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneRetryableSendFailureZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8188         LDKCResult_NoneRetryableSendFailureZ* owner_conv = (LDKCResult_NoneRetryableSendFailureZ*)untag_ptr(owner);
8189         CResult_NoneRetryableSendFailureZ_get_ok(owner_conv);
8190 }
8191
8192 static inline enum LDKRetryableSendFailure CResult_NoneRetryableSendFailureZ_get_err(LDKCResult_NoneRetryableSendFailureZ *NONNULL_PTR owner){
8193 CHECK(!owner->result_ok);
8194         return RetryableSendFailure_clone(&*owner->contents.err);
8195 }
8196 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1NoneRetryableSendFailureZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8197         LDKCResult_NoneRetryableSendFailureZ* owner_conv = (LDKCResult_NoneRetryableSendFailureZ*)untag_ptr(owner);
8198         jclass ret_conv = LDKRetryableSendFailure_to_java(env, CResult_NoneRetryableSendFailureZ_get_err(owner_conv));
8199         return ret_conv;
8200 }
8201
8202 static inline struct LDKThirtyTwoBytes CResult_ThirtyTwoBytesPaymentSendFailureZ_get_ok(LDKCResult_ThirtyTwoBytesPaymentSendFailureZ *NONNULL_PTR owner){
8203 CHECK(owner->result_ok);
8204         return ThirtyTwoBytes_clone(&*owner->contents.result);
8205 }
8206 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesPaymentSendFailureZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8207         LDKCResult_ThirtyTwoBytesPaymentSendFailureZ* owner_conv = (LDKCResult_ThirtyTwoBytesPaymentSendFailureZ*)untag_ptr(owner);
8208         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
8209         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, CResult_ThirtyTwoBytesPaymentSendFailureZ_get_ok(owner_conv).data);
8210         return ret_arr;
8211 }
8212
8213 static inline struct LDKPaymentSendFailure CResult_ThirtyTwoBytesPaymentSendFailureZ_get_err(LDKCResult_ThirtyTwoBytesPaymentSendFailureZ *NONNULL_PTR owner){
8214 CHECK(!owner->result_ok);
8215         return PaymentSendFailure_clone(&*owner->contents.err);
8216 }
8217 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesPaymentSendFailureZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8218         LDKCResult_ThirtyTwoBytesPaymentSendFailureZ* owner_conv = (LDKCResult_ThirtyTwoBytesPaymentSendFailureZ*)untag_ptr(owner);
8219         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
8220         *ret_copy = CResult_ThirtyTwoBytesPaymentSendFailureZ_get_err(owner_conv);
8221         int64_t ret_ref = tag_ptr(ret_copy, true);
8222         return ret_ref;
8223 }
8224
8225 static inline struct LDKThirtyTwoBytes CResult_ThirtyTwoBytesRetryableSendFailureZ_get_ok(LDKCResult_ThirtyTwoBytesRetryableSendFailureZ *NONNULL_PTR owner){
8226 CHECK(owner->result_ok);
8227         return ThirtyTwoBytes_clone(&*owner->contents.result);
8228 }
8229 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesRetryableSendFailureZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8230         LDKCResult_ThirtyTwoBytesRetryableSendFailureZ* owner_conv = (LDKCResult_ThirtyTwoBytesRetryableSendFailureZ*)untag_ptr(owner);
8231         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
8232         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, CResult_ThirtyTwoBytesRetryableSendFailureZ_get_ok(owner_conv).data);
8233         return ret_arr;
8234 }
8235
8236 static inline enum LDKRetryableSendFailure CResult_ThirtyTwoBytesRetryableSendFailureZ_get_err(LDKCResult_ThirtyTwoBytesRetryableSendFailureZ *NONNULL_PTR owner){
8237 CHECK(!owner->result_ok);
8238         return RetryableSendFailure_clone(&*owner->contents.err);
8239 }
8240 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesRetryableSendFailureZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8241         LDKCResult_ThirtyTwoBytesRetryableSendFailureZ* owner_conv = (LDKCResult_ThirtyTwoBytesRetryableSendFailureZ*)untag_ptr(owner);
8242         jclass ret_conv = LDKRetryableSendFailure_to_java(env, CResult_ThirtyTwoBytesRetryableSendFailureZ_get_err(owner_conv));
8243         return ret_conv;
8244 }
8245
8246 static inline struct LDKThirtyTwoBytes C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_get_a(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ *NONNULL_PTR owner){
8247         return ThirtyTwoBytes_clone(&owner->a);
8248 }
8249 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
8250         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)untag_ptr(owner);
8251         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
8252         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_get_a(owner_conv).data);
8253         return ret_arr;
8254 }
8255
8256 static inline struct LDKThirtyTwoBytes C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_get_b(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ *NONNULL_PTR owner){
8257         return ThirtyTwoBytes_clone(&owner->b);
8258 }
8259 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
8260         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)untag_ptr(owner);
8261         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
8262         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_get_b(owner_conv).data);
8263         return ret_arr;
8264 }
8265
8266 static inline struct LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_get_ok(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ *NONNULL_PTR owner){
8267 CHECK(owner->result_ok);
8268         return C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone(&*owner->contents.result);
8269 }
8270 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8271         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ* owner_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ*)untag_ptr(owner);
8272         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ), "LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ");
8273         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_get_ok(owner_conv);
8274         return tag_ptr(ret_conv, true);
8275 }
8276
8277 static inline struct LDKPaymentSendFailure CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_get_err(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ *NONNULL_PTR owner){
8278 CHECK(!owner->result_ok);
8279         return PaymentSendFailure_clone(&*owner->contents.err);
8280 }
8281 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8282         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ* owner_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ*)untag_ptr(owner);
8283         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
8284         *ret_copy = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_get_err(owner_conv);
8285         int64_t ret_ref = tag_ptr(ret_copy, true);
8286         return ret_ref;
8287 }
8288
8289 static inline LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ_clone(const LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ *orig) {
8290         LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ) * orig->datalen, "LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ clone bytes"), .datalen = orig->datalen };
8291         for (size_t i = 0; i < ret.datalen; i++) {
8292                 ret.data[i] = C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone(&orig->data[i]);
8293         }
8294         return ret;
8295 }
8296 static jclass LDKProbeSendFailure_RouteNotFound_class = NULL;
8297 static jmethodID LDKProbeSendFailure_RouteNotFound_meth = NULL;
8298 static jclass LDKProbeSendFailure_SendingFailed_class = NULL;
8299 static jmethodID LDKProbeSendFailure_SendingFailed_meth = NULL;
8300 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKProbeSendFailure_init (JNIEnv *env, jclass clz) {
8301         LDKProbeSendFailure_RouteNotFound_class =
8302                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKProbeSendFailure$RouteNotFound"));
8303         CHECK(LDKProbeSendFailure_RouteNotFound_class != NULL);
8304         LDKProbeSendFailure_RouteNotFound_meth = (*env)->GetMethodID(env, LDKProbeSendFailure_RouteNotFound_class, "<init>", "()V");
8305         CHECK(LDKProbeSendFailure_RouteNotFound_meth != NULL);
8306         LDKProbeSendFailure_SendingFailed_class =
8307                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKProbeSendFailure$SendingFailed"));
8308         CHECK(LDKProbeSendFailure_SendingFailed_class != NULL);
8309         LDKProbeSendFailure_SendingFailed_meth = (*env)->GetMethodID(env, LDKProbeSendFailure_SendingFailed_class, "<init>", "(J)V");
8310         CHECK(LDKProbeSendFailure_SendingFailed_meth != NULL);
8311 }
8312 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKProbeSendFailure_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
8313         LDKProbeSendFailure *obj = (LDKProbeSendFailure*)untag_ptr(ptr);
8314         switch(obj->tag) {
8315                 case LDKProbeSendFailure_RouteNotFound: {
8316                         return (*env)->NewObject(env, LDKProbeSendFailure_RouteNotFound_class, LDKProbeSendFailure_RouteNotFound_meth);
8317                 }
8318                 case LDKProbeSendFailure_SendingFailed: {
8319                         int64_t sending_failed_ref = tag_ptr(&obj->sending_failed, false);
8320                         return (*env)->NewObject(env, LDKProbeSendFailure_SendingFailed_class, LDKProbeSendFailure_SendingFailed_meth, sending_failed_ref);
8321                 }
8322                 default: abort();
8323         }
8324 }
8325 static inline struct LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_get_ok(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ *NONNULL_PTR owner){
8326 CHECK(owner->result_ok);
8327         return CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ_clone(&*owner->contents.result);
8328 }
8329 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8330         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ* owner_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ*)untag_ptr(owner);
8331         LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ ret_var = CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_get_ok(owner_conv);
8332         int64_tArray ret_arr = NULL;
8333         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
8334         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
8335         for (size_t o = 0; o < ret_var.datalen; o++) {
8336                 LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ* ret_conv_40_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ), "LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ");
8337                 *ret_conv_40_conv = ret_var.data[o];
8338                 ret_arr_ptr[o] = tag_ptr(ret_conv_40_conv, true);
8339         }
8340         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
8341         FREE(ret_var.data);
8342         return ret_arr;
8343 }
8344
8345 static inline struct LDKProbeSendFailure CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_get_err(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ *NONNULL_PTR owner){
8346 CHECK(!owner->result_ok);
8347         return ProbeSendFailure_clone(&*owner->contents.err);
8348 }
8349 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8350         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ* owner_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ*)untag_ptr(owner);
8351         LDKProbeSendFailure *ret_copy = MALLOC(sizeof(LDKProbeSendFailure), "LDKProbeSendFailure");
8352         *ret_copy = CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_get_err(owner_conv);
8353         int64_t ret_ref = tag_ptr(ret_copy, true);
8354         return ret_ref;
8355 }
8356
8357 static inline struct LDKChannelId C2Tuple_ChannelIdPublicKeyZ_get_a(LDKC2Tuple_ChannelIdPublicKeyZ *NONNULL_PTR owner){
8358         LDKChannelId ret = owner->a;
8359         ret.is_owned = false;
8360         return ret;
8361 }
8362 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ChannelIdPublicKeyZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
8363         LDKC2Tuple_ChannelIdPublicKeyZ* owner_conv = (LDKC2Tuple_ChannelIdPublicKeyZ*)untag_ptr(owner);
8364         LDKChannelId ret_var = C2Tuple_ChannelIdPublicKeyZ_get_a(owner_conv);
8365         int64_t ret_ref = 0;
8366         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8367         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8368         return ret_ref;
8369 }
8370
8371 static inline struct LDKPublicKey C2Tuple_ChannelIdPublicKeyZ_get_b(LDKC2Tuple_ChannelIdPublicKeyZ *NONNULL_PTR owner){
8372         return owner->b;
8373 }
8374 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ChannelIdPublicKeyZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
8375         LDKC2Tuple_ChannelIdPublicKeyZ* owner_conv = (LDKC2Tuple_ChannelIdPublicKeyZ*)untag_ptr(owner);
8376         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
8377         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, C2Tuple_ChannelIdPublicKeyZ_get_b(owner_conv).compressed_form);
8378         return ret_arr;
8379 }
8380
8381 static inline LDKCVec_C2Tuple_ChannelIdPublicKeyZZ CVec_C2Tuple_ChannelIdPublicKeyZZ_clone(const LDKCVec_C2Tuple_ChannelIdPublicKeyZZ *orig) {
8382         LDKCVec_C2Tuple_ChannelIdPublicKeyZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_ChannelIdPublicKeyZ) * orig->datalen, "LDKCVec_C2Tuple_ChannelIdPublicKeyZZ clone bytes"), .datalen = orig->datalen };
8383         for (size_t i = 0; i < ret.datalen; i++) {
8384                 ret.data[i] = C2Tuple_ChannelIdPublicKeyZ_clone(&orig->data[i]);
8385         }
8386         return ret;
8387 }
8388 static inline LDKCVec_ChannelIdZ CVec_ChannelIdZ_clone(const LDKCVec_ChannelIdZ *orig) {
8389         LDKCVec_ChannelIdZ ret = { .data = MALLOC(sizeof(LDKChannelId) * orig->datalen, "LDKCVec_ChannelIdZ clone bytes"), .datalen = orig->datalen };
8390         for (size_t i = 0; i < ret.datalen; i++) {
8391                 ret.data[i] = ChannelId_clone(&orig->data[i]);
8392         }
8393         return ret;
8394 }
8395 static inline struct LDKOfferWithDerivedMetadataBuilder CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ_get_ok(LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ *NONNULL_PTR owner){
8396         LDKOfferWithDerivedMetadataBuilder ret = *owner->contents.result;
8397         ret.is_owned = false;
8398         return ret;
8399 }
8400 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8401         LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ* owner_conv = (LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ*)untag_ptr(owner);
8402         LDKOfferWithDerivedMetadataBuilder ret_var = CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ_get_ok(owner_conv);
8403         int64_t ret_ref = 0;
8404         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8405         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8406         return ret_ref;
8407 }
8408
8409 static inline enum LDKBolt12SemanticError CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ_get_err(LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ *NONNULL_PTR owner){
8410 CHECK(!owner->result_ok);
8411         return Bolt12SemanticError_clone(&*owner->contents.err);
8412 }
8413 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8414         LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ* owner_conv = (LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ*)untag_ptr(owner);
8415         jclass ret_conv = LDKBolt12SemanticError_to_java(env, CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ_get_err(owner_conv));
8416         return ret_conv;
8417 }
8418
8419 static jclass LDKCOption_StrZ_Some_class = NULL;
8420 static jmethodID LDKCOption_StrZ_Some_meth = NULL;
8421 static jclass LDKCOption_StrZ_None_class = NULL;
8422 static jmethodID LDKCOption_StrZ_None_meth = NULL;
8423 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1StrZ_init (JNIEnv *env, jclass clz) {
8424         LDKCOption_StrZ_Some_class =
8425                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_StrZ$Some"));
8426         CHECK(LDKCOption_StrZ_Some_class != NULL);
8427         LDKCOption_StrZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_StrZ_Some_class, "<init>", "(Ljava/lang/String;)V");
8428         CHECK(LDKCOption_StrZ_Some_meth != NULL);
8429         LDKCOption_StrZ_None_class =
8430                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_StrZ$None"));
8431         CHECK(LDKCOption_StrZ_None_class != NULL);
8432         LDKCOption_StrZ_None_meth = (*env)->GetMethodID(env, LDKCOption_StrZ_None_class, "<init>", "()V");
8433         CHECK(LDKCOption_StrZ_None_meth != NULL);
8434 }
8435 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1StrZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
8436         LDKCOption_StrZ *obj = (LDKCOption_StrZ*)untag_ptr(ptr);
8437         switch(obj->tag) {
8438                 case LDKCOption_StrZ_Some: {
8439                         LDKStr some_str = obj->some;
8440                         jstring some_conv = str_ref_to_java(env, some_str.chars, some_str.len);
8441                         return (*env)->NewObject(env, LDKCOption_StrZ_Some_class, LDKCOption_StrZ_Some_meth, some_conv);
8442                 }
8443                 case LDKCOption_StrZ_None: {
8444                         return (*env)->NewObject(env, LDKCOption_StrZ_None_class, LDKCOption_StrZ_None_meth);
8445                 }
8446                 default: abort();
8447         }
8448 }
8449 static inline struct LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_get_ok(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ *NONNULL_PTR owner){
8450 CHECK(owner->result_ok);
8451         return C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone(&*owner->contents.result);
8452 }
8453 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8454         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ* owner_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ*)untag_ptr(owner);
8455         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ), "LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ");
8456         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_get_ok(owner_conv);
8457         return tag_ptr(ret_conv, true);
8458 }
8459
8460 static inline void CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_get_err(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ *NONNULL_PTR owner){
8461 CHECK(!owner->result_ok);
8462         return *owner->contents.err;
8463 }
8464 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8465         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ* owner_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ*)untag_ptr(owner);
8466         CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_get_err(owner_conv);
8467 }
8468
8469 static inline struct LDKThirtyTwoBytes CResult_ThirtyTwoBytesAPIErrorZ_get_ok(LDKCResult_ThirtyTwoBytesAPIErrorZ *NONNULL_PTR owner){
8470 CHECK(owner->result_ok);
8471         return ThirtyTwoBytes_clone(&*owner->contents.result);
8472 }
8473 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesAPIErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8474         LDKCResult_ThirtyTwoBytesAPIErrorZ* owner_conv = (LDKCResult_ThirtyTwoBytesAPIErrorZ*)untag_ptr(owner);
8475         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
8476         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, CResult_ThirtyTwoBytesAPIErrorZ_get_ok(owner_conv).data);
8477         return ret_arr;
8478 }
8479
8480 static inline struct LDKAPIError CResult_ThirtyTwoBytesAPIErrorZ_get_err(LDKCResult_ThirtyTwoBytesAPIErrorZ *NONNULL_PTR owner){
8481 CHECK(!owner->result_ok);
8482         return APIError_clone(&*owner->contents.err);
8483 }
8484 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesAPIErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8485         LDKCResult_ThirtyTwoBytesAPIErrorZ* owner_conv = (LDKCResult_ThirtyTwoBytesAPIErrorZ*)untag_ptr(owner);
8486         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
8487         *ret_copy = CResult_ThirtyTwoBytesAPIErrorZ_get_err(owner_conv);
8488         int64_t ret_ref = tag_ptr(ret_copy, true);
8489         return ret_ref;
8490 }
8491
8492 static jclass LDKOffersMessage_InvoiceRequest_class = NULL;
8493 static jmethodID LDKOffersMessage_InvoiceRequest_meth = NULL;
8494 static jclass LDKOffersMessage_Invoice_class = NULL;
8495 static jmethodID LDKOffersMessage_Invoice_meth = NULL;
8496 static jclass LDKOffersMessage_InvoiceError_class = NULL;
8497 static jmethodID LDKOffersMessage_InvoiceError_meth = NULL;
8498 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKOffersMessage_init (JNIEnv *env, jclass clz) {
8499         LDKOffersMessage_InvoiceRequest_class =
8500                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKOffersMessage$InvoiceRequest"));
8501         CHECK(LDKOffersMessage_InvoiceRequest_class != NULL);
8502         LDKOffersMessage_InvoiceRequest_meth = (*env)->GetMethodID(env, LDKOffersMessage_InvoiceRequest_class, "<init>", "(J)V");
8503         CHECK(LDKOffersMessage_InvoiceRequest_meth != NULL);
8504         LDKOffersMessage_Invoice_class =
8505                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKOffersMessage$Invoice"));
8506         CHECK(LDKOffersMessage_Invoice_class != NULL);
8507         LDKOffersMessage_Invoice_meth = (*env)->GetMethodID(env, LDKOffersMessage_Invoice_class, "<init>", "(J)V");
8508         CHECK(LDKOffersMessage_Invoice_meth != NULL);
8509         LDKOffersMessage_InvoiceError_class =
8510                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKOffersMessage$InvoiceError"));
8511         CHECK(LDKOffersMessage_InvoiceError_class != NULL);
8512         LDKOffersMessage_InvoiceError_meth = (*env)->GetMethodID(env, LDKOffersMessage_InvoiceError_class, "<init>", "(J)V");
8513         CHECK(LDKOffersMessage_InvoiceError_meth != NULL);
8514 }
8515 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKOffersMessage_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
8516         LDKOffersMessage *obj = (LDKOffersMessage*)untag_ptr(ptr);
8517         switch(obj->tag) {
8518                 case LDKOffersMessage_InvoiceRequest: {
8519                         LDKInvoiceRequest invoice_request_var = obj->invoice_request;
8520                         int64_t invoice_request_ref = 0;
8521                         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_request_var);
8522                         invoice_request_ref = tag_ptr(invoice_request_var.inner, false);
8523                         return (*env)->NewObject(env, LDKOffersMessage_InvoiceRequest_class, LDKOffersMessage_InvoiceRequest_meth, invoice_request_ref);
8524                 }
8525                 case LDKOffersMessage_Invoice: {
8526                         LDKBolt12Invoice invoice_var = obj->invoice;
8527                         int64_t invoice_ref = 0;
8528                         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_var);
8529                         invoice_ref = tag_ptr(invoice_var.inner, false);
8530                         return (*env)->NewObject(env, LDKOffersMessage_Invoice_class, LDKOffersMessage_Invoice_meth, invoice_ref);
8531                 }
8532                 case LDKOffersMessage_InvoiceError: {
8533                         LDKInvoiceError invoice_error_var = obj->invoice_error;
8534                         int64_t invoice_error_ref = 0;
8535                         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_error_var);
8536                         invoice_error_ref = tag_ptr(invoice_error_var.inner, false);
8537                         return (*env)->NewObject(env, LDKOffersMessage_InvoiceError_class, LDKOffersMessage_InvoiceError_meth, invoice_error_ref);
8538                 }
8539                 default: abort();
8540         }
8541 }
8542 static jclass LDKCOption_OffersMessageZ_Some_class = NULL;
8543 static jmethodID LDKCOption_OffersMessageZ_Some_meth = NULL;
8544 static jclass LDKCOption_OffersMessageZ_None_class = NULL;
8545 static jmethodID LDKCOption_OffersMessageZ_None_meth = NULL;
8546 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1OffersMessageZ_init (JNIEnv *env, jclass clz) {
8547         LDKCOption_OffersMessageZ_Some_class =
8548                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_OffersMessageZ$Some"));
8549         CHECK(LDKCOption_OffersMessageZ_Some_class != NULL);
8550         LDKCOption_OffersMessageZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_OffersMessageZ_Some_class, "<init>", "(J)V");
8551         CHECK(LDKCOption_OffersMessageZ_Some_meth != NULL);
8552         LDKCOption_OffersMessageZ_None_class =
8553                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_OffersMessageZ$None"));
8554         CHECK(LDKCOption_OffersMessageZ_None_class != NULL);
8555         LDKCOption_OffersMessageZ_None_meth = (*env)->GetMethodID(env, LDKCOption_OffersMessageZ_None_class, "<init>", "()V");
8556         CHECK(LDKCOption_OffersMessageZ_None_meth != NULL);
8557 }
8558 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1OffersMessageZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
8559         LDKCOption_OffersMessageZ *obj = (LDKCOption_OffersMessageZ*)untag_ptr(ptr);
8560         switch(obj->tag) {
8561                 case LDKCOption_OffersMessageZ_Some: {
8562                         int64_t some_ref = tag_ptr(&obj->some, false);
8563                         return (*env)->NewObject(env, LDKCOption_OffersMessageZ_Some_class, LDKCOption_OffersMessageZ_Some_meth, some_ref);
8564                 }
8565                 case LDKCOption_OffersMessageZ_None: {
8566                         return (*env)->NewObject(env, LDKCOption_OffersMessageZ_None_class, LDKCOption_OffersMessageZ_None_meth);
8567                 }
8568                 default: abort();
8569         }
8570 }
8571 static jclass LDKDestination_Node_class = NULL;
8572 static jmethodID LDKDestination_Node_meth = NULL;
8573 static jclass LDKDestination_BlindedPath_class = NULL;
8574 static jmethodID LDKDestination_BlindedPath_meth = NULL;
8575 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKDestination_init (JNIEnv *env, jclass clz) {
8576         LDKDestination_Node_class =
8577                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKDestination$Node"));
8578         CHECK(LDKDestination_Node_class != NULL);
8579         LDKDestination_Node_meth = (*env)->GetMethodID(env, LDKDestination_Node_class, "<init>", "([B)V");
8580         CHECK(LDKDestination_Node_meth != NULL);
8581         LDKDestination_BlindedPath_class =
8582                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKDestination$BlindedPath"));
8583         CHECK(LDKDestination_BlindedPath_class != NULL);
8584         LDKDestination_BlindedPath_meth = (*env)->GetMethodID(env, LDKDestination_BlindedPath_class, "<init>", "(J)V");
8585         CHECK(LDKDestination_BlindedPath_meth != NULL);
8586 }
8587 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKDestination_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
8588         LDKDestination *obj = (LDKDestination*)untag_ptr(ptr);
8589         switch(obj->tag) {
8590                 case LDKDestination_Node: {
8591                         int8_tArray node_arr = (*env)->NewByteArray(env, 33);
8592                         (*env)->SetByteArrayRegion(env, node_arr, 0, 33, obj->node.compressed_form);
8593                         return (*env)->NewObject(env, LDKDestination_Node_class, LDKDestination_Node_meth, node_arr);
8594                 }
8595                 case LDKDestination_BlindedPath: {
8596                         LDKBlindedPath blinded_path_var = obj->blinded_path;
8597                         int64_t blinded_path_ref = 0;
8598                         CHECK_INNER_FIELD_ACCESS_OR_NULL(blinded_path_var);
8599                         blinded_path_ref = tag_ptr(blinded_path_var.inner, false);
8600                         return (*env)->NewObject(env, LDKDestination_BlindedPath_class, LDKDestination_BlindedPath_meth, blinded_path_ref);
8601                 }
8602                 default: abort();
8603         }
8604 }
8605 static inline struct LDKOffersMessage C3Tuple_OffersMessageDestinationBlindedPathZ_get_a(LDKC3Tuple_OffersMessageDestinationBlindedPathZ *NONNULL_PTR owner){
8606         return OffersMessage_clone(&owner->a);
8607 }
8608 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1OffersMessageDestinationBlindedPathZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
8609         LDKC3Tuple_OffersMessageDestinationBlindedPathZ* owner_conv = (LDKC3Tuple_OffersMessageDestinationBlindedPathZ*)untag_ptr(owner);
8610         LDKOffersMessage *ret_copy = MALLOC(sizeof(LDKOffersMessage), "LDKOffersMessage");
8611         *ret_copy = C3Tuple_OffersMessageDestinationBlindedPathZ_get_a(owner_conv);
8612         int64_t ret_ref = tag_ptr(ret_copy, true);
8613         return ret_ref;
8614 }
8615
8616 static inline struct LDKDestination C3Tuple_OffersMessageDestinationBlindedPathZ_get_b(LDKC3Tuple_OffersMessageDestinationBlindedPathZ *NONNULL_PTR owner){
8617         return Destination_clone(&owner->b);
8618 }
8619 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1OffersMessageDestinationBlindedPathZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
8620         LDKC3Tuple_OffersMessageDestinationBlindedPathZ* owner_conv = (LDKC3Tuple_OffersMessageDestinationBlindedPathZ*)untag_ptr(owner);
8621         LDKDestination *ret_copy = MALLOC(sizeof(LDKDestination), "LDKDestination");
8622         *ret_copy = C3Tuple_OffersMessageDestinationBlindedPathZ_get_b(owner_conv);
8623         int64_t ret_ref = tag_ptr(ret_copy, true);
8624         return ret_ref;
8625 }
8626
8627 static inline struct LDKBlindedPath C3Tuple_OffersMessageDestinationBlindedPathZ_get_c(LDKC3Tuple_OffersMessageDestinationBlindedPathZ *NONNULL_PTR owner){
8628         LDKBlindedPath ret = owner->c;
8629         ret.is_owned = false;
8630         return ret;
8631 }
8632 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1OffersMessageDestinationBlindedPathZ_1get_1c(JNIEnv *env, jclass clz, int64_t owner) {
8633         LDKC3Tuple_OffersMessageDestinationBlindedPathZ* owner_conv = (LDKC3Tuple_OffersMessageDestinationBlindedPathZ*)untag_ptr(owner);
8634         LDKBlindedPath ret_var = C3Tuple_OffersMessageDestinationBlindedPathZ_get_c(owner_conv);
8635         int64_t ret_ref = 0;
8636         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8637         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8638         return ret_ref;
8639 }
8640
8641 static inline LDKCVec_C3Tuple_OffersMessageDestinationBlindedPathZZ CVec_C3Tuple_OffersMessageDestinationBlindedPathZZ_clone(const LDKCVec_C3Tuple_OffersMessageDestinationBlindedPathZZ *orig) {
8642         LDKCVec_C3Tuple_OffersMessageDestinationBlindedPathZZ ret = { .data = MALLOC(sizeof(LDKC3Tuple_OffersMessageDestinationBlindedPathZ) * orig->datalen, "LDKCVec_C3Tuple_OffersMessageDestinationBlindedPathZZ clone bytes"), .datalen = orig->datalen };
8643         for (size_t i = 0; i < ret.datalen; i++) {
8644                 ret.data[i] = C3Tuple_OffersMessageDestinationBlindedPathZ_clone(&orig->data[i]);
8645         }
8646         return ret;
8647 }
8648 static inline struct LDKCounterpartyForwardingInfo CResult_CounterpartyForwardingInfoDecodeErrorZ_get_ok(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ *NONNULL_PTR owner){
8649         LDKCounterpartyForwardingInfo ret = *owner->contents.result;
8650         ret.is_owned = false;
8651         return ret;
8652 }
8653 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyForwardingInfoDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8654         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)untag_ptr(owner);
8655         LDKCounterpartyForwardingInfo ret_var = CResult_CounterpartyForwardingInfoDecodeErrorZ_get_ok(owner_conv);
8656         int64_t ret_ref = 0;
8657         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8658         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8659         return ret_ref;
8660 }
8661
8662 static inline struct LDKDecodeError CResult_CounterpartyForwardingInfoDecodeErrorZ_get_err(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ *NONNULL_PTR owner){
8663 CHECK(!owner->result_ok);
8664         return DecodeError_clone(&*owner->contents.err);
8665 }
8666 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyForwardingInfoDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8667         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)untag_ptr(owner);
8668         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8669         *ret_copy = CResult_CounterpartyForwardingInfoDecodeErrorZ_get_err(owner_conv);
8670         int64_t ret_ref = tag_ptr(ret_copy, true);
8671         return ret_ref;
8672 }
8673
8674 static inline struct LDKChannelCounterparty CResult_ChannelCounterpartyDecodeErrorZ_get_ok(LDKCResult_ChannelCounterpartyDecodeErrorZ *NONNULL_PTR owner){
8675         LDKChannelCounterparty ret = *owner->contents.result;
8676         ret.is_owned = false;
8677         return ret;
8678 }
8679 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelCounterpartyDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8680         LDKCResult_ChannelCounterpartyDecodeErrorZ* owner_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)untag_ptr(owner);
8681         LDKChannelCounterparty ret_var = CResult_ChannelCounterpartyDecodeErrorZ_get_ok(owner_conv);
8682         int64_t ret_ref = 0;
8683         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8684         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8685         return ret_ref;
8686 }
8687
8688 static inline struct LDKDecodeError CResult_ChannelCounterpartyDecodeErrorZ_get_err(LDKCResult_ChannelCounterpartyDecodeErrorZ *NONNULL_PTR owner){
8689 CHECK(!owner->result_ok);
8690         return DecodeError_clone(&*owner->contents.err);
8691 }
8692 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelCounterpartyDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8693         LDKCResult_ChannelCounterpartyDecodeErrorZ* owner_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)untag_ptr(owner);
8694         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8695         *ret_copy = CResult_ChannelCounterpartyDecodeErrorZ_get_err(owner_conv);
8696         int64_t ret_ref = tag_ptr(ret_copy, true);
8697         return ret_ref;
8698 }
8699
8700 static inline struct LDKChannelDetails CResult_ChannelDetailsDecodeErrorZ_get_ok(LDKCResult_ChannelDetailsDecodeErrorZ *NONNULL_PTR owner){
8701         LDKChannelDetails ret = *owner->contents.result;
8702         ret.is_owned = false;
8703         return ret;
8704 }
8705 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDetailsDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8706         LDKCResult_ChannelDetailsDecodeErrorZ* owner_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)untag_ptr(owner);
8707         LDKChannelDetails ret_var = CResult_ChannelDetailsDecodeErrorZ_get_ok(owner_conv);
8708         int64_t ret_ref = 0;
8709         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8710         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8711         return ret_ref;
8712 }
8713
8714 static inline struct LDKDecodeError CResult_ChannelDetailsDecodeErrorZ_get_err(LDKCResult_ChannelDetailsDecodeErrorZ *NONNULL_PTR owner){
8715 CHECK(!owner->result_ok);
8716         return DecodeError_clone(&*owner->contents.err);
8717 }
8718 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDetailsDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8719         LDKCResult_ChannelDetailsDecodeErrorZ* owner_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)untag_ptr(owner);
8720         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8721         *ret_copy = CResult_ChannelDetailsDecodeErrorZ_get_err(owner_conv);
8722         int64_t ret_ref = tag_ptr(ret_copy, true);
8723         return ret_ref;
8724 }
8725
8726 static inline struct LDKPhantomRouteHints CResult_PhantomRouteHintsDecodeErrorZ_get_ok(LDKCResult_PhantomRouteHintsDecodeErrorZ *NONNULL_PTR owner){
8727         LDKPhantomRouteHints ret = *owner->contents.result;
8728         ret.is_owned = false;
8729         return ret;
8730 }
8731 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PhantomRouteHintsDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8732         LDKCResult_PhantomRouteHintsDecodeErrorZ* owner_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)untag_ptr(owner);
8733         LDKPhantomRouteHints ret_var = CResult_PhantomRouteHintsDecodeErrorZ_get_ok(owner_conv);
8734         int64_t ret_ref = 0;
8735         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8736         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8737         return ret_ref;
8738 }
8739
8740 static inline struct LDKDecodeError CResult_PhantomRouteHintsDecodeErrorZ_get_err(LDKCResult_PhantomRouteHintsDecodeErrorZ *NONNULL_PTR owner){
8741 CHECK(!owner->result_ok);
8742         return DecodeError_clone(&*owner->contents.err);
8743 }
8744 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PhantomRouteHintsDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8745         LDKCResult_PhantomRouteHintsDecodeErrorZ* owner_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)untag_ptr(owner);
8746         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8747         *ret_copy = CResult_PhantomRouteHintsDecodeErrorZ_get_err(owner_conv);
8748         int64_t ret_ref = tag_ptr(ret_copy, true);
8749         return ret_ref;
8750 }
8751
8752 static inline struct LDKBlindedForward CResult_BlindedForwardDecodeErrorZ_get_ok(LDKCResult_BlindedForwardDecodeErrorZ *NONNULL_PTR owner){
8753         LDKBlindedForward ret = *owner->contents.result;
8754         ret.is_owned = false;
8755         return ret;
8756 }
8757 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedForwardDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8758         LDKCResult_BlindedForwardDecodeErrorZ* owner_conv = (LDKCResult_BlindedForwardDecodeErrorZ*)untag_ptr(owner);
8759         LDKBlindedForward ret_var = CResult_BlindedForwardDecodeErrorZ_get_ok(owner_conv);
8760         int64_t ret_ref = 0;
8761         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8762         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8763         return ret_ref;
8764 }
8765
8766 static inline struct LDKDecodeError CResult_BlindedForwardDecodeErrorZ_get_err(LDKCResult_BlindedForwardDecodeErrorZ *NONNULL_PTR owner){
8767 CHECK(!owner->result_ok);
8768         return DecodeError_clone(&*owner->contents.err);
8769 }
8770 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedForwardDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8771         LDKCResult_BlindedForwardDecodeErrorZ* owner_conv = (LDKCResult_BlindedForwardDecodeErrorZ*)untag_ptr(owner);
8772         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8773         *ret_copy = CResult_BlindedForwardDecodeErrorZ_get_err(owner_conv);
8774         int64_t ret_ref = tag_ptr(ret_copy, true);
8775         return ret_ref;
8776 }
8777
8778 static jclass LDKPendingHTLCRouting_Forward_class = NULL;
8779 static jmethodID LDKPendingHTLCRouting_Forward_meth = NULL;
8780 static jclass LDKPendingHTLCRouting_Receive_class = NULL;
8781 static jmethodID LDKPendingHTLCRouting_Receive_meth = NULL;
8782 static jclass LDKPendingHTLCRouting_ReceiveKeysend_class = NULL;
8783 static jmethodID LDKPendingHTLCRouting_ReceiveKeysend_meth = NULL;
8784 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKPendingHTLCRouting_init (JNIEnv *env, jclass clz) {
8785         LDKPendingHTLCRouting_Forward_class =
8786                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPendingHTLCRouting$Forward"));
8787         CHECK(LDKPendingHTLCRouting_Forward_class != NULL);
8788         LDKPendingHTLCRouting_Forward_meth = (*env)->GetMethodID(env, LDKPendingHTLCRouting_Forward_class, "<init>", "(JJJ)V");
8789         CHECK(LDKPendingHTLCRouting_Forward_meth != NULL);
8790         LDKPendingHTLCRouting_Receive_class =
8791                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPendingHTLCRouting$Receive"));
8792         CHECK(LDKPendingHTLCRouting_Receive_class != NULL);
8793         LDKPendingHTLCRouting_Receive_meth = (*env)->GetMethodID(env, LDKPendingHTLCRouting_Receive_class, "<init>", "(JJJI[B[JZ)V");
8794         CHECK(LDKPendingHTLCRouting_Receive_meth != NULL);
8795         LDKPendingHTLCRouting_ReceiveKeysend_class =
8796                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPendingHTLCRouting$ReceiveKeysend"));
8797         CHECK(LDKPendingHTLCRouting_ReceiveKeysend_class != NULL);
8798         LDKPendingHTLCRouting_ReceiveKeysend_meth = (*env)->GetMethodID(env, LDKPendingHTLCRouting_ReceiveKeysend_class, "<init>", "(J[BJI[JZ)V");
8799         CHECK(LDKPendingHTLCRouting_ReceiveKeysend_meth != NULL);
8800 }
8801 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKPendingHTLCRouting_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
8802         LDKPendingHTLCRouting *obj = (LDKPendingHTLCRouting*)untag_ptr(ptr);
8803         switch(obj->tag) {
8804                 case LDKPendingHTLCRouting_Forward: {
8805                         LDKOnionPacket onion_packet_var = obj->forward.onion_packet;
8806                         int64_t onion_packet_ref = 0;
8807                         CHECK_INNER_FIELD_ACCESS_OR_NULL(onion_packet_var);
8808                         onion_packet_ref = tag_ptr(onion_packet_var.inner, false);
8809                         int64_t short_channel_id_conv = obj->forward.short_channel_id;
8810                         LDKBlindedForward blinded_var = obj->forward.blinded;
8811                         int64_t blinded_ref = 0;
8812                         CHECK_INNER_FIELD_ACCESS_OR_NULL(blinded_var);
8813                         blinded_ref = tag_ptr(blinded_var.inner, false);
8814                         return (*env)->NewObject(env, LDKPendingHTLCRouting_Forward_class, LDKPendingHTLCRouting_Forward_meth, onion_packet_ref, short_channel_id_conv, blinded_ref);
8815                 }
8816                 case LDKPendingHTLCRouting_Receive: {
8817                         LDKFinalOnionHopData payment_data_var = obj->receive.payment_data;
8818                         int64_t payment_data_ref = 0;
8819                         CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_data_var);
8820                         payment_data_ref = tag_ptr(payment_data_var.inner, false);
8821                         int64_t payment_metadata_ref = tag_ptr(&obj->receive.payment_metadata, false);
8822                         int64_t payment_context_ref = tag_ptr(&obj->receive.payment_context, false);
8823                         int32_t incoming_cltv_expiry_conv = obj->receive.incoming_cltv_expiry;
8824                         int8_tArray phantom_shared_secret_arr = (*env)->NewByteArray(env, 32);
8825                         (*env)->SetByteArrayRegion(env, phantom_shared_secret_arr, 0, 32, obj->receive.phantom_shared_secret.data);
8826                         LDKCVec_C2Tuple_u64CVec_u8ZZZ custom_tlvs_var = obj->receive.custom_tlvs;
8827                         int64_tArray custom_tlvs_arr = NULL;
8828                         custom_tlvs_arr = (*env)->NewLongArray(env, custom_tlvs_var.datalen);
8829                         int64_t *custom_tlvs_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, custom_tlvs_arr, NULL);
8830                         for (size_t x = 0; x < custom_tlvs_var.datalen; x++) {
8831                                 LDKC2Tuple_u64CVec_u8ZZ* custom_tlvs_conv_23_conv = MALLOC(sizeof(LDKC2Tuple_u64CVec_u8ZZ), "LDKC2Tuple_u64CVec_u8ZZ");
8832                                 *custom_tlvs_conv_23_conv = custom_tlvs_var.data[x];
8833                                 *custom_tlvs_conv_23_conv = C2Tuple_u64CVec_u8ZZ_clone(custom_tlvs_conv_23_conv);
8834                                 custom_tlvs_arr_ptr[x] = tag_ptr(custom_tlvs_conv_23_conv, true);
8835                         }
8836                         (*env)->ReleasePrimitiveArrayCritical(env, custom_tlvs_arr, custom_tlvs_arr_ptr, 0);
8837                         jboolean requires_blinded_error_conv = obj->receive.requires_blinded_error;
8838                         return (*env)->NewObject(env, LDKPendingHTLCRouting_Receive_class, LDKPendingHTLCRouting_Receive_meth, payment_data_ref, payment_metadata_ref, payment_context_ref, incoming_cltv_expiry_conv, phantom_shared_secret_arr, custom_tlvs_arr, requires_blinded_error_conv);
8839                 }
8840                 case LDKPendingHTLCRouting_ReceiveKeysend: {
8841                         LDKFinalOnionHopData payment_data_var = obj->receive_keysend.payment_data;
8842                         int64_t payment_data_ref = 0;
8843                         CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_data_var);
8844                         payment_data_ref = tag_ptr(payment_data_var.inner, false);
8845                         int8_tArray payment_preimage_arr = (*env)->NewByteArray(env, 32);
8846                         (*env)->SetByteArrayRegion(env, payment_preimage_arr, 0, 32, obj->receive_keysend.payment_preimage.data);
8847                         int64_t payment_metadata_ref = tag_ptr(&obj->receive_keysend.payment_metadata, false);
8848                         int32_t incoming_cltv_expiry_conv = obj->receive_keysend.incoming_cltv_expiry;
8849                         LDKCVec_C2Tuple_u64CVec_u8ZZZ custom_tlvs_var = obj->receive_keysend.custom_tlvs;
8850                         int64_tArray custom_tlvs_arr = NULL;
8851                         custom_tlvs_arr = (*env)->NewLongArray(env, custom_tlvs_var.datalen);
8852                         int64_t *custom_tlvs_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, custom_tlvs_arr, NULL);
8853                         for (size_t x = 0; x < custom_tlvs_var.datalen; x++) {
8854                                 LDKC2Tuple_u64CVec_u8ZZ* custom_tlvs_conv_23_conv = MALLOC(sizeof(LDKC2Tuple_u64CVec_u8ZZ), "LDKC2Tuple_u64CVec_u8ZZ");
8855                                 *custom_tlvs_conv_23_conv = custom_tlvs_var.data[x];
8856                                 *custom_tlvs_conv_23_conv = C2Tuple_u64CVec_u8ZZ_clone(custom_tlvs_conv_23_conv);
8857                                 custom_tlvs_arr_ptr[x] = tag_ptr(custom_tlvs_conv_23_conv, true);
8858                         }
8859                         (*env)->ReleasePrimitiveArrayCritical(env, custom_tlvs_arr, custom_tlvs_arr_ptr, 0);
8860                         jboolean requires_blinded_error_conv = obj->receive_keysend.requires_blinded_error;
8861                         return (*env)->NewObject(env, LDKPendingHTLCRouting_ReceiveKeysend_class, LDKPendingHTLCRouting_ReceiveKeysend_meth, payment_data_ref, payment_preimage_arr, payment_metadata_ref, incoming_cltv_expiry_conv, custom_tlvs_arr, requires_blinded_error_conv);
8862                 }
8863                 default: abort();
8864         }
8865 }
8866 static inline struct LDKPendingHTLCRouting CResult_PendingHTLCRoutingDecodeErrorZ_get_ok(LDKCResult_PendingHTLCRoutingDecodeErrorZ *NONNULL_PTR owner){
8867 CHECK(owner->result_ok);
8868         return PendingHTLCRouting_clone(&*owner->contents.result);
8869 }
8870 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PendingHTLCRoutingDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8871         LDKCResult_PendingHTLCRoutingDecodeErrorZ* owner_conv = (LDKCResult_PendingHTLCRoutingDecodeErrorZ*)untag_ptr(owner);
8872         LDKPendingHTLCRouting *ret_copy = MALLOC(sizeof(LDKPendingHTLCRouting), "LDKPendingHTLCRouting");
8873         *ret_copy = CResult_PendingHTLCRoutingDecodeErrorZ_get_ok(owner_conv);
8874         int64_t ret_ref = tag_ptr(ret_copy, true);
8875         return ret_ref;
8876 }
8877
8878 static inline struct LDKDecodeError CResult_PendingHTLCRoutingDecodeErrorZ_get_err(LDKCResult_PendingHTLCRoutingDecodeErrorZ *NONNULL_PTR owner){
8879 CHECK(!owner->result_ok);
8880         return DecodeError_clone(&*owner->contents.err);
8881 }
8882 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PendingHTLCRoutingDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8883         LDKCResult_PendingHTLCRoutingDecodeErrorZ* owner_conv = (LDKCResult_PendingHTLCRoutingDecodeErrorZ*)untag_ptr(owner);
8884         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8885         *ret_copy = CResult_PendingHTLCRoutingDecodeErrorZ_get_err(owner_conv);
8886         int64_t ret_ref = tag_ptr(ret_copy, true);
8887         return ret_ref;
8888 }
8889
8890 static inline struct LDKPendingHTLCInfo CResult_PendingHTLCInfoDecodeErrorZ_get_ok(LDKCResult_PendingHTLCInfoDecodeErrorZ *NONNULL_PTR owner){
8891         LDKPendingHTLCInfo ret = *owner->contents.result;
8892         ret.is_owned = false;
8893         return ret;
8894 }
8895 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PendingHTLCInfoDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8896         LDKCResult_PendingHTLCInfoDecodeErrorZ* owner_conv = (LDKCResult_PendingHTLCInfoDecodeErrorZ*)untag_ptr(owner);
8897         LDKPendingHTLCInfo ret_var = CResult_PendingHTLCInfoDecodeErrorZ_get_ok(owner_conv);
8898         int64_t ret_ref = 0;
8899         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
8900         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
8901         return ret_ref;
8902 }
8903
8904 static inline struct LDKDecodeError CResult_PendingHTLCInfoDecodeErrorZ_get_err(LDKCResult_PendingHTLCInfoDecodeErrorZ *NONNULL_PTR owner){
8905 CHECK(!owner->result_ok);
8906         return DecodeError_clone(&*owner->contents.err);
8907 }
8908 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PendingHTLCInfoDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8909         LDKCResult_PendingHTLCInfoDecodeErrorZ* owner_conv = (LDKCResult_PendingHTLCInfoDecodeErrorZ*)untag_ptr(owner);
8910         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8911         *ret_copy = CResult_PendingHTLCInfoDecodeErrorZ_get_err(owner_conv);
8912         int64_t ret_ref = tag_ptr(ret_copy, true);
8913         return ret_ref;
8914 }
8915
8916 static inline enum LDKBlindedFailure CResult_BlindedFailureDecodeErrorZ_get_ok(LDKCResult_BlindedFailureDecodeErrorZ *NONNULL_PTR owner){
8917 CHECK(owner->result_ok);
8918         return BlindedFailure_clone(&*owner->contents.result);
8919 }
8920 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedFailureDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8921         LDKCResult_BlindedFailureDecodeErrorZ* owner_conv = (LDKCResult_BlindedFailureDecodeErrorZ*)untag_ptr(owner);
8922         jclass ret_conv = LDKBlindedFailure_to_java(env, CResult_BlindedFailureDecodeErrorZ_get_ok(owner_conv));
8923         return ret_conv;
8924 }
8925
8926 static inline struct LDKDecodeError CResult_BlindedFailureDecodeErrorZ_get_err(LDKCResult_BlindedFailureDecodeErrorZ *NONNULL_PTR owner){
8927 CHECK(!owner->result_ok);
8928         return DecodeError_clone(&*owner->contents.err);
8929 }
8930 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedFailureDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8931         LDKCResult_BlindedFailureDecodeErrorZ* owner_conv = (LDKCResult_BlindedFailureDecodeErrorZ*)untag_ptr(owner);
8932         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8933         *ret_copy = CResult_BlindedFailureDecodeErrorZ_get_err(owner_conv);
8934         int64_t ret_ref = tag_ptr(ret_copy, true);
8935         return ret_ref;
8936 }
8937
8938 static inline enum LDKChannelShutdownState CResult_ChannelShutdownStateDecodeErrorZ_get_ok(LDKCResult_ChannelShutdownStateDecodeErrorZ *NONNULL_PTR owner){
8939 CHECK(owner->result_ok);
8940         return ChannelShutdownState_clone(&*owner->contents.result);
8941 }
8942 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelShutdownStateDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
8943         LDKCResult_ChannelShutdownStateDecodeErrorZ* owner_conv = (LDKCResult_ChannelShutdownStateDecodeErrorZ*)untag_ptr(owner);
8944         jclass ret_conv = LDKChannelShutdownState_to_java(env, CResult_ChannelShutdownStateDecodeErrorZ_get_ok(owner_conv));
8945         return ret_conv;
8946 }
8947
8948 static inline struct LDKDecodeError CResult_ChannelShutdownStateDecodeErrorZ_get_err(LDKCResult_ChannelShutdownStateDecodeErrorZ *NONNULL_PTR owner){
8949 CHECK(!owner->result_ok);
8950         return DecodeError_clone(&*owner->contents.err);
8951 }
8952 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelShutdownStateDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
8953         LDKCResult_ChannelShutdownStateDecodeErrorZ* owner_conv = (LDKCResult_ChannelShutdownStateDecodeErrorZ*)untag_ptr(owner);
8954         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
8955         *ret_copy = CResult_ChannelShutdownStateDecodeErrorZ_get_err(owner_conv);
8956         int64_t ret_ref = tag_ptr(ret_copy, true);
8957         return ret_ref;
8958 }
8959
8960 static inline LDKCVec_ChannelMonitorZ CVec_ChannelMonitorZ_clone(const LDKCVec_ChannelMonitorZ *orig) {
8961         LDKCVec_ChannelMonitorZ ret = { .data = MALLOC(sizeof(LDKChannelMonitor) * orig->datalen, "LDKCVec_ChannelMonitorZ clone bytes"), .datalen = orig->datalen };
8962         for (size_t i = 0; i < ret.datalen; i++) {
8963                 ret.data[i] = ChannelMonitor_clone(&orig->data[i]);
8964         }
8965         return ret;
8966 }
8967 typedef struct LDKWatch_JCalls {
8968         atomic_size_t refcnt;
8969         JavaVM *vm;
8970         jweak o;
8971         jmethodID watch_channel_meth;
8972         jmethodID update_channel_meth;
8973         jmethodID release_pending_monitor_events_meth;
8974 } LDKWatch_JCalls;
8975 static void LDKWatch_JCalls_free(void* this_arg) {
8976         LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
8977         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
8978                 JNIEnv *env;
8979                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8980                 if (get_jenv_res == JNI_EDETACHED) {
8981                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8982                 } else {
8983                         DO_ASSERT(get_jenv_res == JNI_OK);
8984                 }
8985                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
8986                 if (get_jenv_res == JNI_EDETACHED) {
8987                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8988                 }
8989                 FREE(j_calls);
8990         }
8991 }
8992 LDKCResult_ChannelMonitorUpdateStatusNoneZ watch_channel_LDKWatch_jcall(const void* this_arg, LDKOutPoint funding_txo, LDKChannelMonitor monitor) {
8993         LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
8994         JNIEnv *env;
8995         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8996         if (get_jenv_res == JNI_EDETACHED) {
8997                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8998         } else {
8999                 DO_ASSERT(get_jenv_res == JNI_OK);
9000         }
9001         LDKOutPoint funding_txo_var = funding_txo;
9002         int64_t funding_txo_ref = 0;
9003         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_var);
9004         funding_txo_ref = tag_ptr(funding_txo_var.inner, funding_txo_var.is_owned);
9005         LDKChannelMonitor monitor_var = monitor;
9006         int64_t monitor_ref = 0;
9007         CHECK_INNER_FIELD_ACCESS_OR_NULL(monitor_var);
9008         monitor_ref = tag_ptr(monitor_var.inner, monitor_var.is_owned);
9009         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9010         CHECK(obj != NULL);
9011         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->watch_channel_meth, funding_txo_ref, monitor_ref);
9012         if (UNLIKELY((*env)->ExceptionCheck(env))) {
9013                 (*env)->ExceptionDescribe(env);
9014                 (*env)->FatalError(env, "A call to watch_channel in LDKWatch from rust threw an exception.");
9015         }
9016         void* ret_ptr = untag_ptr(ret);
9017         CHECK_ACCESS(ret_ptr);
9018         LDKCResult_ChannelMonitorUpdateStatusNoneZ ret_conv = *(LDKCResult_ChannelMonitorUpdateStatusNoneZ*)(ret_ptr);
9019         FREE(untag_ptr(ret));
9020         if (get_jenv_res == JNI_EDETACHED) {
9021                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9022         }
9023         return ret_conv;
9024 }
9025 LDKChannelMonitorUpdateStatus update_channel_LDKWatch_jcall(const void* this_arg, LDKOutPoint funding_txo, const LDKChannelMonitorUpdate * update) {
9026         LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
9027         JNIEnv *env;
9028         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9029         if (get_jenv_res == JNI_EDETACHED) {
9030                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9031         } else {
9032                 DO_ASSERT(get_jenv_res == JNI_OK);
9033         }
9034         LDKOutPoint funding_txo_var = funding_txo;
9035         int64_t funding_txo_ref = 0;
9036         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_var);
9037         funding_txo_ref = tag_ptr(funding_txo_var.inner, funding_txo_var.is_owned);
9038         LDKChannelMonitorUpdate update_var = *update;
9039         int64_t update_ref = 0;
9040         update_var = ChannelMonitorUpdate_clone(&update_var);
9041         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_var);
9042         update_ref = tag_ptr(update_var.inner, update_var.is_owned);
9043         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9044         CHECK(obj != NULL);
9045         jclass ret = (*env)->CallObjectMethod(env, obj, j_calls->update_channel_meth, funding_txo_ref, update_ref);
9046         if (UNLIKELY((*env)->ExceptionCheck(env))) {
9047                 (*env)->ExceptionDescribe(env);
9048                 (*env)->FatalError(env, "A call to update_channel in LDKWatch from rust threw an exception.");
9049         }
9050         LDKChannelMonitorUpdateStatus ret_conv = LDKChannelMonitorUpdateStatus_from_java(env, ret);
9051         if (get_jenv_res == JNI_EDETACHED) {
9052                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9053         }
9054         return ret_conv;
9055 }
9056 LDKCVec_C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZZ release_pending_monitor_events_LDKWatch_jcall(const void* this_arg) {
9057         LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
9058         JNIEnv *env;
9059         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9060         if (get_jenv_res == JNI_EDETACHED) {
9061                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9062         } else {
9063                 DO_ASSERT(get_jenv_res == JNI_OK);
9064         }
9065         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9066         CHECK(obj != NULL);
9067         int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->release_pending_monitor_events_meth);
9068         if (UNLIKELY((*env)->ExceptionCheck(env))) {
9069                 (*env)->ExceptionDescribe(env);
9070                 (*env)->FatalError(env, "A call to release_pending_monitor_events in LDKWatch from rust threw an exception.");
9071         }
9072         LDKCVec_C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZZ ret_constr;
9073         ret_constr.datalen = (*env)->GetArrayLength(env, ret);
9074         if (ret_constr.datalen > 0)
9075                 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ), "LDKCVec_C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZZ Elements");
9076         else
9077                 ret_constr.data = NULL;
9078         int64_t* ret_vals = (*env)->GetLongArrayElements (env, ret, NULL);
9079         for (size_t f = 0; f < ret_constr.datalen; f++) {
9080                 int64_t ret_conv_57 = ret_vals[f];
9081                 void* ret_conv_57_ptr = untag_ptr(ret_conv_57);
9082                 CHECK_ACCESS(ret_conv_57_ptr);
9083                 LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ ret_conv_57_conv = *(LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ*)(ret_conv_57_ptr);
9084                 FREE(untag_ptr(ret_conv_57));
9085                 ret_constr.data[f] = ret_conv_57_conv;
9086         }
9087         (*env)->ReleaseLongArrayElements(env, ret, ret_vals, 0);
9088         if (get_jenv_res == JNI_EDETACHED) {
9089                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9090         }
9091         return ret_constr;
9092 }
9093 static void LDKWatch_JCalls_cloned(LDKWatch* new_obj) {
9094         LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) new_obj->this_arg;
9095         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
9096 }
9097 static inline LDKWatch LDKWatch_init (JNIEnv *env, jclass clz, jobject o) {
9098         jclass c = (*env)->GetObjectClass(env, o);
9099         CHECK(c != NULL);
9100         LDKWatch_JCalls *calls = MALLOC(sizeof(LDKWatch_JCalls), "LDKWatch_JCalls");
9101         atomic_init(&calls->refcnt, 1);
9102         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
9103         calls->o = (*env)->NewWeakGlobalRef(env, o);
9104         calls->watch_channel_meth = (*env)->GetMethodID(env, c, "watch_channel", "(JJ)J");
9105         CHECK(calls->watch_channel_meth != NULL);
9106         calls->update_channel_meth = (*env)->GetMethodID(env, c, "update_channel", "(JJ)Lorg/ldk/enums/ChannelMonitorUpdateStatus;");
9107         CHECK(calls->update_channel_meth != NULL);
9108         calls->release_pending_monitor_events_meth = (*env)->GetMethodID(env, c, "release_pending_monitor_events", "()[J");
9109         CHECK(calls->release_pending_monitor_events_meth != NULL);
9110
9111         LDKWatch ret = {
9112                 .this_arg = (void*) calls,
9113                 .watch_channel = watch_channel_LDKWatch_jcall,
9114                 .update_channel = update_channel_LDKWatch_jcall,
9115                 .release_pending_monitor_events = release_pending_monitor_events_LDKWatch_jcall,
9116                 .free = LDKWatch_JCalls_free,
9117         };
9118         return ret;
9119 }
9120 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKWatch_1new(JNIEnv *env, jclass clz, jobject o) {
9121         LDKWatch *res_ptr = MALLOC(sizeof(LDKWatch), "LDKWatch");
9122         *res_ptr = LDKWatch_init(env, clz, o);
9123         return tag_ptr(res_ptr, true);
9124 }
9125 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) {
9126         void* this_arg_ptr = untag_ptr(this_arg);
9127         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9128         LDKWatch* this_arg_conv = (LDKWatch*)this_arg_ptr;
9129         LDKOutPoint funding_txo_conv;
9130         funding_txo_conv.inner = untag_ptr(funding_txo);
9131         funding_txo_conv.is_owned = ptr_is_owned(funding_txo);
9132         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
9133         funding_txo_conv = OutPoint_clone(&funding_txo_conv);
9134         LDKChannelMonitor monitor_conv;
9135         monitor_conv.inner = untag_ptr(monitor);
9136         monitor_conv.is_owned = ptr_is_owned(monitor);
9137         CHECK_INNER_FIELD_ACCESS_OR_NULL(monitor_conv);
9138         monitor_conv = ChannelMonitor_clone(&monitor_conv);
9139         LDKCResult_ChannelMonitorUpdateStatusNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateStatusNoneZ), "LDKCResult_ChannelMonitorUpdateStatusNoneZ");
9140         *ret_conv = (this_arg_conv->watch_channel)(this_arg_conv->this_arg, funding_txo_conv, monitor_conv);
9141         return tag_ptr(ret_conv, true);
9142 }
9143
9144 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) {
9145         void* this_arg_ptr = untag_ptr(this_arg);
9146         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9147         LDKWatch* this_arg_conv = (LDKWatch*)this_arg_ptr;
9148         LDKOutPoint funding_txo_conv;
9149         funding_txo_conv.inner = untag_ptr(funding_txo);
9150         funding_txo_conv.is_owned = ptr_is_owned(funding_txo);
9151         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
9152         funding_txo_conv = OutPoint_clone(&funding_txo_conv);
9153         LDKChannelMonitorUpdate update_conv;
9154         update_conv.inner = untag_ptr(update);
9155         update_conv.is_owned = ptr_is_owned(update);
9156         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_conv);
9157         update_conv.is_owned = false;
9158         jclass ret_conv = LDKChannelMonitorUpdateStatus_to_java(env, (this_arg_conv->update_channel)(this_arg_conv->this_arg, funding_txo_conv, &update_conv));
9159         return ret_conv;
9160 }
9161
9162 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_Watch_1release_1pending_1monitor_1events(JNIEnv *env, jclass clz, int64_t this_arg) {
9163         void* this_arg_ptr = untag_ptr(this_arg);
9164         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9165         LDKWatch* this_arg_conv = (LDKWatch*)this_arg_ptr;
9166         LDKCVec_C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZZ ret_var = (this_arg_conv->release_pending_monitor_events)(this_arg_conv->this_arg);
9167         int64_tArray ret_arr = NULL;
9168         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
9169         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
9170         for (size_t f = 0; f < ret_var.datalen; f++) {
9171                 LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ* ret_conv_57_conv = MALLOC(sizeof(LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ), "LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ");
9172                 *ret_conv_57_conv = ret_var.data[f];
9173                 ret_arr_ptr[f] = tag_ptr(ret_conv_57_conv, true);
9174         }
9175         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
9176         FREE(ret_var.data);
9177         return ret_arr;
9178 }
9179
9180 typedef struct LDKBroadcasterInterface_JCalls {
9181         atomic_size_t refcnt;
9182         JavaVM *vm;
9183         jweak o;
9184         jmethodID broadcast_transactions_meth;
9185 } LDKBroadcasterInterface_JCalls;
9186 static void LDKBroadcasterInterface_JCalls_free(void* this_arg) {
9187         LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
9188         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
9189                 JNIEnv *env;
9190                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9191                 if (get_jenv_res == JNI_EDETACHED) {
9192                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9193                 } else {
9194                         DO_ASSERT(get_jenv_res == JNI_OK);
9195                 }
9196                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
9197                 if (get_jenv_res == JNI_EDETACHED) {
9198                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9199                 }
9200                 FREE(j_calls);
9201         }
9202 }
9203 void broadcast_transactions_LDKBroadcasterInterface_jcall(const void* this_arg, LDKCVec_TransactionZ txs) {
9204         LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
9205         JNIEnv *env;
9206         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9207         if (get_jenv_res == JNI_EDETACHED) {
9208                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9209         } else {
9210                 DO_ASSERT(get_jenv_res == JNI_OK);
9211         }
9212         LDKCVec_TransactionZ txs_var = txs;
9213         jobjectArray txs_arr = NULL;
9214         txs_arr = (*env)->NewObjectArray(env, txs_var.datalen, arr_of_B_clz, NULL);
9215         ;
9216         for (size_t i = 0; i < txs_var.datalen; i++) {
9217                 LDKTransaction txs_conv_8_var = txs_var.data[i];
9218                 int8_tArray txs_conv_8_arr = (*env)->NewByteArray(env, txs_conv_8_var.datalen);
9219                 (*env)->SetByteArrayRegion(env, txs_conv_8_arr, 0, txs_conv_8_var.datalen, txs_conv_8_var.data);
9220                 Transaction_free(txs_conv_8_var);
9221                 (*env)->SetObjectArrayElement(env, txs_arr, i, txs_conv_8_arr);
9222         }
9223         
9224         FREE(txs_var.data);
9225         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9226         CHECK(obj != NULL);
9227         (*env)->CallVoidMethod(env, obj, j_calls->broadcast_transactions_meth, txs_arr);
9228         if (UNLIKELY((*env)->ExceptionCheck(env))) {
9229                 (*env)->ExceptionDescribe(env);
9230                 (*env)->FatalError(env, "A call to broadcast_transactions in LDKBroadcasterInterface from rust threw an exception.");
9231         }
9232         if (get_jenv_res == JNI_EDETACHED) {
9233                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9234         }
9235 }
9236 static void LDKBroadcasterInterface_JCalls_cloned(LDKBroadcasterInterface* new_obj) {
9237         LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) new_obj->this_arg;
9238         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
9239 }
9240 static inline LDKBroadcasterInterface LDKBroadcasterInterface_init (JNIEnv *env, jclass clz, jobject o) {
9241         jclass c = (*env)->GetObjectClass(env, o);
9242         CHECK(c != NULL);
9243         LDKBroadcasterInterface_JCalls *calls = MALLOC(sizeof(LDKBroadcasterInterface_JCalls), "LDKBroadcasterInterface_JCalls");
9244         atomic_init(&calls->refcnt, 1);
9245         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
9246         calls->o = (*env)->NewWeakGlobalRef(env, o);
9247         calls->broadcast_transactions_meth = (*env)->GetMethodID(env, c, "broadcast_transactions", "([[B)V");
9248         CHECK(calls->broadcast_transactions_meth != NULL);
9249
9250         LDKBroadcasterInterface ret = {
9251                 .this_arg = (void*) calls,
9252                 .broadcast_transactions = broadcast_transactions_LDKBroadcasterInterface_jcall,
9253                 .free = LDKBroadcasterInterface_JCalls_free,
9254         };
9255         return ret;
9256 }
9257 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKBroadcasterInterface_1new(JNIEnv *env, jclass clz, jobject o) {
9258         LDKBroadcasterInterface *res_ptr = MALLOC(sizeof(LDKBroadcasterInterface), "LDKBroadcasterInterface");
9259         *res_ptr = LDKBroadcasterInterface_init(env, clz, o);
9260         return tag_ptr(res_ptr, true);
9261 }
9262 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BroadcasterInterface_1broadcast_1transactions(JNIEnv *env, jclass clz, int64_t this_arg, jobjectArray txs) {
9263         void* this_arg_ptr = untag_ptr(this_arg);
9264         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9265         LDKBroadcasterInterface* this_arg_conv = (LDKBroadcasterInterface*)this_arg_ptr;
9266         LDKCVec_TransactionZ txs_constr;
9267         txs_constr.datalen = (*env)->GetArrayLength(env, txs);
9268         if (txs_constr.datalen > 0)
9269                 txs_constr.data = MALLOC(txs_constr.datalen * sizeof(LDKTransaction), "LDKCVec_TransactionZ Elements");
9270         else
9271                 txs_constr.data = NULL;
9272         for (size_t i = 0; i < txs_constr.datalen; i++) {
9273                 int8_tArray txs_conv_8 = (*env)->GetObjectArrayElement(env, txs, i);
9274                 LDKTransaction txs_conv_8_ref;
9275                 txs_conv_8_ref.datalen = (*env)->GetArrayLength(env, txs_conv_8);
9276                 txs_conv_8_ref.data = MALLOC(txs_conv_8_ref.datalen, "LDKTransaction Bytes");
9277                 (*env)->GetByteArrayRegion(env, txs_conv_8, 0, txs_conv_8_ref.datalen, txs_conv_8_ref.data);
9278                 txs_conv_8_ref.data_is_owned = true;
9279                 txs_constr.data[i] = txs_conv_8_ref;
9280         }
9281         (this_arg_conv->broadcast_transactions)(this_arg_conv->this_arg, txs_constr);
9282 }
9283
9284 typedef struct LDKEntropySource_JCalls {
9285         atomic_size_t refcnt;
9286         JavaVM *vm;
9287         jweak o;
9288         jmethodID get_secure_random_bytes_meth;
9289 } LDKEntropySource_JCalls;
9290 static void LDKEntropySource_JCalls_free(void* this_arg) {
9291         LDKEntropySource_JCalls *j_calls = (LDKEntropySource_JCalls*) this_arg;
9292         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
9293                 JNIEnv *env;
9294                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9295                 if (get_jenv_res == JNI_EDETACHED) {
9296                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9297                 } else {
9298                         DO_ASSERT(get_jenv_res == JNI_OK);
9299                 }
9300                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
9301                 if (get_jenv_res == JNI_EDETACHED) {
9302                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9303                 }
9304                 FREE(j_calls);
9305         }
9306 }
9307 LDKThirtyTwoBytes get_secure_random_bytes_LDKEntropySource_jcall(const void* this_arg) {
9308         LDKEntropySource_JCalls *j_calls = (LDKEntropySource_JCalls*) this_arg;
9309         JNIEnv *env;
9310         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9311         if (get_jenv_res == JNI_EDETACHED) {
9312                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9313         } else {
9314                 DO_ASSERT(get_jenv_res == JNI_OK);
9315         }
9316         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9317         CHECK(obj != NULL);
9318         int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_secure_random_bytes_meth);
9319         if (UNLIKELY((*env)->ExceptionCheck(env))) {
9320                 (*env)->ExceptionDescribe(env);
9321                 (*env)->FatalError(env, "A call to get_secure_random_bytes in LDKEntropySource from rust threw an exception.");
9322         }
9323         LDKThirtyTwoBytes ret_ref;
9324         CHECK((*env)->GetArrayLength(env, ret) == 32);
9325         (*env)->GetByteArrayRegion(env, ret, 0, 32, ret_ref.data);
9326         if (get_jenv_res == JNI_EDETACHED) {
9327                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9328         }
9329         return ret_ref;
9330 }
9331 static void LDKEntropySource_JCalls_cloned(LDKEntropySource* new_obj) {
9332         LDKEntropySource_JCalls *j_calls = (LDKEntropySource_JCalls*) new_obj->this_arg;
9333         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
9334 }
9335 static inline LDKEntropySource LDKEntropySource_init (JNIEnv *env, jclass clz, jobject o) {
9336         jclass c = (*env)->GetObjectClass(env, o);
9337         CHECK(c != NULL);
9338         LDKEntropySource_JCalls *calls = MALLOC(sizeof(LDKEntropySource_JCalls), "LDKEntropySource_JCalls");
9339         atomic_init(&calls->refcnt, 1);
9340         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
9341         calls->o = (*env)->NewWeakGlobalRef(env, o);
9342         calls->get_secure_random_bytes_meth = (*env)->GetMethodID(env, c, "get_secure_random_bytes", "()[B");
9343         CHECK(calls->get_secure_random_bytes_meth != NULL);
9344
9345         LDKEntropySource ret = {
9346                 .this_arg = (void*) calls,
9347                 .get_secure_random_bytes = get_secure_random_bytes_LDKEntropySource_jcall,
9348                 .free = LDKEntropySource_JCalls_free,
9349         };
9350         return ret;
9351 }
9352 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKEntropySource_1new(JNIEnv *env, jclass clz, jobject o) {
9353         LDKEntropySource *res_ptr = MALLOC(sizeof(LDKEntropySource), "LDKEntropySource");
9354         *res_ptr = LDKEntropySource_init(env, clz, o);
9355         return tag_ptr(res_ptr, true);
9356 }
9357 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_EntropySource_1get_1secure_1random_1bytes(JNIEnv *env, jclass clz, int64_t this_arg) {
9358         void* this_arg_ptr = untag_ptr(this_arg);
9359         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9360         LDKEntropySource* this_arg_conv = (LDKEntropySource*)this_arg_ptr;
9361         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
9362         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, (this_arg_conv->get_secure_random_bytes)(this_arg_conv->this_arg).data);
9363         return ret_arr;
9364 }
9365
9366 static jclass LDKUnsignedGossipMessage_ChannelAnnouncement_class = NULL;
9367 static jmethodID LDKUnsignedGossipMessage_ChannelAnnouncement_meth = NULL;
9368 static jclass LDKUnsignedGossipMessage_ChannelUpdate_class = NULL;
9369 static jmethodID LDKUnsignedGossipMessage_ChannelUpdate_meth = NULL;
9370 static jclass LDKUnsignedGossipMessage_NodeAnnouncement_class = NULL;
9371 static jmethodID LDKUnsignedGossipMessage_NodeAnnouncement_meth = NULL;
9372 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKUnsignedGossipMessage_init (JNIEnv *env, jclass clz) {
9373         LDKUnsignedGossipMessage_ChannelAnnouncement_class =
9374                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKUnsignedGossipMessage$ChannelAnnouncement"));
9375         CHECK(LDKUnsignedGossipMessage_ChannelAnnouncement_class != NULL);
9376         LDKUnsignedGossipMessage_ChannelAnnouncement_meth = (*env)->GetMethodID(env, LDKUnsignedGossipMessage_ChannelAnnouncement_class, "<init>", "(J)V");
9377         CHECK(LDKUnsignedGossipMessage_ChannelAnnouncement_meth != NULL);
9378         LDKUnsignedGossipMessage_ChannelUpdate_class =
9379                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKUnsignedGossipMessage$ChannelUpdate"));
9380         CHECK(LDKUnsignedGossipMessage_ChannelUpdate_class != NULL);
9381         LDKUnsignedGossipMessage_ChannelUpdate_meth = (*env)->GetMethodID(env, LDKUnsignedGossipMessage_ChannelUpdate_class, "<init>", "(J)V");
9382         CHECK(LDKUnsignedGossipMessage_ChannelUpdate_meth != NULL);
9383         LDKUnsignedGossipMessage_NodeAnnouncement_class =
9384                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKUnsignedGossipMessage$NodeAnnouncement"));
9385         CHECK(LDKUnsignedGossipMessage_NodeAnnouncement_class != NULL);
9386         LDKUnsignedGossipMessage_NodeAnnouncement_meth = (*env)->GetMethodID(env, LDKUnsignedGossipMessage_NodeAnnouncement_class, "<init>", "(J)V");
9387         CHECK(LDKUnsignedGossipMessage_NodeAnnouncement_meth != NULL);
9388 }
9389 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKUnsignedGossipMessage_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
9390         LDKUnsignedGossipMessage *obj = (LDKUnsignedGossipMessage*)untag_ptr(ptr);
9391         switch(obj->tag) {
9392                 case LDKUnsignedGossipMessage_ChannelAnnouncement: {
9393                         LDKUnsignedChannelAnnouncement channel_announcement_var = obj->channel_announcement;
9394                         int64_t channel_announcement_ref = 0;
9395                         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_announcement_var);
9396                         channel_announcement_ref = tag_ptr(channel_announcement_var.inner, false);
9397                         return (*env)->NewObject(env, LDKUnsignedGossipMessage_ChannelAnnouncement_class, LDKUnsignedGossipMessage_ChannelAnnouncement_meth, channel_announcement_ref);
9398                 }
9399                 case LDKUnsignedGossipMessage_ChannelUpdate: {
9400                         LDKUnsignedChannelUpdate channel_update_var = obj->channel_update;
9401                         int64_t channel_update_ref = 0;
9402                         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_update_var);
9403                         channel_update_ref = tag_ptr(channel_update_var.inner, false);
9404                         return (*env)->NewObject(env, LDKUnsignedGossipMessage_ChannelUpdate_class, LDKUnsignedGossipMessage_ChannelUpdate_meth, channel_update_ref);
9405                 }
9406                 case LDKUnsignedGossipMessage_NodeAnnouncement: {
9407                         LDKUnsignedNodeAnnouncement node_announcement_var = obj->node_announcement;
9408                         int64_t node_announcement_ref = 0;
9409                         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_announcement_var);
9410                         node_announcement_ref = tag_ptr(node_announcement_var.inner, false);
9411                         return (*env)->NewObject(env, LDKUnsignedGossipMessage_NodeAnnouncement_class, LDKUnsignedGossipMessage_NodeAnnouncement_meth, node_announcement_ref);
9412                 }
9413                 default: abort();
9414         }
9415 }
9416 typedef struct LDKNodeSigner_JCalls {
9417         atomic_size_t refcnt;
9418         JavaVM *vm;
9419         jweak o;
9420         jmethodID get_inbound_payment_key_material_meth;
9421         jmethodID get_node_id_meth;
9422         jmethodID ecdh_meth;
9423         jmethodID sign_invoice_meth;
9424         jmethodID sign_bolt12_invoice_request_meth;
9425         jmethodID sign_bolt12_invoice_meth;
9426         jmethodID sign_gossip_message_meth;
9427 } LDKNodeSigner_JCalls;
9428 static void LDKNodeSigner_JCalls_free(void* this_arg) {
9429         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) this_arg;
9430         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
9431                 JNIEnv *env;
9432                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9433                 if (get_jenv_res == JNI_EDETACHED) {
9434                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9435                 } else {
9436                         DO_ASSERT(get_jenv_res == JNI_OK);
9437                 }
9438                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
9439                 if (get_jenv_res == JNI_EDETACHED) {
9440                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9441                 }
9442                 FREE(j_calls);
9443         }
9444 }
9445 LDKThirtyTwoBytes get_inbound_payment_key_material_LDKNodeSigner_jcall(const void* this_arg) {
9446         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) this_arg;
9447         JNIEnv *env;
9448         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9449         if (get_jenv_res == JNI_EDETACHED) {
9450                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9451         } else {
9452                 DO_ASSERT(get_jenv_res == JNI_OK);
9453         }
9454         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9455         CHECK(obj != NULL);
9456         int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_inbound_payment_key_material_meth);
9457         if (UNLIKELY((*env)->ExceptionCheck(env))) {
9458                 (*env)->ExceptionDescribe(env);
9459                 (*env)->FatalError(env, "A call to get_inbound_payment_key_material in LDKNodeSigner from rust threw an exception.");
9460         }
9461         LDKThirtyTwoBytes ret_ref;
9462         CHECK((*env)->GetArrayLength(env, ret) == 32);
9463         (*env)->GetByteArrayRegion(env, ret, 0, 32, ret_ref.data);
9464         if (get_jenv_res == JNI_EDETACHED) {
9465                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9466         }
9467         return ret_ref;
9468 }
9469 LDKCResult_PublicKeyNoneZ get_node_id_LDKNodeSigner_jcall(const void* this_arg, LDKRecipient recipient) {
9470         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) this_arg;
9471         JNIEnv *env;
9472         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9473         if (get_jenv_res == JNI_EDETACHED) {
9474                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9475         } else {
9476                 DO_ASSERT(get_jenv_res == JNI_OK);
9477         }
9478         jclass recipient_conv = LDKRecipient_to_java(env, recipient);
9479         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9480         CHECK(obj != NULL);
9481         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->get_node_id_meth, recipient_conv);
9482         if (UNLIKELY((*env)->ExceptionCheck(env))) {
9483                 (*env)->ExceptionDescribe(env);
9484                 (*env)->FatalError(env, "A call to get_node_id in LDKNodeSigner from rust threw an exception.");
9485         }
9486         void* ret_ptr = untag_ptr(ret);
9487         CHECK_ACCESS(ret_ptr);
9488         LDKCResult_PublicKeyNoneZ ret_conv = *(LDKCResult_PublicKeyNoneZ*)(ret_ptr);
9489         FREE(untag_ptr(ret));
9490         if (get_jenv_res == JNI_EDETACHED) {
9491                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9492         }
9493         return ret_conv;
9494 }
9495 LDKCResult_ThirtyTwoBytesNoneZ ecdh_LDKNodeSigner_jcall(const void* this_arg, LDKRecipient recipient, LDKPublicKey other_key, LDKCOption_BigEndianScalarZ tweak) {
9496         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) this_arg;
9497         JNIEnv *env;
9498         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9499         if (get_jenv_res == JNI_EDETACHED) {
9500                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9501         } else {
9502                 DO_ASSERT(get_jenv_res == JNI_OK);
9503         }
9504         jclass recipient_conv = LDKRecipient_to_java(env, recipient);
9505         int8_tArray other_key_arr = (*env)->NewByteArray(env, 33);
9506         (*env)->SetByteArrayRegion(env, other_key_arr, 0, 33, other_key.compressed_form);
9507         LDKCOption_BigEndianScalarZ *tweak_copy = MALLOC(sizeof(LDKCOption_BigEndianScalarZ), "LDKCOption_BigEndianScalarZ");
9508         *tweak_copy = tweak;
9509         int64_t tweak_ref = tag_ptr(tweak_copy, true);
9510         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9511         CHECK(obj != NULL);
9512         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->ecdh_meth, recipient_conv, other_key_arr, tweak_ref);
9513         if (UNLIKELY((*env)->ExceptionCheck(env))) {
9514                 (*env)->ExceptionDescribe(env);
9515                 (*env)->FatalError(env, "A call to ecdh in LDKNodeSigner from rust threw an exception.");
9516         }
9517         void* ret_ptr = untag_ptr(ret);
9518         CHECK_ACCESS(ret_ptr);
9519         LDKCResult_ThirtyTwoBytesNoneZ ret_conv = *(LDKCResult_ThirtyTwoBytesNoneZ*)(ret_ptr);
9520         FREE(untag_ptr(ret));
9521         if (get_jenv_res == JNI_EDETACHED) {
9522                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9523         }
9524         return ret_conv;
9525 }
9526 LDKCResult_RecoverableSignatureNoneZ sign_invoice_LDKNodeSigner_jcall(const void* this_arg, LDKu8slice hrp_bytes, LDKCVec_U5Z invoice_data, LDKRecipient recipient) {
9527         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) this_arg;
9528         JNIEnv *env;
9529         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9530         if (get_jenv_res == JNI_EDETACHED) {
9531                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9532         } else {
9533                 DO_ASSERT(get_jenv_res == JNI_OK);
9534         }
9535         LDKu8slice hrp_bytes_var = hrp_bytes;
9536         int8_tArray hrp_bytes_arr = (*env)->NewByteArray(env, hrp_bytes_var.datalen);
9537         (*env)->SetByteArrayRegion(env, hrp_bytes_arr, 0, hrp_bytes_var.datalen, hrp_bytes_var.data);
9538         LDKCVec_U5Z invoice_data_var = invoice_data;
9539         jobjectArray invoice_data_arr = NULL;
9540         invoice_data_arr = (*env)->NewByteArray(env, invoice_data_var.datalen);
9541         int8_t *invoice_data_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, invoice_data_arr, NULL);
9542         for (size_t h = 0; h < invoice_data_var.datalen; h++) {
9543                 uint8_t invoice_data_conv_7_val = invoice_data_var.data[h]._0;
9544                 invoice_data_arr_ptr[h] = invoice_data_conv_7_val;
9545         }
9546         (*env)->ReleasePrimitiveArrayCritical(env, invoice_data_arr, invoice_data_arr_ptr, 0);
9547         FREE(invoice_data_var.data);
9548         jclass recipient_conv = LDKRecipient_to_java(env, recipient);
9549         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9550         CHECK(obj != NULL);
9551         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_invoice_meth, hrp_bytes_arr, invoice_data_arr, recipient_conv);
9552         if (UNLIKELY((*env)->ExceptionCheck(env))) {
9553                 (*env)->ExceptionDescribe(env);
9554                 (*env)->FatalError(env, "A call to sign_invoice in LDKNodeSigner from rust threw an exception.");
9555         }
9556         void* ret_ptr = untag_ptr(ret);
9557         CHECK_ACCESS(ret_ptr);
9558         LDKCResult_RecoverableSignatureNoneZ ret_conv = *(LDKCResult_RecoverableSignatureNoneZ*)(ret_ptr);
9559         FREE(untag_ptr(ret));
9560         if (get_jenv_res == JNI_EDETACHED) {
9561                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9562         }
9563         return ret_conv;
9564 }
9565 LDKCResult_SchnorrSignatureNoneZ sign_bolt12_invoice_request_LDKNodeSigner_jcall(const void* this_arg, const LDKUnsignedInvoiceRequest * invoice_request) {
9566         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) this_arg;
9567         JNIEnv *env;
9568         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9569         if (get_jenv_res == JNI_EDETACHED) {
9570                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9571         } else {
9572                 DO_ASSERT(get_jenv_res == JNI_OK);
9573         }
9574         LDKUnsignedInvoiceRequest invoice_request_var = *invoice_request;
9575         int64_t invoice_request_ref = 0;
9576         invoice_request_var = UnsignedInvoiceRequest_clone(&invoice_request_var);
9577         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_request_var);
9578         invoice_request_ref = tag_ptr(invoice_request_var.inner, invoice_request_var.is_owned);
9579         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9580         CHECK(obj != NULL);
9581         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_bolt12_invoice_request_meth, invoice_request_ref);
9582         if (UNLIKELY((*env)->ExceptionCheck(env))) {
9583                 (*env)->ExceptionDescribe(env);
9584                 (*env)->FatalError(env, "A call to sign_bolt12_invoice_request in LDKNodeSigner from rust threw an exception.");
9585         }
9586         void* ret_ptr = untag_ptr(ret);
9587         CHECK_ACCESS(ret_ptr);
9588         LDKCResult_SchnorrSignatureNoneZ ret_conv = *(LDKCResult_SchnorrSignatureNoneZ*)(ret_ptr);
9589         FREE(untag_ptr(ret));
9590         if (get_jenv_res == JNI_EDETACHED) {
9591                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9592         }
9593         return ret_conv;
9594 }
9595 LDKCResult_SchnorrSignatureNoneZ sign_bolt12_invoice_LDKNodeSigner_jcall(const void* this_arg, const LDKUnsignedBolt12Invoice * invoice) {
9596         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) this_arg;
9597         JNIEnv *env;
9598         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9599         if (get_jenv_res == JNI_EDETACHED) {
9600                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9601         } else {
9602                 DO_ASSERT(get_jenv_res == JNI_OK);
9603         }
9604         LDKUnsignedBolt12Invoice invoice_var = *invoice;
9605         int64_t invoice_ref = 0;
9606         invoice_var = UnsignedBolt12Invoice_clone(&invoice_var);
9607         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_var);
9608         invoice_ref = tag_ptr(invoice_var.inner, invoice_var.is_owned);
9609         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9610         CHECK(obj != NULL);
9611         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_bolt12_invoice_meth, invoice_ref);
9612         if (UNLIKELY((*env)->ExceptionCheck(env))) {
9613                 (*env)->ExceptionDescribe(env);
9614                 (*env)->FatalError(env, "A call to sign_bolt12_invoice in LDKNodeSigner from rust threw an exception.");
9615         }
9616         void* ret_ptr = untag_ptr(ret);
9617         CHECK_ACCESS(ret_ptr);
9618         LDKCResult_SchnorrSignatureNoneZ ret_conv = *(LDKCResult_SchnorrSignatureNoneZ*)(ret_ptr);
9619         FREE(untag_ptr(ret));
9620         if (get_jenv_res == JNI_EDETACHED) {
9621                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9622         }
9623         return ret_conv;
9624 }
9625 LDKCResult_ECDSASignatureNoneZ sign_gossip_message_LDKNodeSigner_jcall(const void* this_arg, LDKUnsignedGossipMessage msg) {
9626         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) this_arg;
9627         JNIEnv *env;
9628         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9629         if (get_jenv_res == JNI_EDETACHED) {
9630                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9631         } else {
9632                 DO_ASSERT(get_jenv_res == JNI_OK);
9633         }
9634         LDKUnsignedGossipMessage *msg_copy = MALLOC(sizeof(LDKUnsignedGossipMessage), "LDKUnsignedGossipMessage");
9635         *msg_copy = msg;
9636         int64_t msg_ref = tag_ptr(msg_copy, true);
9637         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9638         CHECK(obj != NULL);
9639         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_gossip_message_meth, msg_ref);
9640         if (UNLIKELY((*env)->ExceptionCheck(env))) {
9641                 (*env)->ExceptionDescribe(env);
9642                 (*env)->FatalError(env, "A call to sign_gossip_message in LDKNodeSigner from rust threw an exception.");
9643         }
9644         void* ret_ptr = untag_ptr(ret);
9645         CHECK_ACCESS(ret_ptr);
9646         LDKCResult_ECDSASignatureNoneZ ret_conv = *(LDKCResult_ECDSASignatureNoneZ*)(ret_ptr);
9647         FREE(untag_ptr(ret));
9648         if (get_jenv_res == JNI_EDETACHED) {
9649                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9650         }
9651         return ret_conv;
9652 }
9653 static void LDKNodeSigner_JCalls_cloned(LDKNodeSigner* new_obj) {
9654         LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) new_obj->this_arg;
9655         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
9656 }
9657 static inline LDKNodeSigner LDKNodeSigner_init (JNIEnv *env, jclass clz, jobject o) {
9658         jclass c = (*env)->GetObjectClass(env, o);
9659         CHECK(c != NULL);
9660         LDKNodeSigner_JCalls *calls = MALLOC(sizeof(LDKNodeSigner_JCalls), "LDKNodeSigner_JCalls");
9661         atomic_init(&calls->refcnt, 1);
9662         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
9663         calls->o = (*env)->NewWeakGlobalRef(env, o);
9664         calls->get_inbound_payment_key_material_meth = (*env)->GetMethodID(env, c, "get_inbound_payment_key_material", "()[B");
9665         CHECK(calls->get_inbound_payment_key_material_meth != NULL);
9666         calls->get_node_id_meth = (*env)->GetMethodID(env, c, "get_node_id", "(Lorg/ldk/enums/Recipient;)J");
9667         CHECK(calls->get_node_id_meth != NULL);
9668         calls->ecdh_meth = (*env)->GetMethodID(env, c, "ecdh", "(Lorg/ldk/enums/Recipient;[BJ)J");
9669         CHECK(calls->ecdh_meth != NULL);
9670         calls->sign_invoice_meth = (*env)->GetMethodID(env, c, "sign_invoice", "([B[BLorg/ldk/enums/Recipient;)J");
9671         CHECK(calls->sign_invoice_meth != NULL);
9672         calls->sign_bolt12_invoice_request_meth = (*env)->GetMethodID(env, c, "sign_bolt12_invoice_request", "(J)J");
9673         CHECK(calls->sign_bolt12_invoice_request_meth != NULL);
9674         calls->sign_bolt12_invoice_meth = (*env)->GetMethodID(env, c, "sign_bolt12_invoice", "(J)J");
9675         CHECK(calls->sign_bolt12_invoice_meth != NULL);
9676         calls->sign_gossip_message_meth = (*env)->GetMethodID(env, c, "sign_gossip_message", "(J)J");
9677         CHECK(calls->sign_gossip_message_meth != NULL);
9678
9679         LDKNodeSigner ret = {
9680                 .this_arg = (void*) calls,
9681                 .get_inbound_payment_key_material = get_inbound_payment_key_material_LDKNodeSigner_jcall,
9682                 .get_node_id = get_node_id_LDKNodeSigner_jcall,
9683                 .ecdh = ecdh_LDKNodeSigner_jcall,
9684                 .sign_invoice = sign_invoice_LDKNodeSigner_jcall,
9685                 .sign_bolt12_invoice_request = sign_bolt12_invoice_request_LDKNodeSigner_jcall,
9686                 .sign_bolt12_invoice = sign_bolt12_invoice_LDKNodeSigner_jcall,
9687                 .sign_gossip_message = sign_gossip_message_LDKNodeSigner_jcall,
9688                 .free = LDKNodeSigner_JCalls_free,
9689         };
9690         return ret;
9691 }
9692 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKNodeSigner_1new(JNIEnv *env, jclass clz, jobject o) {
9693         LDKNodeSigner *res_ptr = MALLOC(sizeof(LDKNodeSigner), "LDKNodeSigner");
9694         *res_ptr = LDKNodeSigner_init(env, clz, o);
9695         return tag_ptr(res_ptr, true);
9696 }
9697 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeSigner_1get_1inbound_1payment_1key_1material(JNIEnv *env, jclass clz, int64_t this_arg) {
9698         void* this_arg_ptr = untag_ptr(this_arg);
9699         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9700         LDKNodeSigner* this_arg_conv = (LDKNodeSigner*)this_arg_ptr;
9701         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
9702         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, (this_arg_conv->get_inbound_payment_key_material)(this_arg_conv->this_arg).data);
9703         return ret_arr;
9704 }
9705
9706 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeSigner_1get_1node_1id(JNIEnv *env, jclass clz, int64_t this_arg, jclass recipient) {
9707         void* this_arg_ptr = untag_ptr(this_arg);
9708         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9709         LDKNodeSigner* this_arg_conv = (LDKNodeSigner*)this_arg_ptr;
9710         LDKRecipient recipient_conv = LDKRecipient_from_java(env, recipient);
9711         LDKCResult_PublicKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyNoneZ), "LDKCResult_PublicKeyNoneZ");
9712         *ret_conv = (this_arg_conv->get_node_id)(this_arg_conv->this_arg, recipient_conv);
9713         return tag_ptr(ret_conv, true);
9714 }
9715
9716 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) {
9717         void* this_arg_ptr = untag_ptr(this_arg);
9718         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9719         LDKNodeSigner* this_arg_conv = (LDKNodeSigner*)this_arg_ptr;
9720         LDKRecipient recipient_conv = LDKRecipient_from_java(env, recipient);
9721         LDKPublicKey other_key_ref;
9722         CHECK((*env)->GetArrayLength(env, other_key) == 33);
9723         (*env)->GetByteArrayRegion(env, other_key, 0, 33, other_key_ref.compressed_form);
9724         void* tweak_ptr = untag_ptr(tweak);
9725         CHECK_ACCESS(tweak_ptr);
9726         LDKCOption_BigEndianScalarZ tweak_conv = *(LDKCOption_BigEndianScalarZ*)(tweak_ptr);
9727         tweak_conv = COption_BigEndianScalarZ_clone((LDKCOption_BigEndianScalarZ*)untag_ptr(tweak));
9728         LDKCResult_ThirtyTwoBytesNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesNoneZ), "LDKCResult_ThirtyTwoBytesNoneZ");
9729         *ret_conv = (this_arg_conv->ecdh)(this_arg_conv->this_arg, recipient_conv, other_key_ref, tweak_conv);
9730         return tag_ptr(ret_conv, true);
9731 }
9732
9733 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) {
9734         void* this_arg_ptr = untag_ptr(this_arg);
9735         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9736         LDKNodeSigner* this_arg_conv = (LDKNodeSigner*)this_arg_ptr;
9737         LDKu8slice hrp_bytes_ref;
9738         hrp_bytes_ref.datalen = (*env)->GetArrayLength(env, hrp_bytes);
9739         hrp_bytes_ref.data = (*env)->GetByteArrayElements (env, hrp_bytes, NULL);
9740         LDKCVec_U5Z invoice_data_constr;
9741         invoice_data_constr.datalen = (*env)->GetArrayLength(env, invoice_data);
9742         if (invoice_data_constr.datalen > 0)
9743                 invoice_data_constr.data = MALLOC(invoice_data_constr.datalen * sizeof(LDKU5), "LDKCVec_U5Z Elements");
9744         else
9745                 invoice_data_constr.data = NULL;
9746         int8_t* invoice_data_vals = (*env)->GetByteArrayElements (env, invoice_data, NULL);
9747         for (size_t h = 0; h < invoice_data_constr.datalen; h++) {
9748                 int8_t invoice_data_conv_7 = invoice_data_vals[h];
9749                 
9750                 invoice_data_constr.data[h] = (LDKU5){ ._0 = invoice_data_conv_7 };
9751         }
9752         (*env)->ReleaseByteArrayElements(env, invoice_data, invoice_data_vals, 0);
9753         LDKRecipient recipient_conv = LDKRecipient_from_java(env, recipient);
9754         LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
9755         *ret_conv = (this_arg_conv->sign_invoice)(this_arg_conv->this_arg, hrp_bytes_ref, invoice_data_constr, recipient_conv);
9756         (*env)->ReleaseByteArrayElements(env, hrp_bytes, (int8_t*)hrp_bytes_ref.data, 0);
9757         return tag_ptr(ret_conv, true);
9758 }
9759
9760 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) {
9761         void* this_arg_ptr = untag_ptr(this_arg);
9762         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9763         LDKNodeSigner* this_arg_conv = (LDKNodeSigner*)this_arg_ptr;
9764         LDKUnsignedInvoiceRequest invoice_request_conv;
9765         invoice_request_conv.inner = untag_ptr(invoice_request);
9766         invoice_request_conv.is_owned = ptr_is_owned(invoice_request);
9767         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_request_conv);
9768         invoice_request_conv.is_owned = false;
9769         LDKCResult_SchnorrSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SchnorrSignatureNoneZ), "LDKCResult_SchnorrSignatureNoneZ");
9770         *ret_conv = (this_arg_conv->sign_bolt12_invoice_request)(this_arg_conv->this_arg, &invoice_request_conv);
9771         return tag_ptr(ret_conv, true);
9772 }
9773
9774 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeSigner_1sign_1bolt12_1invoice(JNIEnv *env, jclass clz, int64_t this_arg, int64_t invoice) {
9775         void* this_arg_ptr = untag_ptr(this_arg);
9776         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9777         LDKNodeSigner* this_arg_conv = (LDKNodeSigner*)this_arg_ptr;
9778         LDKUnsignedBolt12Invoice invoice_conv;
9779         invoice_conv.inner = untag_ptr(invoice);
9780         invoice_conv.is_owned = ptr_is_owned(invoice);
9781         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_conv);
9782         invoice_conv.is_owned = false;
9783         LDKCResult_SchnorrSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SchnorrSignatureNoneZ), "LDKCResult_SchnorrSignatureNoneZ");
9784         *ret_conv = (this_arg_conv->sign_bolt12_invoice)(this_arg_conv->this_arg, &invoice_conv);
9785         return tag_ptr(ret_conv, true);
9786 }
9787
9788 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeSigner_1sign_1gossip_1message(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
9789         void* this_arg_ptr = untag_ptr(this_arg);
9790         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
9791         LDKNodeSigner* this_arg_conv = (LDKNodeSigner*)this_arg_ptr;
9792         void* msg_ptr = untag_ptr(msg);
9793         CHECK_ACCESS(msg_ptr);
9794         LDKUnsignedGossipMessage msg_conv = *(LDKUnsignedGossipMessage*)(msg_ptr);
9795         msg_conv = UnsignedGossipMessage_clone((LDKUnsignedGossipMessage*)untag_ptr(msg));
9796         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
9797         *ret_conv = (this_arg_conv->sign_gossip_message)(this_arg_conv->this_arg, msg_conv);
9798         return tag_ptr(ret_conv, true);
9799 }
9800
9801 typedef struct LDKSignerProvider_JCalls {
9802         atomic_size_t refcnt;
9803         JavaVM *vm;
9804         jweak o;
9805         jmethodID generate_channel_keys_id_meth;
9806         jmethodID derive_channel_signer_meth;
9807         jmethodID read_chan_signer_meth;
9808         jmethodID get_destination_script_meth;
9809         jmethodID get_shutdown_scriptpubkey_meth;
9810 } LDKSignerProvider_JCalls;
9811 static void LDKSignerProvider_JCalls_free(void* this_arg) {
9812         LDKSignerProvider_JCalls *j_calls = (LDKSignerProvider_JCalls*) this_arg;
9813         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
9814                 JNIEnv *env;
9815                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9816                 if (get_jenv_res == JNI_EDETACHED) {
9817                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9818                 } else {
9819                         DO_ASSERT(get_jenv_res == JNI_OK);
9820                 }
9821                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
9822                 if (get_jenv_res == JNI_EDETACHED) {
9823                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9824                 }
9825                 FREE(j_calls);
9826         }
9827 }
9828 LDKThirtyTwoBytes generate_channel_keys_id_LDKSignerProvider_jcall(const void* this_arg, bool inbound, uint64_t channel_value_satoshis, LDKU128 user_channel_id) {
9829         LDKSignerProvider_JCalls *j_calls = (LDKSignerProvider_JCalls*) this_arg;
9830         JNIEnv *env;
9831         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9832         if (get_jenv_res == JNI_EDETACHED) {
9833                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9834         } else {
9835                 DO_ASSERT(get_jenv_res == JNI_OK);
9836         }
9837         jboolean inbound_conv = inbound;
9838         int64_t channel_value_satoshis_conv = channel_value_satoshis;
9839         int8_tArray user_channel_id_arr = (*env)->NewByteArray(env, 16);
9840         (*env)->SetByteArrayRegion(env, user_channel_id_arr, 0, 16, user_channel_id.le_bytes);
9841         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9842         CHECK(obj != NULL);
9843         int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->generate_channel_keys_id_meth, inbound_conv, channel_value_satoshis_conv, user_channel_id_arr);
9844         if (UNLIKELY((*env)->ExceptionCheck(env))) {
9845                 (*env)->ExceptionDescribe(env);
9846                 (*env)->FatalError(env, "A call to generate_channel_keys_id in LDKSignerProvider from rust threw an exception.");
9847         }
9848         LDKThirtyTwoBytes ret_ref;
9849         CHECK((*env)->GetArrayLength(env, ret) == 32);
9850         (*env)->GetByteArrayRegion(env, ret, 0, 32, ret_ref.data);
9851         if (get_jenv_res == JNI_EDETACHED) {
9852                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9853         }
9854         return ret_ref;
9855 }
9856 LDKWriteableEcdsaChannelSigner derive_channel_signer_LDKSignerProvider_jcall(const void* this_arg, uint64_t channel_value_satoshis, LDKThirtyTwoBytes channel_keys_id) {
9857         LDKSignerProvider_JCalls *j_calls = (LDKSignerProvider_JCalls*) this_arg;
9858         JNIEnv *env;
9859         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9860         if (get_jenv_res == JNI_EDETACHED) {
9861                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9862         } else {
9863                 DO_ASSERT(get_jenv_res == JNI_OK);
9864         }
9865         int64_t channel_value_satoshis_conv = channel_value_satoshis;
9866         int8_tArray channel_keys_id_arr = (*env)->NewByteArray(env, 32);
9867         (*env)->SetByteArrayRegion(env, channel_keys_id_arr, 0, 32, channel_keys_id.data);
9868         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9869         CHECK(obj != NULL);
9870         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->derive_channel_signer_meth, channel_value_satoshis_conv, channel_keys_id_arr);
9871         if (UNLIKELY((*env)->ExceptionCheck(env))) {
9872                 (*env)->ExceptionDescribe(env);
9873                 (*env)->FatalError(env, "A call to derive_channel_signer in LDKSignerProvider from rust threw an exception.");
9874         }
9875         void* ret_ptr = untag_ptr(ret);
9876         CHECK_ACCESS(ret_ptr);
9877         LDKWriteableEcdsaChannelSigner ret_conv = *(LDKWriteableEcdsaChannelSigner*)(ret_ptr);
9878         FREE(untag_ptr(ret));
9879         if (get_jenv_res == JNI_EDETACHED) {
9880                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9881         }
9882         return ret_conv;
9883 }
9884 LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ read_chan_signer_LDKSignerProvider_jcall(const void* this_arg, LDKu8slice reader) {
9885         LDKSignerProvider_JCalls *j_calls = (LDKSignerProvider_JCalls*) this_arg;
9886         JNIEnv *env;
9887         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9888         if (get_jenv_res == JNI_EDETACHED) {
9889                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9890         } else {
9891                 DO_ASSERT(get_jenv_res == JNI_OK);
9892         }
9893         LDKu8slice reader_var = reader;
9894         int8_tArray reader_arr = (*env)->NewByteArray(env, reader_var.datalen);
9895         (*env)->SetByteArrayRegion(env, reader_arr, 0, reader_var.datalen, reader_var.data);
9896         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9897         CHECK(obj != NULL);
9898         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->read_chan_signer_meth, reader_arr);
9899         if (UNLIKELY((*env)->ExceptionCheck(env))) {
9900                 (*env)->ExceptionDescribe(env);
9901                 (*env)->FatalError(env, "A call to read_chan_signer in LDKSignerProvider from rust threw an exception.");
9902         }
9903         void* ret_ptr = untag_ptr(ret);
9904         CHECK_ACCESS(ret_ptr);
9905         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ ret_conv = *(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ*)(ret_ptr);
9906         FREE(untag_ptr(ret));
9907         if (get_jenv_res == JNI_EDETACHED) {
9908                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9909         }
9910         return ret_conv;
9911 }
9912 LDKCResult_CVec_u8ZNoneZ get_destination_script_LDKSignerProvider_jcall(const void* this_arg, LDKThirtyTwoBytes channel_keys_id) {
9913         LDKSignerProvider_JCalls *j_calls = (LDKSignerProvider_JCalls*) this_arg;
9914         JNIEnv *env;
9915         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9916         if (get_jenv_res == JNI_EDETACHED) {
9917                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9918         } else {
9919                 DO_ASSERT(get_jenv_res == JNI_OK);
9920         }
9921         int8_tArray channel_keys_id_arr = (*env)->NewByteArray(env, 32);
9922         (*env)->SetByteArrayRegion(env, channel_keys_id_arr, 0, 32, channel_keys_id.data);
9923         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9924         CHECK(obj != NULL);
9925         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->get_destination_script_meth, channel_keys_id_arr);
9926         if (UNLIKELY((*env)->ExceptionCheck(env))) {
9927                 (*env)->ExceptionDescribe(env);
9928                 (*env)->FatalError(env, "A call to get_destination_script in LDKSignerProvider from rust threw an exception.");
9929         }
9930         void* ret_ptr = untag_ptr(ret);
9931         CHECK_ACCESS(ret_ptr);
9932         LDKCResult_CVec_u8ZNoneZ ret_conv = *(LDKCResult_CVec_u8ZNoneZ*)(ret_ptr);
9933         FREE(untag_ptr(ret));
9934         if (get_jenv_res == JNI_EDETACHED) {
9935                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9936         }
9937         return ret_conv;
9938 }
9939 LDKCResult_ShutdownScriptNoneZ get_shutdown_scriptpubkey_LDKSignerProvider_jcall(const void* this_arg) {
9940         LDKSignerProvider_JCalls *j_calls = (LDKSignerProvider_JCalls*) this_arg;
9941         JNIEnv *env;
9942         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
9943         if (get_jenv_res == JNI_EDETACHED) {
9944                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9945         } else {
9946                 DO_ASSERT(get_jenv_res == JNI_OK);
9947         }
9948         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9949         CHECK(obj != NULL);
9950         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->get_shutdown_scriptpubkey_meth);
9951         if (UNLIKELY((*env)->ExceptionCheck(env))) {
9952                 (*env)->ExceptionDescribe(env);
9953                 (*env)->FatalError(env, "A call to get_shutdown_scriptpubkey in LDKSignerProvider from rust threw an exception.");
9954         }
9955         void* ret_ptr = untag_ptr(ret);
9956         CHECK_ACCESS(ret_ptr);
9957         LDKCResult_ShutdownScriptNoneZ ret_conv = *(LDKCResult_ShutdownScriptNoneZ*)(ret_ptr);
9958         FREE(untag_ptr(ret));
9959         if (get_jenv_res == JNI_EDETACHED) {
9960                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9961         }
9962         return ret_conv;
9963 }
9964 static void LDKSignerProvider_JCalls_cloned(LDKSignerProvider* new_obj) {
9965         LDKSignerProvider_JCalls *j_calls = (LDKSignerProvider_JCalls*) new_obj->this_arg;
9966         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
9967 }
9968 static inline LDKSignerProvider LDKSignerProvider_init (JNIEnv *env, jclass clz, jobject o) {
9969         jclass c = (*env)->GetObjectClass(env, o);
9970         CHECK(c != NULL);
9971         LDKSignerProvider_JCalls *calls = MALLOC(sizeof(LDKSignerProvider_JCalls), "LDKSignerProvider_JCalls");
9972         atomic_init(&calls->refcnt, 1);
9973         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
9974         calls->o = (*env)->NewWeakGlobalRef(env, o);
9975         calls->generate_channel_keys_id_meth = (*env)->GetMethodID(env, c, "generate_channel_keys_id", "(ZJ[B)[B");
9976         CHECK(calls->generate_channel_keys_id_meth != NULL);
9977         calls->derive_channel_signer_meth = (*env)->GetMethodID(env, c, "derive_channel_signer", "(J[B)J");
9978         CHECK(calls->derive_channel_signer_meth != NULL);
9979         calls->read_chan_signer_meth = (*env)->GetMethodID(env, c, "read_chan_signer", "([B)J");
9980         CHECK(calls->read_chan_signer_meth != NULL);
9981         calls->get_destination_script_meth = (*env)->GetMethodID(env, c, "get_destination_script", "([B)J");
9982         CHECK(calls->get_destination_script_meth != NULL);
9983         calls->get_shutdown_scriptpubkey_meth = (*env)->GetMethodID(env, c, "get_shutdown_scriptpubkey", "()J");
9984         CHECK(calls->get_shutdown_scriptpubkey_meth != NULL);
9985
9986         LDKSignerProvider ret = {
9987                 .this_arg = (void*) calls,
9988                 .generate_channel_keys_id = generate_channel_keys_id_LDKSignerProvider_jcall,
9989                 .derive_channel_signer = derive_channel_signer_LDKSignerProvider_jcall,
9990                 .read_chan_signer = read_chan_signer_LDKSignerProvider_jcall,
9991                 .get_destination_script = get_destination_script_LDKSignerProvider_jcall,
9992                 .get_shutdown_scriptpubkey = get_shutdown_scriptpubkey_LDKSignerProvider_jcall,
9993                 .free = LDKSignerProvider_JCalls_free,
9994         };
9995         return ret;
9996 }
9997 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKSignerProvider_1new(JNIEnv *env, jclass clz, jobject o) {
9998         LDKSignerProvider *res_ptr = MALLOC(sizeof(LDKSignerProvider), "LDKSignerProvider");
9999         *res_ptr = LDKSignerProvider_init(env, clz, o);
10000         return tag_ptr(res_ptr, true);
10001 }
10002 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) {
10003         void* this_arg_ptr = untag_ptr(this_arg);
10004         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10005         LDKSignerProvider* this_arg_conv = (LDKSignerProvider*)this_arg_ptr;
10006         LDKU128 user_channel_id_ref;
10007         CHECK((*env)->GetArrayLength(env, user_channel_id) == 16);
10008         (*env)->GetByteArrayRegion(env, user_channel_id, 0, 16, user_channel_id_ref.le_bytes);
10009         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
10010         (*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);
10011         return ret_arr;
10012 }
10013
10014 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) {
10015         void* this_arg_ptr = untag_ptr(this_arg);
10016         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10017         LDKSignerProvider* this_arg_conv = (LDKSignerProvider*)this_arg_ptr;
10018         LDKThirtyTwoBytes channel_keys_id_ref;
10019         CHECK((*env)->GetArrayLength(env, channel_keys_id) == 32);
10020         (*env)->GetByteArrayRegion(env, channel_keys_id, 0, 32, channel_keys_id_ref.data);
10021         LDKWriteableEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner");
10022         *ret_ret = (this_arg_conv->derive_channel_signer)(this_arg_conv->this_arg, channel_value_satoshis, channel_keys_id_ref);
10023         return tag_ptr(ret_ret, true);
10024 }
10025
10026 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignerProvider_1read_1chan_1signer(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray reader) {
10027         void* this_arg_ptr = untag_ptr(this_arg);
10028         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10029         LDKSignerProvider* this_arg_conv = (LDKSignerProvider*)this_arg_ptr;
10030         LDKu8slice reader_ref;
10031         reader_ref.datalen = (*env)->GetArrayLength(env, reader);
10032         reader_ref.data = (*env)->GetByteArrayElements (env, reader, NULL);
10033         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ), "LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ");
10034         *ret_conv = (this_arg_conv->read_chan_signer)(this_arg_conv->this_arg, reader_ref);
10035         (*env)->ReleaseByteArrayElements(env, reader, (int8_t*)reader_ref.data, 0);
10036         return tag_ptr(ret_conv, true);
10037 }
10038
10039 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) {
10040         void* this_arg_ptr = untag_ptr(this_arg);
10041         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10042         LDKSignerProvider* this_arg_conv = (LDKSignerProvider*)this_arg_ptr;
10043         LDKThirtyTwoBytes channel_keys_id_ref;
10044         CHECK((*env)->GetArrayLength(env, channel_keys_id) == 32);
10045         (*env)->GetByteArrayRegion(env, channel_keys_id, 0, 32, channel_keys_id_ref.data);
10046         LDKCResult_CVec_u8ZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZNoneZ), "LDKCResult_CVec_u8ZNoneZ");
10047         *ret_conv = (this_arg_conv->get_destination_script)(this_arg_conv->this_arg, channel_keys_id_ref);
10048         return tag_ptr(ret_conv, true);
10049 }
10050
10051 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignerProvider_1get_1shutdown_1scriptpubkey(JNIEnv *env, jclass clz, int64_t this_arg) {
10052         void* this_arg_ptr = untag_ptr(this_arg);
10053         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10054         LDKSignerProvider* this_arg_conv = (LDKSignerProvider*)this_arg_ptr;
10055         LDKCResult_ShutdownScriptNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptNoneZ), "LDKCResult_ShutdownScriptNoneZ");
10056         *ret_conv = (this_arg_conv->get_shutdown_scriptpubkey)(this_arg_conv->this_arg);
10057         return tag_ptr(ret_conv, true);
10058 }
10059
10060 typedef struct LDKFeeEstimator_JCalls {
10061         atomic_size_t refcnt;
10062         JavaVM *vm;
10063         jweak o;
10064         jmethodID get_est_sat_per_1000_weight_meth;
10065 } LDKFeeEstimator_JCalls;
10066 static void LDKFeeEstimator_JCalls_free(void* this_arg) {
10067         LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
10068         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
10069                 JNIEnv *env;
10070                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10071                 if (get_jenv_res == JNI_EDETACHED) {
10072                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10073                 } else {
10074                         DO_ASSERT(get_jenv_res == JNI_OK);
10075                 }
10076                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
10077                 if (get_jenv_res == JNI_EDETACHED) {
10078                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10079                 }
10080                 FREE(j_calls);
10081         }
10082 }
10083 uint32_t get_est_sat_per_1000_weight_LDKFeeEstimator_jcall(const void* this_arg, LDKConfirmationTarget confirmation_target) {
10084         LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
10085         JNIEnv *env;
10086         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10087         if (get_jenv_res == JNI_EDETACHED) {
10088                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10089         } else {
10090                 DO_ASSERT(get_jenv_res == JNI_OK);
10091         }
10092         jclass confirmation_target_conv = LDKConfirmationTarget_to_java(env, confirmation_target);
10093         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10094         CHECK(obj != NULL);
10095         int32_t ret = (*env)->CallIntMethod(env, obj, j_calls->get_est_sat_per_1000_weight_meth, confirmation_target_conv);
10096         if (UNLIKELY((*env)->ExceptionCheck(env))) {
10097                 (*env)->ExceptionDescribe(env);
10098                 (*env)->FatalError(env, "A call to get_est_sat_per_1000_weight in LDKFeeEstimator from rust threw an exception.");
10099         }
10100         if (get_jenv_res == JNI_EDETACHED) {
10101                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10102         }
10103         return ret;
10104 }
10105 static void LDKFeeEstimator_JCalls_cloned(LDKFeeEstimator* new_obj) {
10106         LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) new_obj->this_arg;
10107         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
10108 }
10109 static inline LDKFeeEstimator LDKFeeEstimator_init (JNIEnv *env, jclass clz, jobject o) {
10110         jclass c = (*env)->GetObjectClass(env, o);
10111         CHECK(c != NULL);
10112         LDKFeeEstimator_JCalls *calls = MALLOC(sizeof(LDKFeeEstimator_JCalls), "LDKFeeEstimator_JCalls");
10113         atomic_init(&calls->refcnt, 1);
10114         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
10115         calls->o = (*env)->NewWeakGlobalRef(env, o);
10116         calls->get_est_sat_per_1000_weight_meth = (*env)->GetMethodID(env, c, "get_est_sat_per_1000_weight", "(Lorg/ldk/enums/ConfirmationTarget;)I");
10117         CHECK(calls->get_est_sat_per_1000_weight_meth != NULL);
10118
10119         LDKFeeEstimator ret = {
10120                 .this_arg = (void*) calls,
10121                 .get_est_sat_per_1000_weight = get_est_sat_per_1000_weight_LDKFeeEstimator_jcall,
10122                 .free = LDKFeeEstimator_JCalls_free,
10123         };
10124         return ret;
10125 }
10126 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKFeeEstimator_1new(JNIEnv *env, jclass clz, jobject o) {
10127         LDKFeeEstimator *res_ptr = MALLOC(sizeof(LDKFeeEstimator), "LDKFeeEstimator");
10128         *res_ptr = LDKFeeEstimator_init(env, clz, o);
10129         return tag_ptr(res_ptr, true);
10130 }
10131 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) {
10132         void* this_arg_ptr = untag_ptr(this_arg);
10133         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10134         LDKFeeEstimator* this_arg_conv = (LDKFeeEstimator*)this_arg_ptr;
10135         LDKConfirmationTarget confirmation_target_conv = LDKConfirmationTarget_from_java(env, confirmation_target);
10136         int32_t ret_conv = (this_arg_conv->get_est_sat_per_1000_weight)(this_arg_conv->this_arg, confirmation_target_conv);
10137         return ret_conv;
10138 }
10139
10140 typedef struct LDKMessageRouter_JCalls {
10141         atomic_size_t refcnt;
10142         JavaVM *vm;
10143         jweak o;
10144         jmethodID find_path_meth;
10145         jmethodID create_blinded_paths_meth;
10146 } LDKMessageRouter_JCalls;
10147 static void LDKMessageRouter_JCalls_free(void* this_arg) {
10148         LDKMessageRouter_JCalls *j_calls = (LDKMessageRouter_JCalls*) this_arg;
10149         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
10150                 JNIEnv *env;
10151                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10152                 if (get_jenv_res == JNI_EDETACHED) {
10153                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10154                 } else {
10155                         DO_ASSERT(get_jenv_res == JNI_OK);
10156                 }
10157                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
10158                 if (get_jenv_res == JNI_EDETACHED) {
10159                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10160                 }
10161                 FREE(j_calls);
10162         }
10163 }
10164 LDKCResult_OnionMessagePathNoneZ find_path_LDKMessageRouter_jcall(const void* this_arg, LDKPublicKey sender, LDKCVec_PublicKeyZ peers, LDKDestination destination) {
10165         LDKMessageRouter_JCalls *j_calls = (LDKMessageRouter_JCalls*) this_arg;
10166         JNIEnv *env;
10167         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10168         if (get_jenv_res == JNI_EDETACHED) {
10169                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10170         } else {
10171                 DO_ASSERT(get_jenv_res == JNI_OK);
10172         }
10173         int8_tArray sender_arr = (*env)->NewByteArray(env, 33);
10174         (*env)->SetByteArrayRegion(env, sender_arr, 0, 33, sender.compressed_form);
10175         LDKCVec_PublicKeyZ peers_var = peers;
10176         jobjectArray peers_arr = NULL;
10177         peers_arr = (*env)->NewObjectArray(env, peers_var.datalen, arr_of_B_clz, NULL);
10178         ;
10179         for (size_t i = 0; i < peers_var.datalen; i++) {
10180                 int8_tArray peers_conv_8_arr = (*env)->NewByteArray(env, 33);
10181                 (*env)->SetByteArrayRegion(env, peers_conv_8_arr, 0, 33, peers_var.data[i].compressed_form);
10182                 (*env)->SetObjectArrayElement(env, peers_arr, i, peers_conv_8_arr);
10183         }
10184         
10185         FREE(peers_var.data);
10186         LDKDestination *destination_copy = MALLOC(sizeof(LDKDestination), "LDKDestination");
10187         *destination_copy = destination;
10188         int64_t destination_ref = tag_ptr(destination_copy, true);
10189         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10190         CHECK(obj != NULL);
10191         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->find_path_meth, sender_arr, peers_arr, destination_ref);
10192         if (UNLIKELY((*env)->ExceptionCheck(env))) {
10193                 (*env)->ExceptionDescribe(env);
10194                 (*env)->FatalError(env, "A call to find_path in LDKMessageRouter from rust threw an exception.");
10195         }
10196         void* ret_ptr = untag_ptr(ret);
10197         CHECK_ACCESS(ret_ptr);
10198         LDKCResult_OnionMessagePathNoneZ ret_conv = *(LDKCResult_OnionMessagePathNoneZ*)(ret_ptr);
10199         FREE(untag_ptr(ret));
10200         if (get_jenv_res == JNI_EDETACHED) {
10201                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10202         }
10203         return ret_conv;
10204 }
10205 LDKCResult_CVec_BlindedPathZNoneZ create_blinded_paths_LDKMessageRouter_jcall(const void* this_arg, LDKPublicKey recipient, LDKCVec_PublicKeyZ peers) {
10206         LDKMessageRouter_JCalls *j_calls = (LDKMessageRouter_JCalls*) this_arg;
10207         JNIEnv *env;
10208         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10209         if (get_jenv_res == JNI_EDETACHED) {
10210                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10211         } else {
10212                 DO_ASSERT(get_jenv_res == JNI_OK);
10213         }
10214         int8_tArray recipient_arr = (*env)->NewByteArray(env, 33);
10215         (*env)->SetByteArrayRegion(env, recipient_arr, 0, 33, recipient.compressed_form);
10216         LDKCVec_PublicKeyZ peers_var = peers;
10217         jobjectArray peers_arr = NULL;
10218         peers_arr = (*env)->NewObjectArray(env, peers_var.datalen, arr_of_B_clz, NULL);
10219         ;
10220         for (size_t i = 0; i < peers_var.datalen; i++) {
10221                 int8_tArray peers_conv_8_arr = (*env)->NewByteArray(env, 33);
10222                 (*env)->SetByteArrayRegion(env, peers_conv_8_arr, 0, 33, peers_var.data[i].compressed_form);
10223                 (*env)->SetObjectArrayElement(env, peers_arr, i, peers_conv_8_arr);
10224         }
10225         
10226         FREE(peers_var.data);
10227         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10228         CHECK(obj != NULL);
10229         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->create_blinded_paths_meth, recipient_arr, peers_arr);
10230         if (UNLIKELY((*env)->ExceptionCheck(env))) {
10231                 (*env)->ExceptionDescribe(env);
10232                 (*env)->FatalError(env, "A call to create_blinded_paths in LDKMessageRouter from rust threw an exception.");
10233         }
10234         void* ret_ptr = untag_ptr(ret);
10235         CHECK_ACCESS(ret_ptr);
10236         LDKCResult_CVec_BlindedPathZNoneZ ret_conv = *(LDKCResult_CVec_BlindedPathZNoneZ*)(ret_ptr);
10237         FREE(untag_ptr(ret));
10238         if (get_jenv_res == JNI_EDETACHED) {
10239                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10240         }
10241         return ret_conv;
10242 }
10243 static void LDKMessageRouter_JCalls_cloned(LDKMessageRouter* new_obj) {
10244         LDKMessageRouter_JCalls *j_calls = (LDKMessageRouter_JCalls*) new_obj->this_arg;
10245         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
10246 }
10247 static inline LDKMessageRouter LDKMessageRouter_init (JNIEnv *env, jclass clz, jobject o) {
10248         jclass c = (*env)->GetObjectClass(env, o);
10249         CHECK(c != NULL);
10250         LDKMessageRouter_JCalls *calls = MALLOC(sizeof(LDKMessageRouter_JCalls), "LDKMessageRouter_JCalls");
10251         atomic_init(&calls->refcnt, 1);
10252         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
10253         calls->o = (*env)->NewWeakGlobalRef(env, o);
10254         calls->find_path_meth = (*env)->GetMethodID(env, c, "find_path", "([B[[BJ)J");
10255         CHECK(calls->find_path_meth != NULL);
10256         calls->create_blinded_paths_meth = (*env)->GetMethodID(env, c, "create_blinded_paths", "([B[[B)J");
10257         CHECK(calls->create_blinded_paths_meth != NULL);
10258
10259         LDKMessageRouter ret = {
10260                 .this_arg = (void*) calls,
10261                 .find_path = find_path_LDKMessageRouter_jcall,
10262                 .create_blinded_paths = create_blinded_paths_LDKMessageRouter_jcall,
10263                 .free = LDKMessageRouter_JCalls_free,
10264         };
10265         return ret;
10266 }
10267 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKMessageRouter_1new(JNIEnv *env, jclass clz, jobject o) {
10268         LDKMessageRouter *res_ptr = MALLOC(sizeof(LDKMessageRouter), "LDKMessageRouter");
10269         *res_ptr = LDKMessageRouter_init(env, clz, o);
10270         return tag_ptr(res_ptr, true);
10271 }
10272 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) {
10273         void* this_arg_ptr = untag_ptr(this_arg);
10274         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10275         LDKMessageRouter* this_arg_conv = (LDKMessageRouter*)this_arg_ptr;
10276         LDKPublicKey sender_ref;
10277         CHECK((*env)->GetArrayLength(env, sender) == 33);
10278         (*env)->GetByteArrayRegion(env, sender, 0, 33, sender_ref.compressed_form);
10279         LDKCVec_PublicKeyZ peers_constr;
10280         peers_constr.datalen = (*env)->GetArrayLength(env, peers);
10281         if (peers_constr.datalen > 0)
10282                 peers_constr.data = MALLOC(peers_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
10283         else
10284                 peers_constr.data = NULL;
10285         for (size_t i = 0; i < peers_constr.datalen; i++) {
10286                 int8_tArray peers_conv_8 = (*env)->GetObjectArrayElement(env, peers, i);
10287                 LDKPublicKey peers_conv_8_ref;
10288                 CHECK((*env)->GetArrayLength(env, peers_conv_8) == 33);
10289                 (*env)->GetByteArrayRegion(env, peers_conv_8, 0, 33, peers_conv_8_ref.compressed_form);
10290                 peers_constr.data[i] = peers_conv_8_ref;
10291         }
10292         void* destination_ptr = untag_ptr(destination);
10293         CHECK_ACCESS(destination_ptr);
10294         LDKDestination destination_conv = *(LDKDestination*)(destination_ptr);
10295         destination_conv = Destination_clone((LDKDestination*)untag_ptr(destination));
10296         LDKCResult_OnionMessagePathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessagePathNoneZ), "LDKCResult_OnionMessagePathNoneZ");
10297         *ret_conv = (this_arg_conv->find_path)(this_arg_conv->this_arg, sender_ref, peers_constr, destination_conv);
10298         return tag_ptr(ret_conv, true);
10299 }
10300
10301 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) {
10302         void* this_arg_ptr = untag_ptr(this_arg);
10303         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10304         LDKMessageRouter* this_arg_conv = (LDKMessageRouter*)this_arg_ptr;
10305         LDKPublicKey recipient_ref;
10306         CHECK((*env)->GetArrayLength(env, recipient) == 33);
10307         (*env)->GetByteArrayRegion(env, recipient, 0, 33, recipient_ref.compressed_form);
10308         LDKCVec_PublicKeyZ peers_constr;
10309         peers_constr.datalen = (*env)->GetArrayLength(env, peers);
10310         if (peers_constr.datalen > 0)
10311                 peers_constr.data = MALLOC(peers_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
10312         else
10313                 peers_constr.data = NULL;
10314         for (size_t i = 0; i < peers_constr.datalen; i++) {
10315                 int8_tArray peers_conv_8 = (*env)->GetObjectArrayElement(env, peers, i);
10316                 LDKPublicKey peers_conv_8_ref;
10317                 CHECK((*env)->GetArrayLength(env, peers_conv_8) == 33);
10318                 (*env)->GetByteArrayRegion(env, peers_conv_8, 0, 33, peers_conv_8_ref.compressed_form);
10319                 peers_constr.data[i] = peers_conv_8_ref;
10320         }
10321         LDKCResult_CVec_BlindedPathZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_BlindedPathZNoneZ), "LDKCResult_CVec_BlindedPathZNoneZ");
10322         *ret_conv = (this_arg_conv->create_blinded_paths)(this_arg_conv->this_arg, recipient_ref, peers_constr);
10323         return tag_ptr(ret_conv, true);
10324 }
10325
10326 typedef struct LDKRouter_JCalls {
10327         atomic_size_t refcnt;
10328         JavaVM *vm;
10329         jweak o;
10330         LDKMessageRouter_JCalls* MessageRouter;
10331         jmethodID find_route_meth;
10332         jmethodID find_route_with_id_meth;
10333         jmethodID create_blinded_payment_paths_meth;
10334 } LDKRouter_JCalls;
10335 static void LDKRouter_JCalls_free(void* this_arg) {
10336         LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) this_arg;
10337         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
10338                 JNIEnv *env;
10339                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10340                 if (get_jenv_res == JNI_EDETACHED) {
10341                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10342                 } else {
10343                         DO_ASSERT(get_jenv_res == JNI_OK);
10344                 }
10345                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
10346                 if (get_jenv_res == JNI_EDETACHED) {
10347                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10348                 }
10349                 FREE(j_calls);
10350         }
10351 }
10352 LDKCResult_RouteLightningErrorZ find_route_LDKRouter_jcall(const void* this_arg, LDKPublicKey payer, const LDKRouteParameters * route_params, LDKCVec_ChannelDetailsZ * first_hops, LDKInFlightHtlcs inflight_htlcs) {
10353         LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) this_arg;
10354         JNIEnv *env;
10355         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10356         if (get_jenv_res == JNI_EDETACHED) {
10357                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10358         } else {
10359                 DO_ASSERT(get_jenv_res == JNI_OK);
10360         }
10361         int8_tArray payer_arr = (*env)->NewByteArray(env, 33);
10362         (*env)->SetByteArrayRegion(env, payer_arr, 0, 33, payer.compressed_form);
10363         LDKRouteParameters route_params_var = *route_params;
10364         int64_t route_params_ref = 0;
10365         route_params_var = RouteParameters_clone(&route_params_var);
10366         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_var);
10367         route_params_ref = tag_ptr(route_params_var.inner, route_params_var.is_owned);
10368         LDKCVec_ChannelDetailsZ *first_hops_var_ptr = first_hops;
10369         int64_tArray first_hops_arr = NULL;
10370         if (first_hops != NULL) {
10371                 LDKCVec_ChannelDetailsZ first_hops_var = *first_hops_var_ptr;
10372                 first_hops_arr = (*env)->NewLongArray(env, first_hops_var.datalen);
10373                 int64_t *first_hops_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, first_hops_arr, NULL);
10374                 for (size_t q = 0; q < first_hops_var.datalen; q++) {
10375                         LDKChannelDetails first_hops_conv_16_var =      first_hops_var.data[q];
10376                         int64_t first_hops_conv_16_ref = 0;
10377                         CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_var);
10378                         first_hops_conv_16_ref = tag_ptr(first_hops_conv_16_var.inner, first_hops_conv_16_var.is_owned);
10379                         first_hops_arr_ptr[q] = first_hops_conv_16_ref;
10380                 }
10381                 (*env)->ReleasePrimitiveArrayCritical(env, first_hops_arr, first_hops_arr_ptr, 0);
10382         }
10383         LDKInFlightHtlcs inflight_htlcs_var = inflight_htlcs;
10384         int64_t inflight_htlcs_ref = 0;
10385         CHECK_INNER_FIELD_ACCESS_OR_NULL(inflight_htlcs_var);
10386         inflight_htlcs_ref = tag_ptr(inflight_htlcs_var.inner, inflight_htlcs_var.is_owned);
10387         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10388         CHECK(obj != NULL);
10389         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->find_route_meth, payer_arr, route_params_ref, first_hops_arr, inflight_htlcs_ref);
10390         if (UNLIKELY((*env)->ExceptionCheck(env))) {
10391                 (*env)->ExceptionDescribe(env);
10392                 (*env)->FatalError(env, "A call to find_route in LDKRouter from rust threw an exception.");
10393         }
10394         void* ret_ptr = untag_ptr(ret);
10395         CHECK_ACCESS(ret_ptr);
10396         LDKCResult_RouteLightningErrorZ ret_conv = *(LDKCResult_RouteLightningErrorZ*)(ret_ptr);
10397         FREE(untag_ptr(ret));
10398         if (get_jenv_res == JNI_EDETACHED) {
10399                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10400         }
10401         return ret_conv;
10402 }
10403 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) {
10404         LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) this_arg;
10405         JNIEnv *env;
10406         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10407         if (get_jenv_res == JNI_EDETACHED) {
10408                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10409         } else {
10410                 DO_ASSERT(get_jenv_res == JNI_OK);
10411         }
10412         int8_tArray payer_arr = (*env)->NewByteArray(env, 33);
10413         (*env)->SetByteArrayRegion(env, payer_arr, 0, 33, payer.compressed_form);
10414         LDKRouteParameters route_params_var = *route_params;
10415         int64_t route_params_ref = 0;
10416         route_params_var = RouteParameters_clone(&route_params_var);
10417         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_var);
10418         route_params_ref = tag_ptr(route_params_var.inner, route_params_var.is_owned);
10419         LDKCVec_ChannelDetailsZ *first_hops_var_ptr = first_hops;
10420         int64_tArray first_hops_arr = NULL;
10421         if (first_hops != NULL) {
10422                 LDKCVec_ChannelDetailsZ first_hops_var = *first_hops_var_ptr;
10423                 first_hops_arr = (*env)->NewLongArray(env, first_hops_var.datalen);
10424                 int64_t *first_hops_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, first_hops_arr, NULL);
10425                 for (size_t q = 0; q < first_hops_var.datalen; q++) {
10426                         LDKChannelDetails first_hops_conv_16_var =      first_hops_var.data[q];
10427                         int64_t first_hops_conv_16_ref = 0;
10428                         CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_var);
10429                         first_hops_conv_16_ref = tag_ptr(first_hops_conv_16_var.inner, first_hops_conv_16_var.is_owned);
10430                         first_hops_arr_ptr[q] = first_hops_conv_16_ref;
10431                 }
10432                 (*env)->ReleasePrimitiveArrayCritical(env, first_hops_arr, first_hops_arr_ptr, 0);
10433         }
10434         LDKInFlightHtlcs inflight_htlcs_var = inflight_htlcs;
10435         int64_t inflight_htlcs_ref = 0;
10436         CHECK_INNER_FIELD_ACCESS_OR_NULL(inflight_htlcs_var);
10437         inflight_htlcs_ref = tag_ptr(inflight_htlcs_var.inner, inflight_htlcs_var.is_owned);
10438         int8_tArray _payment_hash_arr = (*env)->NewByteArray(env, 32);
10439         (*env)->SetByteArrayRegion(env, _payment_hash_arr, 0, 32, _payment_hash.data);
10440         int8_tArray _payment_id_arr = (*env)->NewByteArray(env, 32);
10441         (*env)->SetByteArrayRegion(env, _payment_id_arr, 0, 32, _payment_id.data);
10442         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10443         CHECK(obj != NULL);
10444         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);
10445         if (UNLIKELY((*env)->ExceptionCheck(env))) {
10446                 (*env)->ExceptionDescribe(env);
10447                 (*env)->FatalError(env, "A call to find_route_with_id in LDKRouter from rust threw an exception.");
10448         }
10449         void* ret_ptr = untag_ptr(ret);
10450         CHECK_ACCESS(ret_ptr);
10451         LDKCResult_RouteLightningErrorZ ret_conv = *(LDKCResult_RouteLightningErrorZ*)(ret_ptr);
10452         FREE(untag_ptr(ret));
10453         if (get_jenv_res == JNI_EDETACHED) {
10454                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10455         }
10456         return ret_conv;
10457 }
10458 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) {
10459         LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) this_arg;
10460         JNIEnv *env;
10461         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
10462         if (get_jenv_res == JNI_EDETACHED) {
10463                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
10464         } else {
10465                 DO_ASSERT(get_jenv_res == JNI_OK);
10466         }
10467         int8_tArray recipient_arr = (*env)->NewByteArray(env, 33);
10468         (*env)->SetByteArrayRegion(env, recipient_arr, 0, 33, recipient.compressed_form);
10469         LDKCVec_ChannelDetailsZ first_hops_var = first_hops;
10470         int64_tArray first_hops_arr = NULL;
10471         first_hops_arr = (*env)->NewLongArray(env, first_hops_var.datalen);
10472         int64_t *first_hops_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, first_hops_arr, NULL);
10473         for (size_t q = 0; q < first_hops_var.datalen; q++) {
10474                 LDKChannelDetails first_hops_conv_16_var = first_hops_var.data[q];
10475                 int64_t first_hops_conv_16_ref = 0;
10476                 CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_var);
10477                 first_hops_conv_16_ref = tag_ptr(first_hops_conv_16_var.inner, first_hops_conv_16_var.is_owned);
10478                 first_hops_arr_ptr[q] = first_hops_conv_16_ref;
10479         }
10480         (*env)->ReleasePrimitiveArrayCritical(env, first_hops_arr, first_hops_arr_ptr, 0);
10481         FREE(first_hops_var.data);
10482         LDKReceiveTlvs tlvs_var = tlvs;
10483         int64_t tlvs_ref = 0;
10484         CHECK_INNER_FIELD_ACCESS_OR_NULL(tlvs_var);
10485         tlvs_ref = tag_ptr(tlvs_var.inner, tlvs_var.is_owned);
10486         int64_t amount_msats_conv = amount_msats;
10487         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
10488         CHECK(obj != NULL);
10489         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->create_blinded_payment_paths_meth, recipient_arr, first_hops_arr, tlvs_ref, amount_msats_conv);
10490         if (UNLIKELY((*env)->ExceptionCheck(env))) {
10491                 (*env)->ExceptionDescribe(env);
10492                 (*env)->FatalError(env, "A call to create_blinded_payment_paths in LDKRouter from rust threw an exception.");
10493         }
10494         void* ret_ptr = untag_ptr(ret);
10495         CHECK_ACCESS(ret_ptr);
10496         LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ ret_conv = *(LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ*)(ret_ptr);
10497         FREE(untag_ptr(ret));
10498         if (get_jenv_res == JNI_EDETACHED) {
10499                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
10500         }
10501         return ret_conv;
10502 }
10503 static void LDKRouter_JCalls_cloned(LDKRouter* new_obj) {
10504         LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) new_obj->this_arg;
10505         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
10506         atomic_fetch_add_explicit(&j_calls->MessageRouter->refcnt, 1, memory_order_release);
10507 }
10508 static inline LDKRouter LDKRouter_init (JNIEnv *env, jclass clz, jobject o, jobject MessageRouter) {
10509         jclass c = (*env)->GetObjectClass(env, o);
10510         CHECK(c != NULL);
10511         LDKRouter_JCalls *calls = MALLOC(sizeof(LDKRouter_JCalls), "LDKRouter_JCalls");
10512         atomic_init(&calls->refcnt, 1);
10513         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
10514         calls->o = (*env)->NewWeakGlobalRef(env, o);
10515         calls->find_route_meth = (*env)->GetMethodID(env, c, "find_route", "([BJ[JJ)J");
10516         CHECK(calls->find_route_meth != NULL);
10517         calls->find_route_with_id_meth = (*env)->GetMethodID(env, c, "find_route_with_id", "([BJ[JJ[B[B)J");
10518         CHECK(calls->find_route_with_id_meth != NULL);
10519         calls->create_blinded_payment_paths_meth = (*env)->GetMethodID(env, c, "create_blinded_payment_paths", "([B[JJJ)J");
10520         CHECK(calls->create_blinded_payment_paths_meth != NULL);
10521
10522         LDKRouter ret = {
10523                 .this_arg = (void*) calls,
10524                 .find_route = find_route_LDKRouter_jcall,
10525                 .find_route_with_id = find_route_with_id_LDKRouter_jcall,
10526                 .create_blinded_payment_paths = create_blinded_payment_paths_LDKRouter_jcall,
10527                 .free = LDKRouter_JCalls_free,
10528                 .MessageRouter = LDKMessageRouter_init(env, clz, MessageRouter),
10529         };
10530         calls->MessageRouter = ret.MessageRouter.this_arg;
10531         return ret;
10532 }
10533 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKRouter_1new(JNIEnv *env, jclass clz, jobject o, jobject MessageRouter) {
10534         LDKRouter *res_ptr = MALLOC(sizeof(LDKRouter), "LDKRouter");
10535         *res_ptr = LDKRouter_init(env, clz, o, MessageRouter);
10536         return tag_ptr(res_ptr, true);
10537 }
10538 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKRouter_1get_1MessageRouter(JNIEnv *env, jclass clz, int64_t arg) {
10539         LDKRouter *inp = (LDKRouter *)untag_ptr(arg);
10540         return tag_ptr(&inp->MessageRouter, false);
10541 }
10542 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) {
10543         void* this_arg_ptr = untag_ptr(this_arg);
10544         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10545         LDKRouter* this_arg_conv = (LDKRouter*)this_arg_ptr;
10546         LDKPublicKey payer_ref;
10547         CHECK((*env)->GetArrayLength(env, payer) == 33);
10548         (*env)->GetByteArrayRegion(env, payer, 0, 33, payer_ref.compressed_form);
10549         LDKRouteParameters route_params_conv;
10550         route_params_conv.inner = untag_ptr(route_params);
10551         route_params_conv.is_owned = ptr_is_owned(route_params);
10552         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
10553         route_params_conv.is_owned = false;
10554         LDKCVec_ChannelDetailsZ first_hops_constr;
10555         LDKCVec_ChannelDetailsZ *first_hops_ptr = NULL;
10556         if (first_hops != NULL) {
10557                 first_hops_constr.datalen = (*env)->GetArrayLength(env, first_hops);
10558                 if (first_hops_constr.datalen > 0)
10559                         first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
10560                 else
10561                         first_hops_constr.data = NULL;
10562                 int64_t* first_hops_vals = (*env)->GetLongArrayElements (env, first_hops, NULL);
10563                 for (size_t q = 0; q < first_hops_constr.datalen; q++) {
10564                         int64_t first_hops_conv_16 = first_hops_vals[q];
10565                         LDKChannelDetails first_hops_conv_16_conv;
10566                         first_hops_conv_16_conv.inner = untag_ptr(first_hops_conv_16);
10567                         first_hops_conv_16_conv.is_owned = ptr_is_owned(first_hops_conv_16);
10568                         CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_conv);
10569                         first_hops_conv_16_conv.is_owned = false;
10570                         first_hops_constr.data[q] = first_hops_conv_16_conv;
10571                 }
10572                 (*env)->ReleaseLongArrayElements(env, first_hops, first_hops_vals, 0);
10573                 first_hops_ptr = &first_hops_constr;
10574         }
10575         LDKInFlightHtlcs inflight_htlcs_conv;
10576         inflight_htlcs_conv.inner = untag_ptr(inflight_htlcs);
10577         inflight_htlcs_conv.is_owned = ptr_is_owned(inflight_htlcs);
10578         CHECK_INNER_FIELD_ACCESS_OR_NULL(inflight_htlcs_conv);
10579         inflight_htlcs_conv = InFlightHtlcs_clone(&inflight_htlcs_conv);
10580         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
10581         *ret_conv = (this_arg_conv->find_route)(this_arg_conv->this_arg, payer_ref, &route_params_conv, first_hops_ptr, inflight_htlcs_conv);
10582         if (first_hops_ptr != NULL) { FREE(first_hops_constr.data); }
10583         return tag_ptr(ret_conv, true);
10584 }
10585
10586 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) {
10587         void* this_arg_ptr = untag_ptr(this_arg);
10588         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10589         LDKRouter* this_arg_conv = (LDKRouter*)this_arg_ptr;
10590         LDKPublicKey payer_ref;
10591         CHECK((*env)->GetArrayLength(env, payer) == 33);
10592         (*env)->GetByteArrayRegion(env, payer, 0, 33, payer_ref.compressed_form);
10593         LDKRouteParameters route_params_conv;
10594         route_params_conv.inner = untag_ptr(route_params);
10595         route_params_conv.is_owned = ptr_is_owned(route_params);
10596         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
10597         route_params_conv.is_owned = false;
10598         LDKCVec_ChannelDetailsZ first_hops_constr;
10599         LDKCVec_ChannelDetailsZ *first_hops_ptr = NULL;
10600         if (first_hops != NULL) {
10601                 first_hops_constr.datalen = (*env)->GetArrayLength(env, first_hops);
10602                 if (first_hops_constr.datalen > 0)
10603                         first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
10604                 else
10605                         first_hops_constr.data = NULL;
10606                 int64_t* first_hops_vals = (*env)->GetLongArrayElements (env, first_hops, NULL);
10607                 for (size_t q = 0; q < first_hops_constr.datalen; q++) {
10608                         int64_t first_hops_conv_16 = first_hops_vals[q];
10609                         LDKChannelDetails first_hops_conv_16_conv;
10610                         first_hops_conv_16_conv.inner = untag_ptr(first_hops_conv_16);
10611                         first_hops_conv_16_conv.is_owned = ptr_is_owned(first_hops_conv_16);
10612                         CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_conv);
10613                         first_hops_conv_16_conv.is_owned = false;
10614                         first_hops_constr.data[q] = first_hops_conv_16_conv;
10615                 }
10616                 (*env)->ReleaseLongArrayElements(env, first_hops, first_hops_vals, 0);
10617                 first_hops_ptr = &first_hops_constr;
10618         }
10619         LDKInFlightHtlcs inflight_htlcs_conv;
10620         inflight_htlcs_conv.inner = untag_ptr(inflight_htlcs);
10621         inflight_htlcs_conv.is_owned = ptr_is_owned(inflight_htlcs);
10622         CHECK_INNER_FIELD_ACCESS_OR_NULL(inflight_htlcs_conv);
10623         inflight_htlcs_conv = InFlightHtlcs_clone(&inflight_htlcs_conv);
10624         LDKThirtyTwoBytes _payment_hash_ref;
10625         CHECK((*env)->GetArrayLength(env, _payment_hash) == 32);
10626         (*env)->GetByteArrayRegion(env, _payment_hash, 0, 32, _payment_hash_ref.data);
10627         LDKThirtyTwoBytes _payment_id_ref;
10628         CHECK((*env)->GetArrayLength(env, _payment_id) == 32);
10629         (*env)->GetByteArrayRegion(env, _payment_id, 0, 32, _payment_id_ref.data);
10630         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
10631         *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);
10632         if (first_hops_ptr != NULL) { FREE(first_hops_constr.data); }
10633         return tag_ptr(ret_conv, true);
10634 }
10635
10636 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) {
10637         void* this_arg_ptr = untag_ptr(this_arg);
10638         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
10639         LDKRouter* this_arg_conv = (LDKRouter*)this_arg_ptr;
10640         LDKPublicKey recipient_ref;
10641         CHECK((*env)->GetArrayLength(env, recipient) == 33);
10642         (*env)->GetByteArrayRegion(env, recipient, 0, 33, recipient_ref.compressed_form);
10643         LDKCVec_ChannelDetailsZ first_hops_constr;
10644         first_hops_constr.datalen = (*env)->GetArrayLength(env, first_hops);
10645         if (first_hops_constr.datalen > 0)
10646                 first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
10647         else
10648                 first_hops_constr.data = NULL;
10649         int64_t* first_hops_vals = (*env)->GetLongArrayElements (env, first_hops, NULL);
10650         for (size_t q = 0; q < first_hops_constr.datalen; q++) {
10651                 int64_t first_hops_conv_16 = first_hops_vals[q];
10652                 LDKChannelDetails first_hops_conv_16_conv;
10653                 first_hops_conv_16_conv.inner = untag_ptr(first_hops_conv_16);
10654                 first_hops_conv_16_conv.is_owned = ptr_is_owned(first_hops_conv_16);
10655                 CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_conv);
10656                 first_hops_conv_16_conv = ChannelDetails_clone(&first_hops_conv_16_conv);
10657                 first_hops_constr.data[q] = first_hops_conv_16_conv;
10658         }
10659         (*env)->ReleaseLongArrayElements(env, first_hops, first_hops_vals, 0);
10660         LDKReceiveTlvs tlvs_conv;
10661         tlvs_conv.inner = untag_ptr(tlvs);
10662         tlvs_conv.is_owned = ptr_is_owned(tlvs);
10663         CHECK_INNER_FIELD_ACCESS_OR_NULL(tlvs_conv);
10664         tlvs_conv = ReceiveTlvs_clone(&tlvs_conv);
10665         LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ), "LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ");
10666         *ret_conv = (this_arg_conv->create_blinded_payment_paths)(this_arg_conv->this_arg, recipient_ref, first_hops_constr, tlvs_conv, amount_msats);
10667         return tag_ptr(ret_conv, true);
10668 }
10669
10670 static inline struct LDKThirtyTwoBytes C2Tuple_ThirtyTwoBytesChannelManagerZ_get_a(LDKC2Tuple_ThirtyTwoBytesChannelManagerZ *NONNULL_PTR owner){
10671         return ThirtyTwoBytes_clone(&owner->a);
10672 }
10673 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesChannelManagerZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
10674         LDKC2Tuple_ThirtyTwoBytesChannelManagerZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesChannelManagerZ*)untag_ptr(owner);
10675         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
10676         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C2Tuple_ThirtyTwoBytesChannelManagerZ_get_a(owner_conv).data);
10677         return ret_arr;
10678 }
10679
10680 static inline struct LDKChannelManager C2Tuple_ThirtyTwoBytesChannelManagerZ_get_b(LDKC2Tuple_ThirtyTwoBytesChannelManagerZ *NONNULL_PTR owner){
10681         LDKChannelManager ret = owner->b;
10682         ret.is_owned = false;
10683         return ret;
10684 }
10685 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesChannelManagerZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
10686         LDKC2Tuple_ThirtyTwoBytesChannelManagerZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesChannelManagerZ*)untag_ptr(owner);
10687         LDKChannelManager ret_var = C2Tuple_ThirtyTwoBytesChannelManagerZ_get_b(owner_conv);
10688         int64_t ret_ref = 0;
10689         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10690         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10691         return ret_ref;
10692 }
10693
10694 static inline struct LDKC2Tuple_ThirtyTwoBytesChannelManagerZ *CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_get_ok(LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ *NONNULL_PTR owner){
10695 CHECK(owner->result_ok);
10696         return &*owner->contents.result;
10697 }
10698 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesChannelManagerZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10699         LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ*)untag_ptr(owner);
10700         int64_t ret_ret = tag_ptr(CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_get_ok(owner_conv), false);
10701         return ret_ret;
10702 }
10703
10704 static inline struct LDKDecodeError CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_get_err(LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ *NONNULL_PTR owner){
10705 CHECK(!owner->result_ok);
10706         return DecodeError_clone(&*owner->contents.err);
10707 }
10708 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesChannelManagerZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10709         LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ*)untag_ptr(owner);
10710         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10711         *ret_copy = CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_get_err(owner_conv);
10712         int64_t ret_ref = tag_ptr(ret_copy, true);
10713         return ret_ref;
10714 }
10715
10716 static jclass LDKMaxDustHTLCExposure_FixedLimitMsat_class = NULL;
10717 static jmethodID LDKMaxDustHTLCExposure_FixedLimitMsat_meth = NULL;
10718 static jclass LDKMaxDustHTLCExposure_FeeRateMultiplier_class = NULL;
10719 static jmethodID LDKMaxDustHTLCExposure_FeeRateMultiplier_meth = NULL;
10720 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKMaxDustHTLCExposure_init (JNIEnv *env, jclass clz) {
10721         LDKMaxDustHTLCExposure_FixedLimitMsat_class =
10722                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMaxDustHTLCExposure$FixedLimitMsat"));
10723         CHECK(LDKMaxDustHTLCExposure_FixedLimitMsat_class != NULL);
10724         LDKMaxDustHTLCExposure_FixedLimitMsat_meth = (*env)->GetMethodID(env, LDKMaxDustHTLCExposure_FixedLimitMsat_class, "<init>", "(J)V");
10725         CHECK(LDKMaxDustHTLCExposure_FixedLimitMsat_meth != NULL);
10726         LDKMaxDustHTLCExposure_FeeRateMultiplier_class =
10727                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMaxDustHTLCExposure$FeeRateMultiplier"));
10728         CHECK(LDKMaxDustHTLCExposure_FeeRateMultiplier_class != NULL);
10729         LDKMaxDustHTLCExposure_FeeRateMultiplier_meth = (*env)->GetMethodID(env, LDKMaxDustHTLCExposure_FeeRateMultiplier_class, "<init>", "(J)V");
10730         CHECK(LDKMaxDustHTLCExposure_FeeRateMultiplier_meth != NULL);
10731 }
10732 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKMaxDustHTLCExposure_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
10733         LDKMaxDustHTLCExposure *obj = (LDKMaxDustHTLCExposure*)untag_ptr(ptr);
10734         switch(obj->tag) {
10735                 case LDKMaxDustHTLCExposure_FixedLimitMsat: {
10736                         int64_t fixed_limit_msat_conv = obj->fixed_limit_msat;
10737                         return (*env)->NewObject(env, LDKMaxDustHTLCExposure_FixedLimitMsat_class, LDKMaxDustHTLCExposure_FixedLimitMsat_meth, fixed_limit_msat_conv);
10738                 }
10739                 case LDKMaxDustHTLCExposure_FeeRateMultiplier: {
10740                         int64_t fee_rate_multiplier_conv = obj->fee_rate_multiplier;
10741                         return (*env)->NewObject(env, LDKMaxDustHTLCExposure_FeeRateMultiplier_class, LDKMaxDustHTLCExposure_FeeRateMultiplier_meth, fee_rate_multiplier_conv);
10742                 }
10743                 default: abort();
10744         }
10745 }
10746 static inline struct LDKMaxDustHTLCExposure CResult_MaxDustHTLCExposureDecodeErrorZ_get_ok(LDKCResult_MaxDustHTLCExposureDecodeErrorZ *NONNULL_PTR owner){
10747 CHECK(owner->result_ok);
10748         return MaxDustHTLCExposure_clone(&*owner->contents.result);
10749 }
10750 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1MaxDustHTLCExposureDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10751         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* owner_conv = (LDKCResult_MaxDustHTLCExposureDecodeErrorZ*)untag_ptr(owner);
10752         LDKMaxDustHTLCExposure *ret_copy = MALLOC(sizeof(LDKMaxDustHTLCExposure), "LDKMaxDustHTLCExposure");
10753         *ret_copy = CResult_MaxDustHTLCExposureDecodeErrorZ_get_ok(owner_conv);
10754         int64_t ret_ref = tag_ptr(ret_copy, true);
10755         return ret_ref;
10756 }
10757
10758 static inline struct LDKDecodeError CResult_MaxDustHTLCExposureDecodeErrorZ_get_err(LDKCResult_MaxDustHTLCExposureDecodeErrorZ *NONNULL_PTR owner){
10759 CHECK(!owner->result_ok);
10760         return DecodeError_clone(&*owner->contents.err);
10761 }
10762 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1MaxDustHTLCExposureDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10763         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* owner_conv = (LDKCResult_MaxDustHTLCExposureDecodeErrorZ*)untag_ptr(owner);
10764         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10765         *ret_copy = CResult_MaxDustHTLCExposureDecodeErrorZ_get_err(owner_conv);
10766         int64_t ret_ref = tag_ptr(ret_copy, true);
10767         return ret_ref;
10768 }
10769
10770 static inline struct LDKChannelConfig CResult_ChannelConfigDecodeErrorZ_get_ok(LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR owner){
10771         LDKChannelConfig ret = *owner->contents.result;
10772         ret.is_owned = false;
10773         return ret;
10774 }
10775 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10776         LDKCResult_ChannelConfigDecodeErrorZ* owner_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)untag_ptr(owner);
10777         LDKChannelConfig ret_var = CResult_ChannelConfigDecodeErrorZ_get_ok(owner_conv);
10778         int64_t ret_ref = 0;
10779         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10780         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10781         return ret_ref;
10782 }
10783
10784 static inline struct LDKDecodeError CResult_ChannelConfigDecodeErrorZ_get_err(LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR owner){
10785 CHECK(!owner->result_ok);
10786         return DecodeError_clone(&*owner->contents.err);
10787 }
10788 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10789         LDKCResult_ChannelConfigDecodeErrorZ* owner_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)untag_ptr(owner);
10790         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10791         *ret_copy = CResult_ChannelConfigDecodeErrorZ_get_err(owner_conv);
10792         int64_t ret_ref = tag_ptr(ret_copy, true);
10793         return ret_ref;
10794 }
10795
10796 static jclass LDKCOption_MaxDustHTLCExposureZ_Some_class = NULL;
10797 static jmethodID LDKCOption_MaxDustHTLCExposureZ_Some_meth = NULL;
10798 static jclass LDKCOption_MaxDustHTLCExposureZ_None_class = NULL;
10799 static jmethodID LDKCOption_MaxDustHTLCExposureZ_None_meth = NULL;
10800 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1MaxDustHTLCExposureZ_init (JNIEnv *env, jclass clz) {
10801         LDKCOption_MaxDustHTLCExposureZ_Some_class =
10802                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_MaxDustHTLCExposureZ$Some"));
10803         CHECK(LDKCOption_MaxDustHTLCExposureZ_Some_class != NULL);
10804         LDKCOption_MaxDustHTLCExposureZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_MaxDustHTLCExposureZ_Some_class, "<init>", "(J)V");
10805         CHECK(LDKCOption_MaxDustHTLCExposureZ_Some_meth != NULL);
10806         LDKCOption_MaxDustHTLCExposureZ_None_class =
10807                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_MaxDustHTLCExposureZ$None"));
10808         CHECK(LDKCOption_MaxDustHTLCExposureZ_None_class != NULL);
10809         LDKCOption_MaxDustHTLCExposureZ_None_meth = (*env)->GetMethodID(env, LDKCOption_MaxDustHTLCExposureZ_None_class, "<init>", "()V");
10810         CHECK(LDKCOption_MaxDustHTLCExposureZ_None_meth != NULL);
10811 }
10812 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1MaxDustHTLCExposureZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
10813         LDKCOption_MaxDustHTLCExposureZ *obj = (LDKCOption_MaxDustHTLCExposureZ*)untag_ptr(ptr);
10814         switch(obj->tag) {
10815                 case LDKCOption_MaxDustHTLCExposureZ_Some: {
10816                         int64_t some_ref = tag_ptr(&obj->some, false);
10817                         return (*env)->NewObject(env, LDKCOption_MaxDustHTLCExposureZ_Some_class, LDKCOption_MaxDustHTLCExposureZ_Some_meth, some_ref);
10818                 }
10819                 case LDKCOption_MaxDustHTLCExposureZ_None: {
10820                         return (*env)->NewObject(env, LDKCOption_MaxDustHTLCExposureZ_None_class, LDKCOption_MaxDustHTLCExposureZ_None_meth);
10821                 }
10822                 default: abort();
10823         }
10824 }
10825 static jclass LDKCOption_APIErrorZ_Some_class = NULL;
10826 static jmethodID LDKCOption_APIErrorZ_Some_meth = NULL;
10827 static jclass LDKCOption_APIErrorZ_None_class = NULL;
10828 static jmethodID LDKCOption_APIErrorZ_None_meth = NULL;
10829 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1APIErrorZ_init (JNIEnv *env, jclass clz) {
10830         LDKCOption_APIErrorZ_Some_class =
10831                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_APIErrorZ$Some"));
10832         CHECK(LDKCOption_APIErrorZ_Some_class != NULL);
10833         LDKCOption_APIErrorZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_APIErrorZ_Some_class, "<init>", "(J)V");
10834         CHECK(LDKCOption_APIErrorZ_Some_meth != NULL);
10835         LDKCOption_APIErrorZ_None_class =
10836                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_APIErrorZ$None"));
10837         CHECK(LDKCOption_APIErrorZ_None_class != NULL);
10838         LDKCOption_APIErrorZ_None_meth = (*env)->GetMethodID(env, LDKCOption_APIErrorZ_None_class, "<init>", "()V");
10839         CHECK(LDKCOption_APIErrorZ_None_meth != NULL);
10840 }
10841 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1APIErrorZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
10842         LDKCOption_APIErrorZ *obj = (LDKCOption_APIErrorZ*)untag_ptr(ptr);
10843         switch(obj->tag) {
10844                 case LDKCOption_APIErrorZ_Some: {
10845                         int64_t some_ref = tag_ptr(&obj->some, false);
10846                         return (*env)->NewObject(env, LDKCOption_APIErrorZ_Some_class, LDKCOption_APIErrorZ_Some_meth, some_ref);
10847                 }
10848                 case LDKCOption_APIErrorZ_None: {
10849                         return (*env)->NewObject(env, LDKCOption_APIErrorZ_None_class, LDKCOption_APIErrorZ_None_meth);
10850                 }
10851                 default: abort();
10852         }
10853 }
10854 static inline struct LDKCOption_APIErrorZ CResult_COption_APIErrorZDecodeErrorZ_get_ok(LDKCResult_COption_APIErrorZDecodeErrorZ *NONNULL_PTR owner){
10855 CHECK(owner->result_ok);
10856         return COption_APIErrorZ_clone(&*owner->contents.result);
10857 }
10858 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1APIErrorZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10859         LDKCResult_COption_APIErrorZDecodeErrorZ* owner_conv = (LDKCResult_COption_APIErrorZDecodeErrorZ*)untag_ptr(owner);
10860         LDKCOption_APIErrorZ *ret_copy = MALLOC(sizeof(LDKCOption_APIErrorZ), "LDKCOption_APIErrorZ");
10861         *ret_copy = CResult_COption_APIErrorZDecodeErrorZ_get_ok(owner_conv);
10862         int64_t ret_ref = tag_ptr(ret_copy, true);
10863         return ret_ref;
10864 }
10865
10866 static inline struct LDKDecodeError CResult_COption_APIErrorZDecodeErrorZ_get_err(LDKCResult_COption_APIErrorZDecodeErrorZ *NONNULL_PTR owner){
10867 CHECK(!owner->result_ok);
10868         return DecodeError_clone(&*owner->contents.err);
10869 }
10870 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1APIErrorZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10871         LDKCResult_COption_APIErrorZDecodeErrorZ* owner_conv = (LDKCResult_COption_APIErrorZDecodeErrorZ*)untag_ptr(owner);
10872         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10873         *ret_copy = CResult_COption_APIErrorZDecodeErrorZ_get_err(owner_conv);
10874         int64_t ret_ref = tag_ptr(ret_copy, true);
10875         return ret_ref;
10876 }
10877
10878 static inline struct LDKChannelMonitorUpdate CResult_ChannelMonitorUpdateDecodeErrorZ_get_ok(LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR owner){
10879         LDKChannelMonitorUpdate ret = *owner->contents.result;
10880         ret.is_owned = false;
10881         return ret;
10882 }
10883 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10884         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* owner_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)untag_ptr(owner);
10885         LDKChannelMonitorUpdate ret_var = CResult_ChannelMonitorUpdateDecodeErrorZ_get_ok(owner_conv);
10886         int64_t ret_ref = 0;
10887         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10888         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10889         return ret_ref;
10890 }
10891
10892 static inline struct LDKDecodeError CResult_ChannelMonitorUpdateDecodeErrorZ_get_err(LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR owner){
10893 CHECK(!owner->result_ok);
10894         return DecodeError_clone(&*owner->contents.err);
10895 }
10896 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10897         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* owner_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)untag_ptr(owner);
10898         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10899         *ret_copy = CResult_ChannelMonitorUpdateDecodeErrorZ_get_err(owner_conv);
10900         int64_t ret_ref = tag_ptr(ret_copy, true);
10901         return ret_ref;
10902 }
10903
10904 static jclass LDKCOption_MonitorEventZ_Some_class = NULL;
10905 static jmethodID LDKCOption_MonitorEventZ_Some_meth = NULL;
10906 static jclass LDKCOption_MonitorEventZ_None_class = NULL;
10907 static jmethodID LDKCOption_MonitorEventZ_None_meth = NULL;
10908 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1MonitorEventZ_init (JNIEnv *env, jclass clz) {
10909         LDKCOption_MonitorEventZ_Some_class =
10910                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_MonitorEventZ$Some"));
10911         CHECK(LDKCOption_MonitorEventZ_Some_class != NULL);
10912         LDKCOption_MonitorEventZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_MonitorEventZ_Some_class, "<init>", "(J)V");
10913         CHECK(LDKCOption_MonitorEventZ_Some_meth != NULL);
10914         LDKCOption_MonitorEventZ_None_class =
10915                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_MonitorEventZ$None"));
10916         CHECK(LDKCOption_MonitorEventZ_None_class != NULL);
10917         LDKCOption_MonitorEventZ_None_meth = (*env)->GetMethodID(env, LDKCOption_MonitorEventZ_None_class, "<init>", "()V");
10918         CHECK(LDKCOption_MonitorEventZ_None_meth != NULL);
10919 }
10920 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1MonitorEventZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
10921         LDKCOption_MonitorEventZ *obj = (LDKCOption_MonitorEventZ*)untag_ptr(ptr);
10922         switch(obj->tag) {
10923                 case LDKCOption_MonitorEventZ_Some: {
10924                         int64_t some_ref = tag_ptr(&obj->some, false);
10925                         return (*env)->NewObject(env, LDKCOption_MonitorEventZ_Some_class, LDKCOption_MonitorEventZ_Some_meth, some_ref);
10926                 }
10927                 case LDKCOption_MonitorEventZ_None: {
10928                         return (*env)->NewObject(env, LDKCOption_MonitorEventZ_None_class, LDKCOption_MonitorEventZ_None_meth);
10929                 }
10930                 default: abort();
10931         }
10932 }
10933 static inline struct LDKCOption_MonitorEventZ CResult_COption_MonitorEventZDecodeErrorZ_get_ok(LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR owner){
10934 CHECK(owner->result_ok);
10935         return COption_MonitorEventZ_clone(&*owner->contents.result);
10936 }
10937 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1MonitorEventZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10938         LDKCResult_COption_MonitorEventZDecodeErrorZ* owner_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)untag_ptr(owner);
10939         LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
10940         *ret_copy = CResult_COption_MonitorEventZDecodeErrorZ_get_ok(owner_conv);
10941         int64_t ret_ref = tag_ptr(ret_copy, true);
10942         return ret_ref;
10943 }
10944
10945 static inline struct LDKDecodeError CResult_COption_MonitorEventZDecodeErrorZ_get_err(LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR owner){
10946 CHECK(!owner->result_ok);
10947         return DecodeError_clone(&*owner->contents.err);
10948 }
10949 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1MonitorEventZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10950         LDKCResult_COption_MonitorEventZDecodeErrorZ* owner_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)untag_ptr(owner);
10951         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10952         *ret_copy = CResult_COption_MonitorEventZDecodeErrorZ_get_err(owner_conv);
10953         int64_t ret_ref = tag_ptr(ret_copy, true);
10954         return ret_ref;
10955 }
10956
10957 static inline struct LDKHTLCUpdate CResult_HTLCUpdateDecodeErrorZ_get_ok(LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR owner){
10958         LDKHTLCUpdate ret = *owner->contents.result;
10959         ret.is_owned = false;
10960         return ret;
10961 }
10962 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
10963         LDKCResult_HTLCUpdateDecodeErrorZ* owner_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)untag_ptr(owner);
10964         LDKHTLCUpdate ret_var = CResult_HTLCUpdateDecodeErrorZ_get_ok(owner_conv);
10965         int64_t ret_ref = 0;
10966         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10967         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10968         return ret_ref;
10969 }
10970
10971 static inline struct LDKDecodeError CResult_HTLCUpdateDecodeErrorZ_get_err(LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR owner){
10972 CHECK(!owner->result_ok);
10973         return DecodeError_clone(&*owner->contents.err);
10974 }
10975 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
10976         LDKCResult_HTLCUpdateDecodeErrorZ* owner_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)untag_ptr(owner);
10977         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
10978         *ret_copy = CResult_HTLCUpdateDecodeErrorZ_get_err(owner_conv);
10979         int64_t ret_ref = tag_ptr(ret_copy, true);
10980         return ret_ref;
10981 }
10982
10983 static inline struct LDKOutPoint C2Tuple_OutPointCVec_u8ZZ_get_a(LDKC2Tuple_OutPointCVec_u8ZZ *NONNULL_PTR owner){
10984         LDKOutPoint ret = owner->a;
10985         ret.is_owned = false;
10986         return ret;
10987 }
10988 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointCVec_1u8ZZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
10989         LDKC2Tuple_OutPointCVec_u8ZZ* owner_conv = (LDKC2Tuple_OutPointCVec_u8ZZ*)untag_ptr(owner);
10990         LDKOutPoint ret_var = C2Tuple_OutPointCVec_u8ZZ_get_a(owner_conv);
10991         int64_t ret_ref = 0;
10992         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
10993         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
10994         return ret_ref;
10995 }
10996
10997 static inline struct LDKCVec_u8Z C2Tuple_OutPointCVec_u8ZZ_get_b(LDKC2Tuple_OutPointCVec_u8ZZ *NONNULL_PTR owner){
10998         return CVec_u8Z_clone(&owner->b);
10999 }
11000 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointCVec_1u8ZZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
11001         LDKC2Tuple_OutPointCVec_u8ZZ* owner_conv = (LDKC2Tuple_OutPointCVec_u8ZZ*)untag_ptr(owner);
11002         LDKCVec_u8Z ret_var = C2Tuple_OutPointCVec_u8ZZ_get_b(owner_conv);
11003         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
11004         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
11005         CVec_u8Z_free(ret_var);
11006         return ret_arr;
11007 }
11008
11009 static inline uint32_t C2Tuple_u32CVec_u8ZZ_get_a(LDKC2Tuple_u32CVec_u8ZZ *NONNULL_PTR owner){
11010         return owner->a;
11011 }
11012 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32CVec_1u8ZZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
11013         LDKC2Tuple_u32CVec_u8ZZ* owner_conv = (LDKC2Tuple_u32CVec_u8ZZ*)untag_ptr(owner);
11014         int32_t ret_conv = C2Tuple_u32CVec_u8ZZ_get_a(owner_conv);
11015         return ret_conv;
11016 }
11017
11018 static inline struct LDKCVec_u8Z C2Tuple_u32CVec_u8ZZ_get_b(LDKC2Tuple_u32CVec_u8ZZ *NONNULL_PTR owner){
11019         return CVec_u8Z_clone(&owner->b);
11020 }
11021 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32CVec_1u8ZZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
11022         LDKC2Tuple_u32CVec_u8ZZ* owner_conv = (LDKC2Tuple_u32CVec_u8ZZ*)untag_ptr(owner);
11023         LDKCVec_u8Z ret_var = C2Tuple_u32CVec_u8ZZ_get_b(owner_conv);
11024         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
11025         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
11026         CVec_u8Z_free(ret_var);
11027         return ret_arr;
11028 }
11029
11030 static inline LDKCVec_C2Tuple_u32CVec_u8ZZZ CVec_C2Tuple_u32CVec_u8ZZZ_clone(const LDKCVec_C2Tuple_u32CVec_u8ZZZ *orig) {
11031         LDKCVec_C2Tuple_u32CVec_u8ZZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_u32CVec_u8ZZ) * orig->datalen, "LDKCVec_C2Tuple_u32CVec_u8ZZZ clone bytes"), .datalen = orig->datalen };
11032         for (size_t i = 0; i < ret.datalen; i++) {
11033                 ret.data[i] = C2Tuple_u32CVec_u8ZZ_clone(&orig->data[i]);
11034         }
11035         return ret;
11036 }
11037 static inline struct LDKThirtyTwoBytes C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_get_a(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ *NONNULL_PTR owner){
11038         return ThirtyTwoBytes_clone(&owner->a);
11039 }
11040 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesCVec_1C2Tuple_1u32CVec_1u8ZZZZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
11041         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ*)untag_ptr(owner);
11042         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
11043         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_get_a(owner_conv).data);
11044         return ret_arr;
11045 }
11046
11047 static inline struct LDKCVec_C2Tuple_u32CVec_u8ZZZ C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_get_b(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ *NONNULL_PTR owner){
11048         return CVec_C2Tuple_u32CVec_u8ZZZ_clone(&owner->b);
11049 }
11050 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesCVec_1C2Tuple_1u32CVec_1u8ZZZZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
11051         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ*)untag_ptr(owner);
11052         LDKCVec_C2Tuple_u32CVec_u8ZZZ ret_var = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_get_b(owner_conv);
11053         int64_tArray ret_arr = NULL;
11054         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
11055         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
11056         for (size_t x = 0; x < ret_var.datalen; x++) {
11057                 LDKC2Tuple_u32CVec_u8ZZ* ret_conv_23_conv = MALLOC(sizeof(LDKC2Tuple_u32CVec_u8ZZ), "LDKC2Tuple_u32CVec_u8ZZ");
11058                 *ret_conv_23_conv = ret_var.data[x];
11059                 ret_arr_ptr[x] = tag_ptr(ret_conv_23_conv, true);
11060         }
11061         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
11062         FREE(ret_var.data);
11063         return ret_arr;
11064 }
11065
11066 static inline LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ_clone(const LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ *orig) {
11067         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 };
11068         for (size_t i = 0; i < ret.datalen; i++) {
11069                 ret.data[i] = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_clone(&orig->data[i]);
11070         }
11071         return ret;
11072 }
11073 static inline LDKCVec_CommitmentTransactionZ CVec_CommitmentTransactionZ_clone(const LDKCVec_CommitmentTransactionZ *orig) {
11074         LDKCVec_CommitmentTransactionZ ret = { .data = MALLOC(sizeof(LDKCommitmentTransaction) * orig->datalen, "LDKCVec_CommitmentTransactionZ clone bytes"), .datalen = orig->datalen };
11075         for (size_t i = 0; i < ret.datalen; i++) {
11076                 ret.data[i] = CommitmentTransaction_clone(&orig->data[i]);
11077         }
11078         return ret;
11079 }
11080 static inline uint32_t C2Tuple_u32TxOutZ_get_a(LDKC2Tuple_u32TxOutZ *NONNULL_PTR owner){
11081         return owner->a;
11082 }
11083 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32TxOutZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
11084         LDKC2Tuple_u32TxOutZ* owner_conv = (LDKC2Tuple_u32TxOutZ*)untag_ptr(owner);
11085         int32_t ret_conv = C2Tuple_u32TxOutZ_get_a(owner_conv);
11086         return ret_conv;
11087 }
11088
11089 static inline struct LDKTxOut C2Tuple_u32TxOutZ_get_b(LDKC2Tuple_u32TxOutZ *NONNULL_PTR owner){
11090         return TxOut_clone(&owner->b);
11091 }
11092 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32TxOutZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
11093         LDKC2Tuple_u32TxOutZ* owner_conv = (LDKC2Tuple_u32TxOutZ*)untag_ptr(owner);
11094         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
11095         *ret_ref = C2Tuple_u32TxOutZ_get_b(owner_conv);
11096         return tag_ptr(ret_ref, true);
11097 }
11098
11099 static inline LDKCVec_C2Tuple_u32TxOutZZ CVec_C2Tuple_u32TxOutZZ_clone(const LDKCVec_C2Tuple_u32TxOutZZ *orig) {
11100         LDKCVec_C2Tuple_u32TxOutZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ) * orig->datalen, "LDKCVec_C2Tuple_u32TxOutZZ clone bytes"), .datalen = orig->datalen };
11101         for (size_t i = 0; i < ret.datalen; i++) {
11102                 ret.data[i] = C2Tuple_u32TxOutZ_clone(&orig->data[i]);
11103         }
11104         return ret;
11105 }
11106 static inline struct LDKThirtyTwoBytes C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_get_a(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR owner){
11107         return ThirtyTwoBytes_clone(&owner->a);
11108 }
11109 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesCVec_1C2Tuple_1u32TxOutZZZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
11110         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ*)untag_ptr(owner);
11111         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
11112         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_get_a(owner_conv).data);
11113         return ret_arr;
11114 }
11115
11116 static inline struct LDKCVec_C2Tuple_u32TxOutZZ C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_get_b(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR owner){
11117         return CVec_C2Tuple_u32TxOutZZ_clone(&owner->b);
11118 }
11119 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesCVec_1C2Tuple_1u32TxOutZZZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
11120         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ*)untag_ptr(owner);
11121         LDKCVec_C2Tuple_u32TxOutZZ ret_var = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_get_b(owner_conv);
11122         int64_tArray ret_arr = NULL;
11123         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
11124         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
11125         for (size_t u = 0; u < ret_var.datalen; u++) {
11126                 LDKC2Tuple_u32TxOutZ* ret_conv_20_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
11127                 *ret_conv_20_conv = ret_var.data[u];
11128                 ret_arr_ptr[u] = tag_ptr(ret_conv_20_conv, true);
11129         }
11130         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
11131         FREE(ret_var.data);
11132         return ret_arr;
11133 }
11134
11135 static inline LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZZ CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZZ_clone(const LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZZ *orig) {
11136         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 };
11137         for (size_t i = 0; i < ret.datalen; i++) {
11138                 ret.data[i] = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_clone(&orig->data[i]);
11139         }
11140         return ret;
11141 }
11142 static jclass LDKBalance_ClaimableOnChannelClose_class = NULL;
11143 static jmethodID LDKBalance_ClaimableOnChannelClose_meth = NULL;
11144 static jclass LDKBalance_ClaimableAwaitingConfirmations_class = NULL;
11145 static jmethodID LDKBalance_ClaimableAwaitingConfirmations_meth = NULL;
11146 static jclass LDKBalance_ContentiousClaimable_class = NULL;
11147 static jmethodID LDKBalance_ContentiousClaimable_meth = NULL;
11148 static jclass LDKBalance_MaybeTimeoutClaimableHTLC_class = NULL;
11149 static jmethodID LDKBalance_MaybeTimeoutClaimableHTLC_meth = NULL;
11150 static jclass LDKBalance_MaybePreimageClaimableHTLC_class = NULL;
11151 static jmethodID LDKBalance_MaybePreimageClaimableHTLC_meth = NULL;
11152 static jclass LDKBalance_CounterpartyRevokedOutputClaimable_class = NULL;
11153 static jmethodID LDKBalance_CounterpartyRevokedOutputClaimable_meth = NULL;
11154 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKBalance_init (JNIEnv *env, jclass clz) {
11155         LDKBalance_ClaimableOnChannelClose_class =
11156                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBalance$ClaimableOnChannelClose"));
11157         CHECK(LDKBalance_ClaimableOnChannelClose_class != NULL);
11158         LDKBalance_ClaimableOnChannelClose_meth = (*env)->GetMethodID(env, LDKBalance_ClaimableOnChannelClose_class, "<init>", "(J)V");
11159         CHECK(LDKBalance_ClaimableOnChannelClose_meth != NULL);
11160         LDKBalance_ClaimableAwaitingConfirmations_class =
11161                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBalance$ClaimableAwaitingConfirmations"));
11162         CHECK(LDKBalance_ClaimableAwaitingConfirmations_class != NULL);
11163         LDKBalance_ClaimableAwaitingConfirmations_meth = (*env)->GetMethodID(env, LDKBalance_ClaimableAwaitingConfirmations_class, "<init>", "(JI)V");
11164         CHECK(LDKBalance_ClaimableAwaitingConfirmations_meth != NULL);
11165         LDKBalance_ContentiousClaimable_class =
11166                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBalance$ContentiousClaimable"));
11167         CHECK(LDKBalance_ContentiousClaimable_class != NULL);
11168         LDKBalance_ContentiousClaimable_meth = (*env)->GetMethodID(env, LDKBalance_ContentiousClaimable_class, "<init>", "(JI[B[B)V");
11169         CHECK(LDKBalance_ContentiousClaimable_meth != NULL);
11170         LDKBalance_MaybeTimeoutClaimableHTLC_class =
11171                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBalance$MaybeTimeoutClaimableHTLC"));
11172         CHECK(LDKBalance_MaybeTimeoutClaimableHTLC_class != NULL);
11173         LDKBalance_MaybeTimeoutClaimableHTLC_meth = (*env)->GetMethodID(env, LDKBalance_MaybeTimeoutClaimableHTLC_class, "<init>", "(JI[B)V");
11174         CHECK(LDKBalance_MaybeTimeoutClaimableHTLC_meth != NULL);
11175         LDKBalance_MaybePreimageClaimableHTLC_class =
11176                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBalance$MaybePreimageClaimableHTLC"));
11177         CHECK(LDKBalance_MaybePreimageClaimableHTLC_class != NULL);
11178         LDKBalance_MaybePreimageClaimableHTLC_meth = (*env)->GetMethodID(env, LDKBalance_MaybePreimageClaimableHTLC_class, "<init>", "(JI[B)V");
11179         CHECK(LDKBalance_MaybePreimageClaimableHTLC_meth != NULL);
11180         LDKBalance_CounterpartyRevokedOutputClaimable_class =
11181                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBalance$CounterpartyRevokedOutputClaimable"));
11182         CHECK(LDKBalance_CounterpartyRevokedOutputClaimable_class != NULL);
11183         LDKBalance_CounterpartyRevokedOutputClaimable_meth = (*env)->GetMethodID(env, LDKBalance_CounterpartyRevokedOutputClaimable_class, "<init>", "(J)V");
11184         CHECK(LDKBalance_CounterpartyRevokedOutputClaimable_meth != NULL);
11185 }
11186 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKBalance_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
11187         LDKBalance *obj = (LDKBalance*)untag_ptr(ptr);
11188         switch(obj->tag) {
11189                 case LDKBalance_ClaimableOnChannelClose: {
11190                         int64_t amount_satoshis_conv = obj->claimable_on_channel_close.amount_satoshis;
11191                         return (*env)->NewObject(env, LDKBalance_ClaimableOnChannelClose_class, LDKBalance_ClaimableOnChannelClose_meth, amount_satoshis_conv);
11192                 }
11193                 case LDKBalance_ClaimableAwaitingConfirmations: {
11194                         int64_t amount_satoshis_conv = obj->claimable_awaiting_confirmations.amount_satoshis;
11195                         int32_t confirmation_height_conv = obj->claimable_awaiting_confirmations.confirmation_height;
11196                         return (*env)->NewObject(env, LDKBalance_ClaimableAwaitingConfirmations_class, LDKBalance_ClaimableAwaitingConfirmations_meth, amount_satoshis_conv, confirmation_height_conv);
11197                 }
11198                 case LDKBalance_ContentiousClaimable: {
11199                         int64_t amount_satoshis_conv = obj->contentious_claimable.amount_satoshis;
11200                         int32_t timeout_height_conv = obj->contentious_claimable.timeout_height;
11201                         int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
11202                         (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->contentious_claimable.payment_hash.data);
11203                         int8_tArray payment_preimage_arr = (*env)->NewByteArray(env, 32);
11204                         (*env)->SetByteArrayRegion(env, payment_preimage_arr, 0, 32, obj->contentious_claimable.payment_preimage.data);
11205                         return (*env)->NewObject(env, LDKBalance_ContentiousClaimable_class, LDKBalance_ContentiousClaimable_meth, amount_satoshis_conv, timeout_height_conv, payment_hash_arr, payment_preimage_arr);
11206                 }
11207                 case LDKBalance_MaybeTimeoutClaimableHTLC: {
11208                         int64_t amount_satoshis_conv = obj->maybe_timeout_claimable_htlc.amount_satoshis;
11209                         int32_t claimable_height_conv = obj->maybe_timeout_claimable_htlc.claimable_height;
11210                         int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
11211                         (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->maybe_timeout_claimable_htlc.payment_hash.data);
11212                         return (*env)->NewObject(env, LDKBalance_MaybeTimeoutClaimableHTLC_class, LDKBalance_MaybeTimeoutClaimableHTLC_meth, amount_satoshis_conv, claimable_height_conv, payment_hash_arr);
11213                 }
11214                 case LDKBalance_MaybePreimageClaimableHTLC: {
11215                         int64_t amount_satoshis_conv = obj->maybe_preimage_claimable_htlc.amount_satoshis;
11216                         int32_t expiry_height_conv = obj->maybe_preimage_claimable_htlc.expiry_height;
11217                         int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
11218                         (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->maybe_preimage_claimable_htlc.payment_hash.data);
11219                         return (*env)->NewObject(env, LDKBalance_MaybePreimageClaimableHTLC_class, LDKBalance_MaybePreimageClaimableHTLC_meth, amount_satoshis_conv, expiry_height_conv, payment_hash_arr);
11220                 }
11221                 case LDKBalance_CounterpartyRevokedOutputClaimable: {
11222                         int64_t amount_satoshis_conv = obj->counterparty_revoked_output_claimable.amount_satoshis;
11223                         return (*env)->NewObject(env, LDKBalance_CounterpartyRevokedOutputClaimable_class, LDKBalance_CounterpartyRevokedOutputClaimable_meth, amount_satoshis_conv);
11224                 }
11225                 default: abort();
11226         }
11227 }
11228 static inline LDKCVec_BalanceZ CVec_BalanceZ_clone(const LDKCVec_BalanceZ *orig) {
11229         LDKCVec_BalanceZ ret = { .data = MALLOC(sizeof(LDKBalance) * orig->datalen, "LDKCVec_BalanceZ clone bytes"), .datalen = orig->datalen };
11230         for (size_t i = 0; i < ret.datalen; i++) {
11231                 ret.data[i] = Balance_clone(&orig->data[i]);
11232         }
11233         return ret;
11234 }
11235 static inline struct LDKThirtyTwoBytes C2Tuple_ThirtyTwoBytesChannelMonitorZ_get_a(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ *NONNULL_PTR owner){
11236         return ThirtyTwoBytes_clone(&owner->a);
11237 }
11238 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesChannelMonitorZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
11239         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)untag_ptr(owner);
11240         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
11241         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C2Tuple_ThirtyTwoBytesChannelMonitorZ_get_a(owner_conv).data);
11242         return ret_arr;
11243 }
11244
11245 static inline struct LDKChannelMonitor C2Tuple_ThirtyTwoBytesChannelMonitorZ_get_b(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ *NONNULL_PTR owner){
11246         LDKChannelMonitor ret = owner->b;
11247         ret.is_owned = false;
11248         return ret;
11249 }
11250 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesChannelMonitorZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
11251         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ* owner_conv = (LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)untag_ptr(owner);
11252         LDKChannelMonitor ret_var = C2Tuple_ThirtyTwoBytesChannelMonitorZ_get_b(owner_conv);
11253         int64_t ret_ref = 0;
11254         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11255         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11256         return ret_ref;
11257 }
11258
11259 static inline struct LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_get_ok(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ *NONNULL_PTR owner){
11260 CHECK(owner->result_ok);
11261         return C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone(&*owner->contents.result);
11262 }
11263 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesChannelMonitorZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11264         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ*)untag_ptr(owner);
11265         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ), "LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ");
11266         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_get_ok(owner_conv);
11267         return tag_ptr(ret_conv, true);
11268 }
11269
11270 static inline struct LDKDecodeError CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_get_err(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ *NONNULL_PTR owner){
11271 CHECK(!owner->result_ok);
11272         return DecodeError_clone(&*owner->contents.err);
11273 }
11274 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesChannelMonitorZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11275         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ*)untag_ptr(owner);
11276         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11277         *ret_copy = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_get_err(owner_conv);
11278         int64_t ret_ref = tag_ptr(ret_copy, true);
11279         return ret_ref;
11280 }
11281
11282 typedef struct LDKType_JCalls {
11283         atomic_size_t refcnt;
11284         JavaVM *vm;
11285         jweak o;
11286         jmethodID type_id_meth;
11287         jmethodID debug_str_meth;
11288         jmethodID write_meth;
11289 } LDKType_JCalls;
11290 static void LDKType_JCalls_free(void* this_arg) {
11291         LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
11292         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
11293                 JNIEnv *env;
11294                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11295                 if (get_jenv_res == JNI_EDETACHED) {
11296                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11297                 } else {
11298                         DO_ASSERT(get_jenv_res == JNI_OK);
11299                 }
11300                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
11301                 if (get_jenv_res == JNI_EDETACHED) {
11302                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11303                 }
11304                 FREE(j_calls);
11305         }
11306 }
11307 uint16_t type_id_LDKType_jcall(const void* this_arg) {
11308         LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
11309         JNIEnv *env;
11310         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11311         if (get_jenv_res == JNI_EDETACHED) {
11312                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11313         } else {
11314                 DO_ASSERT(get_jenv_res == JNI_OK);
11315         }
11316         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11317         CHECK(obj != NULL);
11318         int16_t ret = (*env)->CallShortMethod(env, obj, j_calls->type_id_meth);
11319         if (UNLIKELY((*env)->ExceptionCheck(env))) {
11320                 (*env)->ExceptionDescribe(env);
11321                 (*env)->FatalError(env, "A call to type_id in LDKType from rust threw an exception.");
11322         }
11323         if (get_jenv_res == JNI_EDETACHED) {
11324                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11325         }
11326         return ret;
11327 }
11328 LDKStr debug_str_LDKType_jcall(const void* this_arg) {
11329         LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
11330         JNIEnv *env;
11331         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11332         if (get_jenv_res == JNI_EDETACHED) {
11333                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11334         } else {
11335                 DO_ASSERT(get_jenv_res == JNI_OK);
11336         }
11337         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11338         CHECK(obj != NULL);
11339         jstring ret = (*env)->CallObjectMethod(env, obj, j_calls->debug_str_meth);
11340         if (UNLIKELY((*env)->ExceptionCheck(env))) {
11341                 (*env)->ExceptionDescribe(env);
11342                 (*env)->FatalError(env, "A call to debug_str in LDKType from rust threw an exception.");
11343         }
11344         LDKStr ret_conv = java_to_owned_str(env, ret);
11345         if (get_jenv_res == JNI_EDETACHED) {
11346                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11347         }
11348         return ret_conv;
11349 }
11350 LDKCVec_u8Z write_LDKType_jcall(const void* this_arg) {
11351         LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
11352         JNIEnv *env;
11353         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11354         if (get_jenv_res == JNI_EDETACHED) {
11355                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11356         } else {
11357                 DO_ASSERT(get_jenv_res == JNI_OK);
11358         }
11359         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11360         CHECK(obj != NULL);
11361         int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->write_meth);
11362         if (UNLIKELY((*env)->ExceptionCheck(env))) {
11363                 (*env)->ExceptionDescribe(env);
11364                 (*env)->FatalError(env, "A call to write in LDKType from rust threw an exception.");
11365         }
11366         LDKCVec_u8Z ret_ref;
11367         ret_ref.datalen = (*env)->GetArrayLength(env, ret);
11368         ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
11369         (*env)->GetByteArrayRegion(env, ret, 0, ret_ref.datalen, ret_ref.data);
11370         if (get_jenv_res == JNI_EDETACHED) {
11371                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11372         }
11373         return ret_ref;
11374 }
11375 static void LDKType_JCalls_cloned(LDKType* new_obj) {
11376         LDKType_JCalls *j_calls = (LDKType_JCalls*) new_obj->this_arg;
11377         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
11378 }
11379 static inline LDKType LDKType_init (JNIEnv *env, jclass clz, jobject o) {
11380         jclass c = (*env)->GetObjectClass(env, o);
11381         CHECK(c != NULL);
11382         LDKType_JCalls *calls = MALLOC(sizeof(LDKType_JCalls), "LDKType_JCalls");
11383         atomic_init(&calls->refcnt, 1);
11384         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
11385         calls->o = (*env)->NewWeakGlobalRef(env, o);
11386         calls->type_id_meth = (*env)->GetMethodID(env, c, "type_id", "()S");
11387         CHECK(calls->type_id_meth != NULL);
11388         calls->debug_str_meth = (*env)->GetMethodID(env, c, "debug_str", "()Ljava/lang/String;");
11389         CHECK(calls->debug_str_meth != NULL);
11390         calls->write_meth = (*env)->GetMethodID(env, c, "write", "()[B");
11391         CHECK(calls->write_meth != NULL);
11392
11393         LDKType ret = {
11394                 .this_arg = (void*) calls,
11395                 .type_id = type_id_LDKType_jcall,
11396                 .debug_str = debug_str_LDKType_jcall,
11397                 .write = write_LDKType_jcall,
11398                 .cloned = LDKType_JCalls_cloned,
11399                 .free = LDKType_JCalls_free,
11400         };
11401         return ret;
11402 }
11403 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKType_1new(JNIEnv *env, jclass clz, jobject o) {
11404         LDKType *res_ptr = MALLOC(sizeof(LDKType), "LDKType");
11405         *res_ptr = LDKType_init(env, clz, o);
11406         return tag_ptr(res_ptr, true);
11407 }
11408 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_Type_1type_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
11409         void* this_arg_ptr = untag_ptr(this_arg);
11410         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11411         LDKType* this_arg_conv = (LDKType*)this_arg_ptr;
11412         int16_t ret_conv = (this_arg_conv->type_id)(this_arg_conv->this_arg);
11413         return ret_conv;
11414 }
11415
11416 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Type_1debug_1str(JNIEnv *env, jclass clz, int64_t this_arg) {
11417         void* this_arg_ptr = untag_ptr(this_arg);
11418         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11419         LDKType* this_arg_conv = (LDKType*)this_arg_ptr;
11420         LDKStr ret_str = (this_arg_conv->debug_str)(this_arg_conv->this_arg);
11421         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
11422         Str_free(ret_str);
11423         return ret_conv;
11424 }
11425
11426 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Type_1write(JNIEnv *env, jclass clz, int64_t this_arg) {
11427         void* this_arg_ptr = untag_ptr(this_arg);
11428         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11429         LDKType* this_arg_conv = (LDKType*)this_arg_ptr;
11430         LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
11431         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
11432         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
11433         CVec_u8Z_free(ret_var);
11434         return ret_arr;
11435 }
11436
11437 static inline struct LDKPublicKey C2Tuple_PublicKeyTypeZ_get_a(LDKC2Tuple_PublicKeyTypeZ *NONNULL_PTR owner){
11438         return owner->a;
11439 }
11440 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyTypeZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
11441         LDKC2Tuple_PublicKeyTypeZ* owner_conv = (LDKC2Tuple_PublicKeyTypeZ*)untag_ptr(owner);
11442         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
11443         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, C2Tuple_PublicKeyTypeZ_get_a(owner_conv).compressed_form);
11444         return ret_arr;
11445 }
11446
11447 static inline struct LDKType C2Tuple_PublicKeyTypeZ_get_b(LDKC2Tuple_PublicKeyTypeZ *NONNULL_PTR owner){
11448         return Type_clone(&owner->b);
11449 }
11450 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyTypeZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
11451         LDKC2Tuple_PublicKeyTypeZ* owner_conv = (LDKC2Tuple_PublicKeyTypeZ*)untag_ptr(owner);
11452         LDKType* ret_ret = MALLOC(sizeof(LDKType), "LDKType");
11453         *ret_ret = C2Tuple_PublicKeyTypeZ_get_b(owner_conv);
11454         return tag_ptr(ret_ret, true);
11455 }
11456
11457 static inline LDKCVec_C2Tuple_PublicKeyTypeZZ CVec_C2Tuple_PublicKeyTypeZZ_clone(const LDKCVec_C2Tuple_PublicKeyTypeZZ *orig) {
11458         LDKCVec_C2Tuple_PublicKeyTypeZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ) * orig->datalen, "LDKCVec_C2Tuple_PublicKeyTypeZZ clone bytes"), .datalen = orig->datalen };
11459         for (size_t i = 0; i < ret.datalen; i++) {
11460                 ret.data[i] = C2Tuple_PublicKeyTypeZ_clone(&orig->data[i]);
11461         }
11462         return ret;
11463 }
11464 static inline struct LDKPublicKey C2Tuple_PublicKeyCVec_SocketAddressZZ_get_a(LDKC2Tuple_PublicKeyCVec_SocketAddressZZ *NONNULL_PTR owner){
11465         return owner->a;
11466 }
11467 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyCVec_1SocketAddressZZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
11468         LDKC2Tuple_PublicKeyCVec_SocketAddressZZ* owner_conv = (LDKC2Tuple_PublicKeyCVec_SocketAddressZZ*)untag_ptr(owner);
11469         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
11470         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, C2Tuple_PublicKeyCVec_SocketAddressZZ_get_a(owner_conv).compressed_form);
11471         return ret_arr;
11472 }
11473
11474 static inline struct LDKCVec_SocketAddressZ C2Tuple_PublicKeyCVec_SocketAddressZZ_get_b(LDKC2Tuple_PublicKeyCVec_SocketAddressZZ *NONNULL_PTR owner){
11475         return CVec_SocketAddressZ_clone(&owner->b);
11476 }
11477 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyCVec_1SocketAddressZZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
11478         LDKC2Tuple_PublicKeyCVec_SocketAddressZZ* owner_conv = (LDKC2Tuple_PublicKeyCVec_SocketAddressZZ*)untag_ptr(owner);
11479         LDKCVec_SocketAddressZ ret_var = C2Tuple_PublicKeyCVec_SocketAddressZZ_get_b(owner_conv);
11480         int64_tArray ret_arr = NULL;
11481         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
11482         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
11483         for (size_t p = 0; p < ret_var.datalen; p++) {
11484                 LDKSocketAddress *ret_conv_15_copy = MALLOC(sizeof(LDKSocketAddress), "LDKSocketAddress");
11485                 *ret_conv_15_copy = ret_var.data[p];
11486                 int64_t ret_conv_15_ref = tag_ptr(ret_conv_15_copy, true);
11487                 ret_arr_ptr[p] = ret_conv_15_ref;
11488         }
11489         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
11490         FREE(ret_var.data);
11491         return ret_arr;
11492 }
11493
11494 static inline LDKCVec_C2Tuple_PublicKeyCVec_SocketAddressZZZ CVec_C2Tuple_PublicKeyCVec_SocketAddressZZZ_clone(const LDKCVec_C2Tuple_PublicKeyCVec_SocketAddressZZZ *orig) {
11495         LDKCVec_C2Tuple_PublicKeyCVec_SocketAddressZZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_PublicKeyCVec_SocketAddressZZ) * orig->datalen, "LDKCVec_C2Tuple_PublicKeyCVec_SocketAddressZZZ clone bytes"), .datalen = orig->datalen };
11496         for (size_t i = 0; i < ret.datalen; i++) {
11497                 ret.data[i] = C2Tuple_PublicKeyCVec_SocketAddressZZ_clone(&orig->data[i]);
11498         }
11499         return ret;
11500 }
11501 typedef struct LDKOnionMessageContents_JCalls {
11502         atomic_size_t refcnt;
11503         JavaVM *vm;
11504         jweak o;
11505         jmethodID tlv_type_meth;
11506         jmethodID write_meth;
11507         jmethodID debug_str_meth;
11508 } LDKOnionMessageContents_JCalls;
11509 static void LDKOnionMessageContents_JCalls_free(void* this_arg) {
11510         LDKOnionMessageContents_JCalls *j_calls = (LDKOnionMessageContents_JCalls*) this_arg;
11511         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
11512                 JNIEnv *env;
11513                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11514                 if (get_jenv_res == JNI_EDETACHED) {
11515                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11516                 } else {
11517                         DO_ASSERT(get_jenv_res == JNI_OK);
11518                 }
11519                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
11520                 if (get_jenv_res == JNI_EDETACHED) {
11521                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11522                 }
11523                 FREE(j_calls);
11524         }
11525 }
11526 uint64_t tlv_type_LDKOnionMessageContents_jcall(const void* this_arg) {
11527         LDKOnionMessageContents_JCalls *j_calls = (LDKOnionMessageContents_JCalls*) this_arg;
11528         JNIEnv *env;
11529         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11530         if (get_jenv_res == JNI_EDETACHED) {
11531                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11532         } else {
11533                 DO_ASSERT(get_jenv_res == JNI_OK);
11534         }
11535         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11536         CHECK(obj != NULL);
11537         int64_t ret = (*env)->CallLongMethod(env, obj, j_calls->tlv_type_meth);
11538         if (UNLIKELY((*env)->ExceptionCheck(env))) {
11539                 (*env)->ExceptionDescribe(env);
11540                 (*env)->FatalError(env, "A call to tlv_type in LDKOnionMessageContents from rust threw an exception.");
11541         }
11542         if (get_jenv_res == JNI_EDETACHED) {
11543                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11544         }
11545         return ret;
11546 }
11547 LDKCVec_u8Z write_LDKOnionMessageContents_jcall(const void* this_arg) {
11548         LDKOnionMessageContents_JCalls *j_calls = (LDKOnionMessageContents_JCalls*) this_arg;
11549         JNIEnv *env;
11550         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11551         if (get_jenv_res == JNI_EDETACHED) {
11552                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11553         } else {
11554                 DO_ASSERT(get_jenv_res == JNI_OK);
11555         }
11556         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11557         CHECK(obj != NULL);
11558         int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->write_meth);
11559         if (UNLIKELY((*env)->ExceptionCheck(env))) {
11560                 (*env)->ExceptionDescribe(env);
11561                 (*env)->FatalError(env, "A call to write in LDKOnionMessageContents from rust threw an exception.");
11562         }
11563         LDKCVec_u8Z ret_ref;
11564         ret_ref.datalen = (*env)->GetArrayLength(env, ret);
11565         ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
11566         (*env)->GetByteArrayRegion(env, ret, 0, ret_ref.datalen, ret_ref.data);
11567         if (get_jenv_res == JNI_EDETACHED) {
11568                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11569         }
11570         return ret_ref;
11571 }
11572 LDKStr debug_str_LDKOnionMessageContents_jcall(const void* this_arg) {
11573         LDKOnionMessageContents_JCalls *j_calls = (LDKOnionMessageContents_JCalls*) this_arg;
11574         JNIEnv *env;
11575         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
11576         if (get_jenv_res == JNI_EDETACHED) {
11577                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
11578         } else {
11579                 DO_ASSERT(get_jenv_res == JNI_OK);
11580         }
11581         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
11582         CHECK(obj != NULL);
11583         jstring ret = (*env)->CallObjectMethod(env, obj, j_calls->debug_str_meth);
11584         if (UNLIKELY((*env)->ExceptionCheck(env))) {
11585                 (*env)->ExceptionDescribe(env);
11586                 (*env)->FatalError(env, "A call to debug_str in LDKOnionMessageContents from rust threw an exception.");
11587         }
11588         LDKStr ret_conv = java_to_owned_str(env, ret);
11589         if (get_jenv_res == JNI_EDETACHED) {
11590                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
11591         }
11592         return ret_conv;
11593 }
11594 static void LDKOnionMessageContents_JCalls_cloned(LDKOnionMessageContents* new_obj) {
11595         LDKOnionMessageContents_JCalls *j_calls = (LDKOnionMessageContents_JCalls*) new_obj->this_arg;
11596         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
11597 }
11598 static inline LDKOnionMessageContents LDKOnionMessageContents_init (JNIEnv *env, jclass clz, jobject o) {
11599         jclass c = (*env)->GetObjectClass(env, o);
11600         CHECK(c != NULL);
11601         LDKOnionMessageContents_JCalls *calls = MALLOC(sizeof(LDKOnionMessageContents_JCalls), "LDKOnionMessageContents_JCalls");
11602         atomic_init(&calls->refcnt, 1);
11603         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
11604         calls->o = (*env)->NewWeakGlobalRef(env, o);
11605         calls->tlv_type_meth = (*env)->GetMethodID(env, c, "tlv_type", "()J");
11606         CHECK(calls->tlv_type_meth != NULL);
11607         calls->write_meth = (*env)->GetMethodID(env, c, "write", "()[B");
11608         CHECK(calls->write_meth != NULL);
11609         calls->debug_str_meth = (*env)->GetMethodID(env, c, "debug_str", "()Ljava/lang/String;");
11610         CHECK(calls->debug_str_meth != NULL);
11611
11612         LDKOnionMessageContents ret = {
11613                 .this_arg = (void*) calls,
11614                 .tlv_type = tlv_type_LDKOnionMessageContents_jcall,
11615                 .write = write_LDKOnionMessageContents_jcall,
11616                 .debug_str = debug_str_LDKOnionMessageContents_jcall,
11617                 .cloned = LDKOnionMessageContents_JCalls_cloned,
11618                 .free = LDKOnionMessageContents_JCalls_free,
11619         };
11620         return ret;
11621 }
11622 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKOnionMessageContents_1new(JNIEnv *env, jclass clz, jobject o) {
11623         LDKOnionMessageContents *res_ptr = MALLOC(sizeof(LDKOnionMessageContents), "LDKOnionMessageContents");
11624         *res_ptr = LDKOnionMessageContents_init(env, clz, o);
11625         return tag_ptr(res_ptr, true);
11626 }
11627 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OnionMessageContents_1tlv_1type(JNIEnv *env, jclass clz, int64_t this_arg) {
11628         void* this_arg_ptr = untag_ptr(this_arg);
11629         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11630         LDKOnionMessageContents* this_arg_conv = (LDKOnionMessageContents*)this_arg_ptr;
11631         int64_t ret_conv = (this_arg_conv->tlv_type)(this_arg_conv->this_arg);
11632         return ret_conv;
11633 }
11634
11635 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OnionMessageContents_1write(JNIEnv *env, jclass clz, int64_t this_arg) {
11636         void* this_arg_ptr = untag_ptr(this_arg);
11637         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11638         LDKOnionMessageContents* this_arg_conv = (LDKOnionMessageContents*)this_arg_ptr;
11639         LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
11640         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
11641         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
11642         CVec_u8Z_free(ret_var);
11643         return ret_arr;
11644 }
11645
11646 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_OnionMessageContents_1debug_1str(JNIEnv *env, jclass clz, int64_t this_arg) {
11647         void* this_arg_ptr = untag_ptr(this_arg);
11648         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
11649         LDKOnionMessageContents* this_arg_conv = (LDKOnionMessageContents*)this_arg_ptr;
11650         LDKStr ret_str = (this_arg_conv->debug_str)(this_arg_conv->this_arg);
11651         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
11652         Str_free(ret_str);
11653         return ret_conv;
11654 }
11655
11656 static jclass LDKCOption_OnionMessageContentsZ_Some_class = NULL;
11657 static jmethodID LDKCOption_OnionMessageContentsZ_Some_meth = NULL;
11658 static jclass LDKCOption_OnionMessageContentsZ_None_class = NULL;
11659 static jmethodID LDKCOption_OnionMessageContentsZ_None_meth = NULL;
11660 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1OnionMessageContentsZ_init (JNIEnv *env, jclass clz) {
11661         LDKCOption_OnionMessageContentsZ_Some_class =
11662                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_OnionMessageContentsZ$Some"));
11663         CHECK(LDKCOption_OnionMessageContentsZ_Some_class != NULL);
11664         LDKCOption_OnionMessageContentsZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_OnionMessageContentsZ_Some_class, "<init>", "(J)V");
11665         CHECK(LDKCOption_OnionMessageContentsZ_Some_meth != NULL);
11666         LDKCOption_OnionMessageContentsZ_None_class =
11667                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_OnionMessageContentsZ$None"));
11668         CHECK(LDKCOption_OnionMessageContentsZ_None_class != NULL);
11669         LDKCOption_OnionMessageContentsZ_None_meth = (*env)->GetMethodID(env, LDKCOption_OnionMessageContentsZ_None_class, "<init>", "()V");
11670         CHECK(LDKCOption_OnionMessageContentsZ_None_meth != NULL);
11671 }
11672 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1OnionMessageContentsZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
11673         LDKCOption_OnionMessageContentsZ *obj = (LDKCOption_OnionMessageContentsZ*)untag_ptr(ptr);
11674         switch(obj->tag) {
11675                 case LDKCOption_OnionMessageContentsZ_Some: {
11676                         LDKOnionMessageContents* some_ret = MALLOC(sizeof(LDKOnionMessageContents), "LDKOnionMessageContents");
11677                         *some_ret = OnionMessageContents_clone(&obj->some);
11678                         return (*env)->NewObject(env, LDKCOption_OnionMessageContentsZ_Some_class, LDKCOption_OnionMessageContentsZ_Some_meth, tag_ptr(some_ret, true));
11679                 }
11680                 case LDKCOption_OnionMessageContentsZ_None: {
11681                         return (*env)->NewObject(env, LDKCOption_OnionMessageContentsZ_None_class, LDKCOption_OnionMessageContentsZ_None_meth);
11682                 }
11683                 default: abort();
11684         }
11685 }
11686 static inline struct LDKCOption_OnionMessageContentsZ CResult_COption_OnionMessageContentsZDecodeErrorZ_get_ok(LDKCResult_COption_OnionMessageContentsZDecodeErrorZ *NONNULL_PTR owner){
11687 CHECK(owner->result_ok);
11688         return COption_OnionMessageContentsZ_clone(&*owner->contents.result);
11689 }
11690 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1OnionMessageContentsZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11691         LDKCResult_COption_OnionMessageContentsZDecodeErrorZ* owner_conv = (LDKCResult_COption_OnionMessageContentsZDecodeErrorZ*)untag_ptr(owner);
11692         LDKCOption_OnionMessageContentsZ *ret_copy = MALLOC(sizeof(LDKCOption_OnionMessageContentsZ), "LDKCOption_OnionMessageContentsZ");
11693         *ret_copy = CResult_COption_OnionMessageContentsZDecodeErrorZ_get_ok(owner_conv);
11694         int64_t ret_ref = tag_ptr(ret_copy, true);
11695         return ret_ref;
11696 }
11697
11698 static inline struct LDKDecodeError CResult_COption_OnionMessageContentsZDecodeErrorZ_get_err(LDKCResult_COption_OnionMessageContentsZDecodeErrorZ *NONNULL_PTR owner){
11699 CHECK(!owner->result_ok);
11700         return DecodeError_clone(&*owner->contents.err);
11701 }
11702 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1OnionMessageContentsZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11703         LDKCResult_COption_OnionMessageContentsZDecodeErrorZ* owner_conv = (LDKCResult_COption_OnionMessageContentsZDecodeErrorZ*)untag_ptr(owner);
11704         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11705         *ret_copy = CResult_COption_OnionMessageContentsZDecodeErrorZ_get_err(owner_conv);
11706         int64_t ret_ref = tag_ptr(ret_copy, true);
11707         return ret_ref;
11708 }
11709
11710 static inline struct LDKOnionMessageContents C3Tuple_OnionMessageContentsDestinationBlindedPathZ_get_a(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ *NONNULL_PTR owner){
11711         return OnionMessageContents_clone(&owner->a);
11712 }
11713 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1OnionMessageContentsDestinationBlindedPathZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
11714         LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ* owner_conv = (LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ*)untag_ptr(owner);
11715         LDKOnionMessageContents* ret_ret = MALLOC(sizeof(LDKOnionMessageContents), "LDKOnionMessageContents");
11716         *ret_ret = C3Tuple_OnionMessageContentsDestinationBlindedPathZ_get_a(owner_conv);
11717         return tag_ptr(ret_ret, true);
11718 }
11719
11720 static inline struct LDKDestination C3Tuple_OnionMessageContentsDestinationBlindedPathZ_get_b(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ *NONNULL_PTR owner){
11721         return Destination_clone(&owner->b);
11722 }
11723 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1OnionMessageContentsDestinationBlindedPathZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
11724         LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ* owner_conv = (LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ*)untag_ptr(owner);
11725         LDKDestination *ret_copy = MALLOC(sizeof(LDKDestination), "LDKDestination");
11726         *ret_copy = C3Tuple_OnionMessageContentsDestinationBlindedPathZ_get_b(owner_conv);
11727         int64_t ret_ref = tag_ptr(ret_copy, true);
11728         return ret_ref;
11729 }
11730
11731 static inline struct LDKBlindedPath C3Tuple_OnionMessageContentsDestinationBlindedPathZ_get_c(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ *NONNULL_PTR owner){
11732         LDKBlindedPath ret = owner->c;
11733         ret.is_owned = false;
11734         return ret;
11735 }
11736 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1OnionMessageContentsDestinationBlindedPathZ_1get_1c(JNIEnv *env, jclass clz, int64_t owner) {
11737         LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ* owner_conv = (LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ*)untag_ptr(owner);
11738         LDKBlindedPath ret_var = C3Tuple_OnionMessageContentsDestinationBlindedPathZ_get_c(owner_conv);
11739         int64_t ret_ref = 0;
11740         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11741         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11742         return ret_ref;
11743 }
11744
11745 static inline LDKCVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ CVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ_clone(const LDKCVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ *orig) {
11746         LDKCVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ ret = { .data = MALLOC(sizeof(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ) * orig->datalen, "LDKCVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ clone bytes"), .datalen = orig->datalen };
11747         for (size_t i = 0; i < ret.datalen; i++) {
11748                 ret.data[i] = C3Tuple_OnionMessageContentsDestinationBlindedPathZ_clone(&orig->data[i]);
11749         }
11750         return ret;
11751 }
11752 static jclass LDKCOption_TypeZ_Some_class = NULL;
11753 static jmethodID LDKCOption_TypeZ_Some_meth = NULL;
11754 static jclass LDKCOption_TypeZ_None_class = NULL;
11755 static jmethodID LDKCOption_TypeZ_None_meth = NULL;
11756 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1TypeZ_init (JNIEnv *env, jclass clz) {
11757         LDKCOption_TypeZ_Some_class =
11758                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_TypeZ$Some"));
11759         CHECK(LDKCOption_TypeZ_Some_class != NULL);
11760         LDKCOption_TypeZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_TypeZ_Some_class, "<init>", "(J)V");
11761         CHECK(LDKCOption_TypeZ_Some_meth != NULL);
11762         LDKCOption_TypeZ_None_class =
11763                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_TypeZ$None"));
11764         CHECK(LDKCOption_TypeZ_None_class != NULL);
11765         LDKCOption_TypeZ_None_meth = (*env)->GetMethodID(env, LDKCOption_TypeZ_None_class, "<init>", "()V");
11766         CHECK(LDKCOption_TypeZ_None_meth != NULL);
11767 }
11768 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1TypeZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
11769         LDKCOption_TypeZ *obj = (LDKCOption_TypeZ*)untag_ptr(ptr);
11770         switch(obj->tag) {
11771                 case LDKCOption_TypeZ_Some: {
11772                         LDKType* some_ret = MALLOC(sizeof(LDKType), "LDKType");
11773                         *some_ret = Type_clone(&obj->some);
11774                         return (*env)->NewObject(env, LDKCOption_TypeZ_Some_class, LDKCOption_TypeZ_Some_meth, tag_ptr(some_ret, true));
11775                 }
11776                 case LDKCOption_TypeZ_None: {
11777                         return (*env)->NewObject(env, LDKCOption_TypeZ_None_class, LDKCOption_TypeZ_None_meth);
11778                 }
11779                 default: abort();
11780         }
11781 }
11782 static inline struct LDKCOption_TypeZ CResult_COption_TypeZDecodeErrorZ_get_ok(LDKCResult_COption_TypeZDecodeErrorZ *NONNULL_PTR owner){
11783 CHECK(owner->result_ok);
11784         return COption_TypeZ_clone(&*owner->contents.result);
11785 }
11786 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1TypeZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11787         LDKCResult_COption_TypeZDecodeErrorZ* owner_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)untag_ptr(owner);
11788         LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
11789         *ret_copy = CResult_COption_TypeZDecodeErrorZ_get_ok(owner_conv);
11790         int64_t ret_ref = tag_ptr(ret_copy, true);
11791         return ret_ref;
11792 }
11793
11794 static inline struct LDKDecodeError CResult_COption_TypeZDecodeErrorZ_get_err(LDKCResult_COption_TypeZDecodeErrorZ *NONNULL_PTR owner){
11795 CHECK(!owner->result_ok);
11796         return DecodeError_clone(&*owner->contents.err);
11797 }
11798 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1TypeZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11799         LDKCResult_COption_TypeZDecodeErrorZ* owner_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)untag_ptr(owner);
11800         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
11801         *ret_copy = CResult_COption_TypeZDecodeErrorZ_get_err(owner_conv);
11802         int64_t ret_ref = tag_ptr(ret_copy, true);
11803         return ret_ref;
11804 }
11805
11806 static jclass LDKCOption_SocketAddressZ_Some_class = NULL;
11807 static jmethodID LDKCOption_SocketAddressZ_Some_meth = NULL;
11808 static jclass LDKCOption_SocketAddressZ_None_class = NULL;
11809 static jmethodID LDKCOption_SocketAddressZ_None_meth = NULL;
11810 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1SocketAddressZ_init (JNIEnv *env, jclass clz) {
11811         LDKCOption_SocketAddressZ_Some_class =
11812                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_SocketAddressZ$Some"));
11813         CHECK(LDKCOption_SocketAddressZ_Some_class != NULL);
11814         LDKCOption_SocketAddressZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_SocketAddressZ_Some_class, "<init>", "(J)V");
11815         CHECK(LDKCOption_SocketAddressZ_Some_meth != NULL);
11816         LDKCOption_SocketAddressZ_None_class =
11817                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_SocketAddressZ$None"));
11818         CHECK(LDKCOption_SocketAddressZ_None_class != NULL);
11819         LDKCOption_SocketAddressZ_None_meth = (*env)->GetMethodID(env, LDKCOption_SocketAddressZ_None_class, "<init>", "()V");
11820         CHECK(LDKCOption_SocketAddressZ_None_meth != NULL);
11821 }
11822 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1SocketAddressZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
11823         LDKCOption_SocketAddressZ *obj = (LDKCOption_SocketAddressZ*)untag_ptr(ptr);
11824         switch(obj->tag) {
11825                 case LDKCOption_SocketAddressZ_Some: {
11826                         int64_t some_ref = tag_ptr(&obj->some, false);
11827                         return (*env)->NewObject(env, LDKCOption_SocketAddressZ_Some_class, LDKCOption_SocketAddressZ_Some_meth, some_ref);
11828                 }
11829                 case LDKCOption_SocketAddressZ_None: {
11830                         return (*env)->NewObject(env, LDKCOption_SocketAddressZ_None_class, LDKCOption_SocketAddressZ_None_meth);
11831                 }
11832                 default: abort();
11833         }
11834 }
11835 static inline struct LDKCVec_u8Z CResult_CVec_u8ZPeerHandleErrorZ_get_ok(LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR owner){
11836 CHECK(owner->result_ok);
11837         return CVec_u8Z_clone(&*owner->contents.result);
11838 }
11839 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11840         LDKCResult_CVec_u8ZPeerHandleErrorZ* owner_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)untag_ptr(owner);
11841         LDKCVec_u8Z ret_var = CResult_CVec_u8ZPeerHandleErrorZ_get_ok(owner_conv);
11842         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
11843         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
11844         CVec_u8Z_free(ret_var);
11845         return ret_arr;
11846 }
11847
11848 static inline struct LDKPeerHandleError CResult_CVec_u8ZPeerHandleErrorZ_get_err(LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR owner){
11849         LDKPeerHandleError ret = *owner->contents.err;
11850         ret.is_owned = false;
11851         return ret;
11852 }
11853 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11854         LDKCResult_CVec_u8ZPeerHandleErrorZ* owner_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)untag_ptr(owner);
11855         LDKPeerHandleError ret_var = CResult_CVec_u8ZPeerHandleErrorZ_get_err(owner_conv);
11856         int64_t ret_ref = 0;
11857         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11858         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11859         return ret_ref;
11860 }
11861
11862 static inline void CResult_NonePeerHandleErrorZ_get_ok(LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR owner){
11863 CHECK(owner->result_ok);
11864         return *owner->contents.result;
11865 }
11866 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11867         LDKCResult_NonePeerHandleErrorZ* owner_conv = (LDKCResult_NonePeerHandleErrorZ*)untag_ptr(owner);
11868         CResult_NonePeerHandleErrorZ_get_ok(owner_conv);
11869 }
11870
11871 static inline struct LDKPeerHandleError CResult_NonePeerHandleErrorZ_get_err(LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR owner){
11872         LDKPeerHandleError ret = *owner->contents.err;
11873         ret.is_owned = false;
11874         return ret;
11875 }
11876 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11877         LDKCResult_NonePeerHandleErrorZ* owner_conv = (LDKCResult_NonePeerHandleErrorZ*)untag_ptr(owner);
11878         LDKPeerHandleError ret_var = CResult_NonePeerHandleErrorZ_get_err(owner_conv);
11879         int64_t ret_ref = 0;
11880         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11881         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11882         return ret_ref;
11883 }
11884
11885 static inline bool CResult_boolPeerHandleErrorZ_get_ok(LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR owner){
11886 CHECK(owner->result_ok);
11887         return *owner->contents.result;
11888 }
11889 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11890         LDKCResult_boolPeerHandleErrorZ* owner_conv = (LDKCResult_boolPeerHandleErrorZ*)untag_ptr(owner);
11891         jboolean ret_conv = CResult_boolPeerHandleErrorZ_get_ok(owner_conv);
11892         return ret_conv;
11893 }
11894
11895 static inline struct LDKPeerHandleError CResult_boolPeerHandleErrorZ_get_err(LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR owner){
11896         LDKPeerHandleError ret = *owner->contents.err;
11897         ret.is_owned = false;
11898         return ret;
11899 }
11900 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11901         LDKCResult_boolPeerHandleErrorZ* owner_conv = (LDKCResult_boolPeerHandleErrorZ*)untag_ptr(owner);
11902         LDKPeerHandleError ret_var = CResult_boolPeerHandleErrorZ_get_err(owner_conv);
11903         int64_t ret_ref = 0;
11904         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
11905         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
11906         return ret_ref;
11907 }
11908
11909 static jclass LDKGraphSyncError_DecodeError_class = NULL;
11910 static jmethodID LDKGraphSyncError_DecodeError_meth = NULL;
11911 static jclass LDKGraphSyncError_LightningError_class = NULL;
11912 static jmethodID LDKGraphSyncError_LightningError_meth = NULL;
11913 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKGraphSyncError_init (JNIEnv *env, jclass clz) {
11914         LDKGraphSyncError_DecodeError_class =
11915                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKGraphSyncError$DecodeError"));
11916         CHECK(LDKGraphSyncError_DecodeError_class != NULL);
11917         LDKGraphSyncError_DecodeError_meth = (*env)->GetMethodID(env, LDKGraphSyncError_DecodeError_class, "<init>", "(J)V");
11918         CHECK(LDKGraphSyncError_DecodeError_meth != NULL);
11919         LDKGraphSyncError_LightningError_class =
11920                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKGraphSyncError$LightningError"));
11921         CHECK(LDKGraphSyncError_LightningError_class != NULL);
11922         LDKGraphSyncError_LightningError_meth = (*env)->GetMethodID(env, LDKGraphSyncError_LightningError_class, "<init>", "(J)V");
11923         CHECK(LDKGraphSyncError_LightningError_meth != NULL);
11924 }
11925 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKGraphSyncError_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
11926         LDKGraphSyncError *obj = (LDKGraphSyncError*)untag_ptr(ptr);
11927         switch(obj->tag) {
11928                 case LDKGraphSyncError_DecodeError: {
11929                         int64_t decode_error_ref = tag_ptr(&obj->decode_error, false);
11930                         return (*env)->NewObject(env, LDKGraphSyncError_DecodeError_class, LDKGraphSyncError_DecodeError_meth, decode_error_ref);
11931                 }
11932                 case LDKGraphSyncError_LightningError: {
11933                         LDKLightningError lightning_error_var = obj->lightning_error;
11934                         int64_t lightning_error_ref = 0;
11935                         CHECK_INNER_FIELD_ACCESS_OR_NULL(lightning_error_var);
11936                         lightning_error_ref = tag_ptr(lightning_error_var.inner, false);
11937                         return (*env)->NewObject(env, LDKGraphSyncError_LightningError_class, LDKGraphSyncError_LightningError_meth, lightning_error_ref);
11938                 }
11939                 default: abort();
11940         }
11941 }
11942 static inline uint32_t CResult_u32GraphSyncErrorZ_get_ok(LDKCResult_u32GraphSyncErrorZ *NONNULL_PTR owner){
11943 CHECK(owner->result_ok);
11944         return *owner->contents.result;
11945 }
11946 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_CResult_1u32GraphSyncErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11947         LDKCResult_u32GraphSyncErrorZ* owner_conv = (LDKCResult_u32GraphSyncErrorZ*)untag_ptr(owner);
11948         int32_t ret_conv = CResult_u32GraphSyncErrorZ_get_ok(owner_conv);
11949         return ret_conv;
11950 }
11951
11952 static inline struct LDKGraphSyncError CResult_u32GraphSyncErrorZ_get_err(LDKCResult_u32GraphSyncErrorZ *NONNULL_PTR owner){
11953 CHECK(!owner->result_ok);
11954         return GraphSyncError_clone(&*owner->contents.err);
11955 }
11956 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1u32GraphSyncErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11957         LDKCResult_u32GraphSyncErrorZ* owner_conv = (LDKCResult_u32GraphSyncErrorZ*)untag_ptr(owner);
11958         LDKGraphSyncError *ret_copy = MALLOC(sizeof(LDKGraphSyncError), "LDKGraphSyncError");
11959         *ret_copy = CResult_u32GraphSyncErrorZ_get_err(owner_conv);
11960         int64_t ret_ref = tag_ptr(ret_copy, true);
11961         return ret_ref;
11962 }
11963
11964 static inline struct LDKCVec_u8Z CResult_CVec_u8ZIOErrorZ_get_ok(LDKCResult_CVec_u8ZIOErrorZ *NONNULL_PTR owner){
11965 CHECK(owner->result_ok);
11966         return CVec_u8Z_clone(&*owner->contents.result);
11967 }
11968 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZIOErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11969         LDKCResult_CVec_u8ZIOErrorZ* owner_conv = (LDKCResult_CVec_u8ZIOErrorZ*)untag_ptr(owner);
11970         LDKCVec_u8Z ret_var = CResult_CVec_u8ZIOErrorZ_get_ok(owner_conv);
11971         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
11972         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
11973         CVec_u8Z_free(ret_var);
11974         return ret_arr;
11975 }
11976
11977 static inline enum LDKIOError CResult_CVec_u8ZIOErrorZ_get_err(LDKCResult_CVec_u8ZIOErrorZ *NONNULL_PTR owner){
11978 CHECK(!owner->result_ok);
11979         return *owner->contents.err;
11980 }
11981 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZIOErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
11982         LDKCResult_CVec_u8ZIOErrorZ* owner_conv = (LDKCResult_CVec_u8ZIOErrorZ*)untag_ptr(owner);
11983         jclass ret_conv = LDKIOError_to_java(env, CResult_CVec_u8ZIOErrorZ_get_err(owner_conv));
11984         return ret_conv;
11985 }
11986
11987 static inline struct LDKCVec_StrZ CResult_CVec_StrZIOErrorZ_get_ok(LDKCResult_CVec_StrZIOErrorZ *NONNULL_PTR owner){
11988 CHECK(owner->result_ok);
11989         return *owner->contents.result;
11990 }
11991 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1StrZIOErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
11992         LDKCResult_CVec_StrZIOErrorZ* owner_conv = (LDKCResult_CVec_StrZIOErrorZ*)untag_ptr(owner);
11993         LDKCVec_StrZ ret_var = CResult_CVec_StrZIOErrorZ_get_ok(owner_conv);
11994         jobjectArray ret_arr = NULL;
11995         ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, String_clz, NULL);
11996         ;
11997         jstring *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
11998         for (size_t i = 0; i < ret_var.datalen; i++) {
11999                 LDKStr ret_conv_8_str = ret_var.data[i];
12000                 jstring ret_conv_8_conv = str_ref_to_java(env, ret_conv_8_str.chars, ret_conv_8_str.len);
12001                 ret_arr_ptr[i] = ret_conv_8_conv;
12002         }
12003         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
12004         return ret_arr;
12005 }
12006
12007 static inline enum LDKIOError CResult_CVec_StrZIOErrorZ_get_err(LDKCResult_CVec_StrZIOErrorZ *NONNULL_PTR owner){
12008 CHECK(!owner->result_ok);
12009         return *owner->contents.err;
12010 }
12011 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1StrZIOErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
12012         LDKCResult_CVec_StrZIOErrorZ* owner_conv = (LDKCResult_CVec_StrZIOErrorZ*)untag_ptr(owner);
12013         jclass ret_conv = LDKIOError_to_java(env, CResult_CVec_StrZIOErrorZ_get_err(owner_conv));
12014         return ret_conv;
12015 }
12016
12017 static inline LDKCVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ_clone(const LDKCVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ *orig) {
12018         LDKCVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ) * orig->datalen, "LDKCVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ clone bytes"), .datalen = orig->datalen };
12019         for (size_t i = 0; i < ret.datalen; i++) {
12020                 ret.data[i] = C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone(&orig->data[i]);
12021         }
12022         return ret;
12023 }
12024 static inline struct LDKCVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_get_ok(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ *NONNULL_PTR owner){
12025 CHECK(owner->result_ok);
12026         return CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ_clone(&*owner->contents.result);
12027 }
12028 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1ThirtyTwoBytesChannelMonitorZZIOErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
12029         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ* owner_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ*)untag_ptr(owner);
12030         LDKCVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ ret_var = CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_get_ok(owner_conv);
12031         int64_tArray ret_arr = NULL;
12032         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
12033         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
12034         for (size_t o = 0; o < ret_var.datalen; o++) {
12035                 LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ* ret_conv_40_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ), "LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ");
12036                 *ret_conv_40_conv = ret_var.data[o];
12037                 ret_arr_ptr[o] = tag_ptr(ret_conv_40_conv, true);
12038         }
12039         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
12040         FREE(ret_var.data);
12041         return ret_arr;
12042 }
12043
12044 static inline enum LDKIOError CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_get_err(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ *NONNULL_PTR owner){
12045 CHECK(!owner->result_ok);
12046         return *owner->contents.err;
12047 }
12048 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1ThirtyTwoBytesChannelMonitorZZIOErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
12049         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ* owner_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ*)untag_ptr(owner);
12050         jclass ret_conv = LDKIOError_to_java(env, CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_get_err(owner_conv));
12051         return ret_conv;
12052 }
12053
12054 static inline struct LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_get_ok(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ *NONNULL_PTR owner){
12055 CHECK(owner->result_ok);
12056         return C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone(&*owner->contents.result);
12057 }
12058 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesChannelMonitorZIOErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
12059         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ* owner_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ*)untag_ptr(owner);
12060         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ), "LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ");
12061         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_get_ok(owner_conv);
12062         return tag_ptr(ret_conv, true);
12063 }
12064
12065 static inline enum LDKIOError CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_get_err(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ *NONNULL_PTR owner){
12066 CHECK(!owner->result_ok);
12067         return *owner->contents.err;
12068 }
12069 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesChannelMonitorZIOErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
12070         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ* owner_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ*)untag_ptr(owner);
12071         jclass ret_conv = LDKIOError_to_java(env, CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_get_err(owner_conv));
12072         return ret_conv;
12073 }
12074
12075 static inline struct LDKUnsignedInvoiceRequest CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ_get_ok(LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ *NONNULL_PTR owner){
12076         LDKUnsignedInvoiceRequest ret = *owner->contents.result;
12077         ret.is_owned = false;
12078         return ret;
12079 }
12080 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedInvoiceRequestBolt12SemanticErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
12081         LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ* owner_conv = (LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ*)untag_ptr(owner);
12082         LDKUnsignedInvoiceRequest ret_var = CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ_get_ok(owner_conv);
12083         int64_t ret_ref = 0;
12084         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12085         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12086         return ret_ref;
12087 }
12088
12089 static inline enum LDKBolt12SemanticError CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ_get_err(LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ *NONNULL_PTR owner){
12090 CHECK(!owner->result_ok);
12091         return Bolt12SemanticError_clone(&*owner->contents.err);
12092 }
12093 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedInvoiceRequestBolt12SemanticErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
12094         LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ* owner_conv = (LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ*)untag_ptr(owner);
12095         jclass ret_conv = LDKBolt12SemanticError_to_java(env, CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ_get_err(owner_conv));
12096         return ret_conv;
12097 }
12098
12099 static inline struct LDKInvoiceRequest CResult_InvoiceRequestBolt12SemanticErrorZ_get_ok(LDKCResult_InvoiceRequestBolt12SemanticErrorZ *NONNULL_PTR owner){
12100         LDKInvoiceRequest ret = *owner->contents.result;
12101         ret.is_owned = false;
12102         return ret;
12103 }
12104 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceRequestBolt12SemanticErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
12105         LDKCResult_InvoiceRequestBolt12SemanticErrorZ* owner_conv = (LDKCResult_InvoiceRequestBolt12SemanticErrorZ*)untag_ptr(owner);
12106         LDKInvoiceRequest ret_var = CResult_InvoiceRequestBolt12SemanticErrorZ_get_ok(owner_conv);
12107         int64_t ret_ref = 0;
12108         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12109         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12110         return ret_ref;
12111 }
12112
12113 static inline enum LDKBolt12SemanticError CResult_InvoiceRequestBolt12SemanticErrorZ_get_err(LDKCResult_InvoiceRequestBolt12SemanticErrorZ *NONNULL_PTR owner){
12114 CHECK(!owner->result_ok);
12115         return Bolt12SemanticError_clone(&*owner->contents.err);
12116 }
12117 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceRequestBolt12SemanticErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
12118         LDKCResult_InvoiceRequestBolt12SemanticErrorZ* owner_conv = (LDKCResult_InvoiceRequestBolt12SemanticErrorZ*)untag_ptr(owner);
12119         jclass ret_conv = LDKBolt12SemanticError_to_java(env, CResult_InvoiceRequestBolt12SemanticErrorZ_get_err(owner_conv));
12120         return ret_conv;
12121 }
12122
12123 static jclass LDKCOption_SecretKeyZ_Some_class = NULL;
12124 static jmethodID LDKCOption_SecretKeyZ_Some_meth = NULL;
12125 static jclass LDKCOption_SecretKeyZ_None_class = NULL;
12126 static jmethodID LDKCOption_SecretKeyZ_None_meth = NULL;
12127 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1SecretKeyZ_init (JNIEnv *env, jclass clz) {
12128         LDKCOption_SecretKeyZ_Some_class =
12129                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_SecretKeyZ$Some"));
12130         CHECK(LDKCOption_SecretKeyZ_Some_class != NULL);
12131         LDKCOption_SecretKeyZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_SecretKeyZ_Some_class, "<init>", "([B)V");
12132         CHECK(LDKCOption_SecretKeyZ_Some_meth != NULL);
12133         LDKCOption_SecretKeyZ_None_class =
12134                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_SecretKeyZ$None"));
12135         CHECK(LDKCOption_SecretKeyZ_None_class != NULL);
12136         LDKCOption_SecretKeyZ_None_meth = (*env)->GetMethodID(env, LDKCOption_SecretKeyZ_None_class, "<init>", "()V");
12137         CHECK(LDKCOption_SecretKeyZ_None_meth != NULL);
12138 }
12139 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1SecretKeyZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
12140         LDKCOption_SecretKeyZ *obj = (LDKCOption_SecretKeyZ*)untag_ptr(ptr);
12141         switch(obj->tag) {
12142                 case LDKCOption_SecretKeyZ_Some: {
12143                         int8_tArray some_arr = (*env)->NewByteArray(env, 32);
12144                         (*env)->SetByteArrayRegion(env, some_arr, 0, 32, obj->some.bytes);
12145                         return (*env)->NewObject(env, LDKCOption_SecretKeyZ_Some_class, LDKCOption_SecretKeyZ_Some_meth, some_arr);
12146                 }
12147                 case LDKCOption_SecretKeyZ_None: {
12148                         return (*env)->NewObject(env, LDKCOption_SecretKeyZ_None_class, LDKCOption_SecretKeyZ_None_meth);
12149                 }
12150                 default: abort();
12151         }
12152 }
12153 static inline struct LDKInvoiceWithExplicitSigningPubkeyBuilder CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ_get_ok(LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ *NONNULL_PTR owner){
12154         LDKInvoiceWithExplicitSigningPubkeyBuilder ret = *owner->contents.result;
12155         ret.is_owned = false;
12156         return ret;
12157 }
12158 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
12159         LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ* owner_conv = (LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ*)untag_ptr(owner);
12160         LDKInvoiceWithExplicitSigningPubkeyBuilder ret_var = CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ_get_ok(owner_conv);
12161         int64_t ret_ref = 0;
12162         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12163         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12164         return ret_ref;
12165 }
12166
12167 static inline enum LDKBolt12SemanticError CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ_get_err(LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ *NONNULL_PTR owner){
12168 CHECK(!owner->result_ok);
12169         return Bolt12SemanticError_clone(&*owner->contents.err);
12170 }
12171 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
12172         LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ* owner_conv = (LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ*)untag_ptr(owner);
12173         jclass ret_conv = LDKBolt12SemanticError_to_java(env, CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ_get_err(owner_conv));
12174         return ret_conv;
12175 }
12176
12177 static inline struct LDKVerifiedInvoiceRequest CResult_VerifiedInvoiceRequestNoneZ_get_ok(LDKCResult_VerifiedInvoiceRequestNoneZ *NONNULL_PTR owner){
12178         LDKVerifiedInvoiceRequest ret = *owner->contents.result;
12179         ret.is_owned = false;
12180         return ret;
12181 }
12182 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1VerifiedInvoiceRequestNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
12183         LDKCResult_VerifiedInvoiceRequestNoneZ* owner_conv = (LDKCResult_VerifiedInvoiceRequestNoneZ*)untag_ptr(owner);
12184         LDKVerifiedInvoiceRequest ret_var = CResult_VerifiedInvoiceRequestNoneZ_get_ok(owner_conv);
12185         int64_t ret_ref = 0;
12186         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12187         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12188         return ret_ref;
12189 }
12190
12191 static inline void CResult_VerifiedInvoiceRequestNoneZ_get_err(LDKCResult_VerifiedInvoiceRequestNoneZ *NONNULL_PTR owner){
12192 CHECK(!owner->result_ok);
12193         return *owner->contents.err;
12194 }
12195 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1VerifiedInvoiceRequestNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
12196         LDKCResult_VerifiedInvoiceRequestNoneZ* owner_conv = (LDKCResult_VerifiedInvoiceRequestNoneZ*)untag_ptr(owner);
12197         CResult_VerifiedInvoiceRequestNoneZ_get_err(owner_conv);
12198 }
12199
12200 static inline struct LDKInvoiceWithDerivedSigningPubkeyBuilder CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ_get_ok(LDKCResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ *NONNULL_PTR owner){
12201         LDKInvoiceWithDerivedSigningPubkeyBuilder ret = *owner->contents.result;
12202         ret.is_owned = false;
12203         return ret;
12204 }
12205 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
12206         LDKCResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ* owner_conv = (LDKCResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ*)untag_ptr(owner);
12207         LDKInvoiceWithDerivedSigningPubkeyBuilder ret_var = CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ_get_ok(owner_conv);
12208         int64_t ret_ref = 0;
12209         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12210         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12211         return ret_ref;
12212 }
12213
12214 static inline enum LDKBolt12SemanticError CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ_get_err(LDKCResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ *NONNULL_PTR owner){
12215 CHECK(!owner->result_ok);
12216         return Bolt12SemanticError_clone(&*owner->contents.err);
12217 }
12218 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
12219         LDKCResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ* owner_conv = (LDKCResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ*)untag_ptr(owner);
12220         jclass ret_conv = LDKBolt12SemanticError_to_java(env, CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ_get_err(owner_conv));
12221         return ret_conv;
12222 }
12223
12224 static inline struct LDKInvoiceRequestFields CResult_InvoiceRequestFieldsDecodeErrorZ_get_ok(LDKCResult_InvoiceRequestFieldsDecodeErrorZ *NONNULL_PTR owner){
12225         LDKInvoiceRequestFields ret = *owner->contents.result;
12226         ret.is_owned = false;
12227         return ret;
12228 }
12229 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceRequestFieldsDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
12230         LDKCResult_InvoiceRequestFieldsDecodeErrorZ* owner_conv = (LDKCResult_InvoiceRequestFieldsDecodeErrorZ*)untag_ptr(owner);
12231         LDKInvoiceRequestFields ret_var = CResult_InvoiceRequestFieldsDecodeErrorZ_get_ok(owner_conv);
12232         int64_t ret_ref = 0;
12233         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12234         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12235         return ret_ref;
12236 }
12237
12238 static inline struct LDKDecodeError CResult_InvoiceRequestFieldsDecodeErrorZ_get_err(LDKCResult_InvoiceRequestFieldsDecodeErrorZ *NONNULL_PTR owner){
12239 CHECK(!owner->result_ok);
12240         return DecodeError_clone(&*owner->contents.err);
12241 }
12242 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceRequestFieldsDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
12243         LDKCResult_InvoiceRequestFieldsDecodeErrorZ* owner_conv = (LDKCResult_InvoiceRequestFieldsDecodeErrorZ*)untag_ptr(owner);
12244         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12245         *ret_copy = CResult_InvoiceRequestFieldsDecodeErrorZ_get_err(owner_conv);
12246         int64_t ret_ref = tag_ptr(ret_copy, true);
12247         return ret_ref;
12248 }
12249
12250 static inline LDKCVec_WitnessZ CVec_WitnessZ_clone(const LDKCVec_WitnessZ *orig) {
12251         LDKCVec_WitnessZ ret = { .data = MALLOC(sizeof(LDKWitness) * orig->datalen, "LDKCVec_WitnessZ clone bytes"), .datalen = orig->datalen };
12252         for (size_t i = 0; i < ret.datalen; i++) {
12253                 ret.data[i] = Witness_clone(&orig->data[i]);
12254         }
12255         return ret;
12256 }
12257 static jclass LDKCOption_ECDSASignatureZ_Some_class = NULL;
12258 static jmethodID LDKCOption_ECDSASignatureZ_Some_meth = NULL;
12259 static jclass LDKCOption_ECDSASignatureZ_None_class = NULL;
12260 static jmethodID LDKCOption_ECDSASignatureZ_None_meth = NULL;
12261 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1ECDSASignatureZ_init (JNIEnv *env, jclass clz) {
12262         LDKCOption_ECDSASignatureZ_Some_class =
12263                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_ECDSASignatureZ$Some"));
12264         CHECK(LDKCOption_ECDSASignatureZ_Some_class != NULL);
12265         LDKCOption_ECDSASignatureZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_ECDSASignatureZ_Some_class, "<init>", "([B)V");
12266         CHECK(LDKCOption_ECDSASignatureZ_Some_meth != NULL);
12267         LDKCOption_ECDSASignatureZ_None_class =
12268                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_ECDSASignatureZ$None"));
12269         CHECK(LDKCOption_ECDSASignatureZ_None_class != NULL);
12270         LDKCOption_ECDSASignatureZ_None_meth = (*env)->GetMethodID(env, LDKCOption_ECDSASignatureZ_None_class, "<init>", "()V");
12271         CHECK(LDKCOption_ECDSASignatureZ_None_meth != NULL);
12272 }
12273 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1ECDSASignatureZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
12274         LDKCOption_ECDSASignatureZ *obj = (LDKCOption_ECDSASignatureZ*)untag_ptr(ptr);
12275         switch(obj->tag) {
12276                 case LDKCOption_ECDSASignatureZ_Some: {
12277                         int8_tArray some_arr = (*env)->NewByteArray(env, 64);
12278                         (*env)->SetByteArrayRegion(env, some_arr, 0, 64, obj->some.compact_form);
12279                         return (*env)->NewObject(env, LDKCOption_ECDSASignatureZ_Some_class, LDKCOption_ECDSASignatureZ_Some_meth, some_arr);
12280                 }
12281                 case LDKCOption_ECDSASignatureZ_None: {
12282                         return (*env)->NewObject(env, LDKCOption_ECDSASignatureZ_None_class, LDKCOption_ECDSASignatureZ_None_meth);
12283                 }
12284                 default: abort();
12285         }
12286 }
12287 static jclass LDKCOption_i64Z_Some_class = NULL;
12288 static jmethodID LDKCOption_i64Z_Some_meth = NULL;
12289 static jclass LDKCOption_i64Z_None_class = NULL;
12290 static jmethodID LDKCOption_i64Z_None_meth = NULL;
12291 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1i64Z_init (JNIEnv *env, jclass clz) {
12292         LDKCOption_i64Z_Some_class =
12293                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_i64Z$Some"));
12294         CHECK(LDKCOption_i64Z_Some_class != NULL);
12295         LDKCOption_i64Z_Some_meth = (*env)->GetMethodID(env, LDKCOption_i64Z_Some_class, "<init>", "(J)V");
12296         CHECK(LDKCOption_i64Z_Some_meth != NULL);
12297         LDKCOption_i64Z_None_class =
12298                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_i64Z$None"));
12299         CHECK(LDKCOption_i64Z_None_class != NULL);
12300         LDKCOption_i64Z_None_meth = (*env)->GetMethodID(env, LDKCOption_i64Z_None_class, "<init>", "()V");
12301         CHECK(LDKCOption_i64Z_None_meth != NULL);
12302 }
12303 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1i64Z_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
12304         LDKCOption_i64Z *obj = (LDKCOption_i64Z*)untag_ptr(ptr);
12305         switch(obj->tag) {
12306                 case LDKCOption_i64Z_Some: {
12307                         int64_t some_conv = obj->some;
12308                         return (*env)->NewObject(env, LDKCOption_i64Z_Some_class, LDKCOption_i64Z_Some_meth, some_conv);
12309                 }
12310                 case LDKCOption_i64Z_None: {
12311                         return (*env)->NewObject(env, LDKCOption_i64Z_None_class, LDKCOption_i64Z_None_meth);
12312                 }
12313                 default: abort();
12314         }
12315 }
12316 static inline struct LDKSocketAddress CResult_SocketAddressDecodeErrorZ_get_ok(LDKCResult_SocketAddressDecodeErrorZ *NONNULL_PTR owner){
12317 CHECK(owner->result_ok);
12318         return SocketAddress_clone(&*owner->contents.result);
12319 }
12320 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SocketAddressDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
12321         LDKCResult_SocketAddressDecodeErrorZ* owner_conv = (LDKCResult_SocketAddressDecodeErrorZ*)untag_ptr(owner);
12322         LDKSocketAddress *ret_copy = MALLOC(sizeof(LDKSocketAddress), "LDKSocketAddress");
12323         *ret_copy = CResult_SocketAddressDecodeErrorZ_get_ok(owner_conv);
12324         int64_t ret_ref = tag_ptr(ret_copy, true);
12325         return ret_ref;
12326 }
12327
12328 static inline struct LDKDecodeError CResult_SocketAddressDecodeErrorZ_get_err(LDKCResult_SocketAddressDecodeErrorZ *NONNULL_PTR owner){
12329 CHECK(!owner->result_ok);
12330         return DecodeError_clone(&*owner->contents.err);
12331 }
12332 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SocketAddressDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
12333         LDKCResult_SocketAddressDecodeErrorZ* owner_conv = (LDKCResult_SocketAddressDecodeErrorZ*)untag_ptr(owner);
12334         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12335         *ret_copy = CResult_SocketAddressDecodeErrorZ_get_err(owner_conv);
12336         int64_t ret_ref = tag_ptr(ret_copy, true);
12337         return ret_ref;
12338 }
12339
12340 static inline struct LDKSocketAddress CResult_SocketAddressSocketAddressParseErrorZ_get_ok(LDKCResult_SocketAddressSocketAddressParseErrorZ *NONNULL_PTR owner){
12341 CHECK(owner->result_ok);
12342         return SocketAddress_clone(&*owner->contents.result);
12343 }
12344 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SocketAddressSocketAddressParseErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
12345         LDKCResult_SocketAddressSocketAddressParseErrorZ* owner_conv = (LDKCResult_SocketAddressSocketAddressParseErrorZ*)untag_ptr(owner);
12346         LDKSocketAddress *ret_copy = MALLOC(sizeof(LDKSocketAddress), "LDKSocketAddress");
12347         *ret_copy = CResult_SocketAddressSocketAddressParseErrorZ_get_ok(owner_conv);
12348         int64_t ret_ref = tag_ptr(ret_copy, true);
12349         return ret_ref;
12350 }
12351
12352 static inline enum LDKSocketAddressParseError CResult_SocketAddressSocketAddressParseErrorZ_get_err(LDKCResult_SocketAddressSocketAddressParseErrorZ *NONNULL_PTR owner){
12353 CHECK(!owner->result_ok);
12354         return SocketAddressParseError_clone(&*owner->contents.err);
12355 }
12356 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1SocketAddressSocketAddressParseErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
12357         LDKCResult_SocketAddressSocketAddressParseErrorZ* owner_conv = (LDKCResult_SocketAddressSocketAddressParseErrorZ*)untag_ptr(owner);
12358         jclass ret_conv = LDKSocketAddressParseError_to_java(env, CResult_SocketAddressSocketAddressParseErrorZ_get_err(owner_conv));
12359         return ret_conv;
12360 }
12361
12362 static inline LDKCVec_UpdateAddHTLCZ CVec_UpdateAddHTLCZ_clone(const LDKCVec_UpdateAddHTLCZ *orig) {
12363         LDKCVec_UpdateAddHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateAddHTLC) * orig->datalen, "LDKCVec_UpdateAddHTLCZ clone bytes"), .datalen = orig->datalen };
12364         for (size_t i = 0; i < ret.datalen; i++) {
12365                 ret.data[i] = UpdateAddHTLC_clone(&orig->data[i]);
12366         }
12367         return ret;
12368 }
12369 static inline LDKCVec_UpdateFulfillHTLCZ CVec_UpdateFulfillHTLCZ_clone(const LDKCVec_UpdateFulfillHTLCZ *orig) {
12370         LDKCVec_UpdateFulfillHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFulfillHTLC) * orig->datalen, "LDKCVec_UpdateFulfillHTLCZ clone bytes"), .datalen = orig->datalen };
12371         for (size_t i = 0; i < ret.datalen; i++) {
12372                 ret.data[i] = UpdateFulfillHTLC_clone(&orig->data[i]);
12373         }
12374         return ret;
12375 }
12376 static inline LDKCVec_UpdateFailHTLCZ CVec_UpdateFailHTLCZ_clone(const LDKCVec_UpdateFailHTLCZ *orig) {
12377         LDKCVec_UpdateFailHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFailHTLC) * orig->datalen, "LDKCVec_UpdateFailHTLCZ clone bytes"), .datalen = orig->datalen };
12378         for (size_t i = 0; i < ret.datalen; i++) {
12379                 ret.data[i] = UpdateFailHTLC_clone(&orig->data[i]);
12380         }
12381         return ret;
12382 }
12383 static inline LDKCVec_UpdateFailMalformedHTLCZ CVec_UpdateFailMalformedHTLCZ_clone(const LDKCVec_UpdateFailMalformedHTLCZ *orig) {
12384         LDKCVec_UpdateFailMalformedHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFailMalformedHTLC) * orig->datalen, "LDKCVec_UpdateFailMalformedHTLCZ clone bytes"), .datalen = orig->datalen };
12385         for (size_t i = 0; i < ret.datalen; i++) {
12386                 ret.data[i] = UpdateFailMalformedHTLC_clone(&orig->data[i]);
12387         }
12388         return ret;
12389 }
12390 static inline struct LDKAcceptChannel CResult_AcceptChannelDecodeErrorZ_get_ok(LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR owner){
12391         LDKAcceptChannel ret = *owner->contents.result;
12392         ret.is_owned = false;
12393         return ret;
12394 }
12395 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
12396         LDKCResult_AcceptChannelDecodeErrorZ* owner_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)untag_ptr(owner);
12397         LDKAcceptChannel ret_var = CResult_AcceptChannelDecodeErrorZ_get_ok(owner_conv);
12398         int64_t ret_ref = 0;
12399         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12400         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12401         return ret_ref;
12402 }
12403
12404 static inline struct LDKDecodeError CResult_AcceptChannelDecodeErrorZ_get_err(LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR owner){
12405 CHECK(!owner->result_ok);
12406         return DecodeError_clone(&*owner->contents.err);
12407 }
12408 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
12409         LDKCResult_AcceptChannelDecodeErrorZ* owner_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)untag_ptr(owner);
12410         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12411         *ret_copy = CResult_AcceptChannelDecodeErrorZ_get_err(owner_conv);
12412         int64_t ret_ref = tag_ptr(ret_copy, true);
12413         return ret_ref;
12414 }
12415
12416 static inline struct LDKAcceptChannelV2 CResult_AcceptChannelV2DecodeErrorZ_get_ok(LDKCResult_AcceptChannelV2DecodeErrorZ *NONNULL_PTR owner){
12417         LDKAcceptChannelV2 ret = *owner->contents.result;
12418         ret.is_owned = false;
12419         return ret;
12420 }
12421 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelV2DecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
12422         LDKCResult_AcceptChannelV2DecodeErrorZ* owner_conv = (LDKCResult_AcceptChannelV2DecodeErrorZ*)untag_ptr(owner);
12423         LDKAcceptChannelV2 ret_var = CResult_AcceptChannelV2DecodeErrorZ_get_ok(owner_conv);
12424         int64_t ret_ref = 0;
12425         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12426         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12427         return ret_ref;
12428 }
12429
12430 static inline struct LDKDecodeError CResult_AcceptChannelV2DecodeErrorZ_get_err(LDKCResult_AcceptChannelV2DecodeErrorZ *NONNULL_PTR owner){
12431 CHECK(!owner->result_ok);
12432         return DecodeError_clone(&*owner->contents.err);
12433 }
12434 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelV2DecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
12435         LDKCResult_AcceptChannelV2DecodeErrorZ* owner_conv = (LDKCResult_AcceptChannelV2DecodeErrorZ*)untag_ptr(owner);
12436         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12437         *ret_copy = CResult_AcceptChannelV2DecodeErrorZ_get_err(owner_conv);
12438         int64_t ret_ref = tag_ptr(ret_copy, true);
12439         return ret_ref;
12440 }
12441
12442 static inline struct LDKStfu CResult_StfuDecodeErrorZ_get_ok(LDKCResult_StfuDecodeErrorZ *NONNULL_PTR owner){
12443         LDKStfu ret = *owner->contents.result;
12444         ret.is_owned = false;
12445         return ret;
12446 }
12447 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StfuDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
12448         LDKCResult_StfuDecodeErrorZ* owner_conv = (LDKCResult_StfuDecodeErrorZ*)untag_ptr(owner);
12449         LDKStfu ret_var = CResult_StfuDecodeErrorZ_get_ok(owner_conv);
12450         int64_t ret_ref = 0;
12451         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12452         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12453         return ret_ref;
12454 }
12455
12456 static inline struct LDKDecodeError CResult_StfuDecodeErrorZ_get_err(LDKCResult_StfuDecodeErrorZ *NONNULL_PTR owner){
12457 CHECK(!owner->result_ok);
12458         return DecodeError_clone(&*owner->contents.err);
12459 }
12460 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StfuDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
12461         LDKCResult_StfuDecodeErrorZ* owner_conv = (LDKCResult_StfuDecodeErrorZ*)untag_ptr(owner);
12462         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12463         *ret_copy = CResult_StfuDecodeErrorZ_get_err(owner_conv);
12464         int64_t ret_ref = tag_ptr(ret_copy, true);
12465         return ret_ref;
12466 }
12467
12468 static inline struct LDKSplice CResult_SpliceDecodeErrorZ_get_ok(LDKCResult_SpliceDecodeErrorZ *NONNULL_PTR owner){
12469         LDKSplice ret = *owner->contents.result;
12470         ret.is_owned = false;
12471         return ret;
12472 }
12473 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpliceDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
12474         LDKCResult_SpliceDecodeErrorZ* owner_conv = (LDKCResult_SpliceDecodeErrorZ*)untag_ptr(owner);
12475         LDKSplice ret_var = CResult_SpliceDecodeErrorZ_get_ok(owner_conv);
12476         int64_t ret_ref = 0;
12477         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12478         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12479         return ret_ref;
12480 }
12481
12482 static inline struct LDKDecodeError CResult_SpliceDecodeErrorZ_get_err(LDKCResult_SpliceDecodeErrorZ *NONNULL_PTR owner){
12483 CHECK(!owner->result_ok);
12484         return DecodeError_clone(&*owner->contents.err);
12485 }
12486 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpliceDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
12487         LDKCResult_SpliceDecodeErrorZ* owner_conv = (LDKCResult_SpliceDecodeErrorZ*)untag_ptr(owner);
12488         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12489         *ret_copy = CResult_SpliceDecodeErrorZ_get_err(owner_conv);
12490         int64_t ret_ref = tag_ptr(ret_copy, true);
12491         return ret_ref;
12492 }
12493
12494 static inline struct LDKSpliceAck CResult_SpliceAckDecodeErrorZ_get_ok(LDKCResult_SpliceAckDecodeErrorZ *NONNULL_PTR owner){
12495         LDKSpliceAck ret = *owner->contents.result;
12496         ret.is_owned = false;
12497         return ret;
12498 }
12499 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpliceAckDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
12500         LDKCResult_SpliceAckDecodeErrorZ* owner_conv = (LDKCResult_SpliceAckDecodeErrorZ*)untag_ptr(owner);
12501         LDKSpliceAck ret_var = CResult_SpliceAckDecodeErrorZ_get_ok(owner_conv);
12502         int64_t ret_ref = 0;
12503         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12504         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12505         return ret_ref;
12506 }
12507
12508 static inline struct LDKDecodeError CResult_SpliceAckDecodeErrorZ_get_err(LDKCResult_SpliceAckDecodeErrorZ *NONNULL_PTR owner){
12509 CHECK(!owner->result_ok);
12510         return DecodeError_clone(&*owner->contents.err);
12511 }
12512 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpliceAckDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
12513         LDKCResult_SpliceAckDecodeErrorZ* owner_conv = (LDKCResult_SpliceAckDecodeErrorZ*)untag_ptr(owner);
12514         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12515         *ret_copy = CResult_SpliceAckDecodeErrorZ_get_err(owner_conv);
12516         int64_t ret_ref = tag_ptr(ret_copy, true);
12517         return ret_ref;
12518 }
12519
12520 static inline struct LDKSpliceLocked CResult_SpliceLockedDecodeErrorZ_get_ok(LDKCResult_SpliceLockedDecodeErrorZ *NONNULL_PTR owner){
12521         LDKSpliceLocked ret = *owner->contents.result;
12522         ret.is_owned = false;
12523         return ret;
12524 }
12525 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpliceLockedDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
12526         LDKCResult_SpliceLockedDecodeErrorZ* owner_conv = (LDKCResult_SpliceLockedDecodeErrorZ*)untag_ptr(owner);
12527         LDKSpliceLocked ret_var = CResult_SpliceLockedDecodeErrorZ_get_ok(owner_conv);
12528         int64_t ret_ref = 0;
12529         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12530         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12531         return ret_ref;
12532 }
12533
12534 static inline struct LDKDecodeError CResult_SpliceLockedDecodeErrorZ_get_err(LDKCResult_SpliceLockedDecodeErrorZ *NONNULL_PTR owner){
12535 CHECK(!owner->result_ok);
12536         return DecodeError_clone(&*owner->contents.err);
12537 }
12538 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpliceLockedDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
12539         LDKCResult_SpliceLockedDecodeErrorZ* owner_conv = (LDKCResult_SpliceLockedDecodeErrorZ*)untag_ptr(owner);
12540         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12541         *ret_copy = CResult_SpliceLockedDecodeErrorZ_get_err(owner_conv);
12542         int64_t ret_ref = tag_ptr(ret_copy, true);
12543         return ret_ref;
12544 }
12545
12546 static inline struct LDKTxAddInput CResult_TxAddInputDecodeErrorZ_get_ok(LDKCResult_TxAddInputDecodeErrorZ *NONNULL_PTR owner){
12547         LDKTxAddInput ret = *owner->contents.result;
12548         ret.is_owned = false;
12549         return ret;
12550 }
12551 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAddInputDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
12552         LDKCResult_TxAddInputDecodeErrorZ* owner_conv = (LDKCResult_TxAddInputDecodeErrorZ*)untag_ptr(owner);
12553         LDKTxAddInput ret_var = CResult_TxAddInputDecodeErrorZ_get_ok(owner_conv);
12554         int64_t ret_ref = 0;
12555         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12556         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12557         return ret_ref;
12558 }
12559
12560 static inline struct LDKDecodeError CResult_TxAddInputDecodeErrorZ_get_err(LDKCResult_TxAddInputDecodeErrorZ *NONNULL_PTR owner){
12561 CHECK(!owner->result_ok);
12562         return DecodeError_clone(&*owner->contents.err);
12563 }
12564 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAddInputDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
12565         LDKCResult_TxAddInputDecodeErrorZ* owner_conv = (LDKCResult_TxAddInputDecodeErrorZ*)untag_ptr(owner);
12566         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12567         *ret_copy = CResult_TxAddInputDecodeErrorZ_get_err(owner_conv);
12568         int64_t ret_ref = tag_ptr(ret_copy, true);
12569         return ret_ref;
12570 }
12571
12572 static inline struct LDKTxAddOutput CResult_TxAddOutputDecodeErrorZ_get_ok(LDKCResult_TxAddOutputDecodeErrorZ *NONNULL_PTR owner){
12573         LDKTxAddOutput ret = *owner->contents.result;
12574         ret.is_owned = false;
12575         return ret;
12576 }
12577 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAddOutputDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
12578         LDKCResult_TxAddOutputDecodeErrorZ* owner_conv = (LDKCResult_TxAddOutputDecodeErrorZ*)untag_ptr(owner);
12579         LDKTxAddOutput ret_var = CResult_TxAddOutputDecodeErrorZ_get_ok(owner_conv);
12580         int64_t ret_ref = 0;
12581         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12582         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12583         return ret_ref;
12584 }
12585
12586 static inline struct LDKDecodeError CResult_TxAddOutputDecodeErrorZ_get_err(LDKCResult_TxAddOutputDecodeErrorZ *NONNULL_PTR owner){
12587 CHECK(!owner->result_ok);
12588         return DecodeError_clone(&*owner->contents.err);
12589 }
12590 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAddOutputDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
12591         LDKCResult_TxAddOutputDecodeErrorZ* owner_conv = (LDKCResult_TxAddOutputDecodeErrorZ*)untag_ptr(owner);
12592         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12593         *ret_copy = CResult_TxAddOutputDecodeErrorZ_get_err(owner_conv);
12594         int64_t ret_ref = tag_ptr(ret_copy, true);
12595         return ret_ref;
12596 }
12597
12598 static inline struct LDKTxRemoveInput CResult_TxRemoveInputDecodeErrorZ_get_ok(LDKCResult_TxRemoveInputDecodeErrorZ *NONNULL_PTR owner){
12599         LDKTxRemoveInput ret = *owner->contents.result;
12600         ret.is_owned = false;
12601         return ret;
12602 }
12603 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxRemoveInputDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
12604         LDKCResult_TxRemoveInputDecodeErrorZ* owner_conv = (LDKCResult_TxRemoveInputDecodeErrorZ*)untag_ptr(owner);
12605         LDKTxRemoveInput ret_var = CResult_TxRemoveInputDecodeErrorZ_get_ok(owner_conv);
12606         int64_t ret_ref = 0;
12607         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12608         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12609         return ret_ref;
12610 }
12611
12612 static inline struct LDKDecodeError CResult_TxRemoveInputDecodeErrorZ_get_err(LDKCResult_TxRemoveInputDecodeErrorZ *NONNULL_PTR owner){
12613 CHECK(!owner->result_ok);
12614         return DecodeError_clone(&*owner->contents.err);
12615 }
12616 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxRemoveInputDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
12617         LDKCResult_TxRemoveInputDecodeErrorZ* owner_conv = (LDKCResult_TxRemoveInputDecodeErrorZ*)untag_ptr(owner);
12618         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12619         *ret_copy = CResult_TxRemoveInputDecodeErrorZ_get_err(owner_conv);
12620         int64_t ret_ref = tag_ptr(ret_copy, true);
12621         return ret_ref;
12622 }
12623
12624 static inline struct LDKTxRemoveOutput CResult_TxRemoveOutputDecodeErrorZ_get_ok(LDKCResult_TxRemoveOutputDecodeErrorZ *NONNULL_PTR owner){
12625         LDKTxRemoveOutput ret = *owner->contents.result;
12626         ret.is_owned = false;
12627         return ret;
12628 }
12629 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxRemoveOutputDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
12630         LDKCResult_TxRemoveOutputDecodeErrorZ* owner_conv = (LDKCResult_TxRemoveOutputDecodeErrorZ*)untag_ptr(owner);
12631         LDKTxRemoveOutput ret_var = CResult_TxRemoveOutputDecodeErrorZ_get_ok(owner_conv);
12632         int64_t ret_ref = 0;
12633         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12634         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12635         return ret_ref;
12636 }
12637
12638 static inline struct LDKDecodeError CResult_TxRemoveOutputDecodeErrorZ_get_err(LDKCResult_TxRemoveOutputDecodeErrorZ *NONNULL_PTR owner){
12639 CHECK(!owner->result_ok);
12640         return DecodeError_clone(&*owner->contents.err);
12641 }
12642 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxRemoveOutputDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
12643         LDKCResult_TxRemoveOutputDecodeErrorZ* owner_conv = (LDKCResult_TxRemoveOutputDecodeErrorZ*)untag_ptr(owner);
12644         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12645         *ret_copy = CResult_TxRemoveOutputDecodeErrorZ_get_err(owner_conv);
12646         int64_t ret_ref = tag_ptr(ret_copy, true);
12647         return ret_ref;
12648 }
12649
12650 static inline struct LDKTxComplete CResult_TxCompleteDecodeErrorZ_get_ok(LDKCResult_TxCompleteDecodeErrorZ *NONNULL_PTR owner){
12651         LDKTxComplete ret = *owner->contents.result;
12652         ret.is_owned = false;
12653         return ret;
12654 }
12655 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCompleteDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
12656         LDKCResult_TxCompleteDecodeErrorZ* owner_conv = (LDKCResult_TxCompleteDecodeErrorZ*)untag_ptr(owner);
12657         LDKTxComplete ret_var = CResult_TxCompleteDecodeErrorZ_get_ok(owner_conv);
12658         int64_t ret_ref = 0;
12659         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12660         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12661         return ret_ref;
12662 }
12663
12664 static inline struct LDKDecodeError CResult_TxCompleteDecodeErrorZ_get_err(LDKCResult_TxCompleteDecodeErrorZ *NONNULL_PTR owner){
12665 CHECK(!owner->result_ok);
12666         return DecodeError_clone(&*owner->contents.err);
12667 }
12668 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCompleteDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
12669         LDKCResult_TxCompleteDecodeErrorZ* owner_conv = (LDKCResult_TxCompleteDecodeErrorZ*)untag_ptr(owner);
12670         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12671         *ret_copy = CResult_TxCompleteDecodeErrorZ_get_err(owner_conv);
12672         int64_t ret_ref = tag_ptr(ret_copy, true);
12673         return ret_ref;
12674 }
12675
12676 static inline struct LDKTxSignatures CResult_TxSignaturesDecodeErrorZ_get_ok(LDKCResult_TxSignaturesDecodeErrorZ *NONNULL_PTR owner){
12677         LDKTxSignatures ret = *owner->contents.result;
12678         ret.is_owned = false;
12679         return ret;
12680 }
12681 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxSignaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
12682         LDKCResult_TxSignaturesDecodeErrorZ* owner_conv = (LDKCResult_TxSignaturesDecodeErrorZ*)untag_ptr(owner);
12683         LDKTxSignatures ret_var = CResult_TxSignaturesDecodeErrorZ_get_ok(owner_conv);
12684         int64_t ret_ref = 0;
12685         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12686         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12687         return ret_ref;
12688 }
12689
12690 static inline struct LDKDecodeError CResult_TxSignaturesDecodeErrorZ_get_err(LDKCResult_TxSignaturesDecodeErrorZ *NONNULL_PTR owner){
12691 CHECK(!owner->result_ok);
12692         return DecodeError_clone(&*owner->contents.err);
12693 }
12694 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxSignaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
12695         LDKCResult_TxSignaturesDecodeErrorZ* owner_conv = (LDKCResult_TxSignaturesDecodeErrorZ*)untag_ptr(owner);
12696         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12697         *ret_copy = CResult_TxSignaturesDecodeErrorZ_get_err(owner_conv);
12698         int64_t ret_ref = tag_ptr(ret_copy, true);
12699         return ret_ref;
12700 }
12701
12702 static inline struct LDKTxInitRbf CResult_TxInitRbfDecodeErrorZ_get_ok(LDKCResult_TxInitRbfDecodeErrorZ *NONNULL_PTR owner){
12703         LDKTxInitRbf ret = *owner->contents.result;
12704         ret.is_owned = false;
12705         return ret;
12706 }
12707 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxInitRbfDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
12708         LDKCResult_TxInitRbfDecodeErrorZ* owner_conv = (LDKCResult_TxInitRbfDecodeErrorZ*)untag_ptr(owner);
12709         LDKTxInitRbf ret_var = CResult_TxInitRbfDecodeErrorZ_get_ok(owner_conv);
12710         int64_t ret_ref = 0;
12711         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12712         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12713         return ret_ref;
12714 }
12715
12716 static inline struct LDKDecodeError CResult_TxInitRbfDecodeErrorZ_get_err(LDKCResult_TxInitRbfDecodeErrorZ *NONNULL_PTR owner){
12717 CHECK(!owner->result_ok);
12718         return DecodeError_clone(&*owner->contents.err);
12719 }
12720 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxInitRbfDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
12721         LDKCResult_TxInitRbfDecodeErrorZ* owner_conv = (LDKCResult_TxInitRbfDecodeErrorZ*)untag_ptr(owner);
12722         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12723         *ret_copy = CResult_TxInitRbfDecodeErrorZ_get_err(owner_conv);
12724         int64_t ret_ref = tag_ptr(ret_copy, true);
12725         return ret_ref;
12726 }
12727
12728 static inline struct LDKTxAckRbf CResult_TxAckRbfDecodeErrorZ_get_ok(LDKCResult_TxAckRbfDecodeErrorZ *NONNULL_PTR owner){
12729         LDKTxAckRbf ret = *owner->contents.result;
12730         ret.is_owned = false;
12731         return ret;
12732 }
12733 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAckRbfDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
12734         LDKCResult_TxAckRbfDecodeErrorZ* owner_conv = (LDKCResult_TxAckRbfDecodeErrorZ*)untag_ptr(owner);
12735         LDKTxAckRbf ret_var = CResult_TxAckRbfDecodeErrorZ_get_ok(owner_conv);
12736         int64_t ret_ref = 0;
12737         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12738         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12739         return ret_ref;
12740 }
12741
12742 static inline struct LDKDecodeError CResult_TxAckRbfDecodeErrorZ_get_err(LDKCResult_TxAckRbfDecodeErrorZ *NONNULL_PTR owner){
12743 CHECK(!owner->result_ok);
12744         return DecodeError_clone(&*owner->contents.err);
12745 }
12746 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAckRbfDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
12747         LDKCResult_TxAckRbfDecodeErrorZ* owner_conv = (LDKCResult_TxAckRbfDecodeErrorZ*)untag_ptr(owner);
12748         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12749         *ret_copy = CResult_TxAckRbfDecodeErrorZ_get_err(owner_conv);
12750         int64_t ret_ref = tag_ptr(ret_copy, true);
12751         return ret_ref;
12752 }
12753
12754 static inline struct LDKTxAbort CResult_TxAbortDecodeErrorZ_get_ok(LDKCResult_TxAbortDecodeErrorZ *NONNULL_PTR owner){
12755         LDKTxAbort ret = *owner->contents.result;
12756         ret.is_owned = false;
12757         return ret;
12758 }
12759 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAbortDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
12760         LDKCResult_TxAbortDecodeErrorZ* owner_conv = (LDKCResult_TxAbortDecodeErrorZ*)untag_ptr(owner);
12761         LDKTxAbort ret_var = CResult_TxAbortDecodeErrorZ_get_ok(owner_conv);
12762         int64_t ret_ref = 0;
12763         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12764         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12765         return ret_ref;
12766 }
12767
12768 static inline struct LDKDecodeError CResult_TxAbortDecodeErrorZ_get_err(LDKCResult_TxAbortDecodeErrorZ *NONNULL_PTR owner){
12769 CHECK(!owner->result_ok);
12770         return DecodeError_clone(&*owner->contents.err);
12771 }
12772 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAbortDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
12773         LDKCResult_TxAbortDecodeErrorZ* owner_conv = (LDKCResult_TxAbortDecodeErrorZ*)untag_ptr(owner);
12774         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12775         *ret_copy = CResult_TxAbortDecodeErrorZ_get_err(owner_conv);
12776         int64_t ret_ref = tag_ptr(ret_copy, true);
12777         return ret_ref;
12778 }
12779
12780 static inline struct LDKAnnouncementSignatures CResult_AnnouncementSignaturesDecodeErrorZ_get_ok(LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR owner){
12781         LDKAnnouncementSignatures ret = *owner->contents.result;
12782         ret.is_owned = false;
12783         return ret;
12784 }
12785 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
12786         LDKCResult_AnnouncementSignaturesDecodeErrorZ* owner_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)untag_ptr(owner);
12787         LDKAnnouncementSignatures ret_var = CResult_AnnouncementSignaturesDecodeErrorZ_get_ok(owner_conv);
12788         int64_t ret_ref = 0;
12789         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12790         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12791         return ret_ref;
12792 }
12793
12794 static inline struct LDKDecodeError CResult_AnnouncementSignaturesDecodeErrorZ_get_err(LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR owner){
12795 CHECK(!owner->result_ok);
12796         return DecodeError_clone(&*owner->contents.err);
12797 }
12798 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
12799         LDKCResult_AnnouncementSignaturesDecodeErrorZ* owner_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)untag_ptr(owner);
12800         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12801         *ret_copy = CResult_AnnouncementSignaturesDecodeErrorZ_get_err(owner_conv);
12802         int64_t ret_ref = tag_ptr(ret_copy, true);
12803         return ret_ref;
12804 }
12805
12806 static inline struct LDKChannelReestablish CResult_ChannelReestablishDecodeErrorZ_get_ok(LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR owner){
12807         LDKChannelReestablish ret = *owner->contents.result;
12808         ret.is_owned = false;
12809         return ret;
12810 }
12811 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
12812         LDKCResult_ChannelReestablishDecodeErrorZ* owner_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)untag_ptr(owner);
12813         LDKChannelReestablish ret_var = CResult_ChannelReestablishDecodeErrorZ_get_ok(owner_conv);
12814         int64_t ret_ref = 0;
12815         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12816         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12817         return ret_ref;
12818 }
12819
12820 static inline struct LDKDecodeError CResult_ChannelReestablishDecodeErrorZ_get_err(LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR owner){
12821 CHECK(!owner->result_ok);
12822         return DecodeError_clone(&*owner->contents.err);
12823 }
12824 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
12825         LDKCResult_ChannelReestablishDecodeErrorZ* owner_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)untag_ptr(owner);
12826         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12827         *ret_copy = CResult_ChannelReestablishDecodeErrorZ_get_err(owner_conv);
12828         int64_t ret_ref = tag_ptr(ret_copy, true);
12829         return ret_ref;
12830 }
12831
12832 static inline struct LDKClosingSigned CResult_ClosingSignedDecodeErrorZ_get_ok(LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR owner){
12833         LDKClosingSigned ret = *owner->contents.result;
12834         ret.is_owned = false;
12835         return ret;
12836 }
12837 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
12838         LDKCResult_ClosingSignedDecodeErrorZ* owner_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)untag_ptr(owner);
12839         LDKClosingSigned ret_var = CResult_ClosingSignedDecodeErrorZ_get_ok(owner_conv);
12840         int64_t ret_ref = 0;
12841         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12842         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12843         return ret_ref;
12844 }
12845
12846 static inline struct LDKDecodeError CResult_ClosingSignedDecodeErrorZ_get_err(LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR owner){
12847 CHECK(!owner->result_ok);
12848         return DecodeError_clone(&*owner->contents.err);
12849 }
12850 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
12851         LDKCResult_ClosingSignedDecodeErrorZ* owner_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)untag_ptr(owner);
12852         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12853         *ret_copy = CResult_ClosingSignedDecodeErrorZ_get_err(owner_conv);
12854         int64_t ret_ref = tag_ptr(ret_copy, true);
12855         return ret_ref;
12856 }
12857
12858 static inline struct LDKClosingSignedFeeRange CResult_ClosingSignedFeeRangeDecodeErrorZ_get_ok(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *NONNULL_PTR owner){
12859         LDKClosingSignedFeeRange ret = *owner->contents.result;
12860         ret.is_owned = false;
12861         return ret;
12862 }
12863 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedFeeRangeDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
12864         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* owner_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)untag_ptr(owner);
12865         LDKClosingSignedFeeRange ret_var = CResult_ClosingSignedFeeRangeDecodeErrorZ_get_ok(owner_conv);
12866         int64_t ret_ref = 0;
12867         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12868         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12869         return ret_ref;
12870 }
12871
12872 static inline struct LDKDecodeError CResult_ClosingSignedFeeRangeDecodeErrorZ_get_err(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *NONNULL_PTR owner){
12873 CHECK(!owner->result_ok);
12874         return DecodeError_clone(&*owner->contents.err);
12875 }
12876 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedFeeRangeDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
12877         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* owner_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)untag_ptr(owner);
12878         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12879         *ret_copy = CResult_ClosingSignedFeeRangeDecodeErrorZ_get_err(owner_conv);
12880         int64_t ret_ref = tag_ptr(ret_copy, true);
12881         return ret_ref;
12882 }
12883
12884 static inline struct LDKCommitmentSigned CResult_CommitmentSignedDecodeErrorZ_get_ok(LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR owner){
12885         LDKCommitmentSigned ret = *owner->contents.result;
12886         ret.is_owned = false;
12887         return ret;
12888 }
12889 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
12890         LDKCResult_CommitmentSignedDecodeErrorZ* owner_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)untag_ptr(owner);
12891         LDKCommitmentSigned ret_var = CResult_CommitmentSignedDecodeErrorZ_get_ok(owner_conv);
12892         int64_t ret_ref = 0;
12893         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12894         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12895         return ret_ref;
12896 }
12897
12898 static inline struct LDKDecodeError CResult_CommitmentSignedDecodeErrorZ_get_err(LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR owner){
12899 CHECK(!owner->result_ok);
12900         return DecodeError_clone(&*owner->contents.err);
12901 }
12902 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
12903         LDKCResult_CommitmentSignedDecodeErrorZ* owner_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)untag_ptr(owner);
12904         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12905         *ret_copy = CResult_CommitmentSignedDecodeErrorZ_get_err(owner_conv);
12906         int64_t ret_ref = tag_ptr(ret_copy, true);
12907         return ret_ref;
12908 }
12909
12910 static inline struct LDKFundingCreated CResult_FundingCreatedDecodeErrorZ_get_ok(LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR owner){
12911         LDKFundingCreated ret = *owner->contents.result;
12912         ret.is_owned = false;
12913         return ret;
12914 }
12915 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
12916         LDKCResult_FundingCreatedDecodeErrorZ* owner_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)untag_ptr(owner);
12917         LDKFundingCreated ret_var = CResult_FundingCreatedDecodeErrorZ_get_ok(owner_conv);
12918         int64_t ret_ref = 0;
12919         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12920         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12921         return ret_ref;
12922 }
12923
12924 static inline struct LDKDecodeError CResult_FundingCreatedDecodeErrorZ_get_err(LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR owner){
12925 CHECK(!owner->result_ok);
12926         return DecodeError_clone(&*owner->contents.err);
12927 }
12928 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
12929         LDKCResult_FundingCreatedDecodeErrorZ* owner_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)untag_ptr(owner);
12930         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12931         *ret_copy = CResult_FundingCreatedDecodeErrorZ_get_err(owner_conv);
12932         int64_t ret_ref = tag_ptr(ret_copy, true);
12933         return ret_ref;
12934 }
12935
12936 static inline struct LDKFundingSigned CResult_FundingSignedDecodeErrorZ_get_ok(LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR owner){
12937         LDKFundingSigned ret = *owner->contents.result;
12938         ret.is_owned = false;
12939         return ret;
12940 }
12941 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
12942         LDKCResult_FundingSignedDecodeErrorZ* owner_conv = (LDKCResult_FundingSignedDecodeErrorZ*)untag_ptr(owner);
12943         LDKFundingSigned ret_var = CResult_FundingSignedDecodeErrorZ_get_ok(owner_conv);
12944         int64_t ret_ref = 0;
12945         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12946         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12947         return ret_ref;
12948 }
12949
12950 static inline struct LDKDecodeError CResult_FundingSignedDecodeErrorZ_get_err(LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR owner){
12951 CHECK(!owner->result_ok);
12952         return DecodeError_clone(&*owner->contents.err);
12953 }
12954 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
12955         LDKCResult_FundingSignedDecodeErrorZ* owner_conv = (LDKCResult_FundingSignedDecodeErrorZ*)untag_ptr(owner);
12956         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12957         *ret_copy = CResult_FundingSignedDecodeErrorZ_get_err(owner_conv);
12958         int64_t ret_ref = tag_ptr(ret_copy, true);
12959         return ret_ref;
12960 }
12961
12962 static inline struct LDKChannelReady CResult_ChannelReadyDecodeErrorZ_get_ok(LDKCResult_ChannelReadyDecodeErrorZ *NONNULL_PTR owner){
12963         LDKChannelReady ret = *owner->contents.result;
12964         ret.is_owned = false;
12965         return ret;
12966 }
12967 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReadyDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
12968         LDKCResult_ChannelReadyDecodeErrorZ* owner_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)untag_ptr(owner);
12969         LDKChannelReady ret_var = CResult_ChannelReadyDecodeErrorZ_get_ok(owner_conv);
12970         int64_t ret_ref = 0;
12971         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12972         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12973         return ret_ref;
12974 }
12975
12976 static inline struct LDKDecodeError CResult_ChannelReadyDecodeErrorZ_get_err(LDKCResult_ChannelReadyDecodeErrorZ *NONNULL_PTR owner){
12977 CHECK(!owner->result_ok);
12978         return DecodeError_clone(&*owner->contents.err);
12979 }
12980 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReadyDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
12981         LDKCResult_ChannelReadyDecodeErrorZ* owner_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)untag_ptr(owner);
12982         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
12983         *ret_copy = CResult_ChannelReadyDecodeErrorZ_get_err(owner_conv);
12984         int64_t ret_ref = tag_ptr(ret_copy, true);
12985         return ret_ref;
12986 }
12987
12988 static inline struct LDKInit CResult_InitDecodeErrorZ_get_ok(LDKCResult_InitDecodeErrorZ *NONNULL_PTR owner){
12989         LDKInit ret = *owner->contents.result;
12990         ret.is_owned = false;
12991         return ret;
12992 }
12993 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
12994         LDKCResult_InitDecodeErrorZ* owner_conv = (LDKCResult_InitDecodeErrorZ*)untag_ptr(owner);
12995         LDKInit ret_var = CResult_InitDecodeErrorZ_get_ok(owner_conv);
12996         int64_t ret_ref = 0;
12997         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
12998         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
12999         return ret_ref;
13000 }
13001
13002 static inline struct LDKDecodeError CResult_InitDecodeErrorZ_get_err(LDKCResult_InitDecodeErrorZ *NONNULL_PTR owner){
13003 CHECK(!owner->result_ok);
13004         return DecodeError_clone(&*owner->contents.err);
13005 }
13006 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
13007         LDKCResult_InitDecodeErrorZ* owner_conv = (LDKCResult_InitDecodeErrorZ*)untag_ptr(owner);
13008         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
13009         *ret_copy = CResult_InitDecodeErrorZ_get_err(owner_conv);
13010         int64_t ret_ref = tag_ptr(ret_copy, true);
13011         return ret_ref;
13012 }
13013
13014 static inline struct LDKOpenChannel CResult_OpenChannelDecodeErrorZ_get_ok(LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR owner){
13015         LDKOpenChannel ret = *owner->contents.result;
13016         ret.is_owned = false;
13017         return ret;
13018 }
13019 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
13020         LDKCResult_OpenChannelDecodeErrorZ* owner_conv = (LDKCResult_OpenChannelDecodeErrorZ*)untag_ptr(owner);
13021         LDKOpenChannel ret_var = CResult_OpenChannelDecodeErrorZ_get_ok(owner_conv);
13022         int64_t ret_ref = 0;
13023         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13024         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13025         return ret_ref;
13026 }
13027
13028 static inline struct LDKDecodeError CResult_OpenChannelDecodeErrorZ_get_err(LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR owner){
13029 CHECK(!owner->result_ok);
13030         return DecodeError_clone(&*owner->contents.err);
13031 }
13032 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
13033         LDKCResult_OpenChannelDecodeErrorZ* owner_conv = (LDKCResult_OpenChannelDecodeErrorZ*)untag_ptr(owner);
13034         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
13035         *ret_copy = CResult_OpenChannelDecodeErrorZ_get_err(owner_conv);
13036         int64_t ret_ref = tag_ptr(ret_copy, true);
13037         return ret_ref;
13038 }
13039
13040 static inline struct LDKOpenChannelV2 CResult_OpenChannelV2DecodeErrorZ_get_ok(LDKCResult_OpenChannelV2DecodeErrorZ *NONNULL_PTR owner){
13041         LDKOpenChannelV2 ret = *owner->contents.result;
13042         ret.is_owned = false;
13043         return ret;
13044 }
13045 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelV2DecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
13046         LDKCResult_OpenChannelV2DecodeErrorZ* owner_conv = (LDKCResult_OpenChannelV2DecodeErrorZ*)untag_ptr(owner);
13047         LDKOpenChannelV2 ret_var = CResult_OpenChannelV2DecodeErrorZ_get_ok(owner_conv);
13048         int64_t ret_ref = 0;
13049         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13050         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13051         return ret_ref;
13052 }
13053
13054 static inline struct LDKDecodeError CResult_OpenChannelV2DecodeErrorZ_get_err(LDKCResult_OpenChannelV2DecodeErrorZ *NONNULL_PTR owner){
13055 CHECK(!owner->result_ok);
13056         return DecodeError_clone(&*owner->contents.err);
13057 }
13058 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelV2DecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
13059         LDKCResult_OpenChannelV2DecodeErrorZ* owner_conv = (LDKCResult_OpenChannelV2DecodeErrorZ*)untag_ptr(owner);
13060         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
13061         *ret_copy = CResult_OpenChannelV2DecodeErrorZ_get_err(owner_conv);
13062         int64_t ret_ref = tag_ptr(ret_copy, true);
13063         return ret_ref;
13064 }
13065
13066 static inline struct LDKRevokeAndACK CResult_RevokeAndACKDecodeErrorZ_get_ok(LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR owner){
13067         LDKRevokeAndACK ret = *owner->contents.result;
13068         ret.is_owned = false;
13069         return ret;
13070 }
13071 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
13072         LDKCResult_RevokeAndACKDecodeErrorZ* owner_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)untag_ptr(owner);
13073         LDKRevokeAndACK ret_var = CResult_RevokeAndACKDecodeErrorZ_get_ok(owner_conv);
13074         int64_t ret_ref = 0;
13075         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13076         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13077         return ret_ref;
13078 }
13079
13080 static inline struct LDKDecodeError CResult_RevokeAndACKDecodeErrorZ_get_err(LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR owner){
13081 CHECK(!owner->result_ok);
13082         return DecodeError_clone(&*owner->contents.err);
13083 }
13084 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
13085         LDKCResult_RevokeAndACKDecodeErrorZ* owner_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)untag_ptr(owner);
13086         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
13087         *ret_copy = CResult_RevokeAndACKDecodeErrorZ_get_err(owner_conv);
13088         int64_t ret_ref = tag_ptr(ret_copy, true);
13089         return ret_ref;
13090 }
13091
13092 static inline struct LDKShutdown CResult_ShutdownDecodeErrorZ_get_ok(LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR owner){
13093         LDKShutdown ret = *owner->contents.result;
13094         ret.is_owned = false;
13095         return ret;
13096 }
13097 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
13098         LDKCResult_ShutdownDecodeErrorZ* owner_conv = (LDKCResult_ShutdownDecodeErrorZ*)untag_ptr(owner);
13099         LDKShutdown ret_var = CResult_ShutdownDecodeErrorZ_get_ok(owner_conv);
13100         int64_t ret_ref = 0;
13101         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13102         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13103         return ret_ref;
13104 }
13105
13106 static inline struct LDKDecodeError CResult_ShutdownDecodeErrorZ_get_err(LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR owner){
13107 CHECK(!owner->result_ok);
13108         return DecodeError_clone(&*owner->contents.err);
13109 }
13110 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
13111         LDKCResult_ShutdownDecodeErrorZ* owner_conv = (LDKCResult_ShutdownDecodeErrorZ*)untag_ptr(owner);
13112         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
13113         *ret_copy = CResult_ShutdownDecodeErrorZ_get_err(owner_conv);
13114         int64_t ret_ref = tag_ptr(ret_copy, true);
13115         return ret_ref;
13116 }
13117
13118 static inline struct LDKUpdateFailHTLC CResult_UpdateFailHTLCDecodeErrorZ_get_ok(LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR owner){
13119         LDKUpdateFailHTLC ret = *owner->contents.result;
13120         ret.is_owned = false;
13121         return ret;
13122 }
13123 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
13124         LDKCResult_UpdateFailHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)untag_ptr(owner);
13125         LDKUpdateFailHTLC ret_var = CResult_UpdateFailHTLCDecodeErrorZ_get_ok(owner_conv);
13126         int64_t ret_ref = 0;
13127         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13128         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13129         return ret_ref;
13130 }
13131
13132 static inline struct LDKDecodeError CResult_UpdateFailHTLCDecodeErrorZ_get_err(LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR owner){
13133 CHECK(!owner->result_ok);
13134         return DecodeError_clone(&*owner->contents.err);
13135 }
13136 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
13137         LDKCResult_UpdateFailHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)untag_ptr(owner);
13138         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
13139         *ret_copy = CResult_UpdateFailHTLCDecodeErrorZ_get_err(owner_conv);
13140         int64_t ret_ref = tag_ptr(ret_copy, true);
13141         return ret_ref;
13142 }
13143
13144 static inline struct LDKUpdateFailMalformedHTLC CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_ok(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR owner){
13145         LDKUpdateFailMalformedHTLC ret = *owner->contents.result;
13146         ret.is_owned = false;
13147         return ret;
13148 }
13149 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
13150         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)untag_ptr(owner);
13151         LDKUpdateFailMalformedHTLC ret_var = CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_ok(owner_conv);
13152         int64_t ret_ref = 0;
13153         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13154         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13155         return ret_ref;
13156 }
13157
13158 static inline struct LDKDecodeError CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_err(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR owner){
13159 CHECK(!owner->result_ok);
13160         return DecodeError_clone(&*owner->contents.err);
13161 }
13162 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
13163         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)untag_ptr(owner);
13164         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
13165         *ret_copy = CResult_UpdateFailMalformedHTLCDecodeErrorZ_get_err(owner_conv);
13166         int64_t ret_ref = tag_ptr(ret_copy, true);
13167         return ret_ref;
13168 }
13169
13170 static inline struct LDKUpdateFee CResult_UpdateFeeDecodeErrorZ_get_ok(LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR owner){
13171         LDKUpdateFee ret = *owner->contents.result;
13172         ret.is_owned = false;
13173         return ret;
13174 }
13175 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
13176         LDKCResult_UpdateFeeDecodeErrorZ* owner_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)untag_ptr(owner);
13177         LDKUpdateFee ret_var = CResult_UpdateFeeDecodeErrorZ_get_ok(owner_conv);
13178         int64_t ret_ref = 0;
13179         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13180         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13181         return ret_ref;
13182 }
13183
13184 static inline struct LDKDecodeError CResult_UpdateFeeDecodeErrorZ_get_err(LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR owner){
13185 CHECK(!owner->result_ok);
13186         return DecodeError_clone(&*owner->contents.err);
13187 }
13188 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
13189         LDKCResult_UpdateFeeDecodeErrorZ* owner_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)untag_ptr(owner);
13190         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
13191         *ret_copy = CResult_UpdateFeeDecodeErrorZ_get_err(owner_conv);
13192         int64_t ret_ref = tag_ptr(ret_copy, true);
13193         return ret_ref;
13194 }
13195
13196 static inline struct LDKUpdateFulfillHTLC CResult_UpdateFulfillHTLCDecodeErrorZ_get_ok(LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR owner){
13197         LDKUpdateFulfillHTLC ret = *owner->contents.result;
13198         ret.is_owned = false;
13199         return ret;
13200 }
13201 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
13202         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)untag_ptr(owner);
13203         LDKUpdateFulfillHTLC ret_var = CResult_UpdateFulfillHTLCDecodeErrorZ_get_ok(owner_conv);
13204         int64_t ret_ref = 0;
13205         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13206         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13207         return ret_ref;
13208 }
13209
13210 static inline struct LDKDecodeError CResult_UpdateFulfillHTLCDecodeErrorZ_get_err(LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR owner){
13211 CHECK(!owner->result_ok);
13212         return DecodeError_clone(&*owner->contents.err);
13213 }
13214 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
13215         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)untag_ptr(owner);
13216         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
13217         *ret_copy = CResult_UpdateFulfillHTLCDecodeErrorZ_get_err(owner_conv);
13218         int64_t ret_ref = tag_ptr(ret_copy, true);
13219         return ret_ref;
13220 }
13221
13222 static inline struct LDKOnionPacket CResult_OnionPacketDecodeErrorZ_get_ok(LDKCResult_OnionPacketDecodeErrorZ *NONNULL_PTR owner){
13223         LDKOnionPacket ret = *owner->contents.result;
13224         ret.is_owned = false;
13225         return ret;
13226 }
13227 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OnionPacketDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
13228         LDKCResult_OnionPacketDecodeErrorZ* owner_conv = (LDKCResult_OnionPacketDecodeErrorZ*)untag_ptr(owner);
13229         LDKOnionPacket ret_var = CResult_OnionPacketDecodeErrorZ_get_ok(owner_conv);
13230         int64_t ret_ref = 0;
13231         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13232         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13233         return ret_ref;
13234 }
13235
13236 static inline struct LDKDecodeError CResult_OnionPacketDecodeErrorZ_get_err(LDKCResult_OnionPacketDecodeErrorZ *NONNULL_PTR owner){
13237 CHECK(!owner->result_ok);
13238         return DecodeError_clone(&*owner->contents.err);
13239 }
13240 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OnionPacketDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
13241         LDKCResult_OnionPacketDecodeErrorZ* owner_conv = (LDKCResult_OnionPacketDecodeErrorZ*)untag_ptr(owner);
13242         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
13243         *ret_copy = CResult_OnionPacketDecodeErrorZ_get_err(owner_conv);
13244         int64_t ret_ref = tag_ptr(ret_copy, true);
13245         return ret_ref;
13246 }
13247
13248 static inline struct LDKUpdateAddHTLC CResult_UpdateAddHTLCDecodeErrorZ_get_ok(LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR owner){
13249         LDKUpdateAddHTLC ret = *owner->contents.result;
13250         ret.is_owned = false;
13251         return ret;
13252 }
13253 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
13254         LDKCResult_UpdateAddHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)untag_ptr(owner);
13255         LDKUpdateAddHTLC ret_var = CResult_UpdateAddHTLCDecodeErrorZ_get_ok(owner_conv);
13256         int64_t ret_ref = 0;
13257         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13258         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13259         return ret_ref;
13260 }
13261
13262 static inline struct LDKDecodeError CResult_UpdateAddHTLCDecodeErrorZ_get_err(LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR owner){
13263 CHECK(!owner->result_ok);
13264         return DecodeError_clone(&*owner->contents.err);
13265 }
13266 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
13267         LDKCResult_UpdateAddHTLCDecodeErrorZ* owner_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)untag_ptr(owner);
13268         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
13269         *ret_copy = CResult_UpdateAddHTLCDecodeErrorZ_get_err(owner_conv);
13270         int64_t ret_ref = tag_ptr(ret_copy, true);
13271         return ret_ref;
13272 }
13273
13274 static inline struct LDKOnionMessage CResult_OnionMessageDecodeErrorZ_get_ok(LDKCResult_OnionMessageDecodeErrorZ *NONNULL_PTR owner){
13275         LDKOnionMessage ret = *owner->contents.result;
13276         ret.is_owned = false;
13277         return ret;
13278 }
13279 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OnionMessageDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
13280         LDKCResult_OnionMessageDecodeErrorZ* owner_conv = (LDKCResult_OnionMessageDecodeErrorZ*)untag_ptr(owner);
13281         LDKOnionMessage ret_var = CResult_OnionMessageDecodeErrorZ_get_ok(owner_conv);
13282         int64_t ret_ref = 0;
13283         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13284         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13285         return ret_ref;
13286 }
13287
13288 static inline struct LDKDecodeError CResult_OnionMessageDecodeErrorZ_get_err(LDKCResult_OnionMessageDecodeErrorZ *NONNULL_PTR owner){
13289 CHECK(!owner->result_ok);
13290         return DecodeError_clone(&*owner->contents.err);
13291 }
13292 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OnionMessageDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
13293         LDKCResult_OnionMessageDecodeErrorZ* owner_conv = (LDKCResult_OnionMessageDecodeErrorZ*)untag_ptr(owner);
13294         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
13295         *ret_copy = CResult_OnionMessageDecodeErrorZ_get_err(owner_conv);
13296         int64_t ret_ref = tag_ptr(ret_copy, true);
13297         return ret_ref;
13298 }
13299
13300 static inline struct LDKFinalOnionHopData CResult_FinalOnionHopDataDecodeErrorZ_get_ok(LDKCResult_FinalOnionHopDataDecodeErrorZ *NONNULL_PTR owner){
13301         LDKFinalOnionHopData ret = *owner->contents.result;
13302         ret.is_owned = false;
13303         return ret;
13304 }
13305 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FinalOnionHopDataDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
13306         LDKCResult_FinalOnionHopDataDecodeErrorZ* owner_conv = (LDKCResult_FinalOnionHopDataDecodeErrorZ*)untag_ptr(owner);
13307         LDKFinalOnionHopData ret_var = CResult_FinalOnionHopDataDecodeErrorZ_get_ok(owner_conv);
13308         int64_t ret_ref = 0;
13309         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13310         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13311         return ret_ref;
13312 }
13313
13314 static inline struct LDKDecodeError CResult_FinalOnionHopDataDecodeErrorZ_get_err(LDKCResult_FinalOnionHopDataDecodeErrorZ *NONNULL_PTR owner){
13315 CHECK(!owner->result_ok);
13316         return DecodeError_clone(&*owner->contents.err);
13317 }
13318 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FinalOnionHopDataDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
13319         LDKCResult_FinalOnionHopDataDecodeErrorZ* owner_conv = (LDKCResult_FinalOnionHopDataDecodeErrorZ*)untag_ptr(owner);
13320         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
13321         *ret_copy = CResult_FinalOnionHopDataDecodeErrorZ_get_err(owner_conv);
13322         int64_t ret_ref = tag_ptr(ret_copy, true);
13323         return ret_ref;
13324 }
13325
13326 static inline struct LDKPing CResult_PingDecodeErrorZ_get_ok(LDKCResult_PingDecodeErrorZ *NONNULL_PTR owner){
13327         LDKPing ret = *owner->contents.result;
13328         ret.is_owned = false;
13329         return ret;
13330 }
13331 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
13332         LDKCResult_PingDecodeErrorZ* owner_conv = (LDKCResult_PingDecodeErrorZ*)untag_ptr(owner);
13333         LDKPing ret_var = CResult_PingDecodeErrorZ_get_ok(owner_conv);
13334         int64_t ret_ref = 0;
13335         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13336         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13337         return ret_ref;
13338 }
13339
13340 static inline struct LDKDecodeError CResult_PingDecodeErrorZ_get_err(LDKCResult_PingDecodeErrorZ *NONNULL_PTR owner){
13341 CHECK(!owner->result_ok);
13342         return DecodeError_clone(&*owner->contents.err);
13343 }
13344 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
13345         LDKCResult_PingDecodeErrorZ* owner_conv = (LDKCResult_PingDecodeErrorZ*)untag_ptr(owner);
13346         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
13347         *ret_copy = CResult_PingDecodeErrorZ_get_err(owner_conv);
13348         int64_t ret_ref = tag_ptr(ret_copy, true);
13349         return ret_ref;
13350 }
13351
13352 static inline struct LDKPong CResult_PongDecodeErrorZ_get_ok(LDKCResult_PongDecodeErrorZ *NONNULL_PTR owner){
13353         LDKPong ret = *owner->contents.result;
13354         ret.is_owned = false;
13355         return ret;
13356 }
13357 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
13358         LDKCResult_PongDecodeErrorZ* owner_conv = (LDKCResult_PongDecodeErrorZ*)untag_ptr(owner);
13359         LDKPong ret_var = CResult_PongDecodeErrorZ_get_ok(owner_conv);
13360         int64_t ret_ref = 0;
13361         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13362         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13363         return ret_ref;
13364 }
13365
13366 static inline struct LDKDecodeError CResult_PongDecodeErrorZ_get_err(LDKCResult_PongDecodeErrorZ *NONNULL_PTR owner){
13367 CHECK(!owner->result_ok);
13368         return DecodeError_clone(&*owner->contents.err);
13369 }
13370 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
13371         LDKCResult_PongDecodeErrorZ* owner_conv = (LDKCResult_PongDecodeErrorZ*)untag_ptr(owner);
13372         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
13373         *ret_copy = CResult_PongDecodeErrorZ_get_err(owner_conv);
13374         int64_t ret_ref = tag_ptr(ret_copy, true);
13375         return ret_ref;
13376 }
13377
13378 static inline struct LDKUnsignedChannelAnnouncement CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_ok(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR owner){
13379         LDKUnsignedChannelAnnouncement ret = *owner->contents.result;
13380         ret.is_owned = false;
13381         return ret;
13382 }
13383 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
13384         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)untag_ptr(owner);
13385         LDKUnsignedChannelAnnouncement ret_var = CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_ok(owner_conv);
13386         int64_t ret_ref = 0;
13387         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13388         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13389         return ret_ref;
13390 }
13391
13392 static inline struct LDKDecodeError CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_err(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR owner){
13393 CHECK(!owner->result_ok);
13394         return DecodeError_clone(&*owner->contents.err);
13395 }
13396 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
13397         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)untag_ptr(owner);
13398         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
13399         *ret_copy = CResult_UnsignedChannelAnnouncementDecodeErrorZ_get_err(owner_conv);
13400         int64_t ret_ref = tag_ptr(ret_copy, true);
13401         return ret_ref;
13402 }
13403
13404 static inline struct LDKChannelAnnouncement CResult_ChannelAnnouncementDecodeErrorZ_get_ok(LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR owner){
13405         LDKChannelAnnouncement ret = *owner->contents.result;
13406         ret.is_owned = false;
13407         return ret;
13408 }
13409 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
13410         LDKCResult_ChannelAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)untag_ptr(owner);
13411         LDKChannelAnnouncement ret_var = CResult_ChannelAnnouncementDecodeErrorZ_get_ok(owner_conv);
13412         int64_t ret_ref = 0;
13413         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13414         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13415         return ret_ref;
13416 }
13417
13418 static inline struct LDKDecodeError CResult_ChannelAnnouncementDecodeErrorZ_get_err(LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR owner){
13419 CHECK(!owner->result_ok);
13420         return DecodeError_clone(&*owner->contents.err);
13421 }
13422 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
13423         LDKCResult_ChannelAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)untag_ptr(owner);
13424         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
13425         *ret_copy = CResult_ChannelAnnouncementDecodeErrorZ_get_err(owner_conv);
13426         int64_t ret_ref = tag_ptr(ret_copy, true);
13427         return ret_ref;
13428 }
13429
13430 static inline struct LDKUnsignedChannelUpdate CResult_UnsignedChannelUpdateDecodeErrorZ_get_ok(LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR owner){
13431         LDKUnsignedChannelUpdate ret = *owner->contents.result;
13432         ret.is_owned = false;
13433         return ret;
13434 }
13435 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
13436         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* owner_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)untag_ptr(owner);
13437         LDKUnsignedChannelUpdate ret_var = CResult_UnsignedChannelUpdateDecodeErrorZ_get_ok(owner_conv);
13438         int64_t ret_ref = 0;
13439         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13440         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13441         return ret_ref;
13442 }
13443
13444 static inline struct LDKDecodeError CResult_UnsignedChannelUpdateDecodeErrorZ_get_err(LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR owner){
13445 CHECK(!owner->result_ok);
13446         return DecodeError_clone(&*owner->contents.err);
13447 }
13448 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
13449         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* owner_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)untag_ptr(owner);
13450         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
13451         *ret_copy = CResult_UnsignedChannelUpdateDecodeErrorZ_get_err(owner_conv);
13452         int64_t ret_ref = tag_ptr(ret_copy, true);
13453         return ret_ref;
13454 }
13455
13456 static inline struct LDKChannelUpdate CResult_ChannelUpdateDecodeErrorZ_get_ok(LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR owner){
13457         LDKChannelUpdate ret = *owner->contents.result;
13458         ret.is_owned = false;
13459         return ret;
13460 }
13461 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
13462         LDKCResult_ChannelUpdateDecodeErrorZ* owner_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)untag_ptr(owner);
13463         LDKChannelUpdate ret_var = CResult_ChannelUpdateDecodeErrorZ_get_ok(owner_conv);
13464         int64_t ret_ref = 0;
13465         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13466         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13467         return ret_ref;
13468 }
13469
13470 static inline struct LDKDecodeError CResult_ChannelUpdateDecodeErrorZ_get_err(LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR owner){
13471 CHECK(!owner->result_ok);
13472         return DecodeError_clone(&*owner->contents.err);
13473 }
13474 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
13475         LDKCResult_ChannelUpdateDecodeErrorZ* owner_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)untag_ptr(owner);
13476         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
13477         *ret_copy = CResult_ChannelUpdateDecodeErrorZ_get_err(owner_conv);
13478         int64_t ret_ref = tag_ptr(ret_copy, true);
13479         return ret_ref;
13480 }
13481
13482 static inline struct LDKErrorMessage CResult_ErrorMessageDecodeErrorZ_get_ok(LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR owner){
13483         LDKErrorMessage ret = *owner->contents.result;
13484         ret.is_owned = false;
13485         return ret;
13486 }
13487 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
13488         LDKCResult_ErrorMessageDecodeErrorZ* owner_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)untag_ptr(owner);
13489         LDKErrorMessage ret_var = CResult_ErrorMessageDecodeErrorZ_get_ok(owner_conv);
13490         int64_t ret_ref = 0;
13491         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13492         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13493         return ret_ref;
13494 }
13495
13496 static inline struct LDKDecodeError CResult_ErrorMessageDecodeErrorZ_get_err(LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR owner){
13497 CHECK(!owner->result_ok);
13498         return DecodeError_clone(&*owner->contents.err);
13499 }
13500 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
13501         LDKCResult_ErrorMessageDecodeErrorZ* owner_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)untag_ptr(owner);
13502         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
13503         *ret_copy = CResult_ErrorMessageDecodeErrorZ_get_err(owner_conv);
13504         int64_t ret_ref = tag_ptr(ret_copy, true);
13505         return ret_ref;
13506 }
13507
13508 static inline struct LDKWarningMessage CResult_WarningMessageDecodeErrorZ_get_ok(LDKCResult_WarningMessageDecodeErrorZ *NONNULL_PTR owner){
13509         LDKWarningMessage ret = *owner->contents.result;
13510         ret.is_owned = false;
13511         return ret;
13512 }
13513 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1WarningMessageDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
13514         LDKCResult_WarningMessageDecodeErrorZ* owner_conv = (LDKCResult_WarningMessageDecodeErrorZ*)untag_ptr(owner);
13515         LDKWarningMessage ret_var = CResult_WarningMessageDecodeErrorZ_get_ok(owner_conv);
13516         int64_t ret_ref = 0;
13517         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13518         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13519         return ret_ref;
13520 }
13521
13522 static inline struct LDKDecodeError CResult_WarningMessageDecodeErrorZ_get_err(LDKCResult_WarningMessageDecodeErrorZ *NONNULL_PTR owner){
13523 CHECK(!owner->result_ok);
13524         return DecodeError_clone(&*owner->contents.err);
13525 }
13526 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1WarningMessageDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
13527         LDKCResult_WarningMessageDecodeErrorZ* owner_conv = (LDKCResult_WarningMessageDecodeErrorZ*)untag_ptr(owner);
13528         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
13529         *ret_copy = CResult_WarningMessageDecodeErrorZ_get_err(owner_conv);
13530         int64_t ret_ref = tag_ptr(ret_copy, true);
13531         return ret_ref;
13532 }
13533
13534 static inline struct LDKUnsignedNodeAnnouncement CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_ok(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR owner){
13535         LDKUnsignedNodeAnnouncement ret = *owner->contents.result;
13536         ret.is_owned = false;
13537         return ret;
13538 }
13539 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
13540         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)untag_ptr(owner);
13541         LDKUnsignedNodeAnnouncement ret_var = CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_ok(owner_conv);
13542         int64_t ret_ref = 0;
13543         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13544         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13545         return ret_ref;
13546 }
13547
13548 static inline struct LDKDecodeError CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_err(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR owner){
13549 CHECK(!owner->result_ok);
13550         return DecodeError_clone(&*owner->contents.err);
13551 }
13552 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
13553         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)untag_ptr(owner);
13554         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
13555         *ret_copy = CResult_UnsignedNodeAnnouncementDecodeErrorZ_get_err(owner_conv);
13556         int64_t ret_ref = tag_ptr(ret_copy, true);
13557         return ret_ref;
13558 }
13559
13560 static inline struct LDKNodeAnnouncement CResult_NodeAnnouncementDecodeErrorZ_get_ok(LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR owner){
13561         LDKNodeAnnouncement ret = *owner->contents.result;
13562         ret.is_owned = false;
13563         return ret;
13564 }
13565 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
13566         LDKCResult_NodeAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)untag_ptr(owner);
13567         LDKNodeAnnouncement ret_var = CResult_NodeAnnouncementDecodeErrorZ_get_ok(owner_conv);
13568         int64_t ret_ref = 0;
13569         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13570         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13571         return ret_ref;
13572 }
13573
13574 static inline struct LDKDecodeError CResult_NodeAnnouncementDecodeErrorZ_get_err(LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR owner){
13575 CHECK(!owner->result_ok);
13576         return DecodeError_clone(&*owner->contents.err);
13577 }
13578 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
13579         LDKCResult_NodeAnnouncementDecodeErrorZ* owner_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)untag_ptr(owner);
13580         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
13581         *ret_copy = CResult_NodeAnnouncementDecodeErrorZ_get_err(owner_conv);
13582         int64_t ret_ref = tag_ptr(ret_copy, true);
13583         return ret_ref;
13584 }
13585
13586 static inline struct LDKQueryShortChannelIds CResult_QueryShortChannelIdsDecodeErrorZ_get_ok(LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR owner){
13587         LDKQueryShortChannelIds ret = *owner->contents.result;
13588         ret.is_owned = false;
13589         return ret;
13590 }
13591 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
13592         LDKCResult_QueryShortChannelIdsDecodeErrorZ* owner_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)untag_ptr(owner);
13593         LDKQueryShortChannelIds ret_var = CResult_QueryShortChannelIdsDecodeErrorZ_get_ok(owner_conv);
13594         int64_t ret_ref = 0;
13595         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13596         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13597         return ret_ref;
13598 }
13599
13600 static inline struct LDKDecodeError CResult_QueryShortChannelIdsDecodeErrorZ_get_err(LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR owner){
13601 CHECK(!owner->result_ok);
13602         return DecodeError_clone(&*owner->contents.err);
13603 }
13604 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
13605         LDKCResult_QueryShortChannelIdsDecodeErrorZ* owner_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)untag_ptr(owner);
13606         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
13607         *ret_copy = CResult_QueryShortChannelIdsDecodeErrorZ_get_err(owner_conv);
13608         int64_t ret_ref = tag_ptr(ret_copy, true);
13609         return ret_ref;
13610 }
13611
13612 static inline struct LDKReplyShortChannelIdsEnd CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_ok(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR owner){
13613         LDKReplyShortChannelIdsEnd ret = *owner->contents.result;
13614         ret.is_owned = false;
13615         return ret;
13616 }
13617 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
13618         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* owner_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)untag_ptr(owner);
13619         LDKReplyShortChannelIdsEnd ret_var = CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_ok(owner_conv);
13620         int64_t ret_ref = 0;
13621         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13622         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13623         return ret_ref;
13624 }
13625
13626 static inline struct LDKDecodeError CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_err(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR owner){
13627 CHECK(!owner->result_ok);
13628         return DecodeError_clone(&*owner->contents.err);
13629 }
13630 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
13631         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* owner_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)untag_ptr(owner);
13632         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
13633         *ret_copy = CResult_ReplyShortChannelIdsEndDecodeErrorZ_get_err(owner_conv);
13634         int64_t ret_ref = tag_ptr(ret_copy, true);
13635         return ret_ref;
13636 }
13637
13638 static inline struct LDKQueryChannelRange CResult_QueryChannelRangeDecodeErrorZ_get_ok(LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR owner){
13639         LDKQueryChannelRange ret = *owner->contents.result;
13640         ret.is_owned = false;
13641         return ret;
13642 }
13643 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
13644         LDKCResult_QueryChannelRangeDecodeErrorZ* owner_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)untag_ptr(owner);
13645         LDKQueryChannelRange ret_var = CResult_QueryChannelRangeDecodeErrorZ_get_ok(owner_conv);
13646         int64_t ret_ref = 0;
13647         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13648         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13649         return ret_ref;
13650 }
13651
13652 static inline struct LDKDecodeError CResult_QueryChannelRangeDecodeErrorZ_get_err(LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR owner){
13653 CHECK(!owner->result_ok);
13654         return DecodeError_clone(&*owner->contents.err);
13655 }
13656 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
13657         LDKCResult_QueryChannelRangeDecodeErrorZ* owner_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)untag_ptr(owner);
13658         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
13659         *ret_copy = CResult_QueryChannelRangeDecodeErrorZ_get_err(owner_conv);
13660         int64_t ret_ref = tag_ptr(ret_copy, true);
13661         return ret_ref;
13662 }
13663
13664 static inline struct LDKReplyChannelRange CResult_ReplyChannelRangeDecodeErrorZ_get_ok(LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR owner){
13665         LDKReplyChannelRange ret = *owner->contents.result;
13666         ret.is_owned = false;
13667         return ret;
13668 }
13669 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
13670         LDKCResult_ReplyChannelRangeDecodeErrorZ* owner_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)untag_ptr(owner);
13671         LDKReplyChannelRange ret_var = CResult_ReplyChannelRangeDecodeErrorZ_get_ok(owner_conv);
13672         int64_t ret_ref = 0;
13673         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13674         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13675         return ret_ref;
13676 }
13677
13678 static inline struct LDKDecodeError CResult_ReplyChannelRangeDecodeErrorZ_get_err(LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR owner){
13679 CHECK(!owner->result_ok);
13680         return DecodeError_clone(&*owner->contents.err);
13681 }
13682 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
13683         LDKCResult_ReplyChannelRangeDecodeErrorZ* owner_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)untag_ptr(owner);
13684         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
13685         *ret_copy = CResult_ReplyChannelRangeDecodeErrorZ_get_err(owner_conv);
13686         int64_t ret_ref = tag_ptr(ret_copy, true);
13687         return ret_ref;
13688 }
13689
13690 static inline struct LDKGossipTimestampFilter CResult_GossipTimestampFilterDecodeErrorZ_get_ok(LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR owner){
13691         LDKGossipTimestampFilter ret = *owner->contents.result;
13692         ret.is_owned = false;
13693         return ret;
13694 }
13695 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
13696         LDKCResult_GossipTimestampFilterDecodeErrorZ* owner_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)untag_ptr(owner);
13697         LDKGossipTimestampFilter ret_var = CResult_GossipTimestampFilterDecodeErrorZ_get_ok(owner_conv);
13698         int64_t ret_ref = 0;
13699         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13700         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13701         return ret_ref;
13702 }
13703
13704 static inline struct LDKDecodeError CResult_GossipTimestampFilterDecodeErrorZ_get_err(LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR owner){
13705 CHECK(!owner->result_ok);
13706         return DecodeError_clone(&*owner->contents.err);
13707 }
13708 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
13709         LDKCResult_GossipTimestampFilterDecodeErrorZ* owner_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)untag_ptr(owner);
13710         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
13711         *ret_copy = CResult_GossipTimestampFilterDecodeErrorZ_get_err(owner_conv);
13712         int64_t ret_ref = tag_ptr(ret_copy, true);
13713         return ret_ref;
13714 }
13715
13716 static inline LDKCVec_PhantomRouteHintsZ CVec_PhantomRouteHintsZ_clone(const LDKCVec_PhantomRouteHintsZ *orig) {
13717         LDKCVec_PhantomRouteHintsZ ret = { .data = MALLOC(sizeof(LDKPhantomRouteHints) * orig->datalen, "LDKCVec_PhantomRouteHintsZ clone bytes"), .datalen = orig->datalen };
13718         for (size_t i = 0; i < ret.datalen; i++) {
13719                 ret.data[i] = PhantomRouteHints_clone(&orig->data[i]);
13720         }
13721         return ret;
13722 }
13723 static jclass LDKSignOrCreationError_SignError_class = NULL;
13724 static jmethodID LDKSignOrCreationError_SignError_meth = NULL;
13725 static jclass LDKSignOrCreationError_CreationError_class = NULL;
13726 static jmethodID LDKSignOrCreationError_CreationError_meth = NULL;
13727 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKSignOrCreationError_init (JNIEnv *env, jclass clz) {
13728         LDKSignOrCreationError_SignError_class =
13729                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSignOrCreationError$SignError"));
13730         CHECK(LDKSignOrCreationError_SignError_class != NULL);
13731         LDKSignOrCreationError_SignError_meth = (*env)->GetMethodID(env, LDKSignOrCreationError_SignError_class, "<init>", "()V");
13732         CHECK(LDKSignOrCreationError_SignError_meth != NULL);
13733         LDKSignOrCreationError_CreationError_class =
13734                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSignOrCreationError$CreationError"));
13735         CHECK(LDKSignOrCreationError_CreationError_class != NULL);
13736         LDKSignOrCreationError_CreationError_meth = (*env)->GetMethodID(env, LDKSignOrCreationError_CreationError_class, "<init>", "(Lorg/ldk/enums/CreationError;)V");
13737         CHECK(LDKSignOrCreationError_CreationError_meth != NULL);
13738 }
13739 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKSignOrCreationError_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
13740         LDKSignOrCreationError *obj = (LDKSignOrCreationError*)untag_ptr(ptr);
13741         switch(obj->tag) {
13742                 case LDKSignOrCreationError_SignError: {
13743                         return (*env)->NewObject(env, LDKSignOrCreationError_SignError_class, LDKSignOrCreationError_SignError_meth);
13744                 }
13745                 case LDKSignOrCreationError_CreationError: {
13746                         jclass creation_error_conv = LDKCreationError_to_java(env, obj->creation_error);
13747                         return (*env)->NewObject(env, LDKSignOrCreationError_CreationError_class, LDKSignOrCreationError_CreationError_meth, creation_error_conv);
13748                 }
13749                 default: abort();
13750         }
13751 }
13752 static inline struct LDKBolt11Invoice CResult_Bolt11InvoiceSignOrCreationErrorZ_get_ok(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ *NONNULL_PTR owner){
13753         LDKBolt11Invoice ret = *owner->contents.result;
13754         ret.is_owned = false;
13755         return ret;
13756 }
13757 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceSignOrCreationErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
13758         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* owner_conv = (LDKCResult_Bolt11InvoiceSignOrCreationErrorZ*)untag_ptr(owner);
13759         LDKBolt11Invoice ret_var = CResult_Bolt11InvoiceSignOrCreationErrorZ_get_ok(owner_conv);
13760         int64_t ret_ref = 0;
13761         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13762         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13763         return ret_ref;
13764 }
13765
13766 static inline struct LDKSignOrCreationError CResult_Bolt11InvoiceSignOrCreationErrorZ_get_err(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ *NONNULL_PTR owner){
13767 CHECK(!owner->result_ok);
13768         return SignOrCreationError_clone(&*owner->contents.err);
13769 }
13770 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceSignOrCreationErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
13771         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* owner_conv = (LDKCResult_Bolt11InvoiceSignOrCreationErrorZ*)untag_ptr(owner);
13772         LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
13773         *ret_copy = CResult_Bolt11InvoiceSignOrCreationErrorZ_get_err(owner_conv);
13774         int64_t ret_ref = tag_ptr(ret_copy, true);
13775         return ret_ref;
13776 }
13777
13778 static inline struct LDKOffersMessage CResult_OffersMessageDecodeErrorZ_get_ok(LDKCResult_OffersMessageDecodeErrorZ *NONNULL_PTR owner){
13779 CHECK(owner->result_ok);
13780         return OffersMessage_clone(&*owner->contents.result);
13781 }
13782 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OffersMessageDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
13783         LDKCResult_OffersMessageDecodeErrorZ* owner_conv = (LDKCResult_OffersMessageDecodeErrorZ*)untag_ptr(owner);
13784         LDKOffersMessage *ret_copy = MALLOC(sizeof(LDKOffersMessage), "LDKOffersMessage");
13785         *ret_copy = CResult_OffersMessageDecodeErrorZ_get_ok(owner_conv);
13786         int64_t ret_ref = tag_ptr(ret_copy, true);
13787         return ret_ref;
13788 }
13789
13790 static inline struct LDKDecodeError CResult_OffersMessageDecodeErrorZ_get_err(LDKCResult_OffersMessageDecodeErrorZ *NONNULL_PTR owner){
13791 CHECK(!owner->result_ok);
13792         return DecodeError_clone(&*owner->contents.err);
13793 }
13794 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OffersMessageDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
13795         LDKCResult_OffersMessageDecodeErrorZ* owner_conv = (LDKCResult_OffersMessageDecodeErrorZ*)untag_ptr(owner);
13796         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
13797         *ret_copy = CResult_OffersMessageDecodeErrorZ_get_err(owner_conv);
13798         int64_t ret_ref = tag_ptr(ret_copy, true);
13799         return ret_ref;
13800 }
13801
13802 static jclass LDKCOption_HTLCClaimZ_Some_class = NULL;
13803 static jmethodID LDKCOption_HTLCClaimZ_Some_meth = NULL;
13804 static jclass LDKCOption_HTLCClaimZ_None_class = NULL;
13805 static jmethodID LDKCOption_HTLCClaimZ_None_meth = NULL;
13806 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1HTLCClaimZ_init (JNIEnv *env, jclass clz) {
13807         LDKCOption_HTLCClaimZ_Some_class =
13808                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_HTLCClaimZ$Some"));
13809         CHECK(LDKCOption_HTLCClaimZ_Some_class != NULL);
13810         LDKCOption_HTLCClaimZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_HTLCClaimZ_Some_class, "<init>", "(Lorg/ldk/enums/HTLCClaim;)V");
13811         CHECK(LDKCOption_HTLCClaimZ_Some_meth != NULL);
13812         LDKCOption_HTLCClaimZ_None_class =
13813                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_HTLCClaimZ$None"));
13814         CHECK(LDKCOption_HTLCClaimZ_None_class != NULL);
13815         LDKCOption_HTLCClaimZ_None_meth = (*env)->GetMethodID(env, LDKCOption_HTLCClaimZ_None_class, "<init>", "()V");
13816         CHECK(LDKCOption_HTLCClaimZ_None_meth != NULL);
13817 }
13818 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1HTLCClaimZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
13819         LDKCOption_HTLCClaimZ *obj = (LDKCOption_HTLCClaimZ*)untag_ptr(ptr);
13820         switch(obj->tag) {
13821                 case LDKCOption_HTLCClaimZ_Some: {
13822                         jclass some_conv = LDKHTLCClaim_to_java(env, obj->some);
13823                         return (*env)->NewObject(env, LDKCOption_HTLCClaimZ_Some_class, LDKCOption_HTLCClaimZ_Some_meth, some_conv);
13824                 }
13825                 case LDKCOption_HTLCClaimZ_None: {
13826                         return (*env)->NewObject(env, LDKCOption_HTLCClaimZ_None_class, LDKCOption_HTLCClaimZ_None_meth);
13827                 }
13828                 default: abort();
13829         }
13830 }
13831 static inline struct LDKCounterpartyCommitmentSecrets CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_ok(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ *NONNULL_PTR owner){
13832         LDKCounterpartyCommitmentSecrets ret = *owner->contents.result;
13833         ret.is_owned = false;
13834         return ret;
13835 }
13836 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyCommitmentSecretsDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
13837         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)untag_ptr(owner);
13838         LDKCounterpartyCommitmentSecrets ret_var = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_ok(owner_conv);
13839         int64_t ret_ref = 0;
13840         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13841         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13842         return ret_ref;
13843 }
13844
13845 static inline struct LDKDecodeError CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_err(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ *NONNULL_PTR owner){
13846 CHECK(!owner->result_ok);
13847         return DecodeError_clone(&*owner->contents.err);
13848 }
13849 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyCommitmentSecretsDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
13850         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)untag_ptr(owner);
13851         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
13852         *ret_copy = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_err(owner_conv);
13853         int64_t ret_ref = tag_ptr(ret_copy, true);
13854         return ret_ref;
13855 }
13856
13857 static inline struct LDKTxCreationKeys CResult_TxCreationKeysDecodeErrorZ_get_ok(LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR owner){
13858         LDKTxCreationKeys ret = *owner->contents.result;
13859         ret.is_owned = false;
13860         return ret;
13861 }
13862 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
13863         LDKCResult_TxCreationKeysDecodeErrorZ* owner_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)untag_ptr(owner);
13864         LDKTxCreationKeys ret_var = CResult_TxCreationKeysDecodeErrorZ_get_ok(owner_conv);
13865         int64_t ret_ref = 0;
13866         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13867         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13868         return ret_ref;
13869 }
13870
13871 static inline struct LDKDecodeError CResult_TxCreationKeysDecodeErrorZ_get_err(LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR owner){
13872 CHECK(!owner->result_ok);
13873         return DecodeError_clone(&*owner->contents.err);
13874 }
13875 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
13876         LDKCResult_TxCreationKeysDecodeErrorZ* owner_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)untag_ptr(owner);
13877         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
13878         *ret_copy = CResult_TxCreationKeysDecodeErrorZ_get_err(owner_conv);
13879         int64_t ret_ref = tag_ptr(ret_copy, true);
13880         return ret_ref;
13881 }
13882
13883 static inline struct LDKChannelPublicKeys CResult_ChannelPublicKeysDecodeErrorZ_get_ok(LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR owner){
13884         LDKChannelPublicKeys ret = *owner->contents.result;
13885         ret.is_owned = false;
13886         return ret;
13887 }
13888 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
13889         LDKCResult_ChannelPublicKeysDecodeErrorZ* owner_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)untag_ptr(owner);
13890         LDKChannelPublicKeys ret_var = CResult_ChannelPublicKeysDecodeErrorZ_get_ok(owner_conv);
13891         int64_t ret_ref = 0;
13892         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13893         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13894         return ret_ref;
13895 }
13896
13897 static inline struct LDKDecodeError CResult_ChannelPublicKeysDecodeErrorZ_get_err(LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR owner){
13898 CHECK(!owner->result_ok);
13899         return DecodeError_clone(&*owner->contents.err);
13900 }
13901 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
13902         LDKCResult_ChannelPublicKeysDecodeErrorZ* owner_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)untag_ptr(owner);
13903         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
13904         *ret_copy = CResult_ChannelPublicKeysDecodeErrorZ_get_err(owner_conv);
13905         int64_t ret_ref = tag_ptr(ret_copy, true);
13906         return ret_ref;
13907 }
13908
13909 static inline struct LDKHTLCOutputInCommitment CResult_HTLCOutputInCommitmentDecodeErrorZ_get_ok(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR owner){
13910         LDKHTLCOutputInCommitment ret = *owner->contents.result;
13911         ret.is_owned = false;
13912         return ret;
13913 }
13914 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
13915         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* owner_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)untag_ptr(owner);
13916         LDKHTLCOutputInCommitment ret_var = CResult_HTLCOutputInCommitmentDecodeErrorZ_get_ok(owner_conv);
13917         int64_t ret_ref = 0;
13918         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13919         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13920         return ret_ref;
13921 }
13922
13923 static inline struct LDKDecodeError CResult_HTLCOutputInCommitmentDecodeErrorZ_get_err(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR owner){
13924 CHECK(!owner->result_ok);
13925         return DecodeError_clone(&*owner->contents.err);
13926 }
13927 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
13928         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* owner_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)untag_ptr(owner);
13929         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
13930         *ret_copy = CResult_HTLCOutputInCommitmentDecodeErrorZ_get_err(owner_conv);
13931         int64_t ret_ref = tag_ptr(ret_copy, true);
13932         return ret_ref;
13933 }
13934
13935 static inline struct LDKCounterpartyChannelTransactionParameters CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_ok(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR owner){
13936         LDKCounterpartyChannelTransactionParameters ret = *owner->contents.result;
13937         ret.is_owned = false;
13938         return ret;
13939 }
13940 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
13941         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)untag_ptr(owner);
13942         LDKCounterpartyChannelTransactionParameters ret_var = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_ok(owner_conv);
13943         int64_t ret_ref = 0;
13944         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13945         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13946         return ret_ref;
13947 }
13948
13949 static inline struct LDKDecodeError CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_err(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR owner){
13950 CHECK(!owner->result_ok);
13951         return DecodeError_clone(&*owner->contents.err);
13952 }
13953 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
13954         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* owner_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)untag_ptr(owner);
13955         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
13956         *ret_copy = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_err(owner_conv);
13957         int64_t ret_ref = tag_ptr(ret_copy, true);
13958         return ret_ref;
13959 }
13960
13961 static inline struct LDKChannelTransactionParameters CResult_ChannelTransactionParametersDecodeErrorZ_get_ok(LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR owner){
13962         LDKChannelTransactionParameters ret = *owner->contents.result;
13963         ret.is_owned = false;
13964         return ret;
13965 }
13966 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
13967         LDKCResult_ChannelTransactionParametersDecodeErrorZ* owner_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)untag_ptr(owner);
13968         LDKChannelTransactionParameters ret_var = CResult_ChannelTransactionParametersDecodeErrorZ_get_ok(owner_conv);
13969         int64_t ret_ref = 0;
13970         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13971         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13972         return ret_ref;
13973 }
13974
13975 static inline struct LDKDecodeError CResult_ChannelTransactionParametersDecodeErrorZ_get_err(LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR owner){
13976 CHECK(!owner->result_ok);
13977         return DecodeError_clone(&*owner->contents.err);
13978 }
13979 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
13980         LDKCResult_ChannelTransactionParametersDecodeErrorZ* owner_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)untag_ptr(owner);
13981         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
13982         *ret_copy = CResult_ChannelTransactionParametersDecodeErrorZ_get_err(owner_conv);
13983         int64_t ret_ref = tag_ptr(ret_copy, true);
13984         return ret_ref;
13985 }
13986
13987 static inline struct LDKHolderCommitmentTransaction CResult_HolderCommitmentTransactionDecodeErrorZ_get_ok(LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
13988         LDKHolderCommitmentTransaction ret = *owner->contents.result;
13989         ret.is_owned = false;
13990         return ret;
13991 }
13992 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
13993         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)untag_ptr(owner);
13994         LDKHolderCommitmentTransaction ret_var = CResult_HolderCommitmentTransactionDecodeErrorZ_get_ok(owner_conv);
13995         int64_t ret_ref = 0;
13996         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
13997         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
13998         return ret_ref;
13999 }
14000
14001 static inline struct LDKDecodeError CResult_HolderCommitmentTransactionDecodeErrorZ_get_err(LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
14002 CHECK(!owner->result_ok);
14003         return DecodeError_clone(&*owner->contents.err);
14004 }
14005 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
14006         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)untag_ptr(owner);
14007         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
14008         *ret_copy = CResult_HolderCommitmentTransactionDecodeErrorZ_get_err(owner_conv);
14009         int64_t ret_ref = tag_ptr(ret_copy, true);
14010         return ret_ref;
14011 }
14012
14013 static inline struct LDKBuiltCommitmentTransaction CResult_BuiltCommitmentTransactionDecodeErrorZ_get_ok(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
14014         LDKBuiltCommitmentTransaction ret = *owner->contents.result;
14015         ret.is_owned = false;
14016         return ret;
14017 }
14018 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
14019         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)untag_ptr(owner);
14020         LDKBuiltCommitmentTransaction ret_var = CResult_BuiltCommitmentTransactionDecodeErrorZ_get_ok(owner_conv);
14021         int64_t ret_ref = 0;
14022         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
14023         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
14024         return ret_ref;
14025 }
14026
14027 static inline struct LDKDecodeError CResult_BuiltCommitmentTransactionDecodeErrorZ_get_err(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
14028 CHECK(!owner->result_ok);
14029         return DecodeError_clone(&*owner->contents.err);
14030 }
14031 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
14032         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)untag_ptr(owner);
14033         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
14034         *ret_copy = CResult_BuiltCommitmentTransactionDecodeErrorZ_get_err(owner_conv);
14035         int64_t ret_ref = tag_ptr(ret_copy, true);
14036         return ret_ref;
14037 }
14038
14039 static inline struct LDKTrustedClosingTransaction CResult_TrustedClosingTransactionNoneZ_get_ok(LDKCResult_TrustedClosingTransactionNoneZ *NONNULL_PTR owner){
14040         LDKTrustedClosingTransaction ret = *owner->contents.result;
14041         ret.is_owned = false;
14042         return ret;
14043 }
14044 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedClosingTransactionNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
14045         LDKCResult_TrustedClosingTransactionNoneZ* owner_conv = (LDKCResult_TrustedClosingTransactionNoneZ*)untag_ptr(owner);
14046         LDKTrustedClosingTransaction ret_var = CResult_TrustedClosingTransactionNoneZ_get_ok(owner_conv);
14047         int64_t ret_ref = 0;
14048         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
14049         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
14050         return ret_ref;
14051 }
14052
14053 static inline void CResult_TrustedClosingTransactionNoneZ_get_err(LDKCResult_TrustedClosingTransactionNoneZ *NONNULL_PTR owner){
14054 CHECK(!owner->result_ok);
14055         return *owner->contents.err;
14056 }
14057 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedClosingTransactionNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
14058         LDKCResult_TrustedClosingTransactionNoneZ* owner_conv = (LDKCResult_TrustedClosingTransactionNoneZ*)untag_ptr(owner);
14059         CResult_TrustedClosingTransactionNoneZ_get_err(owner_conv);
14060 }
14061
14062 static inline struct LDKCommitmentTransaction CResult_CommitmentTransactionDecodeErrorZ_get_ok(LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
14063         LDKCommitmentTransaction ret = *owner->contents.result;
14064         ret.is_owned = false;
14065         return ret;
14066 }
14067 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
14068         LDKCResult_CommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)untag_ptr(owner);
14069         LDKCommitmentTransaction ret_var = CResult_CommitmentTransactionDecodeErrorZ_get_ok(owner_conv);
14070         int64_t ret_ref = 0;
14071         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
14072         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
14073         return ret_ref;
14074 }
14075
14076 static inline struct LDKDecodeError CResult_CommitmentTransactionDecodeErrorZ_get_err(LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR owner){
14077 CHECK(!owner->result_ok);
14078         return DecodeError_clone(&*owner->contents.err);
14079 }
14080 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
14081         LDKCResult_CommitmentTransactionDecodeErrorZ* owner_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)untag_ptr(owner);
14082         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
14083         *ret_copy = CResult_CommitmentTransactionDecodeErrorZ_get_err(owner_conv);
14084         int64_t ret_ref = tag_ptr(ret_copy, true);
14085         return ret_ref;
14086 }
14087
14088 static inline struct LDKTrustedCommitmentTransaction CResult_TrustedCommitmentTransactionNoneZ_get_ok(LDKCResult_TrustedCommitmentTransactionNoneZ *NONNULL_PTR owner){
14089         LDKTrustedCommitmentTransaction ret = *owner->contents.result;
14090         ret.is_owned = false;
14091         return ret;
14092 }
14093 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedCommitmentTransactionNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
14094         LDKCResult_TrustedCommitmentTransactionNoneZ* owner_conv = (LDKCResult_TrustedCommitmentTransactionNoneZ*)untag_ptr(owner);
14095         LDKTrustedCommitmentTransaction ret_var = CResult_TrustedCommitmentTransactionNoneZ_get_ok(owner_conv);
14096         int64_t ret_ref = 0;
14097         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
14098         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
14099         return ret_ref;
14100 }
14101
14102 static inline void CResult_TrustedCommitmentTransactionNoneZ_get_err(LDKCResult_TrustedCommitmentTransactionNoneZ *NONNULL_PTR owner){
14103 CHECK(!owner->result_ok);
14104         return *owner->contents.err;
14105 }
14106 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedCommitmentTransactionNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
14107         LDKCResult_TrustedCommitmentTransactionNoneZ* owner_conv = (LDKCResult_TrustedCommitmentTransactionNoneZ*)untag_ptr(owner);
14108         CResult_TrustedCommitmentTransactionNoneZ_get_err(owner_conv);
14109 }
14110
14111 static inline struct LDKCVec_ECDSASignatureZ CResult_CVec_ECDSASignatureZNoneZ_get_ok(LDKCResult_CVec_ECDSASignatureZNoneZ *NONNULL_PTR owner){
14112 CHECK(owner->result_ok);
14113         return *owner->contents.result;
14114 }
14115 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1ECDSASignatureZNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
14116         LDKCResult_CVec_ECDSASignatureZNoneZ* owner_conv = (LDKCResult_CVec_ECDSASignatureZNoneZ*)untag_ptr(owner);
14117         LDKCVec_ECDSASignatureZ ret_var = CResult_CVec_ECDSASignatureZNoneZ_get_ok(owner_conv);
14118         jobjectArray ret_arr = NULL;
14119         ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
14120         ;
14121         for (size_t i = 0; i < ret_var.datalen; i++) {
14122                 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, 64);
14123                 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, 64, ret_var.data[i].compact_form);
14124                 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
14125         }
14126         
14127         return ret_arr;
14128 }
14129
14130 static inline void CResult_CVec_ECDSASignatureZNoneZ_get_err(LDKCResult_CVec_ECDSASignatureZNoneZ *NONNULL_PTR owner){
14131 CHECK(!owner->result_ok);
14132         return *owner->contents.err;
14133 }
14134 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1ECDSASignatureZNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
14135         LDKCResult_CVec_ECDSASignatureZNoneZ* owner_conv = (LDKCResult_CVec_ECDSASignatureZNoneZ*)untag_ptr(owner);
14136         CResult_CVec_ECDSASignatureZNoneZ_get_err(owner_conv);
14137 }
14138
14139 static jclass LDKCOption_usizeZ_Some_class = NULL;
14140 static jmethodID LDKCOption_usizeZ_Some_meth = NULL;
14141 static jclass LDKCOption_usizeZ_None_class = NULL;
14142 static jmethodID LDKCOption_usizeZ_None_meth = NULL;
14143 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1usizeZ_init (JNIEnv *env, jclass clz) {
14144         LDKCOption_usizeZ_Some_class =
14145                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_usizeZ$Some"));
14146         CHECK(LDKCOption_usizeZ_Some_class != NULL);
14147         LDKCOption_usizeZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_usizeZ_Some_class, "<init>", "(J)V");
14148         CHECK(LDKCOption_usizeZ_Some_meth != NULL);
14149         LDKCOption_usizeZ_None_class =
14150                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_usizeZ$None"));
14151         CHECK(LDKCOption_usizeZ_None_class != NULL);
14152         LDKCOption_usizeZ_None_meth = (*env)->GetMethodID(env, LDKCOption_usizeZ_None_class, "<init>", "()V");
14153         CHECK(LDKCOption_usizeZ_None_meth != NULL);
14154 }
14155 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1usizeZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
14156         LDKCOption_usizeZ *obj = (LDKCOption_usizeZ*)untag_ptr(ptr);
14157         switch(obj->tag) {
14158                 case LDKCOption_usizeZ_Some: {
14159                         int64_t some_conv = obj->some;
14160                         return (*env)->NewObject(env, LDKCOption_usizeZ_Some_class, LDKCOption_usizeZ_Some_meth, some_conv);
14161                 }
14162                 case LDKCOption_usizeZ_None: {
14163                         return (*env)->NewObject(env, LDKCOption_usizeZ_None_class, LDKCOption_usizeZ_None_meth);
14164                 }
14165                 default: abort();
14166         }
14167 }
14168 static inline struct LDKShutdownScript CResult_ShutdownScriptDecodeErrorZ_get_ok(LDKCResult_ShutdownScriptDecodeErrorZ *NONNULL_PTR owner){
14169         LDKShutdownScript ret = *owner->contents.result;
14170         ret.is_owned = false;
14171         return ret;
14172 }
14173 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
14174         LDKCResult_ShutdownScriptDecodeErrorZ* owner_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)untag_ptr(owner);
14175         LDKShutdownScript ret_var = CResult_ShutdownScriptDecodeErrorZ_get_ok(owner_conv);
14176         int64_t ret_ref = 0;
14177         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
14178         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
14179         return ret_ref;
14180 }
14181
14182 static inline struct LDKDecodeError CResult_ShutdownScriptDecodeErrorZ_get_err(LDKCResult_ShutdownScriptDecodeErrorZ *NONNULL_PTR owner){
14183 CHECK(!owner->result_ok);
14184         return DecodeError_clone(&*owner->contents.err);
14185 }
14186 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
14187         LDKCResult_ShutdownScriptDecodeErrorZ* owner_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)untag_ptr(owner);
14188         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
14189         *ret_copy = CResult_ShutdownScriptDecodeErrorZ_get_err(owner_conv);
14190         int64_t ret_ref = tag_ptr(ret_copy, true);
14191         return ret_ref;
14192 }
14193
14194 static inline struct LDKShutdownScript CResult_ShutdownScriptInvalidShutdownScriptZ_get_ok(LDKCResult_ShutdownScriptInvalidShutdownScriptZ *NONNULL_PTR owner){
14195         LDKShutdownScript ret = *owner->contents.result;
14196         ret.is_owned = false;
14197         return ret;
14198 }
14199 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptInvalidShutdownScriptZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
14200         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* owner_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)untag_ptr(owner);
14201         LDKShutdownScript ret_var = CResult_ShutdownScriptInvalidShutdownScriptZ_get_ok(owner_conv);
14202         int64_t ret_ref = 0;
14203         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
14204         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
14205         return ret_ref;
14206 }
14207
14208 static inline struct LDKInvalidShutdownScript CResult_ShutdownScriptInvalidShutdownScriptZ_get_err(LDKCResult_ShutdownScriptInvalidShutdownScriptZ *NONNULL_PTR owner){
14209         LDKInvalidShutdownScript ret = *owner->contents.err;
14210         ret.is_owned = false;
14211         return ret;
14212 }
14213 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptInvalidShutdownScriptZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
14214         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* owner_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)untag_ptr(owner);
14215         LDKInvalidShutdownScript ret_var = CResult_ShutdownScriptInvalidShutdownScriptZ_get_err(owner_conv);
14216         int64_t ret_ref = 0;
14217         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
14218         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
14219         return ret_ref;
14220 }
14221
14222 static jclass LDKPaymentPurpose_Bolt11InvoicePayment_class = NULL;
14223 static jmethodID LDKPaymentPurpose_Bolt11InvoicePayment_meth = NULL;
14224 static jclass LDKPaymentPurpose_Bolt12OfferPayment_class = NULL;
14225 static jmethodID LDKPaymentPurpose_Bolt12OfferPayment_meth = NULL;
14226 static jclass LDKPaymentPurpose_Bolt12RefundPayment_class = NULL;
14227 static jmethodID LDKPaymentPurpose_Bolt12RefundPayment_meth = NULL;
14228 static jclass LDKPaymentPurpose_SpontaneousPayment_class = NULL;
14229 static jmethodID LDKPaymentPurpose_SpontaneousPayment_meth = NULL;
14230 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKPaymentPurpose_init (JNIEnv *env, jclass clz) {
14231         LDKPaymentPurpose_Bolt11InvoicePayment_class =
14232                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentPurpose$Bolt11InvoicePayment"));
14233         CHECK(LDKPaymentPurpose_Bolt11InvoicePayment_class != NULL);
14234         LDKPaymentPurpose_Bolt11InvoicePayment_meth = (*env)->GetMethodID(env, LDKPaymentPurpose_Bolt11InvoicePayment_class, "<init>", "(J[B)V");
14235         CHECK(LDKPaymentPurpose_Bolt11InvoicePayment_meth != NULL);
14236         LDKPaymentPurpose_Bolt12OfferPayment_class =
14237                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentPurpose$Bolt12OfferPayment"));
14238         CHECK(LDKPaymentPurpose_Bolt12OfferPayment_class != NULL);
14239         LDKPaymentPurpose_Bolt12OfferPayment_meth = (*env)->GetMethodID(env, LDKPaymentPurpose_Bolt12OfferPayment_class, "<init>", "(J[BJ)V");
14240         CHECK(LDKPaymentPurpose_Bolt12OfferPayment_meth != NULL);
14241         LDKPaymentPurpose_Bolt12RefundPayment_class =
14242                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentPurpose$Bolt12RefundPayment"));
14243         CHECK(LDKPaymentPurpose_Bolt12RefundPayment_class != NULL);
14244         LDKPaymentPurpose_Bolt12RefundPayment_meth = (*env)->GetMethodID(env, LDKPaymentPurpose_Bolt12RefundPayment_class, "<init>", "(J[BJ)V");
14245         CHECK(LDKPaymentPurpose_Bolt12RefundPayment_meth != NULL);
14246         LDKPaymentPurpose_SpontaneousPayment_class =
14247                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentPurpose$SpontaneousPayment"));
14248         CHECK(LDKPaymentPurpose_SpontaneousPayment_class != NULL);
14249         LDKPaymentPurpose_SpontaneousPayment_meth = (*env)->GetMethodID(env, LDKPaymentPurpose_SpontaneousPayment_class, "<init>", "([B)V");
14250         CHECK(LDKPaymentPurpose_SpontaneousPayment_meth != NULL);
14251 }
14252 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKPaymentPurpose_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
14253         LDKPaymentPurpose *obj = (LDKPaymentPurpose*)untag_ptr(ptr);
14254         switch(obj->tag) {
14255                 case LDKPaymentPurpose_Bolt11InvoicePayment: {
14256                         int64_t payment_preimage_ref = tag_ptr(&obj->bolt11_invoice_payment.payment_preimage, false);
14257                         int8_tArray payment_secret_arr = (*env)->NewByteArray(env, 32);
14258                         (*env)->SetByteArrayRegion(env, payment_secret_arr, 0, 32, obj->bolt11_invoice_payment.payment_secret.data);
14259                         return (*env)->NewObject(env, LDKPaymentPurpose_Bolt11InvoicePayment_class, LDKPaymentPurpose_Bolt11InvoicePayment_meth, payment_preimage_ref, payment_secret_arr);
14260                 }
14261                 case LDKPaymentPurpose_Bolt12OfferPayment: {
14262                         int64_t payment_preimage_ref = tag_ptr(&obj->bolt12_offer_payment.payment_preimage, false);
14263                         int8_tArray payment_secret_arr = (*env)->NewByteArray(env, 32);
14264                         (*env)->SetByteArrayRegion(env, payment_secret_arr, 0, 32, obj->bolt12_offer_payment.payment_secret.data);
14265                         LDKBolt12OfferContext payment_context_var = obj->bolt12_offer_payment.payment_context;
14266                         int64_t payment_context_ref = 0;
14267                         CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_context_var);
14268                         payment_context_ref = tag_ptr(payment_context_var.inner, false);
14269                         return (*env)->NewObject(env, LDKPaymentPurpose_Bolt12OfferPayment_class, LDKPaymentPurpose_Bolt12OfferPayment_meth, payment_preimage_ref, payment_secret_arr, payment_context_ref);
14270                 }
14271                 case LDKPaymentPurpose_Bolt12RefundPayment: {
14272                         int64_t payment_preimage_ref = tag_ptr(&obj->bolt12_refund_payment.payment_preimage, false);
14273                         int8_tArray payment_secret_arr = (*env)->NewByteArray(env, 32);
14274                         (*env)->SetByteArrayRegion(env, payment_secret_arr, 0, 32, obj->bolt12_refund_payment.payment_secret.data);
14275                         LDKBolt12RefundContext payment_context_var = obj->bolt12_refund_payment.payment_context;
14276                         int64_t payment_context_ref = 0;
14277                         CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_context_var);
14278                         payment_context_ref = tag_ptr(payment_context_var.inner, false);
14279                         return (*env)->NewObject(env, LDKPaymentPurpose_Bolt12RefundPayment_class, LDKPaymentPurpose_Bolt12RefundPayment_meth, payment_preimage_ref, payment_secret_arr, payment_context_ref);
14280                 }
14281                 case LDKPaymentPurpose_SpontaneousPayment: {
14282                         int8_tArray spontaneous_payment_arr = (*env)->NewByteArray(env, 32);
14283                         (*env)->SetByteArrayRegion(env, spontaneous_payment_arr, 0, 32, obj->spontaneous_payment.data);
14284                         return (*env)->NewObject(env, LDKPaymentPurpose_SpontaneousPayment_class, LDKPaymentPurpose_SpontaneousPayment_meth, spontaneous_payment_arr);
14285                 }
14286                 default: abort();
14287         }
14288 }
14289 static inline struct LDKPaymentPurpose CResult_PaymentPurposeDecodeErrorZ_get_ok(LDKCResult_PaymentPurposeDecodeErrorZ *NONNULL_PTR owner){
14290 CHECK(owner->result_ok);
14291         return PaymentPurpose_clone(&*owner->contents.result);
14292 }
14293 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPurposeDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
14294         LDKCResult_PaymentPurposeDecodeErrorZ* owner_conv = (LDKCResult_PaymentPurposeDecodeErrorZ*)untag_ptr(owner);
14295         LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
14296         *ret_copy = CResult_PaymentPurposeDecodeErrorZ_get_ok(owner_conv);
14297         int64_t ret_ref = tag_ptr(ret_copy, true);
14298         return ret_ref;
14299 }
14300
14301 static inline struct LDKDecodeError CResult_PaymentPurposeDecodeErrorZ_get_err(LDKCResult_PaymentPurposeDecodeErrorZ *NONNULL_PTR owner){
14302 CHECK(!owner->result_ok);
14303         return DecodeError_clone(&*owner->contents.err);
14304 }
14305 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPurposeDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
14306         LDKCResult_PaymentPurposeDecodeErrorZ* owner_conv = (LDKCResult_PaymentPurposeDecodeErrorZ*)untag_ptr(owner);
14307         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
14308         *ret_copy = CResult_PaymentPurposeDecodeErrorZ_get_err(owner_conv);
14309         int64_t ret_ref = tag_ptr(ret_copy, true);
14310         return ret_ref;
14311 }
14312
14313 static inline struct LDKClaimedHTLC CResult_ClaimedHTLCDecodeErrorZ_get_ok(LDKCResult_ClaimedHTLCDecodeErrorZ *NONNULL_PTR owner){
14314         LDKClaimedHTLC ret = *owner->contents.result;
14315         ret.is_owned = false;
14316         return ret;
14317 }
14318 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClaimedHTLCDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
14319         LDKCResult_ClaimedHTLCDecodeErrorZ* owner_conv = (LDKCResult_ClaimedHTLCDecodeErrorZ*)untag_ptr(owner);
14320         LDKClaimedHTLC ret_var = CResult_ClaimedHTLCDecodeErrorZ_get_ok(owner_conv);
14321         int64_t ret_ref = 0;
14322         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
14323         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
14324         return ret_ref;
14325 }
14326
14327 static inline struct LDKDecodeError CResult_ClaimedHTLCDecodeErrorZ_get_err(LDKCResult_ClaimedHTLCDecodeErrorZ *NONNULL_PTR owner){
14328 CHECK(!owner->result_ok);
14329         return DecodeError_clone(&*owner->contents.err);
14330 }
14331 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClaimedHTLCDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
14332         LDKCResult_ClaimedHTLCDecodeErrorZ* owner_conv = (LDKCResult_ClaimedHTLCDecodeErrorZ*)untag_ptr(owner);
14333         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
14334         *ret_copy = CResult_ClaimedHTLCDecodeErrorZ_get_err(owner_conv);
14335         int64_t ret_ref = tag_ptr(ret_copy, true);
14336         return ret_ref;
14337 }
14338
14339 static jclass LDKPathFailure_InitialSend_class = NULL;
14340 static jmethodID LDKPathFailure_InitialSend_meth = NULL;
14341 static jclass LDKPathFailure_OnPath_class = NULL;
14342 static jmethodID LDKPathFailure_OnPath_meth = NULL;
14343 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKPathFailure_init (JNIEnv *env, jclass clz) {
14344         LDKPathFailure_InitialSend_class =
14345                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPathFailure$InitialSend"));
14346         CHECK(LDKPathFailure_InitialSend_class != NULL);
14347         LDKPathFailure_InitialSend_meth = (*env)->GetMethodID(env, LDKPathFailure_InitialSend_class, "<init>", "(J)V");
14348         CHECK(LDKPathFailure_InitialSend_meth != NULL);
14349         LDKPathFailure_OnPath_class =
14350                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPathFailure$OnPath"));
14351         CHECK(LDKPathFailure_OnPath_class != NULL);
14352         LDKPathFailure_OnPath_meth = (*env)->GetMethodID(env, LDKPathFailure_OnPath_class, "<init>", "(J)V");
14353         CHECK(LDKPathFailure_OnPath_meth != NULL);
14354 }
14355 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKPathFailure_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
14356         LDKPathFailure *obj = (LDKPathFailure*)untag_ptr(ptr);
14357         switch(obj->tag) {
14358                 case LDKPathFailure_InitialSend: {
14359                         int64_t err_ref = tag_ptr(&obj->initial_send.err, false);
14360                         return (*env)->NewObject(env, LDKPathFailure_InitialSend_class, LDKPathFailure_InitialSend_meth, err_ref);
14361                 }
14362                 case LDKPathFailure_OnPath: {
14363                         int64_t network_update_ref = tag_ptr(&obj->on_path.network_update, false);
14364                         return (*env)->NewObject(env, LDKPathFailure_OnPath_class, LDKPathFailure_OnPath_meth, network_update_ref);
14365                 }
14366                 default: abort();
14367         }
14368 }
14369 static jclass LDKCOption_PathFailureZ_Some_class = NULL;
14370 static jmethodID LDKCOption_PathFailureZ_Some_meth = NULL;
14371 static jclass LDKCOption_PathFailureZ_None_class = NULL;
14372 static jmethodID LDKCOption_PathFailureZ_None_meth = NULL;
14373 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1PathFailureZ_init (JNIEnv *env, jclass clz) {
14374         LDKCOption_PathFailureZ_Some_class =
14375                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_PathFailureZ$Some"));
14376         CHECK(LDKCOption_PathFailureZ_Some_class != NULL);
14377         LDKCOption_PathFailureZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_PathFailureZ_Some_class, "<init>", "(J)V");
14378         CHECK(LDKCOption_PathFailureZ_Some_meth != NULL);
14379         LDKCOption_PathFailureZ_None_class =
14380                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_PathFailureZ$None"));
14381         CHECK(LDKCOption_PathFailureZ_None_class != NULL);
14382         LDKCOption_PathFailureZ_None_meth = (*env)->GetMethodID(env, LDKCOption_PathFailureZ_None_class, "<init>", "()V");
14383         CHECK(LDKCOption_PathFailureZ_None_meth != NULL);
14384 }
14385 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1PathFailureZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
14386         LDKCOption_PathFailureZ *obj = (LDKCOption_PathFailureZ*)untag_ptr(ptr);
14387         switch(obj->tag) {
14388                 case LDKCOption_PathFailureZ_Some: {
14389                         int64_t some_ref = tag_ptr(&obj->some, false);
14390                         return (*env)->NewObject(env, LDKCOption_PathFailureZ_Some_class, LDKCOption_PathFailureZ_Some_meth, some_ref);
14391                 }
14392                 case LDKCOption_PathFailureZ_None: {
14393                         return (*env)->NewObject(env, LDKCOption_PathFailureZ_None_class, LDKCOption_PathFailureZ_None_meth);
14394                 }
14395                 default: abort();
14396         }
14397 }
14398 static inline struct LDKCOption_PathFailureZ CResult_COption_PathFailureZDecodeErrorZ_get_ok(LDKCResult_COption_PathFailureZDecodeErrorZ *NONNULL_PTR owner){
14399 CHECK(owner->result_ok);
14400         return COption_PathFailureZ_clone(&*owner->contents.result);
14401 }
14402 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1PathFailureZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
14403         LDKCResult_COption_PathFailureZDecodeErrorZ* owner_conv = (LDKCResult_COption_PathFailureZDecodeErrorZ*)untag_ptr(owner);
14404         LDKCOption_PathFailureZ *ret_copy = MALLOC(sizeof(LDKCOption_PathFailureZ), "LDKCOption_PathFailureZ");
14405         *ret_copy = CResult_COption_PathFailureZDecodeErrorZ_get_ok(owner_conv);
14406         int64_t ret_ref = tag_ptr(ret_copy, true);
14407         return ret_ref;
14408 }
14409
14410 static inline struct LDKDecodeError CResult_COption_PathFailureZDecodeErrorZ_get_err(LDKCResult_COption_PathFailureZDecodeErrorZ *NONNULL_PTR owner){
14411 CHECK(!owner->result_ok);
14412         return DecodeError_clone(&*owner->contents.err);
14413 }
14414 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1PathFailureZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
14415         LDKCResult_COption_PathFailureZDecodeErrorZ* owner_conv = (LDKCResult_COption_PathFailureZDecodeErrorZ*)untag_ptr(owner);
14416         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
14417         *ret_copy = CResult_COption_PathFailureZDecodeErrorZ_get_err(owner_conv);
14418         int64_t ret_ref = tag_ptr(ret_copy, true);
14419         return ret_ref;
14420 }
14421
14422 static jclass LDKCOption_ClosureReasonZ_Some_class = NULL;
14423 static jmethodID LDKCOption_ClosureReasonZ_Some_meth = NULL;
14424 static jclass LDKCOption_ClosureReasonZ_None_class = NULL;
14425 static jmethodID LDKCOption_ClosureReasonZ_None_meth = NULL;
14426 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1ClosureReasonZ_init (JNIEnv *env, jclass clz) {
14427         LDKCOption_ClosureReasonZ_Some_class =
14428                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_ClosureReasonZ$Some"));
14429         CHECK(LDKCOption_ClosureReasonZ_Some_class != NULL);
14430         LDKCOption_ClosureReasonZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_ClosureReasonZ_Some_class, "<init>", "(J)V");
14431         CHECK(LDKCOption_ClosureReasonZ_Some_meth != NULL);
14432         LDKCOption_ClosureReasonZ_None_class =
14433                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_ClosureReasonZ$None"));
14434         CHECK(LDKCOption_ClosureReasonZ_None_class != NULL);
14435         LDKCOption_ClosureReasonZ_None_meth = (*env)->GetMethodID(env, LDKCOption_ClosureReasonZ_None_class, "<init>", "()V");
14436         CHECK(LDKCOption_ClosureReasonZ_None_meth != NULL);
14437 }
14438 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1ClosureReasonZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
14439         LDKCOption_ClosureReasonZ *obj = (LDKCOption_ClosureReasonZ*)untag_ptr(ptr);
14440         switch(obj->tag) {
14441                 case LDKCOption_ClosureReasonZ_Some: {
14442                         int64_t some_ref = tag_ptr(&obj->some, false);
14443                         return (*env)->NewObject(env, LDKCOption_ClosureReasonZ_Some_class, LDKCOption_ClosureReasonZ_Some_meth, some_ref);
14444                 }
14445                 case LDKCOption_ClosureReasonZ_None: {
14446                         return (*env)->NewObject(env, LDKCOption_ClosureReasonZ_None_class, LDKCOption_ClosureReasonZ_None_meth);
14447                 }
14448                 default: abort();
14449         }
14450 }
14451 static inline struct LDKCOption_ClosureReasonZ CResult_COption_ClosureReasonZDecodeErrorZ_get_ok(LDKCResult_COption_ClosureReasonZDecodeErrorZ *NONNULL_PTR owner){
14452 CHECK(owner->result_ok);
14453         return COption_ClosureReasonZ_clone(&*owner->contents.result);
14454 }
14455 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1ClosureReasonZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
14456         LDKCResult_COption_ClosureReasonZDecodeErrorZ* owner_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)untag_ptr(owner);
14457         LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
14458         *ret_copy = CResult_COption_ClosureReasonZDecodeErrorZ_get_ok(owner_conv);
14459         int64_t ret_ref = tag_ptr(ret_copy, true);
14460         return ret_ref;
14461 }
14462
14463 static inline struct LDKDecodeError CResult_COption_ClosureReasonZDecodeErrorZ_get_err(LDKCResult_COption_ClosureReasonZDecodeErrorZ *NONNULL_PTR owner){
14464 CHECK(!owner->result_ok);
14465         return DecodeError_clone(&*owner->contents.err);
14466 }
14467 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1ClosureReasonZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
14468         LDKCResult_COption_ClosureReasonZDecodeErrorZ* owner_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)untag_ptr(owner);
14469         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
14470         *ret_copy = CResult_COption_ClosureReasonZDecodeErrorZ_get_err(owner_conv);
14471         int64_t ret_ref = tag_ptr(ret_copy, true);
14472         return ret_ref;
14473 }
14474
14475 static jclass LDKHTLCDestination_NextHopChannel_class = NULL;
14476 static jmethodID LDKHTLCDestination_NextHopChannel_meth = NULL;
14477 static jclass LDKHTLCDestination_UnknownNextHop_class = NULL;
14478 static jmethodID LDKHTLCDestination_UnknownNextHop_meth = NULL;
14479 static jclass LDKHTLCDestination_InvalidForward_class = NULL;
14480 static jmethodID LDKHTLCDestination_InvalidForward_meth = NULL;
14481 static jclass LDKHTLCDestination_InvalidOnion_class = NULL;
14482 static jmethodID LDKHTLCDestination_InvalidOnion_meth = NULL;
14483 static jclass LDKHTLCDestination_FailedPayment_class = NULL;
14484 static jmethodID LDKHTLCDestination_FailedPayment_meth = NULL;
14485 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKHTLCDestination_init (JNIEnv *env, jclass clz) {
14486         LDKHTLCDestination_NextHopChannel_class =
14487                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKHTLCDestination$NextHopChannel"));
14488         CHECK(LDKHTLCDestination_NextHopChannel_class != NULL);
14489         LDKHTLCDestination_NextHopChannel_meth = (*env)->GetMethodID(env, LDKHTLCDestination_NextHopChannel_class, "<init>", "([BJ)V");
14490         CHECK(LDKHTLCDestination_NextHopChannel_meth != NULL);
14491         LDKHTLCDestination_UnknownNextHop_class =
14492                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKHTLCDestination$UnknownNextHop"));
14493         CHECK(LDKHTLCDestination_UnknownNextHop_class != NULL);
14494         LDKHTLCDestination_UnknownNextHop_meth = (*env)->GetMethodID(env, LDKHTLCDestination_UnknownNextHop_class, "<init>", "(J)V");
14495         CHECK(LDKHTLCDestination_UnknownNextHop_meth != NULL);
14496         LDKHTLCDestination_InvalidForward_class =
14497                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKHTLCDestination$InvalidForward"));
14498         CHECK(LDKHTLCDestination_InvalidForward_class != NULL);
14499         LDKHTLCDestination_InvalidForward_meth = (*env)->GetMethodID(env, LDKHTLCDestination_InvalidForward_class, "<init>", "(J)V");
14500         CHECK(LDKHTLCDestination_InvalidForward_meth != NULL);
14501         LDKHTLCDestination_InvalidOnion_class =
14502                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKHTLCDestination$InvalidOnion"));
14503         CHECK(LDKHTLCDestination_InvalidOnion_class != NULL);
14504         LDKHTLCDestination_InvalidOnion_meth = (*env)->GetMethodID(env, LDKHTLCDestination_InvalidOnion_class, "<init>", "()V");
14505         CHECK(LDKHTLCDestination_InvalidOnion_meth != NULL);
14506         LDKHTLCDestination_FailedPayment_class =
14507                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKHTLCDestination$FailedPayment"));
14508         CHECK(LDKHTLCDestination_FailedPayment_class != NULL);
14509         LDKHTLCDestination_FailedPayment_meth = (*env)->GetMethodID(env, LDKHTLCDestination_FailedPayment_class, "<init>", "([B)V");
14510         CHECK(LDKHTLCDestination_FailedPayment_meth != NULL);
14511 }
14512 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKHTLCDestination_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
14513         LDKHTLCDestination *obj = (LDKHTLCDestination*)untag_ptr(ptr);
14514         switch(obj->tag) {
14515                 case LDKHTLCDestination_NextHopChannel: {
14516                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
14517                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->next_hop_channel.node_id.compressed_form);
14518                         LDKChannelId channel_id_var = obj->next_hop_channel.channel_id;
14519                         int64_t channel_id_ref = 0;
14520                         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_var);
14521                         channel_id_ref = tag_ptr(channel_id_var.inner, false);
14522                         return (*env)->NewObject(env, LDKHTLCDestination_NextHopChannel_class, LDKHTLCDestination_NextHopChannel_meth, node_id_arr, channel_id_ref);
14523                 }
14524                 case LDKHTLCDestination_UnknownNextHop: {
14525                         int64_t requested_forward_scid_conv = obj->unknown_next_hop.requested_forward_scid;
14526                         return (*env)->NewObject(env, LDKHTLCDestination_UnknownNextHop_class, LDKHTLCDestination_UnknownNextHop_meth, requested_forward_scid_conv);
14527                 }
14528                 case LDKHTLCDestination_InvalidForward: {
14529                         int64_t requested_forward_scid_conv = obj->invalid_forward.requested_forward_scid;
14530                         return (*env)->NewObject(env, LDKHTLCDestination_InvalidForward_class, LDKHTLCDestination_InvalidForward_meth, requested_forward_scid_conv);
14531                 }
14532                 case LDKHTLCDestination_InvalidOnion: {
14533                         return (*env)->NewObject(env, LDKHTLCDestination_InvalidOnion_class, LDKHTLCDestination_InvalidOnion_meth);
14534                 }
14535                 case LDKHTLCDestination_FailedPayment: {
14536                         int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
14537                         (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->failed_payment.payment_hash.data);
14538                         return (*env)->NewObject(env, LDKHTLCDestination_FailedPayment_class, LDKHTLCDestination_FailedPayment_meth, payment_hash_arr);
14539                 }
14540                 default: abort();
14541         }
14542 }
14543 static jclass LDKCOption_HTLCDestinationZ_Some_class = NULL;
14544 static jmethodID LDKCOption_HTLCDestinationZ_Some_meth = NULL;
14545 static jclass LDKCOption_HTLCDestinationZ_None_class = NULL;
14546 static jmethodID LDKCOption_HTLCDestinationZ_None_meth = NULL;
14547 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1HTLCDestinationZ_init (JNIEnv *env, jclass clz) {
14548         LDKCOption_HTLCDestinationZ_Some_class =
14549                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_HTLCDestinationZ$Some"));
14550         CHECK(LDKCOption_HTLCDestinationZ_Some_class != NULL);
14551         LDKCOption_HTLCDestinationZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_HTLCDestinationZ_Some_class, "<init>", "(J)V");
14552         CHECK(LDKCOption_HTLCDestinationZ_Some_meth != NULL);
14553         LDKCOption_HTLCDestinationZ_None_class =
14554                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_HTLCDestinationZ$None"));
14555         CHECK(LDKCOption_HTLCDestinationZ_None_class != NULL);
14556         LDKCOption_HTLCDestinationZ_None_meth = (*env)->GetMethodID(env, LDKCOption_HTLCDestinationZ_None_class, "<init>", "()V");
14557         CHECK(LDKCOption_HTLCDestinationZ_None_meth != NULL);
14558 }
14559 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1HTLCDestinationZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
14560         LDKCOption_HTLCDestinationZ *obj = (LDKCOption_HTLCDestinationZ*)untag_ptr(ptr);
14561         switch(obj->tag) {
14562                 case LDKCOption_HTLCDestinationZ_Some: {
14563                         int64_t some_ref = tag_ptr(&obj->some, false);
14564                         return (*env)->NewObject(env, LDKCOption_HTLCDestinationZ_Some_class, LDKCOption_HTLCDestinationZ_Some_meth, some_ref);
14565                 }
14566                 case LDKCOption_HTLCDestinationZ_None: {
14567                         return (*env)->NewObject(env, LDKCOption_HTLCDestinationZ_None_class, LDKCOption_HTLCDestinationZ_None_meth);
14568                 }
14569                 default: abort();
14570         }
14571 }
14572 static inline struct LDKCOption_HTLCDestinationZ CResult_COption_HTLCDestinationZDecodeErrorZ_get_ok(LDKCResult_COption_HTLCDestinationZDecodeErrorZ *NONNULL_PTR owner){
14573 CHECK(owner->result_ok);
14574         return COption_HTLCDestinationZ_clone(&*owner->contents.result);
14575 }
14576 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1HTLCDestinationZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
14577         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* owner_conv = (LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)untag_ptr(owner);
14578         LDKCOption_HTLCDestinationZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCDestinationZ), "LDKCOption_HTLCDestinationZ");
14579         *ret_copy = CResult_COption_HTLCDestinationZDecodeErrorZ_get_ok(owner_conv);
14580         int64_t ret_ref = tag_ptr(ret_copy, true);
14581         return ret_ref;
14582 }
14583
14584 static inline struct LDKDecodeError CResult_COption_HTLCDestinationZDecodeErrorZ_get_err(LDKCResult_COption_HTLCDestinationZDecodeErrorZ *NONNULL_PTR owner){
14585 CHECK(!owner->result_ok);
14586         return DecodeError_clone(&*owner->contents.err);
14587 }
14588 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1HTLCDestinationZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
14589         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* owner_conv = (LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)untag_ptr(owner);
14590         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
14591         *ret_copy = CResult_COption_HTLCDestinationZDecodeErrorZ_get_err(owner_conv);
14592         int64_t ret_ref = tag_ptr(ret_copy, true);
14593         return ret_ref;
14594 }
14595
14596 static inline enum LDKPaymentFailureReason CResult_PaymentFailureReasonDecodeErrorZ_get_ok(LDKCResult_PaymentFailureReasonDecodeErrorZ *NONNULL_PTR owner){
14597 CHECK(owner->result_ok);
14598         return PaymentFailureReason_clone(&*owner->contents.result);
14599 }
14600 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentFailureReasonDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
14601         LDKCResult_PaymentFailureReasonDecodeErrorZ* owner_conv = (LDKCResult_PaymentFailureReasonDecodeErrorZ*)untag_ptr(owner);
14602         jclass ret_conv = LDKPaymentFailureReason_to_java(env, CResult_PaymentFailureReasonDecodeErrorZ_get_ok(owner_conv));
14603         return ret_conv;
14604 }
14605
14606 static inline struct LDKDecodeError CResult_PaymentFailureReasonDecodeErrorZ_get_err(LDKCResult_PaymentFailureReasonDecodeErrorZ *NONNULL_PTR owner){
14607 CHECK(!owner->result_ok);
14608         return DecodeError_clone(&*owner->contents.err);
14609 }
14610 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentFailureReasonDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
14611         LDKCResult_PaymentFailureReasonDecodeErrorZ* owner_conv = (LDKCResult_PaymentFailureReasonDecodeErrorZ*)untag_ptr(owner);
14612         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
14613         *ret_copy = CResult_PaymentFailureReasonDecodeErrorZ_get_err(owner_conv);
14614         int64_t ret_ref = tag_ptr(ret_copy, true);
14615         return ret_ref;
14616 }
14617
14618 static jclass LDKCOption_U128Z_Some_class = NULL;
14619 static jmethodID LDKCOption_U128Z_Some_meth = NULL;
14620 static jclass LDKCOption_U128Z_None_class = NULL;
14621 static jmethodID LDKCOption_U128Z_None_meth = NULL;
14622 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1U128Z_init (JNIEnv *env, jclass clz) {
14623         LDKCOption_U128Z_Some_class =
14624                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_U128Z$Some"));
14625         CHECK(LDKCOption_U128Z_Some_class != NULL);
14626         LDKCOption_U128Z_Some_meth = (*env)->GetMethodID(env, LDKCOption_U128Z_Some_class, "<init>", "([B)V");
14627         CHECK(LDKCOption_U128Z_Some_meth != NULL);
14628         LDKCOption_U128Z_None_class =
14629                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_U128Z$None"));
14630         CHECK(LDKCOption_U128Z_None_class != NULL);
14631         LDKCOption_U128Z_None_meth = (*env)->GetMethodID(env, LDKCOption_U128Z_None_class, "<init>", "()V");
14632         CHECK(LDKCOption_U128Z_None_meth != NULL);
14633 }
14634 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1U128Z_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
14635         LDKCOption_U128Z *obj = (LDKCOption_U128Z*)untag_ptr(ptr);
14636         switch(obj->tag) {
14637                 case LDKCOption_U128Z_Some: {
14638                         int8_tArray some_arr = (*env)->NewByteArray(env, 16);
14639                         (*env)->SetByteArrayRegion(env, some_arr, 0, 16, obj->some.le_bytes);
14640                         return (*env)->NewObject(env, LDKCOption_U128Z_Some_class, LDKCOption_U128Z_Some_meth, some_arr);
14641                 }
14642                 case LDKCOption_U128Z_None: {
14643                         return (*env)->NewObject(env, LDKCOption_U128Z_None_class, LDKCOption_U128Z_None_meth);
14644                 }
14645                 default: abort();
14646         }
14647 }
14648 static inline LDKCVec_ClaimedHTLCZ CVec_ClaimedHTLCZ_clone(const LDKCVec_ClaimedHTLCZ *orig) {
14649         LDKCVec_ClaimedHTLCZ ret = { .data = MALLOC(sizeof(LDKClaimedHTLC) * orig->datalen, "LDKCVec_ClaimedHTLCZ clone bytes"), .datalen = orig->datalen };
14650         for (size_t i = 0; i < ret.datalen; i++) {
14651                 ret.data[i] = ClaimedHTLC_clone(&orig->data[i]);
14652         }
14653         return ret;
14654 }
14655 static jclass LDKCOption_PaymentFailureReasonZ_Some_class = NULL;
14656 static jmethodID LDKCOption_PaymentFailureReasonZ_Some_meth = NULL;
14657 static jclass LDKCOption_PaymentFailureReasonZ_None_class = NULL;
14658 static jmethodID LDKCOption_PaymentFailureReasonZ_None_meth = NULL;
14659 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1PaymentFailureReasonZ_init (JNIEnv *env, jclass clz) {
14660         LDKCOption_PaymentFailureReasonZ_Some_class =
14661                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_PaymentFailureReasonZ$Some"));
14662         CHECK(LDKCOption_PaymentFailureReasonZ_Some_class != NULL);
14663         LDKCOption_PaymentFailureReasonZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_PaymentFailureReasonZ_Some_class, "<init>", "(Lorg/ldk/enums/PaymentFailureReason;)V");
14664         CHECK(LDKCOption_PaymentFailureReasonZ_Some_meth != NULL);
14665         LDKCOption_PaymentFailureReasonZ_None_class =
14666                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_PaymentFailureReasonZ$None"));
14667         CHECK(LDKCOption_PaymentFailureReasonZ_None_class != NULL);
14668         LDKCOption_PaymentFailureReasonZ_None_meth = (*env)->GetMethodID(env, LDKCOption_PaymentFailureReasonZ_None_class, "<init>", "()V");
14669         CHECK(LDKCOption_PaymentFailureReasonZ_None_meth != NULL);
14670 }
14671 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1PaymentFailureReasonZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
14672         LDKCOption_PaymentFailureReasonZ *obj = (LDKCOption_PaymentFailureReasonZ*)untag_ptr(ptr);
14673         switch(obj->tag) {
14674                 case LDKCOption_PaymentFailureReasonZ_Some: {
14675                         jclass some_conv = LDKPaymentFailureReason_to_java(env, obj->some);
14676                         return (*env)->NewObject(env, LDKCOption_PaymentFailureReasonZ_Some_class, LDKCOption_PaymentFailureReasonZ_Some_meth, some_conv);
14677                 }
14678                 case LDKCOption_PaymentFailureReasonZ_None: {
14679                         return (*env)->NewObject(env, LDKCOption_PaymentFailureReasonZ_None_class, LDKCOption_PaymentFailureReasonZ_None_meth);
14680                 }
14681                 default: abort();
14682         }
14683 }
14684 static jclass LDKBumpTransactionEvent_ChannelClose_class = NULL;
14685 static jmethodID LDKBumpTransactionEvent_ChannelClose_meth = NULL;
14686 static jclass LDKBumpTransactionEvent_HTLCResolution_class = NULL;
14687 static jmethodID LDKBumpTransactionEvent_HTLCResolution_meth = NULL;
14688 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKBumpTransactionEvent_init (JNIEnv *env, jclass clz) {
14689         LDKBumpTransactionEvent_ChannelClose_class =
14690                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBumpTransactionEvent$ChannelClose"));
14691         CHECK(LDKBumpTransactionEvent_ChannelClose_class != NULL);
14692         LDKBumpTransactionEvent_ChannelClose_meth = (*env)->GetMethodID(env, LDKBumpTransactionEvent_ChannelClose_class, "<init>", "(J[B[BI[BJJ[J)V");
14693         CHECK(LDKBumpTransactionEvent_ChannelClose_meth != NULL);
14694         LDKBumpTransactionEvent_HTLCResolution_class =
14695                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBumpTransactionEvent$HTLCResolution"));
14696         CHECK(LDKBumpTransactionEvent_HTLCResolution_class != NULL);
14697         LDKBumpTransactionEvent_HTLCResolution_meth = (*env)->GetMethodID(env, LDKBumpTransactionEvent_HTLCResolution_class, "<init>", "(J[B[BI[JI)V");
14698         CHECK(LDKBumpTransactionEvent_HTLCResolution_meth != NULL);
14699 }
14700 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKBumpTransactionEvent_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
14701         LDKBumpTransactionEvent *obj = (LDKBumpTransactionEvent*)untag_ptr(ptr);
14702         switch(obj->tag) {
14703                 case LDKBumpTransactionEvent_ChannelClose: {
14704                         LDKChannelId channel_id_var = obj->channel_close.channel_id;
14705                         int64_t channel_id_ref = 0;
14706                         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_var);
14707                         channel_id_ref = tag_ptr(channel_id_var.inner, false);
14708                         int8_tArray counterparty_node_id_arr = (*env)->NewByteArray(env, 33);
14709                         (*env)->SetByteArrayRegion(env, counterparty_node_id_arr, 0, 33, obj->channel_close.counterparty_node_id.compressed_form);
14710                         int8_tArray claim_id_arr = (*env)->NewByteArray(env, 32);
14711                         (*env)->SetByteArrayRegion(env, claim_id_arr, 0, 32, obj->channel_close.claim_id.data);
14712                         int32_t package_target_feerate_sat_per_1000_weight_conv = obj->channel_close.package_target_feerate_sat_per_1000_weight;
14713                         LDKTransaction commitment_tx_var = obj->channel_close.commitment_tx;
14714                         int8_tArray commitment_tx_arr = (*env)->NewByteArray(env, commitment_tx_var.datalen);
14715                         (*env)->SetByteArrayRegion(env, commitment_tx_arr, 0, commitment_tx_var.datalen, commitment_tx_var.data);
14716                         int64_t commitment_tx_fee_satoshis_conv = obj->channel_close.commitment_tx_fee_satoshis;
14717                         LDKAnchorDescriptor anchor_descriptor_var = obj->channel_close.anchor_descriptor;
14718                         int64_t anchor_descriptor_ref = 0;
14719                         CHECK_INNER_FIELD_ACCESS_OR_NULL(anchor_descriptor_var);
14720                         anchor_descriptor_ref = tag_ptr(anchor_descriptor_var.inner, false);
14721                         LDKCVec_HTLCOutputInCommitmentZ pending_htlcs_var = obj->channel_close.pending_htlcs;
14722                         int64_tArray pending_htlcs_arr = NULL;
14723                         pending_htlcs_arr = (*env)->NewLongArray(env, pending_htlcs_var.datalen);
14724                         int64_t *pending_htlcs_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, pending_htlcs_arr, NULL);
14725                         for (size_t y = 0; y < pending_htlcs_var.datalen; y++) {
14726                                 LDKHTLCOutputInCommitment pending_htlcs_conv_24_var = pending_htlcs_var.data[y];
14727                                 int64_t pending_htlcs_conv_24_ref = 0;
14728                                 CHECK_INNER_FIELD_ACCESS_OR_NULL(pending_htlcs_conv_24_var);
14729                                 pending_htlcs_conv_24_ref = tag_ptr(pending_htlcs_conv_24_var.inner, false);
14730                                 pending_htlcs_arr_ptr[y] = pending_htlcs_conv_24_ref;
14731                         }
14732                         (*env)->ReleasePrimitiveArrayCritical(env, pending_htlcs_arr, pending_htlcs_arr_ptr, 0);
14733                         return (*env)->NewObject(env, LDKBumpTransactionEvent_ChannelClose_class, LDKBumpTransactionEvent_ChannelClose_meth, channel_id_ref, counterparty_node_id_arr, claim_id_arr, package_target_feerate_sat_per_1000_weight_conv, commitment_tx_arr, commitment_tx_fee_satoshis_conv, anchor_descriptor_ref, pending_htlcs_arr);
14734                 }
14735                 case LDKBumpTransactionEvent_HTLCResolution: {
14736                         LDKChannelId channel_id_var = obj->htlc_resolution.channel_id;
14737                         int64_t channel_id_ref = 0;
14738                         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_var);
14739                         channel_id_ref = tag_ptr(channel_id_var.inner, false);
14740                         int8_tArray counterparty_node_id_arr = (*env)->NewByteArray(env, 33);
14741                         (*env)->SetByteArrayRegion(env, counterparty_node_id_arr, 0, 33, obj->htlc_resolution.counterparty_node_id.compressed_form);
14742                         int8_tArray claim_id_arr = (*env)->NewByteArray(env, 32);
14743                         (*env)->SetByteArrayRegion(env, claim_id_arr, 0, 32, obj->htlc_resolution.claim_id.data);
14744                         int32_t target_feerate_sat_per_1000_weight_conv = obj->htlc_resolution.target_feerate_sat_per_1000_weight;
14745                         LDKCVec_HTLCDescriptorZ htlc_descriptors_var = obj->htlc_resolution.htlc_descriptors;
14746                         int64_tArray htlc_descriptors_arr = NULL;
14747                         htlc_descriptors_arr = (*env)->NewLongArray(env, htlc_descriptors_var.datalen);
14748                         int64_t *htlc_descriptors_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, htlc_descriptors_arr, NULL);
14749                         for (size_t q = 0; q < htlc_descriptors_var.datalen; q++) {
14750                                 LDKHTLCDescriptor htlc_descriptors_conv_16_var = htlc_descriptors_var.data[q];
14751                                 int64_t htlc_descriptors_conv_16_ref = 0;
14752                                 CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_descriptors_conv_16_var);
14753                                 htlc_descriptors_conv_16_ref = tag_ptr(htlc_descriptors_conv_16_var.inner, false);
14754                                 htlc_descriptors_arr_ptr[q] = htlc_descriptors_conv_16_ref;
14755                         }
14756                         (*env)->ReleasePrimitiveArrayCritical(env, htlc_descriptors_arr, htlc_descriptors_arr_ptr, 0);
14757                         int32_t tx_lock_time_conv = obj->htlc_resolution.tx_lock_time;
14758                         return (*env)->NewObject(env, LDKBumpTransactionEvent_HTLCResolution_class, LDKBumpTransactionEvent_HTLCResolution_meth, channel_id_ref, counterparty_node_id_arr, claim_id_arr, target_feerate_sat_per_1000_weight_conv, htlc_descriptors_arr, tx_lock_time_conv);
14759                 }
14760                 default: abort();
14761         }
14762 }
14763 static jclass LDKEvent_FundingGenerationReady_class = NULL;
14764 static jmethodID LDKEvent_FundingGenerationReady_meth = NULL;
14765 static jclass LDKEvent_PaymentClaimable_class = NULL;
14766 static jmethodID LDKEvent_PaymentClaimable_meth = NULL;
14767 static jclass LDKEvent_PaymentClaimed_class = NULL;
14768 static jmethodID LDKEvent_PaymentClaimed_meth = NULL;
14769 static jclass LDKEvent_ConnectionNeeded_class = NULL;
14770 static jmethodID LDKEvent_ConnectionNeeded_meth = NULL;
14771 static jclass LDKEvent_InvoiceRequestFailed_class = NULL;
14772 static jmethodID LDKEvent_InvoiceRequestFailed_meth = NULL;
14773 static jclass LDKEvent_PaymentSent_class = NULL;
14774 static jmethodID LDKEvent_PaymentSent_meth = NULL;
14775 static jclass LDKEvent_PaymentFailed_class = NULL;
14776 static jmethodID LDKEvent_PaymentFailed_meth = NULL;
14777 static jclass LDKEvent_PaymentPathSuccessful_class = NULL;
14778 static jmethodID LDKEvent_PaymentPathSuccessful_meth = NULL;
14779 static jclass LDKEvent_PaymentPathFailed_class = NULL;
14780 static jmethodID LDKEvent_PaymentPathFailed_meth = NULL;
14781 static jclass LDKEvent_ProbeSuccessful_class = NULL;
14782 static jmethodID LDKEvent_ProbeSuccessful_meth = NULL;
14783 static jclass LDKEvent_ProbeFailed_class = NULL;
14784 static jmethodID LDKEvent_ProbeFailed_meth = NULL;
14785 static jclass LDKEvent_PendingHTLCsForwardable_class = NULL;
14786 static jmethodID LDKEvent_PendingHTLCsForwardable_meth = NULL;
14787 static jclass LDKEvent_HTLCIntercepted_class = NULL;
14788 static jmethodID LDKEvent_HTLCIntercepted_meth = NULL;
14789 static jclass LDKEvent_SpendableOutputs_class = NULL;
14790 static jmethodID LDKEvent_SpendableOutputs_meth = NULL;
14791 static jclass LDKEvent_PaymentForwarded_class = NULL;
14792 static jmethodID LDKEvent_PaymentForwarded_meth = NULL;
14793 static jclass LDKEvent_ChannelPending_class = NULL;
14794 static jmethodID LDKEvent_ChannelPending_meth = NULL;
14795 static jclass LDKEvent_ChannelReady_class = NULL;
14796 static jmethodID LDKEvent_ChannelReady_meth = NULL;
14797 static jclass LDKEvent_ChannelClosed_class = NULL;
14798 static jmethodID LDKEvent_ChannelClosed_meth = NULL;
14799 static jclass LDKEvent_DiscardFunding_class = NULL;
14800 static jmethodID LDKEvent_DiscardFunding_meth = NULL;
14801 static jclass LDKEvent_OpenChannelRequest_class = NULL;
14802 static jmethodID LDKEvent_OpenChannelRequest_meth = NULL;
14803 static jclass LDKEvent_HTLCHandlingFailed_class = NULL;
14804 static jmethodID LDKEvent_HTLCHandlingFailed_meth = NULL;
14805 static jclass LDKEvent_BumpTransaction_class = NULL;
14806 static jmethodID LDKEvent_BumpTransaction_meth = NULL;
14807 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKEvent_init (JNIEnv *env, jclass clz) {
14808         LDKEvent_FundingGenerationReady_class =
14809                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$FundingGenerationReady"));
14810         CHECK(LDKEvent_FundingGenerationReady_class != NULL);
14811         LDKEvent_FundingGenerationReady_meth = (*env)->GetMethodID(env, LDKEvent_FundingGenerationReady_class, "<init>", "(J[BJ[B[B)V");
14812         CHECK(LDKEvent_FundingGenerationReady_meth != NULL);
14813         LDKEvent_PaymentClaimable_class =
14814                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$PaymentClaimable"));
14815         CHECK(LDKEvent_PaymentClaimable_class != NULL);
14816         LDKEvent_PaymentClaimable_meth = (*env)->GetMethodID(env, LDKEvent_PaymentClaimable_class, "<init>", "([B[BJJJJJJJ)V");
14817         CHECK(LDKEvent_PaymentClaimable_meth != NULL);
14818         LDKEvent_PaymentClaimed_class =
14819                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$PaymentClaimed"));
14820         CHECK(LDKEvent_PaymentClaimed_class != NULL);
14821         LDKEvent_PaymentClaimed_meth = (*env)->GetMethodID(env, LDKEvent_PaymentClaimed_class, "<init>", "([B[BJJ[JJ)V");
14822         CHECK(LDKEvent_PaymentClaimed_meth != NULL);
14823         LDKEvent_ConnectionNeeded_class =
14824                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$ConnectionNeeded"));
14825         CHECK(LDKEvent_ConnectionNeeded_class != NULL);
14826         LDKEvent_ConnectionNeeded_meth = (*env)->GetMethodID(env, LDKEvent_ConnectionNeeded_class, "<init>", "([B[J)V");
14827         CHECK(LDKEvent_ConnectionNeeded_meth != NULL);
14828         LDKEvent_InvoiceRequestFailed_class =
14829                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$InvoiceRequestFailed"));
14830         CHECK(LDKEvent_InvoiceRequestFailed_class != NULL);
14831         LDKEvent_InvoiceRequestFailed_meth = (*env)->GetMethodID(env, LDKEvent_InvoiceRequestFailed_class, "<init>", "([B)V");
14832         CHECK(LDKEvent_InvoiceRequestFailed_meth != NULL);
14833         LDKEvent_PaymentSent_class =
14834                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$PaymentSent"));
14835         CHECK(LDKEvent_PaymentSent_class != NULL);
14836         LDKEvent_PaymentSent_meth = (*env)->GetMethodID(env, LDKEvent_PaymentSent_class, "<init>", "(J[B[BJ)V");
14837         CHECK(LDKEvent_PaymentSent_meth != NULL);
14838         LDKEvent_PaymentFailed_class =
14839                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$PaymentFailed"));
14840         CHECK(LDKEvent_PaymentFailed_class != NULL);
14841         LDKEvent_PaymentFailed_meth = (*env)->GetMethodID(env, LDKEvent_PaymentFailed_class, "<init>", "([B[BJ)V");
14842         CHECK(LDKEvent_PaymentFailed_meth != NULL);
14843         LDKEvent_PaymentPathSuccessful_class =
14844                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$PaymentPathSuccessful"));
14845         CHECK(LDKEvent_PaymentPathSuccessful_class != NULL);
14846         LDKEvent_PaymentPathSuccessful_meth = (*env)->GetMethodID(env, LDKEvent_PaymentPathSuccessful_class, "<init>", "([BJJ)V");
14847         CHECK(LDKEvent_PaymentPathSuccessful_meth != NULL);
14848         LDKEvent_PaymentPathFailed_class =
14849                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$PaymentPathFailed"));
14850         CHECK(LDKEvent_PaymentPathFailed_class != NULL);
14851         LDKEvent_PaymentPathFailed_meth = (*env)->GetMethodID(env, LDKEvent_PaymentPathFailed_class, "<init>", "(J[BZJJJ)V");
14852         CHECK(LDKEvent_PaymentPathFailed_meth != NULL);
14853         LDKEvent_ProbeSuccessful_class =
14854                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$ProbeSuccessful"));
14855         CHECK(LDKEvent_ProbeSuccessful_class != NULL);
14856         LDKEvent_ProbeSuccessful_meth = (*env)->GetMethodID(env, LDKEvent_ProbeSuccessful_class, "<init>", "([B[BJ)V");
14857         CHECK(LDKEvent_ProbeSuccessful_meth != NULL);
14858         LDKEvent_ProbeFailed_class =
14859                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$ProbeFailed"));
14860         CHECK(LDKEvent_ProbeFailed_class != NULL);
14861         LDKEvent_ProbeFailed_meth = (*env)->GetMethodID(env, LDKEvent_ProbeFailed_class, "<init>", "([B[BJJ)V");
14862         CHECK(LDKEvent_ProbeFailed_meth != NULL);
14863         LDKEvent_PendingHTLCsForwardable_class =
14864                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$PendingHTLCsForwardable"));
14865         CHECK(LDKEvent_PendingHTLCsForwardable_class != NULL);
14866         LDKEvent_PendingHTLCsForwardable_meth = (*env)->GetMethodID(env, LDKEvent_PendingHTLCsForwardable_class, "<init>", "(J)V");
14867         CHECK(LDKEvent_PendingHTLCsForwardable_meth != NULL);
14868         LDKEvent_HTLCIntercepted_class =
14869                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$HTLCIntercepted"));
14870         CHECK(LDKEvent_HTLCIntercepted_class != NULL);
14871         LDKEvent_HTLCIntercepted_meth = (*env)->GetMethodID(env, LDKEvent_HTLCIntercepted_class, "<init>", "([BJ[BJJ)V");
14872         CHECK(LDKEvent_HTLCIntercepted_meth != NULL);
14873         LDKEvent_SpendableOutputs_class =
14874                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$SpendableOutputs"));
14875         CHECK(LDKEvent_SpendableOutputs_class != NULL);
14876         LDKEvent_SpendableOutputs_meth = (*env)->GetMethodID(env, LDKEvent_SpendableOutputs_class, "<init>", "([JJ)V");
14877         CHECK(LDKEvent_SpendableOutputs_meth != NULL);
14878         LDKEvent_PaymentForwarded_class =
14879                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$PaymentForwarded"));
14880         CHECK(LDKEvent_PaymentForwarded_class != NULL);
14881         LDKEvent_PaymentForwarded_meth = (*env)->GetMethodID(env, LDKEvent_PaymentForwarded_class, "<init>", "(JJJJJJZJ)V");
14882         CHECK(LDKEvent_PaymentForwarded_meth != NULL);
14883         LDKEvent_ChannelPending_class =
14884                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$ChannelPending"));
14885         CHECK(LDKEvent_ChannelPending_class != NULL);
14886         LDKEvent_ChannelPending_meth = (*env)->GetMethodID(env, LDKEvent_ChannelPending_class, "<init>", "(J[BJ[BJJ)V");
14887         CHECK(LDKEvent_ChannelPending_meth != NULL);
14888         LDKEvent_ChannelReady_class =
14889                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$ChannelReady"));
14890         CHECK(LDKEvent_ChannelReady_class != NULL);
14891         LDKEvent_ChannelReady_meth = (*env)->GetMethodID(env, LDKEvent_ChannelReady_class, "<init>", "(J[B[BJ)V");
14892         CHECK(LDKEvent_ChannelReady_meth != NULL);
14893         LDKEvent_ChannelClosed_class =
14894                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$ChannelClosed"));
14895         CHECK(LDKEvent_ChannelClosed_class != NULL);
14896         LDKEvent_ChannelClosed_meth = (*env)->GetMethodID(env, LDKEvent_ChannelClosed_class, "<init>", "(J[BJ[BJJ)V");
14897         CHECK(LDKEvent_ChannelClosed_meth != NULL);
14898         LDKEvent_DiscardFunding_class =
14899                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$DiscardFunding"));
14900         CHECK(LDKEvent_DiscardFunding_class != NULL);
14901         LDKEvent_DiscardFunding_meth = (*env)->GetMethodID(env, LDKEvent_DiscardFunding_class, "<init>", "(J[B)V");
14902         CHECK(LDKEvent_DiscardFunding_meth != NULL);
14903         LDKEvent_OpenChannelRequest_class =
14904                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$OpenChannelRequest"));
14905         CHECK(LDKEvent_OpenChannelRequest_class != NULL);
14906         LDKEvent_OpenChannelRequest_meth = (*env)->GetMethodID(env, LDKEvent_OpenChannelRequest_class, "<init>", "(J[BJJJ)V");
14907         CHECK(LDKEvent_OpenChannelRequest_meth != NULL);
14908         LDKEvent_HTLCHandlingFailed_class =
14909                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$HTLCHandlingFailed"));
14910         CHECK(LDKEvent_HTLCHandlingFailed_class != NULL);
14911         LDKEvent_HTLCHandlingFailed_meth = (*env)->GetMethodID(env, LDKEvent_HTLCHandlingFailed_class, "<init>", "(JJ)V");
14912         CHECK(LDKEvent_HTLCHandlingFailed_meth != NULL);
14913         LDKEvent_BumpTransaction_class =
14914                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$BumpTransaction"));
14915         CHECK(LDKEvent_BumpTransaction_class != NULL);
14916         LDKEvent_BumpTransaction_meth = (*env)->GetMethodID(env, LDKEvent_BumpTransaction_class, "<init>", "(J)V");
14917         CHECK(LDKEvent_BumpTransaction_meth != NULL);
14918 }
14919 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKEvent_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
14920         LDKEvent *obj = (LDKEvent*)untag_ptr(ptr);
14921         switch(obj->tag) {
14922                 case LDKEvent_FundingGenerationReady: {
14923                         LDKChannelId temporary_channel_id_var = obj->funding_generation_ready.temporary_channel_id;
14924                         int64_t temporary_channel_id_ref = 0;
14925                         CHECK_INNER_FIELD_ACCESS_OR_NULL(temporary_channel_id_var);
14926                         temporary_channel_id_ref = tag_ptr(temporary_channel_id_var.inner, false);
14927                         int8_tArray counterparty_node_id_arr = (*env)->NewByteArray(env, 33);
14928                         (*env)->SetByteArrayRegion(env, counterparty_node_id_arr, 0, 33, obj->funding_generation_ready.counterparty_node_id.compressed_form);
14929                         int64_t channel_value_satoshis_conv = obj->funding_generation_ready.channel_value_satoshis;
14930                         LDKCVec_u8Z output_script_var = obj->funding_generation_ready.output_script;
14931                         int8_tArray output_script_arr = (*env)->NewByteArray(env, output_script_var.datalen);
14932                         (*env)->SetByteArrayRegion(env, output_script_arr, 0, output_script_var.datalen, output_script_var.data);
14933                         int8_tArray user_channel_id_arr = (*env)->NewByteArray(env, 16);
14934                         (*env)->SetByteArrayRegion(env, user_channel_id_arr, 0, 16, obj->funding_generation_ready.user_channel_id.le_bytes);
14935                         return (*env)->NewObject(env, LDKEvent_FundingGenerationReady_class, LDKEvent_FundingGenerationReady_meth, temporary_channel_id_ref, counterparty_node_id_arr, channel_value_satoshis_conv, output_script_arr, user_channel_id_arr);
14936                 }
14937                 case LDKEvent_PaymentClaimable: {
14938                         int8_tArray receiver_node_id_arr = (*env)->NewByteArray(env, 33);
14939                         (*env)->SetByteArrayRegion(env, receiver_node_id_arr, 0, 33, obj->payment_claimable.receiver_node_id.compressed_form);
14940                         int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
14941                         (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->payment_claimable.payment_hash.data);
14942                         LDKRecipientOnionFields onion_fields_var = obj->payment_claimable.onion_fields;
14943                         int64_t onion_fields_ref = 0;
14944                         CHECK_INNER_FIELD_ACCESS_OR_NULL(onion_fields_var);
14945                         onion_fields_ref = tag_ptr(onion_fields_var.inner, false);
14946                         int64_t amount_msat_conv = obj->payment_claimable.amount_msat;
14947                         int64_t counterparty_skimmed_fee_msat_conv = obj->payment_claimable.counterparty_skimmed_fee_msat;
14948                         int64_t purpose_ref = tag_ptr(&obj->payment_claimable.purpose, false);
14949                         LDKChannelId via_channel_id_var = obj->payment_claimable.via_channel_id;
14950                         int64_t via_channel_id_ref = 0;
14951                         CHECK_INNER_FIELD_ACCESS_OR_NULL(via_channel_id_var);
14952                         via_channel_id_ref = tag_ptr(via_channel_id_var.inner, false);
14953                         int64_t via_user_channel_id_ref = tag_ptr(&obj->payment_claimable.via_user_channel_id, false);
14954                         int64_t claim_deadline_ref = tag_ptr(&obj->payment_claimable.claim_deadline, false);
14955                         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);
14956                 }
14957                 case LDKEvent_PaymentClaimed: {
14958                         int8_tArray receiver_node_id_arr = (*env)->NewByteArray(env, 33);
14959                         (*env)->SetByteArrayRegion(env, receiver_node_id_arr, 0, 33, obj->payment_claimed.receiver_node_id.compressed_form);
14960                         int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
14961                         (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->payment_claimed.payment_hash.data);
14962                         int64_t amount_msat_conv = obj->payment_claimed.amount_msat;
14963                         int64_t purpose_ref = tag_ptr(&obj->payment_claimed.purpose, false);
14964                         LDKCVec_ClaimedHTLCZ htlcs_var = obj->payment_claimed.htlcs;
14965                         int64_tArray htlcs_arr = NULL;
14966                         htlcs_arr = (*env)->NewLongArray(env, htlcs_var.datalen);
14967                         int64_t *htlcs_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, htlcs_arr, NULL);
14968                         for (size_t n = 0; n < htlcs_var.datalen; n++) {
14969                                 LDKClaimedHTLC htlcs_conv_13_var = htlcs_var.data[n];
14970                                 int64_t htlcs_conv_13_ref = 0;
14971                                 CHECK_INNER_FIELD_ACCESS_OR_NULL(htlcs_conv_13_var);
14972                                 htlcs_conv_13_ref = tag_ptr(htlcs_conv_13_var.inner, false);
14973                                 htlcs_arr_ptr[n] = htlcs_conv_13_ref;
14974                         }
14975                         (*env)->ReleasePrimitiveArrayCritical(env, htlcs_arr, htlcs_arr_ptr, 0);
14976                         int64_t sender_intended_total_msat_ref = tag_ptr(&obj->payment_claimed.sender_intended_total_msat, false);
14977                         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);
14978                 }
14979                 case LDKEvent_ConnectionNeeded: {
14980                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
14981                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->connection_needed.node_id.compressed_form);
14982                         LDKCVec_SocketAddressZ addresses_var = obj->connection_needed.addresses;
14983                         int64_tArray addresses_arr = NULL;
14984                         addresses_arr = (*env)->NewLongArray(env, addresses_var.datalen);
14985                         int64_t *addresses_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, addresses_arr, NULL);
14986                         for (size_t p = 0; p < addresses_var.datalen; p++) {
14987                                 int64_t addresses_conv_15_ref = tag_ptr(&addresses_var.data[p], false);
14988                                 addresses_arr_ptr[p] = addresses_conv_15_ref;
14989                         }
14990                         (*env)->ReleasePrimitiveArrayCritical(env, addresses_arr, addresses_arr_ptr, 0);
14991                         return (*env)->NewObject(env, LDKEvent_ConnectionNeeded_class, LDKEvent_ConnectionNeeded_meth, node_id_arr, addresses_arr);
14992                 }
14993                 case LDKEvent_InvoiceRequestFailed: {
14994                         int8_tArray payment_id_arr = (*env)->NewByteArray(env, 32);
14995                         (*env)->SetByteArrayRegion(env, payment_id_arr, 0, 32, obj->invoice_request_failed.payment_id.data);
14996                         return (*env)->NewObject(env, LDKEvent_InvoiceRequestFailed_class, LDKEvent_InvoiceRequestFailed_meth, payment_id_arr);
14997                 }
14998                 case LDKEvent_PaymentSent: {
14999                         int64_t payment_id_ref = tag_ptr(&obj->payment_sent.payment_id, false);
15000                         int8_tArray payment_preimage_arr = (*env)->NewByteArray(env, 32);
15001                         (*env)->SetByteArrayRegion(env, payment_preimage_arr, 0, 32, obj->payment_sent.payment_preimage.data);
15002                         int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
15003                         (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->payment_sent.payment_hash.data);
15004                         int64_t fee_paid_msat_ref = tag_ptr(&obj->payment_sent.fee_paid_msat, false);
15005                         return (*env)->NewObject(env, LDKEvent_PaymentSent_class, LDKEvent_PaymentSent_meth, payment_id_ref, payment_preimage_arr, payment_hash_arr, fee_paid_msat_ref);
15006                 }
15007                 case LDKEvent_PaymentFailed: {
15008                         int8_tArray payment_id_arr = (*env)->NewByteArray(env, 32);
15009                         (*env)->SetByteArrayRegion(env, payment_id_arr, 0, 32, obj->payment_failed.payment_id.data);
15010                         int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
15011                         (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->payment_failed.payment_hash.data);
15012                         int64_t reason_ref = tag_ptr(&obj->payment_failed.reason, false);
15013                         return (*env)->NewObject(env, LDKEvent_PaymentFailed_class, LDKEvent_PaymentFailed_meth, payment_id_arr, payment_hash_arr, reason_ref);
15014                 }
15015                 case LDKEvent_PaymentPathSuccessful: {
15016                         int8_tArray payment_id_arr = (*env)->NewByteArray(env, 32);
15017                         (*env)->SetByteArrayRegion(env, payment_id_arr, 0, 32, obj->payment_path_successful.payment_id.data);
15018                         int64_t payment_hash_ref = tag_ptr(&obj->payment_path_successful.payment_hash, false);
15019                         LDKPath path_var = obj->payment_path_successful.path;
15020                         int64_t path_ref = 0;
15021                         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_var);
15022                         path_ref = tag_ptr(path_var.inner, false);
15023                         return (*env)->NewObject(env, LDKEvent_PaymentPathSuccessful_class, LDKEvent_PaymentPathSuccessful_meth, payment_id_arr, payment_hash_ref, path_ref);
15024                 }
15025                 case LDKEvent_PaymentPathFailed: {
15026                         int64_t payment_id_ref = tag_ptr(&obj->payment_path_failed.payment_id, false);
15027                         int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
15028                         (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->payment_path_failed.payment_hash.data);
15029                         jboolean payment_failed_permanently_conv = obj->payment_path_failed.payment_failed_permanently;
15030                         int64_t failure_ref = tag_ptr(&obj->payment_path_failed.failure, false);
15031                         LDKPath path_var = obj->payment_path_failed.path;
15032                         int64_t path_ref = 0;
15033                         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_var);
15034                         path_ref = tag_ptr(path_var.inner, false);
15035                         int64_t short_channel_id_ref = tag_ptr(&obj->payment_path_failed.short_channel_id, false);
15036                         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);
15037                 }
15038                 case LDKEvent_ProbeSuccessful: {
15039                         int8_tArray payment_id_arr = (*env)->NewByteArray(env, 32);
15040                         (*env)->SetByteArrayRegion(env, payment_id_arr, 0, 32, obj->probe_successful.payment_id.data);
15041                         int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
15042                         (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->probe_successful.payment_hash.data);
15043                         LDKPath path_var = obj->probe_successful.path;
15044                         int64_t path_ref = 0;
15045                         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_var);
15046                         path_ref = tag_ptr(path_var.inner, false);
15047                         return (*env)->NewObject(env, LDKEvent_ProbeSuccessful_class, LDKEvent_ProbeSuccessful_meth, payment_id_arr, payment_hash_arr, path_ref);
15048                 }
15049                 case LDKEvent_ProbeFailed: {
15050                         int8_tArray payment_id_arr = (*env)->NewByteArray(env, 32);
15051                         (*env)->SetByteArrayRegion(env, payment_id_arr, 0, 32, obj->probe_failed.payment_id.data);
15052                         int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
15053                         (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->probe_failed.payment_hash.data);
15054                         LDKPath path_var = obj->probe_failed.path;
15055                         int64_t path_ref = 0;
15056                         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_var);
15057                         path_ref = tag_ptr(path_var.inner, false);
15058                         int64_t short_channel_id_ref = tag_ptr(&obj->probe_failed.short_channel_id, false);
15059                         return (*env)->NewObject(env, LDKEvent_ProbeFailed_class, LDKEvent_ProbeFailed_meth, payment_id_arr, payment_hash_arr, path_ref, short_channel_id_ref);
15060                 }
15061                 case LDKEvent_PendingHTLCsForwardable: {
15062                         int64_t time_forwardable_conv = obj->pending_htl_cs_forwardable.time_forwardable;
15063                         return (*env)->NewObject(env, LDKEvent_PendingHTLCsForwardable_class, LDKEvent_PendingHTLCsForwardable_meth, time_forwardable_conv);
15064                 }
15065                 case LDKEvent_HTLCIntercepted: {
15066                         int8_tArray intercept_id_arr = (*env)->NewByteArray(env, 32);
15067                         (*env)->SetByteArrayRegion(env, intercept_id_arr, 0, 32, obj->htlc_intercepted.intercept_id.data);
15068                         int64_t requested_next_hop_scid_conv = obj->htlc_intercepted.requested_next_hop_scid;
15069                         int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
15070                         (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->htlc_intercepted.payment_hash.data);
15071                         int64_t inbound_amount_msat_conv = obj->htlc_intercepted.inbound_amount_msat;
15072                         int64_t expected_outbound_amount_msat_conv = obj->htlc_intercepted.expected_outbound_amount_msat;
15073                         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);
15074                 }
15075                 case LDKEvent_SpendableOutputs: {
15076                         LDKCVec_SpendableOutputDescriptorZ outputs_var = obj->spendable_outputs.outputs;
15077                         int64_tArray outputs_arr = NULL;
15078                         outputs_arr = (*env)->NewLongArray(env, outputs_var.datalen);
15079                         int64_t *outputs_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, outputs_arr, NULL);
15080                         for (size_t b = 0; b < outputs_var.datalen; b++) {
15081                                 int64_t outputs_conv_27_ref = tag_ptr(&outputs_var.data[b], false);
15082                                 outputs_arr_ptr[b] = outputs_conv_27_ref;
15083                         }
15084                         (*env)->ReleasePrimitiveArrayCritical(env, outputs_arr, outputs_arr_ptr, 0);
15085                         LDKChannelId channel_id_var = obj->spendable_outputs.channel_id;
15086                         int64_t channel_id_ref = 0;
15087                         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_var);
15088                         channel_id_ref = tag_ptr(channel_id_var.inner, false);
15089                         return (*env)->NewObject(env, LDKEvent_SpendableOutputs_class, LDKEvent_SpendableOutputs_meth, outputs_arr, channel_id_ref);
15090                 }
15091                 case LDKEvent_PaymentForwarded: {
15092                         LDKChannelId prev_channel_id_var = obj->payment_forwarded.prev_channel_id;
15093                         int64_t prev_channel_id_ref = 0;
15094                         CHECK_INNER_FIELD_ACCESS_OR_NULL(prev_channel_id_var);
15095                         prev_channel_id_ref = tag_ptr(prev_channel_id_var.inner, false);
15096                         LDKChannelId next_channel_id_var = obj->payment_forwarded.next_channel_id;
15097                         int64_t next_channel_id_ref = 0;
15098                         CHECK_INNER_FIELD_ACCESS_OR_NULL(next_channel_id_var);
15099                         next_channel_id_ref = tag_ptr(next_channel_id_var.inner, false);
15100                         int64_t prev_user_channel_id_ref = tag_ptr(&obj->payment_forwarded.prev_user_channel_id, false);
15101                         int64_t next_user_channel_id_ref = tag_ptr(&obj->payment_forwarded.next_user_channel_id, false);
15102                         int64_t total_fee_earned_msat_ref = tag_ptr(&obj->payment_forwarded.total_fee_earned_msat, false);
15103                         int64_t skimmed_fee_msat_ref = tag_ptr(&obj->payment_forwarded.skimmed_fee_msat, false);
15104                         jboolean claim_from_onchain_tx_conv = obj->payment_forwarded.claim_from_onchain_tx;
15105                         int64_t outbound_amount_forwarded_msat_ref = tag_ptr(&obj->payment_forwarded.outbound_amount_forwarded_msat, false);
15106                         return (*env)->NewObject(env, LDKEvent_PaymentForwarded_class, LDKEvent_PaymentForwarded_meth, prev_channel_id_ref, next_channel_id_ref, prev_user_channel_id_ref, next_user_channel_id_ref, total_fee_earned_msat_ref, skimmed_fee_msat_ref, claim_from_onchain_tx_conv, outbound_amount_forwarded_msat_ref);
15107                 }
15108                 case LDKEvent_ChannelPending: {
15109                         LDKChannelId channel_id_var = obj->channel_pending.channel_id;
15110                         int64_t channel_id_ref = 0;
15111                         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_var);
15112                         channel_id_ref = tag_ptr(channel_id_var.inner, false);
15113                         int8_tArray user_channel_id_arr = (*env)->NewByteArray(env, 16);
15114                         (*env)->SetByteArrayRegion(env, user_channel_id_arr, 0, 16, obj->channel_pending.user_channel_id.le_bytes);
15115                         LDKChannelId former_temporary_channel_id_var = obj->channel_pending.former_temporary_channel_id;
15116                         int64_t former_temporary_channel_id_ref = 0;
15117                         CHECK_INNER_FIELD_ACCESS_OR_NULL(former_temporary_channel_id_var);
15118                         former_temporary_channel_id_ref = tag_ptr(former_temporary_channel_id_var.inner, false);
15119                         int8_tArray counterparty_node_id_arr = (*env)->NewByteArray(env, 33);
15120                         (*env)->SetByteArrayRegion(env, counterparty_node_id_arr, 0, 33, obj->channel_pending.counterparty_node_id.compressed_form);
15121                         LDKOutPoint funding_txo_var = obj->channel_pending.funding_txo;
15122                         int64_t funding_txo_ref = 0;
15123                         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_var);
15124                         funding_txo_ref = tag_ptr(funding_txo_var.inner, false);
15125                         LDKChannelTypeFeatures channel_type_var = obj->channel_pending.channel_type;
15126                         int64_t channel_type_ref = 0;
15127                         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_var);
15128                         channel_type_ref = tag_ptr(channel_type_var.inner, false);
15129                         return (*env)->NewObject(env, LDKEvent_ChannelPending_class, LDKEvent_ChannelPending_meth, channel_id_ref, user_channel_id_arr, former_temporary_channel_id_ref, counterparty_node_id_arr, funding_txo_ref, channel_type_ref);
15130                 }
15131                 case LDKEvent_ChannelReady: {
15132                         LDKChannelId channel_id_var = obj->channel_ready.channel_id;
15133                         int64_t channel_id_ref = 0;
15134                         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_var);
15135                         channel_id_ref = tag_ptr(channel_id_var.inner, false);
15136                         int8_tArray user_channel_id_arr = (*env)->NewByteArray(env, 16);
15137                         (*env)->SetByteArrayRegion(env, user_channel_id_arr, 0, 16, obj->channel_ready.user_channel_id.le_bytes);
15138                         int8_tArray counterparty_node_id_arr = (*env)->NewByteArray(env, 33);
15139                         (*env)->SetByteArrayRegion(env, counterparty_node_id_arr, 0, 33, obj->channel_ready.counterparty_node_id.compressed_form);
15140                         LDKChannelTypeFeatures channel_type_var = obj->channel_ready.channel_type;
15141                         int64_t channel_type_ref = 0;
15142                         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_var);
15143                         channel_type_ref = tag_ptr(channel_type_var.inner, false);
15144                         return (*env)->NewObject(env, LDKEvent_ChannelReady_class, LDKEvent_ChannelReady_meth, channel_id_ref, user_channel_id_arr, counterparty_node_id_arr, channel_type_ref);
15145                 }
15146                 case LDKEvent_ChannelClosed: {
15147                         LDKChannelId channel_id_var = obj->channel_closed.channel_id;
15148                         int64_t channel_id_ref = 0;
15149                         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_var);
15150                         channel_id_ref = tag_ptr(channel_id_var.inner, false);
15151                         int8_tArray user_channel_id_arr = (*env)->NewByteArray(env, 16);
15152                         (*env)->SetByteArrayRegion(env, user_channel_id_arr, 0, 16, obj->channel_closed.user_channel_id.le_bytes);
15153                         int64_t reason_ref = tag_ptr(&obj->channel_closed.reason, false);
15154                         int8_tArray counterparty_node_id_arr = (*env)->NewByteArray(env, 33);
15155                         (*env)->SetByteArrayRegion(env, counterparty_node_id_arr, 0, 33, obj->channel_closed.counterparty_node_id.compressed_form);
15156                         int64_t channel_capacity_sats_ref = tag_ptr(&obj->channel_closed.channel_capacity_sats, false);
15157                         LDKOutPoint channel_funding_txo_var = obj->channel_closed.channel_funding_txo;
15158                         int64_t channel_funding_txo_ref = 0;
15159                         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_funding_txo_var);
15160                         channel_funding_txo_ref = tag_ptr(channel_funding_txo_var.inner, false);
15161                         return (*env)->NewObject(env, LDKEvent_ChannelClosed_class, LDKEvent_ChannelClosed_meth, channel_id_ref, user_channel_id_arr, reason_ref, counterparty_node_id_arr, channel_capacity_sats_ref, channel_funding_txo_ref);
15162                 }
15163                 case LDKEvent_DiscardFunding: {
15164                         LDKChannelId channel_id_var = obj->discard_funding.channel_id;
15165                         int64_t channel_id_ref = 0;
15166                         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_var);
15167                         channel_id_ref = tag_ptr(channel_id_var.inner, false);
15168                         LDKTransaction transaction_var = obj->discard_funding.transaction;
15169                         int8_tArray transaction_arr = (*env)->NewByteArray(env, transaction_var.datalen);
15170                         (*env)->SetByteArrayRegion(env, transaction_arr, 0, transaction_var.datalen, transaction_var.data);
15171                         return (*env)->NewObject(env, LDKEvent_DiscardFunding_class, LDKEvent_DiscardFunding_meth, channel_id_ref, transaction_arr);
15172                 }
15173                 case LDKEvent_OpenChannelRequest: {
15174                         LDKChannelId temporary_channel_id_var = obj->open_channel_request.temporary_channel_id;
15175                         int64_t temporary_channel_id_ref = 0;
15176                         CHECK_INNER_FIELD_ACCESS_OR_NULL(temporary_channel_id_var);
15177                         temporary_channel_id_ref = tag_ptr(temporary_channel_id_var.inner, false);
15178                         int8_tArray counterparty_node_id_arr = (*env)->NewByteArray(env, 33);
15179                         (*env)->SetByteArrayRegion(env, counterparty_node_id_arr, 0, 33, obj->open_channel_request.counterparty_node_id.compressed_form);
15180                         int64_t funding_satoshis_conv = obj->open_channel_request.funding_satoshis;
15181                         int64_t push_msat_conv = obj->open_channel_request.push_msat;
15182                         LDKChannelTypeFeatures channel_type_var = obj->open_channel_request.channel_type;
15183                         int64_t channel_type_ref = 0;
15184                         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_var);
15185                         channel_type_ref = tag_ptr(channel_type_var.inner, false);
15186                         return (*env)->NewObject(env, LDKEvent_OpenChannelRequest_class, LDKEvent_OpenChannelRequest_meth, temporary_channel_id_ref, counterparty_node_id_arr, funding_satoshis_conv, push_msat_conv, channel_type_ref);
15187                 }
15188                 case LDKEvent_HTLCHandlingFailed: {
15189                         LDKChannelId prev_channel_id_var = obj->htlc_handling_failed.prev_channel_id;
15190                         int64_t prev_channel_id_ref = 0;
15191                         CHECK_INNER_FIELD_ACCESS_OR_NULL(prev_channel_id_var);
15192                         prev_channel_id_ref = tag_ptr(prev_channel_id_var.inner, false);
15193                         int64_t failed_next_destination_ref = tag_ptr(&obj->htlc_handling_failed.failed_next_destination, false);
15194                         return (*env)->NewObject(env, LDKEvent_HTLCHandlingFailed_class, LDKEvent_HTLCHandlingFailed_meth, prev_channel_id_ref, failed_next_destination_ref);
15195                 }
15196                 case LDKEvent_BumpTransaction: {
15197                         int64_t bump_transaction_ref = tag_ptr(&obj->bump_transaction, false);
15198                         return (*env)->NewObject(env, LDKEvent_BumpTransaction_class, LDKEvent_BumpTransaction_meth, bump_transaction_ref);
15199                 }
15200                 default: abort();
15201         }
15202 }
15203 static jclass LDKCOption_EventZ_Some_class = NULL;
15204 static jmethodID LDKCOption_EventZ_Some_meth = NULL;
15205 static jclass LDKCOption_EventZ_None_class = NULL;
15206 static jmethodID LDKCOption_EventZ_None_meth = NULL;
15207 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1EventZ_init (JNIEnv *env, jclass clz) {
15208         LDKCOption_EventZ_Some_class =
15209                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_EventZ$Some"));
15210         CHECK(LDKCOption_EventZ_Some_class != NULL);
15211         LDKCOption_EventZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_EventZ_Some_class, "<init>", "(J)V");
15212         CHECK(LDKCOption_EventZ_Some_meth != NULL);
15213         LDKCOption_EventZ_None_class =
15214                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_EventZ$None"));
15215         CHECK(LDKCOption_EventZ_None_class != NULL);
15216         LDKCOption_EventZ_None_meth = (*env)->GetMethodID(env, LDKCOption_EventZ_None_class, "<init>", "()V");
15217         CHECK(LDKCOption_EventZ_None_meth != NULL);
15218 }
15219 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1EventZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
15220         LDKCOption_EventZ *obj = (LDKCOption_EventZ*)untag_ptr(ptr);
15221         switch(obj->tag) {
15222                 case LDKCOption_EventZ_Some: {
15223                         int64_t some_ref = tag_ptr(&obj->some, false);
15224                         return (*env)->NewObject(env, LDKCOption_EventZ_Some_class, LDKCOption_EventZ_Some_meth, some_ref);
15225                 }
15226                 case LDKCOption_EventZ_None: {
15227                         return (*env)->NewObject(env, LDKCOption_EventZ_None_class, LDKCOption_EventZ_None_meth);
15228                 }
15229                 default: abort();
15230         }
15231 }
15232 static inline struct LDKCOption_EventZ CResult_COption_EventZDecodeErrorZ_get_ok(LDKCResult_COption_EventZDecodeErrorZ *NONNULL_PTR owner){
15233 CHECK(owner->result_ok);
15234         return COption_EventZ_clone(&*owner->contents.result);
15235 }
15236 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1EventZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
15237         LDKCResult_COption_EventZDecodeErrorZ* owner_conv = (LDKCResult_COption_EventZDecodeErrorZ*)untag_ptr(owner);
15238         LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
15239         *ret_copy = CResult_COption_EventZDecodeErrorZ_get_ok(owner_conv);
15240         int64_t ret_ref = tag_ptr(ret_copy, true);
15241         return ret_ref;
15242 }
15243
15244 static inline struct LDKDecodeError CResult_COption_EventZDecodeErrorZ_get_err(LDKCResult_COption_EventZDecodeErrorZ *NONNULL_PTR owner){
15245 CHECK(!owner->result_ok);
15246         return DecodeError_clone(&*owner->contents.err);
15247 }
15248 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1EventZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
15249         LDKCResult_COption_EventZDecodeErrorZ* owner_conv = (LDKCResult_COption_EventZDecodeErrorZ*)untag_ptr(owner);
15250         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
15251         *ret_copy = CResult_COption_EventZDecodeErrorZ_get_err(owner_conv);
15252         int64_t ret_ref = tag_ptr(ret_copy, true);
15253         return ret_ref;
15254 }
15255
15256 static jclass LDKBolt11ParseError_Bech32Error_class = NULL;
15257 static jmethodID LDKBolt11ParseError_Bech32Error_meth = NULL;
15258 static jclass LDKBolt11ParseError_ParseAmountError_class = NULL;
15259 static jmethodID LDKBolt11ParseError_ParseAmountError_meth = NULL;
15260 static jclass LDKBolt11ParseError_MalformedSignature_class = NULL;
15261 static jmethodID LDKBolt11ParseError_MalformedSignature_meth = NULL;
15262 static jclass LDKBolt11ParseError_BadPrefix_class = NULL;
15263 static jmethodID LDKBolt11ParseError_BadPrefix_meth = NULL;
15264 static jclass LDKBolt11ParseError_UnknownCurrency_class = NULL;
15265 static jmethodID LDKBolt11ParseError_UnknownCurrency_meth = NULL;
15266 static jclass LDKBolt11ParseError_UnknownSiPrefix_class = NULL;
15267 static jmethodID LDKBolt11ParseError_UnknownSiPrefix_meth = NULL;
15268 static jclass LDKBolt11ParseError_MalformedHRP_class = NULL;
15269 static jmethodID LDKBolt11ParseError_MalformedHRP_meth = NULL;
15270 static jclass LDKBolt11ParseError_TooShortDataPart_class = NULL;
15271 static jmethodID LDKBolt11ParseError_TooShortDataPart_meth = NULL;
15272 static jclass LDKBolt11ParseError_UnexpectedEndOfTaggedFields_class = NULL;
15273 static jmethodID LDKBolt11ParseError_UnexpectedEndOfTaggedFields_meth = NULL;
15274 static jclass LDKBolt11ParseError_DescriptionDecodeError_class = NULL;
15275 static jmethodID LDKBolt11ParseError_DescriptionDecodeError_meth = NULL;
15276 static jclass LDKBolt11ParseError_PaddingError_class = NULL;
15277 static jmethodID LDKBolt11ParseError_PaddingError_meth = NULL;
15278 static jclass LDKBolt11ParseError_IntegerOverflowError_class = NULL;
15279 static jmethodID LDKBolt11ParseError_IntegerOverflowError_meth = NULL;
15280 static jclass LDKBolt11ParseError_InvalidSegWitProgramLength_class = NULL;
15281 static jmethodID LDKBolt11ParseError_InvalidSegWitProgramLength_meth = NULL;
15282 static jclass LDKBolt11ParseError_InvalidPubKeyHashLength_class = NULL;
15283 static jmethodID LDKBolt11ParseError_InvalidPubKeyHashLength_meth = NULL;
15284 static jclass LDKBolt11ParseError_InvalidScriptHashLength_class = NULL;
15285 static jmethodID LDKBolt11ParseError_InvalidScriptHashLength_meth = NULL;
15286 static jclass LDKBolt11ParseError_InvalidRecoveryId_class = NULL;
15287 static jmethodID LDKBolt11ParseError_InvalidRecoveryId_meth = NULL;
15288 static jclass LDKBolt11ParseError_InvalidSliceLength_class = NULL;
15289 static jmethodID LDKBolt11ParseError_InvalidSliceLength_meth = NULL;
15290 static jclass LDKBolt11ParseError_Skip_class = NULL;
15291 static jmethodID LDKBolt11ParseError_Skip_meth = NULL;
15292 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKBolt11ParseError_init (JNIEnv *env, jclass clz) {
15293         LDKBolt11ParseError_Bech32Error_class =
15294                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBolt11ParseError$Bech32Error"));
15295         CHECK(LDKBolt11ParseError_Bech32Error_class != NULL);
15296         LDKBolt11ParseError_Bech32Error_meth = (*env)->GetMethodID(env, LDKBolt11ParseError_Bech32Error_class, "<init>", "(J)V");
15297         CHECK(LDKBolt11ParseError_Bech32Error_meth != NULL);
15298         LDKBolt11ParseError_ParseAmountError_class =
15299                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBolt11ParseError$ParseAmountError"));
15300         CHECK(LDKBolt11ParseError_ParseAmountError_class != NULL);
15301         LDKBolt11ParseError_ParseAmountError_meth = (*env)->GetMethodID(env, LDKBolt11ParseError_ParseAmountError_class, "<init>", "(I)V");
15302         CHECK(LDKBolt11ParseError_ParseAmountError_meth != NULL);
15303         LDKBolt11ParseError_MalformedSignature_class =
15304                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBolt11ParseError$MalformedSignature"));
15305         CHECK(LDKBolt11ParseError_MalformedSignature_class != NULL);
15306         LDKBolt11ParseError_MalformedSignature_meth = (*env)->GetMethodID(env, LDKBolt11ParseError_MalformedSignature_class, "<init>", "(Lorg/ldk/enums/Secp256k1Error;)V");
15307         CHECK(LDKBolt11ParseError_MalformedSignature_meth != NULL);
15308         LDKBolt11ParseError_BadPrefix_class =
15309                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBolt11ParseError$BadPrefix"));
15310         CHECK(LDKBolt11ParseError_BadPrefix_class != NULL);
15311         LDKBolt11ParseError_BadPrefix_meth = (*env)->GetMethodID(env, LDKBolt11ParseError_BadPrefix_class, "<init>", "()V");
15312         CHECK(LDKBolt11ParseError_BadPrefix_meth != NULL);
15313         LDKBolt11ParseError_UnknownCurrency_class =
15314                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBolt11ParseError$UnknownCurrency"));
15315         CHECK(LDKBolt11ParseError_UnknownCurrency_class != NULL);
15316         LDKBolt11ParseError_UnknownCurrency_meth = (*env)->GetMethodID(env, LDKBolt11ParseError_UnknownCurrency_class, "<init>", "()V");
15317         CHECK(LDKBolt11ParseError_UnknownCurrency_meth != NULL);
15318         LDKBolt11ParseError_UnknownSiPrefix_class =
15319                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBolt11ParseError$UnknownSiPrefix"));
15320         CHECK(LDKBolt11ParseError_UnknownSiPrefix_class != NULL);
15321         LDKBolt11ParseError_UnknownSiPrefix_meth = (*env)->GetMethodID(env, LDKBolt11ParseError_UnknownSiPrefix_class, "<init>", "()V");
15322         CHECK(LDKBolt11ParseError_UnknownSiPrefix_meth != NULL);
15323         LDKBolt11ParseError_MalformedHRP_class =
15324                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBolt11ParseError$MalformedHRP"));
15325         CHECK(LDKBolt11ParseError_MalformedHRP_class != NULL);
15326         LDKBolt11ParseError_MalformedHRP_meth = (*env)->GetMethodID(env, LDKBolt11ParseError_MalformedHRP_class, "<init>", "()V");
15327         CHECK(LDKBolt11ParseError_MalformedHRP_meth != NULL);
15328         LDKBolt11ParseError_TooShortDataPart_class =
15329                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBolt11ParseError$TooShortDataPart"));
15330         CHECK(LDKBolt11ParseError_TooShortDataPart_class != NULL);
15331         LDKBolt11ParseError_TooShortDataPart_meth = (*env)->GetMethodID(env, LDKBolt11ParseError_TooShortDataPart_class, "<init>", "()V");
15332         CHECK(LDKBolt11ParseError_TooShortDataPart_meth != NULL);
15333         LDKBolt11ParseError_UnexpectedEndOfTaggedFields_class =
15334                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBolt11ParseError$UnexpectedEndOfTaggedFields"));
15335         CHECK(LDKBolt11ParseError_UnexpectedEndOfTaggedFields_class != NULL);
15336         LDKBolt11ParseError_UnexpectedEndOfTaggedFields_meth = (*env)->GetMethodID(env, LDKBolt11ParseError_UnexpectedEndOfTaggedFields_class, "<init>", "()V");
15337         CHECK(LDKBolt11ParseError_UnexpectedEndOfTaggedFields_meth != NULL);
15338         LDKBolt11ParseError_DescriptionDecodeError_class =
15339                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBolt11ParseError$DescriptionDecodeError"));
15340         CHECK(LDKBolt11ParseError_DescriptionDecodeError_class != NULL);
15341         LDKBolt11ParseError_DescriptionDecodeError_meth = (*env)->GetMethodID(env, LDKBolt11ParseError_DescriptionDecodeError_class, "<init>", "(I)V");
15342         CHECK(LDKBolt11ParseError_DescriptionDecodeError_meth != NULL);
15343         LDKBolt11ParseError_PaddingError_class =
15344                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBolt11ParseError$PaddingError"));
15345         CHECK(LDKBolt11ParseError_PaddingError_class != NULL);
15346         LDKBolt11ParseError_PaddingError_meth = (*env)->GetMethodID(env, LDKBolt11ParseError_PaddingError_class, "<init>", "()V");
15347         CHECK(LDKBolt11ParseError_PaddingError_meth != NULL);
15348         LDKBolt11ParseError_IntegerOverflowError_class =
15349                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBolt11ParseError$IntegerOverflowError"));
15350         CHECK(LDKBolt11ParseError_IntegerOverflowError_class != NULL);
15351         LDKBolt11ParseError_IntegerOverflowError_meth = (*env)->GetMethodID(env, LDKBolt11ParseError_IntegerOverflowError_class, "<init>", "()V");
15352         CHECK(LDKBolt11ParseError_IntegerOverflowError_meth != NULL);
15353         LDKBolt11ParseError_InvalidSegWitProgramLength_class =
15354                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBolt11ParseError$InvalidSegWitProgramLength"));
15355         CHECK(LDKBolt11ParseError_InvalidSegWitProgramLength_class != NULL);
15356         LDKBolt11ParseError_InvalidSegWitProgramLength_meth = (*env)->GetMethodID(env, LDKBolt11ParseError_InvalidSegWitProgramLength_class, "<init>", "()V");
15357         CHECK(LDKBolt11ParseError_InvalidSegWitProgramLength_meth != NULL);
15358         LDKBolt11ParseError_InvalidPubKeyHashLength_class =
15359                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBolt11ParseError$InvalidPubKeyHashLength"));
15360         CHECK(LDKBolt11ParseError_InvalidPubKeyHashLength_class != NULL);
15361         LDKBolt11ParseError_InvalidPubKeyHashLength_meth = (*env)->GetMethodID(env, LDKBolt11ParseError_InvalidPubKeyHashLength_class, "<init>", "()V");
15362         CHECK(LDKBolt11ParseError_InvalidPubKeyHashLength_meth != NULL);
15363         LDKBolt11ParseError_InvalidScriptHashLength_class =
15364                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBolt11ParseError$InvalidScriptHashLength"));
15365         CHECK(LDKBolt11ParseError_InvalidScriptHashLength_class != NULL);
15366         LDKBolt11ParseError_InvalidScriptHashLength_meth = (*env)->GetMethodID(env, LDKBolt11ParseError_InvalidScriptHashLength_class, "<init>", "()V");
15367         CHECK(LDKBolt11ParseError_InvalidScriptHashLength_meth != NULL);
15368         LDKBolt11ParseError_InvalidRecoveryId_class =
15369                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBolt11ParseError$InvalidRecoveryId"));
15370         CHECK(LDKBolt11ParseError_InvalidRecoveryId_class != NULL);
15371         LDKBolt11ParseError_InvalidRecoveryId_meth = (*env)->GetMethodID(env, LDKBolt11ParseError_InvalidRecoveryId_class, "<init>", "()V");
15372         CHECK(LDKBolt11ParseError_InvalidRecoveryId_meth != NULL);
15373         LDKBolt11ParseError_InvalidSliceLength_class =
15374                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBolt11ParseError$InvalidSliceLength"));
15375         CHECK(LDKBolt11ParseError_InvalidSliceLength_class != NULL);
15376         LDKBolt11ParseError_InvalidSliceLength_meth = (*env)->GetMethodID(env, LDKBolt11ParseError_InvalidSliceLength_class, "<init>", "(Ljava/lang/String;)V");
15377         CHECK(LDKBolt11ParseError_InvalidSliceLength_meth != NULL);
15378         LDKBolt11ParseError_Skip_class =
15379                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBolt11ParseError$Skip"));
15380         CHECK(LDKBolt11ParseError_Skip_class != NULL);
15381         LDKBolt11ParseError_Skip_meth = (*env)->GetMethodID(env, LDKBolt11ParseError_Skip_class, "<init>", "()V");
15382         CHECK(LDKBolt11ParseError_Skip_meth != NULL);
15383 }
15384 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKBolt11ParseError_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
15385         LDKBolt11ParseError *obj = (LDKBolt11ParseError*)untag_ptr(ptr);
15386         switch(obj->tag) {
15387                 case LDKBolt11ParseError_Bech32Error: {
15388                         int64_t bech32_error_ref = tag_ptr(&obj->bech32_error, false);
15389                         return (*env)->NewObject(env, LDKBolt11ParseError_Bech32Error_class, LDKBolt11ParseError_Bech32Error_meth, bech32_error_ref);
15390                 }
15391                 case LDKBolt11ParseError_ParseAmountError: {
15392                         /*obj->parse_amount_error*/
15393                         return (*env)->NewObject(env, LDKBolt11ParseError_ParseAmountError_class, LDKBolt11ParseError_ParseAmountError_meth, 0);
15394                 }
15395                 case LDKBolt11ParseError_MalformedSignature: {
15396                         jclass malformed_signature_conv = LDKSecp256k1Error_to_java(env, obj->malformed_signature);
15397                         return (*env)->NewObject(env, LDKBolt11ParseError_MalformedSignature_class, LDKBolt11ParseError_MalformedSignature_meth, malformed_signature_conv);
15398                 }
15399                 case LDKBolt11ParseError_BadPrefix: {
15400                         return (*env)->NewObject(env, LDKBolt11ParseError_BadPrefix_class, LDKBolt11ParseError_BadPrefix_meth);
15401                 }
15402                 case LDKBolt11ParseError_UnknownCurrency: {
15403                         return (*env)->NewObject(env, LDKBolt11ParseError_UnknownCurrency_class, LDKBolt11ParseError_UnknownCurrency_meth);
15404                 }
15405                 case LDKBolt11ParseError_UnknownSiPrefix: {
15406                         return (*env)->NewObject(env, LDKBolt11ParseError_UnknownSiPrefix_class, LDKBolt11ParseError_UnknownSiPrefix_meth);
15407                 }
15408                 case LDKBolt11ParseError_MalformedHRP: {
15409                         return (*env)->NewObject(env, LDKBolt11ParseError_MalformedHRP_class, LDKBolt11ParseError_MalformedHRP_meth);
15410                 }
15411                 case LDKBolt11ParseError_TooShortDataPart: {
15412                         return (*env)->NewObject(env, LDKBolt11ParseError_TooShortDataPart_class, LDKBolt11ParseError_TooShortDataPart_meth);
15413                 }
15414                 case LDKBolt11ParseError_UnexpectedEndOfTaggedFields: {
15415                         return (*env)->NewObject(env, LDKBolt11ParseError_UnexpectedEndOfTaggedFields_class, LDKBolt11ParseError_UnexpectedEndOfTaggedFields_meth);
15416                 }
15417                 case LDKBolt11ParseError_DescriptionDecodeError: {
15418                         /*obj->description_decode_error*/
15419                         return (*env)->NewObject(env, LDKBolt11ParseError_DescriptionDecodeError_class, LDKBolt11ParseError_DescriptionDecodeError_meth, 0);
15420                 }
15421                 case LDKBolt11ParseError_PaddingError: {
15422                         return (*env)->NewObject(env, LDKBolt11ParseError_PaddingError_class, LDKBolt11ParseError_PaddingError_meth);
15423                 }
15424                 case LDKBolt11ParseError_IntegerOverflowError: {
15425                         return (*env)->NewObject(env, LDKBolt11ParseError_IntegerOverflowError_class, LDKBolt11ParseError_IntegerOverflowError_meth);
15426                 }
15427                 case LDKBolt11ParseError_InvalidSegWitProgramLength: {
15428                         return (*env)->NewObject(env, LDKBolt11ParseError_InvalidSegWitProgramLength_class, LDKBolt11ParseError_InvalidSegWitProgramLength_meth);
15429                 }
15430                 case LDKBolt11ParseError_InvalidPubKeyHashLength: {
15431                         return (*env)->NewObject(env, LDKBolt11ParseError_InvalidPubKeyHashLength_class, LDKBolt11ParseError_InvalidPubKeyHashLength_meth);
15432                 }
15433                 case LDKBolt11ParseError_InvalidScriptHashLength: {
15434                         return (*env)->NewObject(env, LDKBolt11ParseError_InvalidScriptHashLength_class, LDKBolt11ParseError_InvalidScriptHashLength_meth);
15435                 }
15436                 case LDKBolt11ParseError_InvalidRecoveryId: {
15437                         return (*env)->NewObject(env, LDKBolt11ParseError_InvalidRecoveryId_class, LDKBolt11ParseError_InvalidRecoveryId_meth);
15438                 }
15439                 case LDKBolt11ParseError_InvalidSliceLength: {
15440                         LDKStr invalid_slice_length_str = obj->invalid_slice_length;
15441                         jstring invalid_slice_length_conv = str_ref_to_java(env, invalid_slice_length_str.chars, invalid_slice_length_str.len);
15442                         return (*env)->NewObject(env, LDKBolt11ParseError_InvalidSliceLength_class, LDKBolt11ParseError_InvalidSliceLength_meth, invalid_slice_length_conv);
15443                 }
15444                 case LDKBolt11ParseError_Skip: {
15445                         return (*env)->NewObject(env, LDKBolt11ParseError_Skip_class, LDKBolt11ParseError_Skip_meth);
15446                 }
15447                 default: abort();
15448         }
15449 }
15450 static inline enum LDKSiPrefix CResult_SiPrefixBolt11ParseErrorZ_get_ok(LDKCResult_SiPrefixBolt11ParseErrorZ *NONNULL_PTR owner){
15451 CHECK(owner->result_ok);
15452         return SiPrefix_clone(&*owner->contents.result);
15453 }
15454 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixBolt11ParseErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
15455         LDKCResult_SiPrefixBolt11ParseErrorZ* owner_conv = (LDKCResult_SiPrefixBolt11ParseErrorZ*)untag_ptr(owner);
15456         jclass ret_conv = LDKSiPrefix_to_java(env, CResult_SiPrefixBolt11ParseErrorZ_get_ok(owner_conv));
15457         return ret_conv;
15458 }
15459
15460 static inline struct LDKBolt11ParseError CResult_SiPrefixBolt11ParseErrorZ_get_err(LDKCResult_SiPrefixBolt11ParseErrorZ *NONNULL_PTR owner){
15461 CHECK(!owner->result_ok);
15462         return Bolt11ParseError_clone(&*owner->contents.err);
15463 }
15464 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixBolt11ParseErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
15465         LDKCResult_SiPrefixBolt11ParseErrorZ* owner_conv = (LDKCResult_SiPrefixBolt11ParseErrorZ*)untag_ptr(owner);
15466         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
15467         *ret_copy = CResult_SiPrefixBolt11ParseErrorZ_get_err(owner_conv);
15468         int64_t ret_ref = tag_ptr(ret_copy, true);
15469         return ret_ref;
15470 }
15471
15472 static jclass LDKParseOrSemanticError_ParseError_class = NULL;
15473 static jmethodID LDKParseOrSemanticError_ParseError_meth = NULL;
15474 static jclass LDKParseOrSemanticError_SemanticError_class = NULL;
15475 static jmethodID LDKParseOrSemanticError_SemanticError_meth = NULL;
15476 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKParseOrSemanticError_init (JNIEnv *env, jclass clz) {
15477         LDKParseOrSemanticError_ParseError_class =
15478                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseOrSemanticError$ParseError"));
15479         CHECK(LDKParseOrSemanticError_ParseError_class != NULL);
15480         LDKParseOrSemanticError_ParseError_meth = (*env)->GetMethodID(env, LDKParseOrSemanticError_ParseError_class, "<init>", "(J)V");
15481         CHECK(LDKParseOrSemanticError_ParseError_meth != NULL);
15482         LDKParseOrSemanticError_SemanticError_class =
15483                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseOrSemanticError$SemanticError"));
15484         CHECK(LDKParseOrSemanticError_SemanticError_class != NULL);
15485         LDKParseOrSemanticError_SemanticError_meth = (*env)->GetMethodID(env, LDKParseOrSemanticError_SemanticError_class, "<init>", "(Lorg/ldk/enums/Bolt11SemanticError;)V");
15486         CHECK(LDKParseOrSemanticError_SemanticError_meth != NULL);
15487 }
15488 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKParseOrSemanticError_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
15489         LDKParseOrSemanticError *obj = (LDKParseOrSemanticError*)untag_ptr(ptr);
15490         switch(obj->tag) {
15491                 case LDKParseOrSemanticError_ParseError: {
15492                         int64_t parse_error_ref = tag_ptr(&obj->parse_error, false);
15493                         return (*env)->NewObject(env, LDKParseOrSemanticError_ParseError_class, LDKParseOrSemanticError_ParseError_meth, parse_error_ref);
15494                 }
15495                 case LDKParseOrSemanticError_SemanticError: {
15496                         jclass semantic_error_conv = LDKBolt11SemanticError_to_java(env, obj->semantic_error);
15497                         return (*env)->NewObject(env, LDKParseOrSemanticError_SemanticError_class, LDKParseOrSemanticError_SemanticError_meth, semantic_error_conv);
15498                 }
15499                 default: abort();
15500         }
15501 }
15502 static inline struct LDKBolt11Invoice CResult_Bolt11InvoiceParseOrSemanticErrorZ_get_ok(LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ *NONNULL_PTR owner){
15503         LDKBolt11Invoice ret = *owner->contents.result;
15504         ret.is_owned = false;
15505         return ret;
15506 }
15507 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceParseOrSemanticErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
15508         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* owner_conv = (LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ*)untag_ptr(owner);
15509         LDKBolt11Invoice ret_var = CResult_Bolt11InvoiceParseOrSemanticErrorZ_get_ok(owner_conv);
15510         int64_t ret_ref = 0;
15511         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
15512         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
15513         return ret_ref;
15514 }
15515
15516 static inline struct LDKParseOrSemanticError CResult_Bolt11InvoiceParseOrSemanticErrorZ_get_err(LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ *NONNULL_PTR owner){
15517 CHECK(!owner->result_ok);
15518         return ParseOrSemanticError_clone(&*owner->contents.err);
15519 }
15520 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceParseOrSemanticErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
15521         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* owner_conv = (LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ*)untag_ptr(owner);
15522         LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
15523         *ret_copy = CResult_Bolt11InvoiceParseOrSemanticErrorZ_get_err(owner_conv);
15524         int64_t ret_ref = tag_ptr(ret_copy, true);
15525         return ret_ref;
15526 }
15527
15528 static inline struct LDKSignedRawBolt11Invoice CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_get_ok(LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ *NONNULL_PTR owner){
15529         LDKSignedRawBolt11Invoice ret = *owner->contents.result;
15530         ret.is_owned = false;
15531         return ret;
15532 }
15533 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawBolt11InvoiceBolt11ParseErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
15534         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* owner_conv = (LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ*)untag_ptr(owner);
15535         LDKSignedRawBolt11Invoice ret_var = CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_get_ok(owner_conv);
15536         int64_t ret_ref = 0;
15537         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
15538         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
15539         return ret_ref;
15540 }
15541
15542 static inline struct LDKBolt11ParseError CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_get_err(LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ *NONNULL_PTR owner){
15543 CHECK(!owner->result_ok);
15544         return Bolt11ParseError_clone(&*owner->contents.err);
15545 }
15546 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawBolt11InvoiceBolt11ParseErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
15547         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* owner_conv = (LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ*)untag_ptr(owner);
15548         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
15549         *ret_copy = CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_get_err(owner_conv);
15550         int64_t ret_ref = tag_ptr(ret_copy, true);
15551         return ret_ref;
15552 }
15553
15554 static inline struct LDKRawBolt11Invoice C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_get_a(LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ *NONNULL_PTR owner){
15555         LDKRawBolt11Invoice ret = owner->a;
15556         ret.is_owned = false;
15557         return ret;
15558 }
15559 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1RawBolt11Invoice_1u832Bolt11InvoiceSignatureZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
15560         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ* owner_conv = (LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ*)untag_ptr(owner);
15561         LDKRawBolt11Invoice ret_var = C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_get_a(owner_conv);
15562         int64_t ret_ref = 0;
15563         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
15564         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
15565         return ret_ref;
15566 }
15567
15568 static inline struct LDKThirtyTwoBytes C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_get_b(LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ *NONNULL_PTR owner){
15569         return ThirtyTwoBytes_clone(&owner->b);
15570 }
15571 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C3Tuple_1RawBolt11Invoice_1u832Bolt11InvoiceSignatureZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
15572         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ* owner_conv = (LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ*)untag_ptr(owner);
15573         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
15574         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_get_b(owner_conv).data);
15575         return ret_arr;
15576 }
15577
15578 static inline struct LDKBolt11InvoiceSignature C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_get_c(LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ *NONNULL_PTR owner){
15579         LDKBolt11InvoiceSignature ret = owner->c;
15580         ret.is_owned = false;
15581         return ret;
15582 }
15583 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1RawBolt11Invoice_1u832Bolt11InvoiceSignatureZ_1get_1c(JNIEnv *env, jclass clz, int64_t owner) {
15584         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ* owner_conv = (LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ*)untag_ptr(owner);
15585         LDKBolt11InvoiceSignature ret_var = C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_get_c(owner_conv);
15586         int64_t ret_ref = 0;
15587         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
15588         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
15589         return ret_ref;
15590 }
15591
15592 static inline struct LDKPayeePubKey CResult_PayeePubKeySecp256k1ErrorZ_get_ok(LDKCResult_PayeePubKeySecp256k1ErrorZ *NONNULL_PTR owner){
15593         LDKPayeePubKey ret = *owner->contents.result;
15594         ret.is_owned = false;
15595         return ret;
15596 }
15597 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeySecp256k1ErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
15598         LDKCResult_PayeePubKeySecp256k1ErrorZ* owner_conv = (LDKCResult_PayeePubKeySecp256k1ErrorZ*)untag_ptr(owner);
15599         LDKPayeePubKey ret_var = CResult_PayeePubKeySecp256k1ErrorZ_get_ok(owner_conv);
15600         int64_t ret_ref = 0;
15601         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
15602         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
15603         return ret_ref;
15604 }
15605
15606 static inline enum LDKSecp256k1Error CResult_PayeePubKeySecp256k1ErrorZ_get_err(LDKCResult_PayeePubKeySecp256k1ErrorZ *NONNULL_PTR owner){
15607 CHECK(!owner->result_ok);
15608         return *owner->contents.err;
15609 }
15610 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeySecp256k1ErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
15611         LDKCResult_PayeePubKeySecp256k1ErrorZ* owner_conv = (LDKCResult_PayeePubKeySecp256k1ErrorZ*)untag_ptr(owner);
15612         jclass ret_conv = LDKSecp256k1Error_to_java(env, CResult_PayeePubKeySecp256k1ErrorZ_get_err(owner_conv));
15613         return ret_conv;
15614 }
15615
15616 static inline LDKCVec_PrivateRouteZ CVec_PrivateRouteZ_clone(const LDKCVec_PrivateRouteZ *orig) {
15617         LDKCVec_PrivateRouteZ ret = { .data = MALLOC(sizeof(LDKPrivateRoute) * orig->datalen, "LDKCVec_PrivateRouteZ clone bytes"), .datalen = orig->datalen };
15618         for (size_t i = 0; i < ret.datalen; i++) {
15619                 ret.data[i] = PrivateRoute_clone(&orig->data[i]);
15620         }
15621         return ret;
15622 }
15623 static inline struct LDKPositiveTimestamp CResult_PositiveTimestampCreationErrorZ_get_ok(LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR owner){
15624         LDKPositiveTimestamp ret = *owner->contents.result;
15625         ret.is_owned = false;
15626         return ret;
15627 }
15628 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
15629         LDKCResult_PositiveTimestampCreationErrorZ* owner_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)untag_ptr(owner);
15630         LDKPositiveTimestamp ret_var = CResult_PositiveTimestampCreationErrorZ_get_ok(owner_conv);
15631         int64_t ret_ref = 0;
15632         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
15633         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
15634         return ret_ref;
15635 }
15636
15637 static inline enum LDKCreationError CResult_PositiveTimestampCreationErrorZ_get_err(LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR owner){
15638 CHECK(!owner->result_ok);
15639         return CreationError_clone(&*owner->contents.err);
15640 }
15641 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
15642         LDKCResult_PositiveTimestampCreationErrorZ* owner_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)untag_ptr(owner);
15643         jclass ret_conv = LDKCreationError_to_java(env, CResult_PositiveTimestampCreationErrorZ_get_err(owner_conv));
15644         return ret_conv;
15645 }
15646
15647 static inline void CResult_NoneBolt11SemanticErrorZ_get_ok(LDKCResult_NoneBolt11SemanticErrorZ *NONNULL_PTR owner){
15648 CHECK(owner->result_ok);
15649         return *owner->contents.result;
15650 }
15651 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneBolt11SemanticErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
15652         LDKCResult_NoneBolt11SemanticErrorZ* owner_conv = (LDKCResult_NoneBolt11SemanticErrorZ*)untag_ptr(owner);
15653         CResult_NoneBolt11SemanticErrorZ_get_ok(owner_conv);
15654 }
15655
15656 static inline enum LDKBolt11SemanticError CResult_NoneBolt11SemanticErrorZ_get_err(LDKCResult_NoneBolt11SemanticErrorZ *NONNULL_PTR owner){
15657 CHECK(!owner->result_ok);
15658         return Bolt11SemanticError_clone(&*owner->contents.err);
15659 }
15660 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1NoneBolt11SemanticErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
15661         LDKCResult_NoneBolt11SemanticErrorZ* owner_conv = (LDKCResult_NoneBolt11SemanticErrorZ*)untag_ptr(owner);
15662         jclass ret_conv = LDKBolt11SemanticError_to_java(env, CResult_NoneBolt11SemanticErrorZ_get_err(owner_conv));
15663         return ret_conv;
15664 }
15665
15666 static inline struct LDKBolt11Invoice CResult_Bolt11InvoiceBolt11SemanticErrorZ_get_ok(LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ *NONNULL_PTR owner){
15667         LDKBolt11Invoice ret = *owner->contents.result;
15668         ret.is_owned = false;
15669         return ret;
15670 }
15671 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceBolt11SemanticErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
15672         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* owner_conv = (LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ*)untag_ptr(owner);
15673         LDKBolt11Invoice ret_var = CResult_Bolt11InvoiceBolt11SemanticErrorZ_get_ok(owner_conv);
15674         int64_t ret_ref = 0;
15675         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
15676         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
15677         return ret_ref;
15678 }
15679
15680 static inline enum LDKBolt11SemanticError CResult_Bolt11InvoiceBolt11SemanticErrorZ_get_err(LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ *NONNULL_PTR owner){
15681 CHECK(!owner->result_ok);
15682         return Bolt11SemanticError_clone(&*owner->contents.err);
15683 }
15684 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceBolt11SemanticErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
15685         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* owner_conv = (LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ*)untag_ptr(owner);
15686         jclass ret_conv = LDKBolt11SemanticError_to_java(env, CResult_Bolt11InvoiceBolt11SemanticErrorZ_get_err(owner_conv));
15687         return ret_conv;
15688 }
15689
15690 static inline struct LDKDescription CResult_DescriptionCreationErrorZ_get_ok(LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR owner){
15691         LDKDescription ret = *owner->contents.result;
15692         ret.is_owned = false;
15693         return ret;
15694 }
15695 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
15696         LDKCResult_DescriptionCreationErrorZ* owner_conv = (LDKCResult_DescriptionCreationErrorZ*)untag_ptr(owner);
15697         LDKDescription ret_var = CResult_DescriptionCreationErrorZ_get_ok(owner_conv);
15698         int64_t ret_ref = 0;
15699         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
15700         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
15701         return ret_ref;
15702 }
15703
15704 static inline enum LDKCreationError CResult_DescriptionCreationErrorZ_get_err(LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR owner){
15705 CHECK(!owner->result_ok);
15706         return CreationError_clone(&*owner->contents.err);
15707 }
15708 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
15709         LDKCResult_DescriptionCreationErrorZ* owner_conv = (LDKCResult_DescriptionCreationErrorZ*)untag_ptr(owner);
15710         jclass ret_conv = LDKCreationError_to_java(env, CResult_DescriptionCreationErrorZ_get_err(owner_conv));
15711         return ret_conv;
15712 }
15713
15714 static inline struct LDKPrivateRoute CResult_PrivateRouteCreationErrorZ_get_ok(LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR owner){
15715         LDKPrivateRoute ret = *owner->contents.result;
15716         ret.is_owned = false;
15717         return ret;
15718 }
15719 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
15720         LDKCResult_PrivateRouteCreationErrorZ* owner_conv = (LDKCResult_PrivateRouteCreationErrorZ*)untag_ptr(owner);
15721         LDKPrivateRoute ret_var = CResult_PrivateRouteCreationErrorZ_get_ok(owner_conv);
15722         int64_t ret_ref = 0;
15723         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
15724         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
15725         return ret_ref;
15726 }
15727
15728 static inline enum LDKCreationError CResult_PrivateRouteCreationErrorZ_get_err(LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR owner){
15729 CHECK(!owner->result_ok);
15730         return CreationError_clone(&*owner->contents.err);
15731 }
15732 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
15733         LDKCResult_PrivateRouteCreationErrorZ* owner_conv = (LDKCResult_PrivateRouteCreationErrorZ*)untag_ptr(owner);
15734         jclass ret_conv = LDKCreationError_to_java(env, CResult_PrivateRouteCreationErrorZ_get_err(owner_conv));
15735         return ret_conv;
15736 }
15737
15738 static inline struct LDKOutPoint CResult_OutPointDecodeErrorZ_get_ok(LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR owner){
15739         LDKOutPoint ret = *owner->contents.result;
15740         ret.is_owned = false;
15741         return ret;
15742 }
15743 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
15744         LDKCResult_OutPointDecodeErrorZ* owner_conv = (LDKCResult_OutPointDecodeErrorZ*)untag_ptr(owner);
15745         LDKOutPoint ret_var = CResult_OutPointDecodeErrorZ_get_ok(owner_conv);
15746         int64_t ret_ref = 0;
15747         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
15748         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
15749         return ret_ref;
15750 }
15751
15752 static inline struct LDKDecodeError CResult_OutPointDecodeErrorZ_get_err(LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR owner){
15753 CHECK(!owner->result_ok);
15754         return DecodeError_clone(&*owner->contents.err);
15755 }
15756 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
15757         LDKCResult_OutPointDecodeErrorZ* owner_conv = (LDKCResult_OutPointDecodeErrorZ*)untag_ptr(owner);
15758         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
15759         *ret_copy = CResult_OutPointDecodeErrorZ_get_err(owner_conv);
15760         int64_t ret_ref = tag_ptr(ret_copy, true);
15761         return ret_ref;
15762 }
15763
15764 static inline struct LDKBigSize CResult_BigSizeDecodeErrorZ_get_ok(LDKCResult_BigSizeDecodeErrorZ *NONNULL_PTR owner){
15765         LDKBigSize ret = *owner->contents.result;
15766         ret.is_owned = false;
15767         return ret;
15768 }
15769 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BigSizeDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
15770         LDKCResult_BigSizeDecodeErrorZ* owner_conv = (LDKCResult_BigSizeDecodeErrorZ*)untag_ptr(owner);
15771         LDKBigSize ret_var = CResult_BigSizeDecodeErrorZ_get_ok(owner_conv);
15772         int64_t ret_ref = 0;
15773         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
15774         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
15775         return ret_ref;
15776 }
15777
15778 static inline struct LDKDecodeError CResult_BigSizeDecodeErrorZ_get_err(LDKCResult_BigSizeDecodeErrorZ *NONNULL_PTR owner){
15779 CHECK(!owner->result_ok);
15780         return DecodeError_clone(&*owner->contents.err);
15781 }
15782 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BigSizeDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
15783         LDKCResult_BigSizeDecodeErrorZ* owner_conv = (LDKCResult_BigSizeDecodeErrorZ*)untag_ptr(owner);
15784         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
15785         *ret_copy = CResult_BigSizeDecodeErrorZ_get_err(owner_conv);
15786         int64_t ret_ref = tag_ptr(ret_copy, true);
15787         return ret_ref;
15788 }
15789
15790 static inline struct LDKHostname CResult_HostnameDecodeErrorZ_get_ok(LDKCResult_HostnameDecodeErrorZ *NONNULL_PTR owner){
15791         LDKHostname ret = *owner->contents.result;
15792         ret.is_owned = false;
15793         return ret;
15794 }
15795 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HostnameDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
15796         LDKCResult_HostnameDecodeErrorZ* owner_conv = (LDKCResult_HostnameDecodeErrorZ*)untag_ptr(owner);
15797         LDKHostname ret_var = CResult_HostnameDecodeErrorZ_get_ok(owner_conv);
15798         int64_t ret_ref = 0;
15799         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
15800         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
15801         return ret_ref;
15802 }
15803
15804 static inline struct LDKDecodeError CResult_HostnameDecodeErrorZ_get_err(LDKCResult_HostnameDecodeErrorZ *NONNULL_PTR owner){
15805 CHECK(!owner->result_ok);
15806         return DecodeError_clone(&*owner->contents.err);
15807 }
15808 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HostnameDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
15809         LDKCResult_HostnameDecodeErrorZ* owner_conv = (LDKCResult_HostnameDecodeErrorZ*)untag_ptr(owner);
15810         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
15811         *ret_copy = CResult_HostnameDecodeErrorZ_get_err(owner_conv);
15812         int64_t ret_ref = tag_ptr(ret_copy, true);
15813         return ret_ref;
15814 }
15815
15816 static inline struct LDKTransactionU16LenLimited CResult_TransactionU16LenLimitedNoneZ_get_ok(LDKCResult_TransactionU16LenLimitedNoneZ *NONNULL_PTR owner){
15817         LDKTransactionU16LenLimited ret = *owner->contents.result;
15818         ret.is_owned = false;
15819         return ret;
15820 }
15821 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionU16LenLimitedNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
15822         LDKCResult_TransactionU16LenLimitedNoneZ* owner_conv = (LDKCResult_TransactionU16LenLimitedNoneZ*)untag_ptr(owner);
15823         LDKTransactionU16LenLimited ret_var = CResult_TransactionU16LenLimitedNoneZ_get_ok(owner_conv);
15824         int64_t ret_ref = 0;
15825         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
15826         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
15827         return ret_ref;
15828 }
15829
15830 static inline void CResult_TransactionU16LenLimitedNoneZ_get_err(LDKCResult_TransactionU16LenLimitedNoneZ *NONNULL_PTR owner){
15831 CHECK(!owner->result_ok);
15832         return *owner->contents.err;
15833 }
15834 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionU16LenLimitedNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
15835         LDKCResult_TransactionU16LenLimitedNoneZ* owner_conv = (LDKCResult_TransactionU16LenLimitedNoneZ*)untag_ptr(owner);
15836         CResult_TransactionU16LenLimitedNoneZ_get_err(owner_conv);
15837 }
15838
15839 static inline struct LDKTransactionU16LenLimited CResult_TransactionU16LenLimitedDecodeErrorZ_get_ok(LDKCResult_TransactionU16LenLimitedDecodeErrorZ *NONNULL_PTR owner){
15840         LDKTransactionU16LenLimited ret = *owner->contents.result;
15841         ret.is_owned = false;
15842         return ret;
15843 }
15844 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionU16LenLimitedDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
15845         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* owner_conv = (LDKCResult_TransactionU16LenLimitedDecodeErrorZ*)untag_ptr(owner);
15846         LDKTransactionU16LenLimited ret_var = CResult_TransactionU16LenLimitedDecodeErrorZ_get_ok(owner_conv);
15847         int64_t ret_ref = 0;
15848         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
15849         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
15850         return ret_ref;
15851 }
15852
15853 static inline struct LDKDecodeError CResult_TransactionU16LenLimitedDecodeErrorZ_get_err(LDKCResult_TransactionU16LenLimitedDecodeErrorZ *NONNULL_PTR owner){
15854 CHECK(!owner->result_ok);
15855         return DecodeError_clone(&*owner->contents.err);
15856 }
15857 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionU16LenLimitedDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
15858         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* owner_conv = (LDKCResult_TransactionU16LenLimitedDecodeErrorZ*)untag_ptr(owner);
15859         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
15860         *ret_copy = CResult_TransactionU16LenLimitedDecodeErrorZ_get_err(owner_conv);
15861         int64_t ret_ref = tag_ptr(ret_copy, true);
15862         return ret_ref;
15863 }
15864
15865 static inline struct LDKUntrustedString CResult_UntrustedStringDecodeErrorZ_get_ok(LDKCResult_UntrustedStringDecodeErrorZ *NONNULL_PTR owner){
15866         LDKUntrustedString ret = *owner->contents.result;
15867         ret.is_owned = false;
15868         return ret;
15869 }
15870 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UntrustedStringDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
15871         LDKCResult_UntrustedStringDecodeErrorZ* owner_conv = (LDKCResult_UntrustedStringDecodeErrorZ*)untag_ptr(owner);
15872         LDKUntrustedString ret_var = CResult_UntrustedStringDecodeErrorZ_get_ok(owner_conv);
15873         int64_t ret_ref = 0;
15874         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
15875         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
15876         return ret_ref;
15877 }
15878
15879 static inline struct LDKDecodeError CResult_UntrustedStringDecodeErrorZ_get_err(LDKCResult_UntrustedStringDecodeErrorZ *NONNULL_PTR owner){
15880 CHECK(!owner->result_ok);
15881         return DecodeError_clone(&*owner->contents.err);
15882 }
15883 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UntrustedStringDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
15884         LDKCResult_UntrustedStringDecodeErrorZ* owner_conv = (LDKCResult_UntrustedStringDecodeErrorZ*)untag_ptr(owner);
15885         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
15886         *ret_copy = CResult_UntrustedStringDecodeErrorZ_get_err(owner_conv);
15887         int64_t ret_ref = tag_ptr(ret_copy, true);
15888         return ret_ref;
15889 }
15890
15891 static inline struct LDKChannelId CResult_ChannelIdDecodeErrorZ_get_ok(LDKCResult_ChannelIdDecodeErrorZ *NONNULL_PTR owner){
15892         LDKChannelId ret = *owner->contents.result;
15893         ret.is_owned = false;
15894         return ret;
15895 }
15896 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelIdDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
15897         LDKCResult_ChannelIdDecodeErrorZ* owner_conv = (LDKCResult_ChannelIdDecodeErrorZ*)untag_ptr(owner);
15898         LDKChannelId ret_var = CResult_ChannelIdDecodeErrorZ_get_ok(owner_conv);
15899         int64_t ret_ref = 0;
15900         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
15901         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
15902         return ret_ref;
15903 }
15904
15905 static inline struct LDKDecodeError CResult_ChannelIdDecodeErrorZ_get_err(LDKCResult_ChannelIdDecodeErrorZ *NONNULL_PTR owner){
15906 CHECK(!owner->result_ok);
15907         return DecodeError_clone(&*owner->contents.err);
15908 }
15909 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelIdDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
15910         LDKCResult_ChannelIdDecodeErrorZ* owner_conv = (LDKCResult_ChannelIdDecodeErrorZ*)untag_ptr(owner);
15911         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
15912         *ret_copy = CResult_ChannelIdDecodeErrorZ_get_err(owner_conv);
15913         int64_t ret_ref = tag_ptr(ret_copy, true);
15914         return ret_ref;
15915 }
15916
15917 static inline struct LDKThirtyTwoBytes C2Tuple__u832u16Z_get_a(LDKC2Tuple__u832u16Z *NONNULL_PTR owner){
15918         return ThirtyTwoBytes_clone(&owner->a);
15919 }
15920 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1_1u832u16Z_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
15921         LDKC2Tuple__u832u16Z* owner_conv = (LDKC2Tuple__u832u16Z*)untag_ptr(owner);
15922         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
15923         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C2Tuple__u832u16Z_get_a(owner_conv).data);
15924         return ret_arr;
15925 }
15926
15927 static inline uint16_t C2Tuple__u832u16Z_get_b(LDKC2Tuple__u832u16Z *NONNULL_PTR owner){
15928         return owner->b;
15929 }
15930 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1_1u832u16Z_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
15931         LDKC2Tuple__u832u16Z* owner_conv = (LDKC2Tuple__u832u16Z*)untag_ptr(owner);
15932         int16_t ret_conv = C2Tuple__u832u16Z_get_b(owner_conv);
15933         return ret_conv;
15934 }
15935
15936 static inline struct LDKPaymentRelay CResult_PaymentRelayDecodeErrorZ_get_ok(LDKCResult_PaymentRelayDecodeErrorZ *NONNULL_PTR owner){
15937         LDKPaymentRelay ret = *owner->contents.result;
15938         ret.is_owned = false;
15939         return ret;
15940 }
15941 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentRelayDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
15942         LDKCResult_PaymentRelayDecodeErrorZ* owner_conv = (LDKCResult_PaymentRelayDecodeErrorZ*)untag_ptr(owner);
15943         LDKPaymentRelay ret_var = CResult_PaymentRelayDecodeErrorZ_get_ok(owner_conv);
15944         int64_t ret_ref = 0;
15945         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
15946         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
15947         return ret_ref;
15948 }
15949
15950 static inline struct LDKDecodeError CResult_PaymentRelayDecodeErrorZ_get_err(LDKCResult_PaymentRelayDecodeErrorZ *NONNULL_PTR owner){
15951 CHECK(!owner->result_ok);
15952         return DecodeError_clone(&*owner->contents.err);
15953 }
15954 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentRelayDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
15955         LDKCResult_PaymentRelayDecodeErrorZ* owner_conv = (LDKCResult_PaymentRelayDecodeErrorZ*)untag_ptr(owner);
15956         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
15957         *ret_copy = CResult_PaymentRelayDecodeErrorZ_get_err(owner_conv);
15958         int64_t ret_ref = tag_ptr(ret_copy, true);
15959         return ret_ref;
15960 }
15961
15962 static inline struct LDKPaymentConstraints CResult_PaymentConstraintsDecodeErrorZ_get_ok(LDKCResult_PaymentConstraintsDecodeErrorZ *NONNULL_PTR owner){
15963         LDKPaymentConstraints ret = *owner->contents.result;
15964         ret.is_owned = false;
15965         return ret;
15966 }
15967 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentConstraintsDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
15968         LDKCResult_PaymentConstraintsDecodeErrorZ* owner_conv = (LDKCResult_PaymentConstraintsDecodeErrorZ*)untag_ptr(owner);
15969         LDKPaymentConstraints ret_var = CResult_PaymentConstraintsDecodeErrorZ_get_ok(owner_conv);
15970         int64_t ret_ref = 0;
15971         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
15972         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
15973         return ret_ref;
15974 }
15975
15976 static inline struct LDKDecodeError CResult_PaymentConstraintsDecodeErrorZ_get_err(LDKCResult_PaymentConstraintsDecodeErrorZ *NONNULL_PTR owner){
15977 CHECK(!owner->result_ok);
15978         return DecodeError_clone(&*owner->contents.err);
15979 }
15980 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentConstraintsDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
15981         LDKCResult_PaymentConstraintsDecodeErrorZ* owner_conv = (LDKCResult_PaymentConstraintsDecodeErrorZ*)untag_ptr(owner);
15982         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
15983         *ret_copy = CResult_PaymentConstraintsDecodeErrorZ_get_err(owner_conv);
15984         int64_t ret_ref = tag_ptr(ret_copy, true);
15985         return ret_ref;
15986 }
15987
15988 static inline struct LDKPaymentContext CResult_PaymentContextDecodeErrorZ_get_ok(LDKCResult_PaymentContextDecodeErrorZ *NONNULL_PTR owner){
15989 CHECK(owner->result_ok);
15990         return PaymentContext_clone(&*owner->contents.result);
15991 }
15992 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentContextDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
15993         LDKCResult_PaymentContextDecodeErrorZ* owner_conv = (LDKCResult_PaymentContextDecodeErrorZ*)untag_ptr(owner);
15994         LDKPaymentContext *ret_copy = MALLOC(sizeof(LDKPaymentContext), "LDKPaymentContext");
15995         *ret_copy = CResult_PaymentContextDecodeErrorZ_get_ok(owner_conv);
15996         int64_t ret_ref = tag_ptr(ret_copy, true);
15997         return ret_ref;
15998 }
15999
16000 static inline struct LDKDecodeError CResult_PaymentContextDecodeErrorZ_get_err(LDKCResult_PaymentContextDecodeErrorZ *NONNULL_PTR owner){
16001 CHECK(!owner->result_ok);
16002         return DecodeError_clone(&*owner->contents.err);
16003 }
16004 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentContextDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
16005         LDKCResult_PaymentContextDecodeErrorZ* owner_conv = (LDKCResult_PaymentContextDecodeErrorZ*)untag_ptr(owner);
16006         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
16007         *ret_copy = CResult_PaymentContextDecodeErrorZ_get_err(owner_conv);
16008         int64_t ret_ref = tag_ptr(ret_copy, true);
16009         return ret_ref;
16010 }
16011
16012 static inline struct LDKUnknownPaymentContext CResult_UnknownPaymentContextDecodeErrorZ_get_ok(LDKCResult_UnknownPaymentContextDecodeErrorZ *NONNULL_PTR owner){
16013         LDKUnknownPaymentContext ret = *owner->contents.result;
16014         ret.is_owned = false;
16015         return ret;
16016 }
16017 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnknownPaymentContextDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
16018         LDKCResult_UnknownPaymentContextDecodeErrorZ* owner_conv = (LDKCResult_UnknownPaymentContextDecodeErrorZ*)untag_ptr(owner);
16019         LDKUnknownPaymentContext ret_var = CResult_UnknownPaymentContextDecodeErrorZ_get_ok(owner_conv);
16020         int64_t ret_ref = 0;
16021         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
16022         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
16023         return ret_ref;
16024 }
16025
16026 static inline struct LDKDecodeError CResult_UnknownPaymentContextDecodeErrorZ_get_err(LDKCResult_UnknownPaymentContextDecodeErrorZ *NONNULL_PTR owner){
16027 CHECK(!owner->result_ok);
16028         return DecodeError_clone(&*owner->contents.err);
16029 }
16030 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnknownPaymentContextDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
16031         LDKCResult_UnknownPaymentContextDecodeErrorZ* owner_conv = (LDKCResult_UnknownPaymentContextDecodeErrorZ*)untag_ptr(owner);
16032         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
16033         *ret_copy = CResult_UnknownPaymentContextDecodeErrorZ_get_err(owner_conv);
16034         int64_t ret_ref = tag_ptr(ret_copy, true);
16035         return ret_ref;
16036 }
16037
16038 static inline struct LDKBolt12OfferContext CResult_Bolt12OfferContextDecodeErrorZ_get_ok(LDKCResult_Bolt12OfferContextDecodeErrorZ *NONNULL_PTR owner){
16039         LDKBolt12OfferContext ret = *owner->contents.result;
16040         ret.is_owned = false;
16041         return ret;
16042 }
16043 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt12OfferContextDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
16044         LDKCResult_Bolt12OfferContextDecodeErrorZ* owner_conv = (LDKCResult_Bolt12OfferContextDecodeErrorZ*)untag_ptr(owner);
16045         LDKBolt12OfferContext ret_var = CResult_Bolt12OfferContextDecodeErrorZ_get_ok(owner_conv);
16046         int64_t ret_ref = 0;
16047         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
16048         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
16049         return ret_ref;
16050 }
16051
16052 static inline struct LDKDecodeError CResult_Bolt12OfferContextDecodeErrorZ_get_err(LDKCResult_Bolt12OfferContextDecodeErrorZ *NONNULL_PTR owner){
16053 CHECK(!owner->result_ok);
16054         return DecodeError_clone(&*owner->contents.err);
16055 }
16056 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt12OfferContextDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
16057         LDKCResult_Bolt12OfferContextDecodeErrorZ* owner_conv = (LDKCResult_Bolt12OfferContextDecodeErrorZ*)untag_ptr(owner);
16058         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
16059         *ret_copy = CResult_Bolt12OfferContextDecodeErrorZ_get_err(owner_conv);
16060         int64_t ret_ref = tag_ptr(ret_copy, true);
16061         return ret_ref;
16062 }
16063
16064 static inline struct LDKBolt12RefundContext CResult_Bolt12RefundContextDecodeErrorZ_get_ok(LDKCResult_Bolt12RefundContextDecodeErrorZ *NONNULL_PTR owner){
16065         LDKBolt12RefundContext ret = *owner->contents.result;
16066         ret.is_owned = false;
16067         return ret;
16068 }
16069 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt12RefundContextDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
16070         LDKCResult_Bolt12RefundContextDecodeErrorZ* owner_conv = (LDKCResult_Bolt12RefundContextDecodeErrorZ*)untag_ptr(owner);
16071         LDKBolt12RefundContext ret_var = CResult_Bolt12RefundContextDecodeErrorZ_get_ok(owner_conv);
16072         int64_t ret_ref = 0;
16073         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
16074         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
16075         return ret_ref;
16076 }
16077
16078 static inline struct LDKDecodeError CResult_Bolt12RefundContextDecodeErrorZ_get_err(LDKCResult_Bolt12RefundContextDecodeErrorZ *NONNULL_PTR owner){
16079 CHECK(!owner->result_ok);
16080         return DecodeError_clone(&*owner->contents.err);
16081 }
16082 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt12RefundContextDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
16083         LDKCResult_Bolt12RefundContextDecodeErrorZ* owner_conv = (LDKCResult_Bolt12RefundContextDecodeErrorZ*)untag_ptr(owner);
16084         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
16085         *ret_copy = CResult_Bolt12RefundContextDecodeErrorZ_get_err(owner_conv);
16086         int64_t ret_ref = tag_ptr(ret_copy, true);
16087         return ret_ref;
16088 }
16089
16090 static inline struct LDKStr CResult_StrSecp256k1ErrorZ_get_ok(LDKCResult_StrSecp256k1ErrorZ *NONNULL_PTR owner){
16091 CHECK(owner->result_ok);
16092         return *owner->contents.result;
16093 }
16094 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_CResult_1StrSecp256k1ErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
16095         LDKCResult_StrSecp256k1ErrorZ* owner_conv = (LDKCResult_StrSecp256k1ErrorZ*)untag_ptr(owner);
16096         LDKStr ret_str = CResult_StrSecp256k1ErrorZ_get_ok(owner_conv);
16097         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
16098         return ret_conv;
16099 }
16100
16101 static inline enum LDKSecp256k1Error CResult_StrSecp256k1ErrorZ_get_err(LDKCResult_StrSecp256k1ErrorZ *NONNULL_PTR owner){
16102 CHECK(!owner->result_ok);
16103         return *owner->contents.err;
16104 }
16105 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1StrSecp256k1ErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
16106         LDKCResult_StrSecp256k1ErrorZ* owner_conv = (LDKCResult_StrSecp256k1ErrorZ*)untag_ptr(owner);
16107         jclass ret_conv = LDKSecp256k1Error_to_java(env, CResult_StrSecp256k1ErrorZ_get_err(owner_conv));
16108         return ret_conv;
16109 }
16110
16111 static inline struct LDKThirtyTwoBytes C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_get_a(LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ *NONNULL_PTR owner){
16112         return ThirtyTwoBytes_clone(&owner->a);
16113 }
16114 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
16115         LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ* owner_conv = (LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ*)untag_ptr(owner);
16116         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
16117         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_get_a(owner_conv).data);
16118         return ret_arr;
16119 }
16120
16121 static inline struct LDKRecipientOnionFields C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_get_b(LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ *NONNULL_PTR owner){
16122         LDKRecipientOnionFields ret = owner->b;
16123         ret.is_owned = false;
16124         return ret;
16125 }
16126 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
16127         LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ* owner_conv = (LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ*)untag_ptr(owner);
16128         LDKRecipientOnionFields ret_var = C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_get_b(owner_conv);
16129         int64_t ret_ref = 0;
16130         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
16131         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
16132         return ret_ref;
16133 }
16134
16135 static inline struct LDKRouteParameters C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_get_c(LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ *NONNULL_PTR owner){
16136         LDKRouteParameters ret = owner->c;
16137         ret.is_owned = false;
16138         return ret;
16139 }
16140 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_1get_1c(JNIEnv *env, jclass clz, int64_t owner) {
16141         LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ* owner_conv = (LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ*)untag_ptr(owner);
16142         LDKRouteParameters ret_var = C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_get_c(owner_conv);
16143         int64_t ret_ref = 0;
16144         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
16145         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
16146         return ret_ref;
16147 }
16148
16149 static inline struct LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_get_ok(LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ *NONNULL_PTR owner){
16150 CHECK(owner->result_ok);
16151         return C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_clone(&*owner->contents.result);
16152 }
16153 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C3Tuple_1ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
16154         LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ* owner_conv = (LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ*)untag_ptr(owner);
16155         LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ), "LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ");
16156         *ret_conv = CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_get_ok(owner_conv);
16157         return tag_ptr(ret_conv, true);
16158 }
16159
16160 static inline void CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_get_err(LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ *NONNULL_PTR owner){
16161 CHECK(!owner->result_ok);
16162         return *owner->contents.err;
16163 }
16164 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C3Tuple_1ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
16165         LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ* owner_conv = (LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ*)untag_ptr(owner);
16166         CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_get_err(owner_conv);
16167 }
16168
16169 static inline struct LDKPublicKey C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_get_a(LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ *NONNULL_PTR owner){
16170         return owner->a;
16171 }
16172 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C3Tuple_1PublicKeyOnionMessageCOption_1CVec_1SocketAddressZZZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
16173         LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ* owner_conv = (LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ*)untag_ptr(owner);
16174         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
16175         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_get_a(owner_conv).compressed_form);
16176         return ret_arr;
16177 }
16178
16179 static inline struct LDKOnionMessage C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_get_b(LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ *NONNULL_PTR owner){
16180         LDKOnionMessage ret = owner->b;
16181         ret.is_owned = false;
16182         return ret;
16183 }
16184 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1PublicKeyOnionMessageCOption_1CVec_1SocketAddressZZZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
16185         LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ* owner_conv = (LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ*)untag_ptr(owner);
16186         LDKOnionMessage ret_var = C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_get_b(owner_conv);
16187         int64_t ret_ref = 0;
16188         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
16189         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
16190         return ret_ref;
16191 }
16192
16193 static inline struct LDKCOption_CVec_SocketAddressZZ C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_get_c(LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ *NONNULL_PTR owner){
16194         return COption_CVec_SocketAddressZZ_clone(&owner->c);
16195 }
16196 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1PublicKeyOnionMessageCOption_1CVec_1SocketAddressZZZ_1get_1c(JNIEnv *env, jclass clz, int64_t owner) {
16197         LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ* owner_conv = (LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ*)untag_ptr(owner);
16198         LDKCOption_CVec_SocketAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_SocketAddressZZ), "LDKCOption_CVec_SocketAddressZZ");
16199         *ret_copy = C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_get_c(owner_conv);
16200         int64_t ret_ref = tag_ptr(ret_copy, true);
16201         return ret_ref;
16202 }
16203
16204 static jclass LDKSendError_Secp256k1_class = NULL;
16205 static jmethodID LDKSendError_Secp256k1_meth = NULL;
16206 static jclass LDKSendError_TooBigPacket_class = NULL;
16207 static jmethodID LDKSendError_TooBigPacket_meth = NULL;
16208 static jclass LDKSendError_TooFewBlindedHops_class = NULL;
16209 static jmethodID LDKSendError_TooFewBlindedHops_meth = NULL;
16210 static jclass LDKSendError_InvalidFirstHop_class = NULL;
16211 static jmethodID LDKSendError_InvalidFirstHop_meth = NULL;
16212 static jclass LDKSendError_PathNotFound_class = NULL;
16213 static jmethodID LDKSendError_PathNotFound_meth = NULL;
16214 static jclass LDKSendError_InvalidMessage_class = NULL;
16215 static jmethodID LDKSendError_InvalidMessage_meth = NULL;
16216 static jclass LDKSendError_BufferFull_class = NULL;
16217 static jmethodID LDKSendError_BufferFull_meth = NULL;
16218 static jclass LDKSendError_GetNodeIdFailed_class = NULL;
16219 static jmethodID LDKSendError_GetNodeIdFailed_meth = NULL;
16220 static jclass LDKSendError_UnresolvedIntroductionNode_class = NULL;
16221 static jmethodID LDKSendError_UnresolvedIntroductionNode_meth = NULL;
16222 static jclass LDKSendError_BlindedPathAdvanceFailed_class = NULL;
16223 static jmethodID LDKSendError_BlindedPathAdvanceFailed_meth = NULL;
16224 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKSendError_init (JNIEnv *env, jclass clz) {
16225         LDKSendError_Secp256k1_class =
16226                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSendError$Secp256k1"));
16227         CHECK(LDKSendError_Secp256k1_class != NULL);
16228         LDKSendError_Secp256k1_meth = (*env)->GetMethodID(env, LDKSendError_Secp256k1_class, "<init>", "(Lorg/ldk/enums/Secp256k1Error;)V");
16229         CHECK(LDKSendError_Secp256k1_meth != NULL);
16230         LDKSendError_TooBigPacket_class =
16231                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSendError$TooBigPacket"));
16232         CHECK(LDKSendError_TooBigPacket_class != NULL);
16233         LDKSendError_TooBigPacket_meth = (*env)->GetMethodID(env, LDKSendError_TooBigPacket_class, "<init>", "()V");
16234         CHECK(LDKSendError_TooBigPacket_meth != NULL);
16235         LDKSendError_TooFewBlindedHops_class =
16236                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSendError$TooFewBlindedHops"));
16237         CHECK(LDKSendError_TooFewBlindedHops_class != NULL);
16238         LDKSendError_TooFewBlindedHops_meth = (*env)->GetMethodID(env, LDKSendError_TooFewBlindedHops_class, "<init>", "()V");
16239         CHECK(LDKSendError_TooFewBlindedHops_meth != NULL);
16240         LDKSendError_InvalidFirstHop_class =
16241                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSendError$InvalidFirstHop"));
16242         CHECK(LDKSendError_InvalidFirstHop_class != NULL);
16243         LDKSendError_InvalidFirstHop_meth = (*env)->GetMethodID(env, LDKSendError_InvalidFirstHop_class, "<init>", "([B)V");
16244         CHECK(LDKSendError_InvalidFirstHop_meth != NULL);
16245         LDKSendError_PathNotFound_class =
16246                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSendError$PathNotFound"));
16247         CHECK(LDKSendError_PathNotFound_class != NULL);
16248         LDKSendError_PathNotFound_meth = (*env)->GetMethodID(env, LDKSendError_PathNotFound_class, "<init>", "()V");
16249         CHECK(LDKSendError_PathNotFound_meth != NULL);
16250         LDKSendError_InvalidMessage_class =
16251                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSendError$InvalidMessage"));
16252         CHECK(LDKSendError_InvalidMessage_class != NULL);
16253         LDKSendError_InvalidMessage_meth = (*env)->GetMethodID(env, LDKSendError_InvalidMessage_class, "<init>", "()V");
16254         CHECK(LDKSendError_InvalidMessage_meth != NULL);
16255         LDKSendError_BufferFull_class =
16256                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSendError$BufferFull"));
16257         CHECK(LDKSendError_BufferFull_class != NULL);
16258         LDKSendError_BufferFull_meth = (*env)->GetMethodID(env, LDKSendError_BufferFull_class, "<init>", "()V");
16259         CHECK(LDKSendError_BufferFull_meth != NULL);
16260         LDKSendError_GetNodeIdFailed_class =
16261                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSendError$GetNodeIdFailed"));
16262         CHECK(LDKSendError_GetNodeIdFailed_class != NULL);
16263         LDKSendError_GetNodeIdFailed_meth = (*env)->GetMethodID(env, LDKSendError_GetNodeIdFailed_class, "<init>", "()V");
16264         CHECK(LDKSendError_GetNodeIdFailed_meth != NULL);
16265         LDKSendError_UnresolvedIntroductionNode_class =
16266                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSendError$UnresolvedIntroductionNode"));
16267         CHECK(LDKSendError_UnresolvedIntroductionNode_class != NULL);
16268         LDKSendError_UnresolvedIntroductionNode_meth = (*env)->GetMethodID(env, LDKSendError_UnresolvedIntroductionNode_class, "<init>", "()V");
16269         CHECK(LDKSendError_UnresolvedIntroductionNode_meth != NULL);
16270         LDKSendError_BlindedPathAdvanceFailed_class =
16271                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSendError$BlindedPathAdvanceFailed"));
16272         CHECK(LDKSendError_BlindedPathAdvanceFailed_class != NULL);
16273         LDKSendError_BlindedPathAdvanceFailed_meth = (*env)->GetMethodID(env, LDKSendError_BlindedPathAdvanceFailed_class, "<init>", "()V");
16274         CHECK(LDKSendError_BlindedPathAdvanceFailed_meth != NULL);
16275 }
16276 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKSendError_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
16277         LDKSendError *obj = (LDKSendError*)untag_ptr(ptr);
16278         switch(obj->tag) {
16279                 case LDKSendError_Secp256k1: {
16280                         jclass secp256k1_conv = LDKSecp256k1Error_to_java(env, obj->secp256k1);
16281                         return (*env)->NewObject(env, LDKSendError_Secp256k1_class, LDKSendError_Secp256k1_meth, secp256k1_conv);
16282                 }
16283                 case LDKSendError_TooBigPacket: {
16284                         return (*env)->NewObject(env, LDKSendError_TooBigPacket_class, LDKSendError_TooBigPacket_meth);
16285                 }
16286                 case LDKSendError_TooFewBlindedHops: {
16287                         return (*env)->NewObject(env, LDKSendError_TooFewBlindedHops_class, LDKSendError_TooFewBlindedHops_meth);
16288                 }
16289                 case LDKSendError_InvalidFirstHop: {
16290                         int8_tArray invalid_first_hop_arr = (*env)->NewByteArray(env, 33);
16291                         (*env)->SetByteArrayRegion(env, invalid_first_hop_arr, 0, 33, obj->invalid_first_hop.compressed_form);
16292                         return (*env)->NewObject(env, LDKSendError_InvalidFirstHop_class, LDKSendError_InvalidFirstHop_meth, invalid_first_hop_arr);
16293                 }
16294                 case LDKSendError_PathNotFound: {
16295                         return (*env)->NewObject(env, LDKSendError_PathNotFound_class, LDKSendError_PathNotFound_meth);
16296                 }
16297                 case LDKSendError_InvalidMessage: {
16298                         return (*env)->NewObject(env, LDKSendError_InvalidMessage_class, LDKSendError_InvalidMessage_meth);
16299                 }
16300                 case LDKSendError_BufferFull: {
16301                         return (*env)->NewObject(env, LDKSendError_BufferFull_class, LDKSendError_BufferFull_meth);
16302                 }
16303                 case LDKSendError_GetNodeIdFailed: {
16304                         return (*env)->NewObject(env, LDKSendError_GetNodeIdFailed_class, LDKSendError_GetNodeIdFailed_meth);
16305                 }
16306                 case LDKSendError_UnresolvedIntroductionNode: {
16307                         return (*env)->NewObject(env, LDKSendError_UnresolvedIntroductionNode_class, LDKSendError_UnresolvedIntroductionNode_meth);
16308                 }
16309                 case LDKSendError_BlindedPathAdvanceFailed: {
16310                         return (*env)->NewObject(env, LDKSendError_BlindedPathAdvanceFailed_class, LDKSendError_BlindedPathAdvanceFailed_meth);
16311                 }
16312                 default: abort();
16313         }
16314 }
16315 static inline struct LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_get_ok(LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ *NONNULL_PTR owner){
16316 CHECK(owner->result_ok);
16317         return C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_clone(&*owner->contents.result);
16318 }
16319 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C3Tuple_1PublicKeyOnionMessageCOption_1CVec_1SocketAddressZZZSendErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
16320         LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ* owner_conv = (LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ*)untag_ptr(owner);
16321         LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ), "LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ");
16322         *ret_conv = CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_get_ok(owner_conv);
16323         return tag_ptr(ret_conv, true);
16324 }
16325
16326 static inline struct LDKSendError CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_get_err(LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ *NONNULL_PTR owner){
16327 CHECK(!owner->result_ok);
16328         return SendError_clone(&*owner->contents.err);
16329 }
16330 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C3Tuple_1PublicKeyOnionMessageCOption_1CVec_1SocketAddressZZZSendErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
16331         LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ* owner_conv = (LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ*)untag_ptr(owner);
16332         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
16333         *ret_copy = CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_get_err(owner_conv);
16334         int64_t ret_ref = tag_ptr(ret_copy, true);
16335         return ret_ref;
16336 }
16337
16338 static jclass LDKNextMessageHop_NodeId_class = NULL;
16339 static jmethodID LDKNextMessageHop_NodeId_meth = NULL;
16340 static jclass LDKNextMessageHop_ShortChannelId_class = NULL;
16341 static jmethodID LDKNextMessageHop_ShortChannelId_meth = NULL;
16342 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKNextMessageHop_init (JNIEnv *env, jclass clz) {
16343         LDKNextMessageHop_NodeId_class =
16344                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKNextMessageHop$NodeId"));
16345         CHECK(LDKNextMessageHop_NodeId_class != NULL);
16346         LDKNextMessageHop_NodeId_meth = (*env)->GetMethodID(env, LDKNextMessageHop_NodeId_class, "<init>", "([B)V");
16347         CHECK(LDKNextMessageHop_NodeId_meth != NULL);
16348         LDKNextMessageHop_ShortChannelId_class =
16349                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKNextMessageHop$ShortChannelId"));
16350         CHECK(LDKNextMessageHop_ShortChannelId_class != NULL);
16351         LDKNextMessageHop_ShortChannelId_meth = (*env)->GetMethodID(env, LDKNextMessageHop_ShortChannelId_class, "<init>", "(J)V");
16352         CHECK(LDKNextMessageHop_ShortChannelId_meth != NULL);
16353 }
16354 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKNextMessageHop_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
16355         LDKNextMessageHop *obj = (LDKNextMessageHop*)untag_ptr(ptr);
16356         switch(obj->tag) {
16357                 case LDKNextMessageHop_NodeId: {
16358                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
16359                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->node_id.compressed_form);
16360                         return (*env)->NewObject(env, LDKNextMessageHop_NodeId_class, LDKNextMessageHop_NodeId_meth, node_id_arr);
16361                 }
16362                 case LDKNextMessageHop_ShortChannelId: {
16363                         int64_t short_channel_id_conv = obj->short_channel_id;
16364                         return (*env)->NewObject(env, LDKNextMessageHop_ShortChannelId_class, LDKNextMessageHop_ShortChannelId_meth, short_channel_id_conv);
16365                 }
16366                 default: abort();
16367         }
16368 }
16369 static jclass LDKParsedOnionMessageContents_Offers_class = NULL;
16370 static jmethodID LDKParsedOnionMessageContents_Offers_meth = NULL;
16371 static jclass LDKParsedOnionMessageContents_Custom_class = NULL;
16372 static jmethodID LDKParsedOnionMessageContents_Custom_meth = NULL;
16373 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKParsedOnionMessageContents_init (JNIEnv *env, jclass clz) {
16374         LDKParsedOnionMessageContents_Offers_class =
16375                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParsedOnionMessageContents$Offers"));
16376         CHECK(LDKParsedOnionMessageContents_Offers_class != NULL);
16377         LDKParsedOnionMessageContents_Offers_meth = (*env)->GetMethodID(env, LDKParsedOnionMessageContents_Offers_class, "<init>", "(J)V");
16378         CHECK(LDKParsedOnionMessageContents_Offers_meth != NULL);
16379         LDKParsedOnionMessageContents_Custom_class =
16380                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParsedOnionMessageContents$Custom"));
16381         CHECK(LDKParsedOnionMessageContents_Custom_class != NULL);
16382         LDKParsedOnionMessageContents_Custom_meth = (*env)->GetMethodID(env, LDKParsedOnionMessageContents_Custom_class, "<init>", "(J)V");
16383         CHECK(LDKParsedOnionMessageContents_Custom_meth != NULL);
16384 }
16385 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKParsedOnionMessageContents_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
16386         LDKParsedOnionMessageContents *obj = (LDKParsedOnionMessageContents*)untag_ptr(ptr);
16387         switch(obj->tag) {
16388                 case LDKParsedOnionMessageContents_Offers: {
16389                         int64_t offers_ref = tag_ptr(&obj->offers, false);
16390                         return (*env)->NewObject(env, LDKParsedOnionMessageContents_Offers_class, LDKParsedOnionMessageContents_Offers_meth, offers_ref);
16391                 }
16392                 case LDKParsedOnionMessageContents_Custom: {
16393                         LDKOnionMessageContents* custom_ret = MALLOC(sizeof(LDKOnionMessageContents), "LDKOnionMessageContents");
16394                         *custom_ret = OnionMessageContents_clone(&obj->custom);
16395                         return (*env)->NewObject(env, LDKParsedOnionMessageContents_Custom_class, LDKParsedOnionMessageContents_Custom_meth, tag_ptr(custom_ret, true));
16396                 }
16397                 default: abort();
16398         }
16399 }
16400 static jclass LDKPeeledOnion_Forward_class = NULL;
16401 static jmethodID LDKPeeledOnion_Forward_meth = NULL;
16402 static jclass LDKPeeledOnion_Receive_class = NULL;
16403 static jmethodID LDKPeeledOnion_Receive_meth = NULL;
16404 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKPeeledOnion_init (JNIEnv *env, jclass clz) {
16405         LDKPeeledOnion_Forward_class =
16406                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPeeledOnion$Forward"));
16407         CHECK(LDKPeeledOnion_Forward_class != NULL);
16408         LDKPeeledOnion_Forward_meth = (*env)->GetMethodID(env, LDKPeeledOnion_Forward_class, "<init>", "(JJ)V");
16409         CHECK(LDKPeeledOnion_Forward_meth != NULL);
16410         LDKPeeledOnion_Receive_class =
16411                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPeeledOnion$Receive"));
16412         CHECK(LDKPeeledOnion_Receive_class != NULL);
16413         LDKPeeledOnion_Receive_meth = (*env)->GetMethodID(env, LDKPeeledOnion_Receive_class, "<init>", "(J[BJ)V");
16414         CHECK(LDKPeeledOnion_Receive_meth != NULL);
16415 }
16416 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKPeeledOnion_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
16417         LDKPeeledOnion *obj = (LDKPeeledOnion*)untag_ptr(ptr);
16418         switch(obj->tag) {
16419                 case LDKPeeledOnion_Forward: {
16420                         int64_t _0_ref = tag_ptr(&obj->forward._0, false);
16421                         LDKOnionMessage _1_var = obj->forward._1;
16422                         int64_t _1_ref = 0;
16423                         CHECK_INNER_FIELD_ACCESS_OR_NULL(_1_var);
16424                         _1_ref = tag_ptr(_1_var.inner, false);
16425                         return (*env)->NewObject(env, LDKPeeledOnion_Forward_class, LDKPeeledOnion_Forward_meth, _0_ref, _1_ref);
16426                 }
16427                 case LDKPeeledOnion_Receive: {
16428                         int64_t _0_ref = tag_ptr(&obj->receive._0, false);
16429                         int8_tArray _1_arr = (*env)->NewByteArray(env, 32);
16430                         (*env)->SetByteArrayRegion(env, _1_arr, 0, 32, obj->receive._1.data);
16431                         LDKBlindedPath _2_var = obj->receive._2;
16432                         int64_t _2_ref = 0;
16433                         CHECK_INNER_FIELD_ACCESS_OR_NULL(_2_var);
16434                         _2_ref = tag_ptr(_2_var.inner, false);
16435                         return (*env)->NewObject(env, LDKPeeledOnion_Receive_class, LDKPeeledOnion_Receive_meth, _0_ref, _1_arr, _2_ref);
16436                 }
16437                 default: abort();
16438         }
16439 }
16440 static inline struct LDKPeeledOnion CResult_PeeledOnionNoneZ_get_ok(LDKCResult_PeeledOnionNoneZ *NONNULL_PTR owner){
16441 CHECK(owner->result_ok);
16442         return PeeledOnion_clone(&*owner->contents.result);
16443 }
16444 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PeeledOnionNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
16445         LDKCResult_PeeledOnionNoneZ* owner_conv = (LDKCResult_PeeledOnionNoneZ*)untag_ptr(owner);
16446         LDKPeeledOnion *ret_copy = MALLOC(sizeof(LDKPeeledOnion), "LDKPeeledOnion");
16447         *ret_copy = CResult_PeeledOnionNoneZ_get_ok(owner_conv);
16448         int64_t ret_ref = tag_ptr(ret_copy, true);
16449         return ret_ref;
16450 }
16451
16452 static inline void CResult_PeeledOnionNoneZ_get_err(LDKCResult_PeeledOnionNoneZ *NONNULL_PTR owner){
16453 CHECK(!owner->result_ok);
16454         return *owner->contents.err;
16455 }
16456 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PeeledOnionNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
16457         LDKCResult_PeeledOnionNoneZ* owner_conv = (LDKCResult_PeeledOnionNoneZ*)untag_ptr(owner);
16458         CResult_PeeledOnionNoneZ_get_err(owner_conv);
16459 }
16460
16461 static jclass LDKSendSuccess_Buffered_class = NULL;
16462 static jmethodID LDKSendSuccess_Buffered_meth = NULL;
16463 static jclass LDKSendSuccess_BufferedAwaitingConnection_class = NULL;
16464 static jmethodID LDKSendSuccess_BufferedAwaitingConnection_meth = NULL;
16465 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKSendSuccess_init (JNIEnv *env, jclass clz) {
16466         LDKSendSuccess_Buffered_class =
16467                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSendSuccess$Buffered"));
16468         CHECK(LDKSendSuccess_Buffered_class != NULL);
16469         LDKSendSuccess_Buffered_meth = (*env)->GetMethodID(env, LDKSendSuccess_Buffered_class, "<init>", "()V");
16470         CHECK(LDKSendSuccess_Buffered_meth != NULL);
16471         LDKSendSuccess_BufferedAwaitingConnection_class =
16472                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSendSuccess$BufferedAwaitingConnection"));
16473         CHECK(LDKSendSuccess_BufferedAwaitingConnection_class != NULL);
16474         LDKSendSuccess_BufferedAwaitingConnection_meth = (*env)->GetMethodID(env, LDKSendSuccess_BufferedAwaitingConnection_class, "<init>", "([B)V");
16475         CHECK(LDKSendSuccess_BufferedAwaitingConnection_meth != NULL);
16476 }
16477 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKSendSuccess_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
16478         LDKSendSuccess *obj = (LDKSendSuccess*)untag_ptr(ptr);
16479         switch(obj->tag) {
16480                 case LDKSendSuccess_Buffered: {
16481                         return (*env)->NewObject(env, LDKSendSuccess_Buffered_class, LDKSendSuccess_Buffered_meth);
16482                 }
16483                 case LDKSendSuccess_BufferedAwaitingConnection: {
16484                         int8_tArray buffered_awaiting_connection_arr = (*env)->NewByteArray(env, 33);
16485                         (*env)->SetByteArrayRegion(env, buffered_awaiting_connection_arr, 0, 33, obj->buffered_awaiting_connection.compressed_form);
16486                         return (*env)->NewObject(env, LDKSendSuccess_BufferedAwaitingConnection_class, LDKSendSuccess_BufferedAwaitingConnection_meth, buffered_awaiting_connection_arr);
16487                 }
16488                 default: abort();
16489         }
16490 }
16491 static inline struct LDKSendSuccess CResult_SendSuccessSendErrorZ_get_ok(LDKCResult_SendSuccessSendErrorZ *NONNULL_PTR owner){
16492 CHECK(owner->result_ok);
16493         return SendSuccess_clone(&*owner->contents.result);
16494 }
16495 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SendSuccessSendErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
16496         LDKCResult_SendSuccessSendErrorZ* owner_conv = (LDKCResult_SendSuccessSendErrorZ*)untag_ptr(owner);
16497         LDKSendSuccess *ret_copy = MALLOC(sizeof(LDKSendSuccess), "LDKSendSuccess");
16498         *ret_copy = CResult_SendSuccessSendErrorZ_get_ok(owner_conv);
16499         int64_t ret_ref = tag_ptr(ret_copy, true);
16500         return ret_ref;
16501 }
16502
16503 static inline struct LDKSendError CResult_SendSuccessSendErrorZ_get_err(LDKCResult_SendSuccessSendErrorZ *NONNULL_PTR owner){
16504 CHECK(!owner->result_ok);
16505         return SendError_clone(&*owner->contents.err);
16506 }
16507 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SendSuccessSendErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
16508         LDKCResult_SendSuccessSendErrorZ* owner_conv = (LDKCResult_SendSuccessSendErrorZ*)untag_ptr(owner);
16509         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
16510         *ret_copy = CResult_SendSuccessSendErrorZ_get_err(owner_conv);
16511         int64_t ret_ref = tag_ptr(ret_copy, true);
16512         return ret_ref;
16513 }
16514
16515 static inline struct LDKBlindedPath CResult_BlindedPathNoneZ_get_ok(LDKCResult_BlindedPathNoneZ *NONNULL_PTR owner){
16516         LDKBlindedPath ret = *owner->contents.result;
16517         ret.is_owned = false;
16518         return ret;
16519 }
16520 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPathNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
16521         LDKCResult_BlindedPathNoneZ* owner_conv = (LDKCResult_BlindedPathNoneZ*)untag_ptr(owner);
16522         LDKBlindedPath ret_var = CResult_BlindedPathNoneZ_get_ok(owner_conv);
16523         int64_t ret_ref = 0;
16524         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
16525         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
16526         return ret_ref;
16527 }
16528
16529 static inline void CResult_BlindedPathNoneZ_get_err(LDKCResult_BlindedPathNoneZ *NONNULL_PTR owner){
16530 CHECK(!owner->result_ok);
16531         return *owner->contents.err;
16532 }
16533 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPathNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
16534         LDKCResult_BlindedPathNoneZ* owner_conv = (LDKCResult_BlindedPathNoneZ*)untag_ptr(owner);
16535         CResult_BlindedPathNoneZ_get_err(owner_conv);
16536 }
16537
16538 static inline struct LDKC2Tuple_BlindedPayInfoBlindedPathZ CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_get_ok(LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ *NONNULL_PTR owner){
16539 CHECK(owner->result_ok);
16540         return C2Tuple_BlindedPayInfoBlindedPathZ_clone(&*owner->contents.result);
16541 }
16542 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlindedPayInfoBlindedPathZNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
16543         LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ* owner_conv = (LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ*)untag_ptr(owner);
16544         LDKC2Tuple_BlindedPayInfoBlindedPathZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKC2Tuple_BlindedPayInfoBlindedPathZ");
16545         *ret_conv = CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_get_ok(owner_conv);
16546         return tag_ptr(ret_conv, true);
16547 }
16548
16549 static inline void CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_get_err(LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ *NONNULL_PTR owner){
16550 CHECK(!owner->result_ok);
16551         return *owner->contents.err;
16552 }
16553 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlindedPayInfoBlindedPathZNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
16554         LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ* owner_conv = (LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ*)untag_ptr(owner);
16555         CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_get_err(owner_conv);
16556 }
16557
16558 static inline LDKCVec_ForwardNodeZ CVec_ForwardNodeZ_clone(const LDKCVec_ForwardNodeZ *orig) {
16559         LDKCVec_ForwardNodeZ ret = { .data = MALLOC(sizeof(LDKForwardNode) * orig->datalen, "LDKCVec_ForwardNodeZ clone bytes"), .datalen = orig->datalen };
16560         for (size_t i = 0; i < ret.datalen; i++) {
16561                 ret.data[i] = ForwardNode_clone(&orig->data[i]);
16562         }
16563         return ret;
16564 }
16565 static inline struct LDKBlindedPath CResult_BlindedPathDecodeErrorZ_get_ok(LDKCResult_BlindedPathDecodeErrorZ *NONNULL_PTR owner){
16566         LDKBlindedPath ret = *owner->contents.result;
16567         ret.is_owned = false;
16568         return ret;
16569 }
16570 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPathDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
16571         LDKCResult_BlindedPathDecodeErrorZ* owner_conv = (LDKCResult_BlindedPathDecodeErrorZ*)untag_ptr(owner);
16572         LDKBlindedPath ret_var = CResult_BlindedPathDecodeErrorZ_get_ok(owner_conv);
16573         int64_t ret_ref = 0;
16574         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
16575         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
16576         return ret_ref;
16577 }
16578
16579 static inline struct LDKDecodeError CResult_BlindedPathDecodeErrorZ_get_err(LDKCResult_BlindedPathDecodeErrorZ *NONNULL_PTR owner){
16580 CHECK(!owner->result_ok);
16581         return DecodeError_clone(&*owner->contents.err);
16582 }
16583 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPathDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
16584         LDKCResult_BlindedPathDecodeErrorZ* owner_conv = (LDKCResult_BlindedPathDecodeErrorZ*)untag_ptr(owner);
16585         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
16586         *ret_copy = CResult_BlindedPathDecodeErrorZ_get_err(owner_conv);
16587         int64_t ret_ref = tag_ptr(ret_copy, true);
16588         return ret_ref;
16589 }
16590
16591 static inline struct LDKBlindedHop CResult_BlindedHopDecodeErrorZ_get_ok(LDKCResult_BlindedHopDecodeErrorZ *NONNULL_PTR owner){
16592         LDKBlindedHop ret = *owner->contents.result;
16593         ret.is_owned = false;
16594         return ret;
16595 }
16596 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedHopDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
16597         LDKCResult_BlindedHopDecodeErrorZ* owner_conv = (LDKCResult_BlindedHopDecodeErrorZ*)untag_ptr(owner);
16598         LDKBlindedHop ret_var = CResult_BlindedHopDecodeErrorZ_get_ok(owner_conv);
16599         int64_t ret_ref = 0;
16600         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
16601         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
16602         return ret_ref;
16603 }
16604
16605 static inline struct LDKDecodeError CResult_BlindedHopDecodeErrorZ_get_err(LDKCResult_BlindedHopDecodeErrorZ *NONNULL_PTR owner){
16606 CHECK(!owner->result_ok);
16607         return DecodeError_clone(&*owner->contents.err);
16608 }
16609 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedHopDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
16610         LDKCResult_BlindedHopDecodeErrorZ* owner_conv = (LDKCResult_BlindedHopDecodeErrorZ*)untag_ptr(owner);
16611         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
16612         *ret_copy = CResult_BlindedHopDecodeErrorZ_get_err(owner_conv);
16613         int64_t ret_ref = tag_ptr(ret_copy, true);
16614         return ret_ref;
16615 }
16616
16617 static inline struct LDKInvoiceError CResult_InvoiceErrorDecodeErrorZ_get_ok(LDKCResult_InvoiceErrorDecodeErrorZ *NONNULL_PTR owner){
16618         LDKInvoiceError ret = *owner->contents.result;
16619         ret.is_owned = false;
16620         return ret;
16621 }
16622 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceErrorDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
16623         LDKCResult_InvoiceErrorDecodeErrorZ* owner_conv = (LDKCResult_InvoiceErrorDecodeErrorZ*)untag_ptr(owner);
16624         LDKInvoiceError ret_var = CResult_InvoiceErrorDecodeErrorZ_get_ok(owner_conv);
16625         int64_t ret_ref = 0;
16626         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
16627         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
16628         return ret_ref;
16629 }
16630
16631 static inline struct LDKDecodeError CResult_InvoiceErrorDecodeErrorZ_get_err(LDKCResult_InvoiceErrorDecodeErrorZ *NONNULL_PTR owner){
16632 CHECK(!owner->result_ok);
16633         return DecodeError_clone(&*owner->contents.err);
16634 }
16635 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceErrorDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
16636         LDKCResult_InvoiceErrorDecodeErrorZ* owner_conv = (LDKCResult_InvoiceErrorDecodeErrorZ*)untag_ptr(owner);
16637         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
16638         *ret_copy = CResult_InvoiceErrorDecodeErrorZ_get_err(owner_conv);
16639         int64_t ret_ref = tag_ptr(ret_copy, true);
16640         return ret_ref;
16641 }
16642
16643 static inline struct LDKTrackedSpendableOutput CResult_TrackedSpendableOutputDecodeErrorZ_get_ok(LDKCResult_TrackedSpendableOutputDecodeErrorZ *NONNULL_PTR owner){
16644         LDKTrackedSpendableOutput ret = *owner->contents.result;
16645         ret.is_owned = false;
16646         return ret;
16647 }
16648 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TrackedSpendableOutputDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
16649         LDKCResult_TrackedSpendableOutputDecodeErrorZ* owner_conv = (LDKCResult_TrackedSpendableOutputDecodeErrorZ*)untag_ptr(owner);
16650         LDKTrackedSpendableOutput ret_var = CResult_TrackedSpendableOutputDecodeErrorZ_get_ok(owner_conv);
16651         int64_t ret_ref = 0;
16652         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
16653         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
16654         return ret_ref;
16655 }
16656
16657 static inline struct LDKDecodeError CResult_TrackedSpendableOutputDecodeErrorZ_get_err(LDKCResult_TrackedSpendableOutputDecodeErrorZ *NONNULL_PTR owner){
16658 CHECK(!owner->result_ok);
16659         return DecodeError_clone(&*owner->contents.err);
16660 }
16661 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TrackedSpendableOutputDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
16662         LDKCResult_TrackedSpendableOutputDecodeErrorZ* owner_conv = (LDKCResult_TrackedSpendableOutputDecodeErrorZ*)untag_ptr(owner);
16663         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
16664         *ret_copy = CResult_TrackedSpendableOutputDecodeErrorZ_get_err(owner_conv);
16665         int64_t ret_ref = tag_ptr(ret_copy, true);
16666         return ret_ref;
16667 }
16668
16669 static jclass LDKOutputSpendStatus_PendingInitialBroadcast_class = NULL;
16670 static jmethodID LDKOutputSpendStatus_PendingInitialBroadcast_meth = NULL;
16671 static jclass LDKOutputSpendStatus_PendingFirstConfirmation_class = NULL;
16672 static jmethodID LDKOutputSpendStatus_PendingFirstConfirmation_meth = NULL;
16673 static jclass LDKOutputSpendStatus_PendingThresholdConfirmations_class = NULL;
16674 static jmethodID LDKOutputSpendStatus_PendingThresholdConfirmations_meth = NULL;
16675 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKOutputSpendStatus_init (JNIEnv *env, jclass clz) {
16676         LDKOutputSpendStatus_PendingInitialBroadcast_class =
16677                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKOutputSpendStatus$PendingInitialBroadcast"));
16678         CHECK(LDKOutputSpendStatus_PendingInitialBroadcast_class != NULL);
16679         LDKOutputSpendStatus_PendingInitialBroadcast_meth = (*env)->GetMethodID(env, LDKOutputSpendStatus_PendingInitialBroadcast_class, "<init>", "(J)V");
16680         CHECK(LDKOutputSpendStatus_PendingInitialBroadcast_meth != NULL);
16681         LDKOutputSpendStatus_PendingFirstConfirmation_class =
16682                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKOutputSpendStatus$PendingFirstConfirmation"));
16683         CHECK(LDKOutputSpendStatus_PendingFirstConfirmation_class != NULL);
16684         LDKOutputSpendStatus_PendingFirstConfirmation_meth = (*env)->GetMethodID(env, LDKOutputSpendStatus_PendingFirstConfirmation_class, "<init>", "([BI[B)V");
16685         CHECK(LDKOutputSpendStatus_PendingFirstConfirmation_meth != NULL);
16686         LDKOutputSpendStatus_PendingThresholdConfirmations_class =
16687                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKOutputSpendStatus$PendingThresholdConfirmations"));
16688         CHECK(LDKOutputSpendStatus_PendingThresholdConfirmations_class != NULL);
16689         LDKOutputSpendStatus_PendingThresholdConfirmations_meth = (*env)->GetMethodID(env, LDKOutputSpendStatus_PendingThresholdConfirmations_class, "<init>", "([BI[BI[B)V");
16690         CHECK(LDKOutputSpendStatus_PendingThresholdConfirmations_meth != NULL);
16691 }
16692 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKOutputSpendStatus_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
16693         LDKOutputSpendStatus *obj = (LDKOutputSpendStatus*)untag_ptr(ptr);
16694         switch(obj->tag) {
16695                 case LDKOutputSpendStatus_PendingInitialBroadcast: {
16696                         int64_t delayed_until_height_ref = tag_ptr(&obj->pending_initial_broadcast.delayed_until_height, false);
16697                         return (*env)->NewObject(env, LDKOutputSpendStatus_PendingInitialBroadcast_class, LDKOutputSpendStatus_PendingInitialBroadcast_meth, delayed_until_height_ref);
16698                 }
16699                 case LDKOutputSpendStatus_PendingFirstConfirmation: {
16700                         int8_tArray first_broadcast_hash_arr = (*env)->NewByteArray(env, 32);
16701                         (*env)->SetByteArrayRegion(env, first_broadcast_hash_arr, 0, 32, obj->pending_first_confirmation.first_broadcast_hash.data);
16702                         int32_t latest_broadcast_height_conv = obj->pending_first_confirmation.latest_broadcast_height;
16703                         LDKTransaction latest_spending_tx_var = obj->pending_first_confirmation.latest_spending_tx;
16704                         int8_tArray latest_spending_tx_arr = (*env)->NewByteArray(env, latest_spending_tx_var.datalen);
16705                         (*env)->SetByteArrayRegion(env, latest_spending_tx_arr, 0, latest_spending_tx_var.datalen, latest_spending_tx_var.data);
16706                         return (*env)->NewObject(env, LDKOutputSpendStatus_PendingFirstConfirmation_class, LDKOutputSpendStatus_PendingFirstConfirmation_meth, first_broadcast_hash_arr, latest_broadcast_height_conv, latest_spending_tx_arr);
16707                 }
16708                 case LDKOutputSpendStatus_PendingThresholdConfirmations: {
16709                         int8_tArray first_broadcast_hash_arr = (*env)->NewByteArray(env, 32);
16710                         (*env)->SetByteArrayRegion(env, first_broadcast_hash_arr, 0, 32, obj->pending_threshold_confirmations.first_broadcast_hash.data);
16711                         int32_t latest_broadcast_height_conv = obj->pending_threshold_confirmations.latest_broadcast_height;
16712                         LDKTransaction latest_spending_tx_var = obj->pending_threshold_confirmations.latest_spending_tx;
16713                         int8_tArray latest_spending_tx_arr = (*env)->NewByteArray(env, latest_spending_tx_var.datalen);
16714                         (*env)->SetByteArrayRegion(env, latest_spending_tx_arr, 0, latest_spending_tx_var.datalen, latest_spending_tx_var.data);
16715                         int32_t confirmation_height_conv = obj->pending_threshold_confirmations.confirmation_height;
16716                         int8_tArray confirmation_hash_arr = (*env)->NewByteArray(env, 32);
16717                         (*env)->SetByteArrayRegion(env, confirmation_hash_arr, 0, 32, obj->pending_threshold_confirmations.confirmation_hash.data);
16718                         return (*env)->NewObject(env, LDKOutputSpendStatus_PendingThresholdConfirmations_class, LDKOutputSpendStatus_PendingThresholdConfirmations_meth, first_broadcast_hash_arr, latest_broadcast_height_conv, latest_spending_tx_arr, confirmation_height_conv, confirmation_hash_arr);
16719                 }
16720                 default: abort();
16721         }
16722 }
16723 static inline struct LDKOutputSpendStatus CResult_OutputSpendStatusDecodeErrorZ_get_ok(LDKCResult_OutputSpendStatusDecodeErrorZ *NONNULL_PTR owner){
16724 CHECK(owner->result_ok);
16725         return OutputSpendStatus_clone(&*owner->contents.result);
16726 }
16727 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OutputSpendStatusDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
16728         LDKCResult_OutputSpendStatusDecodeErrorZ* owner_conv = (LDKCResult_OutputSpendStatusDecodeErrorZ*)untag_ptr(owner);
16729         LDKOutputSpendStatus *ret_copy = MALLOC(sizeof(LDKOutputSpendStatus), "LDKOutputSpendStatus");
16730         *ret_copy = CResult_OutputSpendStatusDecodeErrorZ_get_ok(owner_conv);
16731         int64_t ret_ref = tag_ptr(ret_copy, true);
16732         return ret_ref;
16733 }
16734
16735 static inline struct LDKDecodeError CResult_OutputSpendStatusDecodeErrorZ_get_err(LDKCResult_OutputSpendStatusDecodeErrorZ *NONNULL_PTR owner){
16736 CHECK(!owner->result_ok);
16737         return DecodeError_clone(&*owner->contents.err);
16738 }
16739 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OutputSpendStatusDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
16740         LDKCResult_OutputSpendStatusDecodeErrorZ* owner_conv = (LDKCResult_OutputSpendStatusDecodeErrorZ*)untag_ptr(owner);
16741         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
16742         *ret_copy = CResult_OutputSpendStatusDecodeErrorZ_get_err(owner_conv);
16743         int64_t ret_ref = tag_ptr(ret_copy, true);
16744         return ret_ref;
16745 }
16746
16747 typedef struct LDKFilter_JCalls {
16748         atomic_size_t refcnt;
16749         JavaVM *vm;
16750         jweak o;
16751         jmethodID register_tx_meth;
16752         jmethodID register_output_meth;
16753 } LDKFilter_JCalls;
16754 static void LDKFilter_JCalls_free(void* this_arg) {
16755         LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
16756         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
16757                 JNIEnv *env;
16758                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
16759                 if (get_jenv_res == JNI_EDETACHED) {
16760                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
16761                 } else {
16762                         DO_ASSERT(get_jenv_res == JNI_OK);
16763                 }
16764                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
16765                 if (get_jenv_res == JNI_EDETACHED) {
16766                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
16767                 }
16768                 FREE(j_calls);
16769         }
16770 }
16771 void register_tx_LDKFilter_jcall(const void* this_arg, const uint8_t (* txid)[32], LDKu8slice script_pubkey) {
16772         LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
16773         JNIEnv *env;
16774         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
16775         if (get_jenv_res == JNI_EDETACHED) {
16776                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
16777         } else {
16778                 DO_ASSERT(get_jenv_res == JNI_OK);
16779         }
16780         int8_tArray txid_arr = (*env)->NewByteArray(env, 32);
16781         (*env)->SetByteArrayRegion(env, txid_arr, 0, 32, *txid);
16782         LDKu8slice script_pubkey_var = script_pubkey;
16783         int8_tArray script_pubkey_arr = (*env)->NewByteArray(env, script_pubkey_var.datalen);
16784         (*env)->SetByteArrayRegion(env, script_pubkey_arr, 0, script_pubkey_var.datalen, script_pubkey_var.data);
16785         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
16786         CHECK(obj != NULL);
16787         (*env)->CallVoidMethod(env, obj, j_calls->register_tx_meth, txid_arr, script_pubkey_arr);
16788         if (UNLIKELY((*env)->ExceptionCheck(env))) {
16789                 (*env)->ExceptionDescribe(env);
16790                 (*env)->FatalError(env, "A call to register_tx in LDKFilter from rust threw an exception.");
16791         }
16792         if (get_jenv_res == JNI_EDETACHED) {
16793                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
16794         }
16795 }
16796 void register_output_LDKFilter_jcall(const void* this_arg, LDKWatchedOutput output) {
16797         LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
16798         JNIEnv *env;
16799         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
16800         if (get_jenv_res == JNI_EDETACHED) {
16801                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
16802         } else {
16803                 DO_ASSERT(get_jenv_res == JNI_OK);
16804         }
16805         LDKWatchedOutput output_var = output;
16806         int64_t output_ref = 0;
16807         CHECK_INNER_FIELD_ACCESS_OR_NULL(output_var);
16808         output_ref = tag_ptr(output_var.inner, output_var.is_owned);
16809         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
16810         CHECK(obj != NULL);
16811         (*env)->CallVoidMethod(env, obj, j_calls->register_output_meth, output_ref);
16812         if (UNLIKELY((*env)->ExceptionCheck(env))) {
16813                 (*env)->ExceptionDescribe(env);
16814                 (*env)->FatalError(env, "A call to register_output in LDKFilter from rust threw an exception.");
16815         }
16816         if (get_jenv_res == JNI_EDETACHED) {
16817                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
16818         }
16819 }
16820 static void LDKFilter_JCalls_cloned(LDKFilter* new_obj) {
16821         LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) new_obj->this_arg;
16822         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
16823 }
16824 static inline LDKFilter LDKFilter_init (JNIEnv *env, jclass clz, jobject o) {
16825         jclass c = (*env)->GetObjectClass(env, o);
16826         CHECK(c != NULL);
16827         LDKFilter_JCalls *calls = MALLOC(sizeof(LDKFilter_JCalls), "LDKFilter_JCalls");
16828         atomic_init(&calls->refcnt, 1);
16829         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
16830         calls->o = (*env)->NewWeakGlobalRef(env, o);
16831         calls->register_tx_meth = (*env)->GetMethodID(env, c, "register_tx", "([B[B)V");
16832         CHECK(calls->register_tx_meth != NULL);
16833         calls->register_output_meth = (*env)->GetMethodID(env, c, "register_output", "(J)V");
16834         CHECK(calls->register_output_meth != NULL);
16835
16836         LDKFilter ret = {
16837                 .this_arg = (void*) calls,
16838                 .register_tx = register_tx_LDKFilter_jcall,
16839                 .register_output = register_output_LDKFilter_jcall,
16840                 .free = LDKFilter_JCalls_free,
16841         };
16842         return ret;
16843 }
16844 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKFilter_1new(JNIEnv *env, jclass clz, jobject o) {
16845         LDKFilter *res_ptr = MALLOC(sizeof(LDKFilter), "LDKFilter");
16846         *res_ptr = LDKFilter_init(env, clz, o);
16847         return tag_ptr(res_ptr, true);
16848 }
16849 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) {
16850         void* this_arg_ptr = untag_ptr(this_arg);
16851         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16852         LDKFilter* this_arg_conv = (LDKFilter*)this_arg_ptr;
16853         uint8_t txid_arr[32];
16854         CHECK((*env)->GetArrayLength(env, txid) == 32);
16855         (*env)->GetByteArrayRegion(env, txid, 0, 32, txid_arr);
16856         uint8_t (*txid_ref)[32] = &txid_arr;
16857         LDKu8slice script_pubkey_ref;
16858         script_pubkey_ref.datalen = (*env)->GetArrayLength(env, script_pubkey);
16859         script_pubkey_ref.data = (*env)->GetByteArrayElements (env, script_pubkey, NULL);
16860         (this_arg_conv->register_tx)(this_arg_conv->this_arg, txid_ref, script_pubkey_ref);
16861         (*env)->ReleaseByteArrayElements(env, script_pubkey, (int8_t*)script_pubkey_ref.data, 0);
16862 }
16863
16864 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Filter_1register_1output(JNIEnv *env, jclass clz, int64_t this_arg, int64_t output) {
16865         void* this_arg_ptr = untag_ptr(this_arg);
16866         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16867         LDKFilter* this_arg_conv = (LDKFilter*)this_arg_ptr;
16868         LDKWatchedOutput output_conv;
16869         output_conv.inner = untag_ptr(output);
16870         output_conv.is_owned = ptr_is_owned(output);
16871         CHECK_INNER_FIELD_ACCESS_OR_NULL(output_conv);
16872         output_conv = WatchedOutput_clone(&output_conv);
16873         (this_arg_conv->register_output)(this_arg_conv->this_arg, output_conv);
16874 }
16875
16876 static jclass LDKCOption_FilterZ_Some_class = NULL;
16877 static jmethodID LDKCOption_FilterZ_Some_meth = NULL;
16878 static jclass LDKCOption_FilterZ_None_class = NULL;
16879 static jmethodID LDKCOption_FilterZ_None_meth = NULL;
16880 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1FilterZ_init (JNIEnv *env, jclass clz) {
16881         LDKCOption_FilterZ_Some_class =
16882                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_FilterZ$Some"));
16883         CHECK(LDKCOption_FilterZ_Some_class != NULL);
16884         LDKCOption_FilterZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_FilterZ_Some_class, "<init>", "(J)V");
16885         CHECK(LDKCOption_FilterZ_Some_meth != NULL);
16886         LDKCOption_FilterZ_None_class =
16887                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_FilterZ$None"));
16888         CHECK(LDKCOption_FilterZ_None_class != NULL);
16889         LDKCOption_FilterZ_None_meth = (*env)->GetMethodID(env, LDKCOption_FilterZ_None_class, "<init>", "()V");
16890         CHECK(LDKCOption_FilterZ_None_meth != NULL);
16891 }
16892 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1FilterZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
16893         LDKCOption_FilterZ *obj = (LDKCOption_FilterZ*)untag_ptr(ptr);
16894         switch(obj->tag) {
16895                 case LDKCOption_FilterZ_Some: {
16896                         LDKFilter* some_ret = MALLOC(sizeof(LDKFilter), "LDKFilter");
16897                         *some_ret = obj->some;
16898                         // WARNING: We likely need to clone here, but no clone is available, so we just do it for Java instances
16899                         if ((*some_ret).free == LDKFilter_JCalls_free) {
16900                                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
16901                                 LDKFilter_JCalls_cloned(&(*some_ret));
16902                         }
16903                         return (*env)->NewObject(env, LDKCOption_FilterZ_Some_class, LDKCOption_FilterZ_Some_meth, tag_ptr(some_ret, true));
16904                 }
16905                 case LDKCOption_FilterZ_None: {
16906                         return (*env)->NewObject(env, LDKCOption_FilterZ_None_class, LDKCOption_FilterZ_None_meth);
16907                 }
16908                 default: abort();
16909         }
16910 }
16911 static inline LDKCVec_TrackedSpendableOutputZ CVec_TrackedSpendableOutputZ_clone(const LDKCVec_TrackedSpendableOutputZ *orig) {
16912         LDKCVec_TrackedSpendableOutputZ ret = { .data = MALLOC(sizeof(LDKTrackedSpendableOutput) * orig->datalen, "LDKCVec_TrackedSpendableOutputZ clone bytes"), .datalen = orig->datalen };
16913         for (size_t i = 0; i < ret.datalen; i++) {
16914                 ret.data[i] = TrackedSpendableOutput_clone(&orig->data[i]);
16915         }
16916         return ret;
16917 }
16918 typedef struct LDKChangeDestinationSource_JCalls {
16919         atomic_size_t refcnt;
16920         JavaVM *vm;
16921         jweak o;
16922         jmethodID get_change_destination_script_meth;
16923 } LDKChangeDestinationSource_JCalls;
16924 static void LDKChangeDestinationSource_JCalls_free(void* this_arg) {
16925         LDKChangeDestinationSource_JCalls *j_calls = (LDKChangeDestinationSource_JCalls*) this_arg;
16926         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
16927                 JNIEnv *env;
16928                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
16929                 if (get_jenv_res == JNI_EDETACHED) {
16930                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
16931                 } else {
16932                         DO_ASSERT(get_jenv_res == JNI_OK);
16933                 }
16934                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
16935                 if (get_jenv_res == JNI_EDETACHED) {
16936                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
16937                 }
16938                 FREE(j_calls);
16939         }
16940 }
16941 LDKCResult_CVec_u8ZNoneZ get_change_destination_script_LDKChangeDestinationSource_jcall(const void* this_arg) {
16942         LDKChangeDestinationSource_JCalls *j_calls = (LDKChangeDestinationSource_JCalls*) this_arg;
16943         JNIEnv *env;
16944         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
16945         if (get_jenv_res == JNI_EDETACHED) {
16946                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
16947         } else {
16948                 DO_ASSERT(get_jenv_res == JNI_OK);
16949         }
16950         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
16951         CHECK(obj != NULL);
16952         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->get_change_destination_script_meth);
16953         if (UNLIKELY((*env)->ExceptionCheck(env))) {
16954                 (*env)->ExceptionDescribe(env);
16955                 (*env)->FatalError(env, "A call to get_change_destination_script in LDKChangeDestinationSource from rust threw an exception.");
16956         }
16957         void* ret_ptr = untag_ptr(ret);
16958         CHECK_ACCESS(ret_ptr);
16959         LDKCResult_CVec_u8ZNoneZ ret_conv = *(LDKCResult_CVec_u8ZNoneZ*)(ret_ptr);
16960         FREE(untag_ptr(ret));
16961         if (get_jenv_res == JNI_EDETACHED) {
16962                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
16963         }
16964         return ret_conv;
16965 }
16966 static void LDKChangeDestinationSource_JCalls_cloned(LDKChangeDestinationSource* new_obj) {
16967         LDKChangeDestinationSource_JCalls *j_calls = (LDKChangeDestinationSource_JCalls*) new_obj->this_arg;
16968         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
16969 }
16970 static inline LDKChangeDestinationSource LDKChangeDestinationSource_init (JNIEnv *env, jclass clz, jobject o) {
16971         jclass c = (*env)->GetObjectClass(env, o);
16972         CHECK(c != NULL);
16973         LDKChangeDestinationSource_JCalls *calls = MALLOC(sizeof(LDKChangeDestinationSource_JCalls), "LDKChangeDestinationSource_JCalls");
16974         atomic_init(&calls->refcnt, 1);
16975         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
16976         calls->o = (*env)->NewWeakGlobalRef(env, o);
16977         calls->get_change_destination_script_meth = (*env)->GetMethodID(env, c, "get_change_destination_script", "()J");
16978         CHECK(calls->get_change_destination_script_meth != NULL);
16979
16980         LDKChangeDestinationSource ret = {
16981                 .this_arg = (void*) calls,
16982                 .get_change_destination_script = get_change_destination_script_LDKChangeDestinationSource_jcall,
16983                 .free = LDKChangeDestinationSource_JCalls_free,
16984         };
16985         return ret;
16986 }
16987 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKChangeDestinationSource_1new(JNIEnv *env, jclass clz, jobject o) {
16988         LDKChangeDestinationSource *res_ptr = MALLOC(sizeof(LDKChangeDestinationSource), "LDKChangeDestinationSource");
16989         *res_ptr = LDKChangeDestinationSource_init(env, clz, o);
16990         return tag_ptr(res_ptr, true);
16991 }
16992 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChangeDestinationSource_1get_1change_1destination_1script(JNIEnv *env, jclass clz, int64_t this_arg) {
16993         void* this_arg_ptr = untag_ptr(this_arg);
16994         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
16995         LDKChangeDestinationSource* this_arg_conv = (LDKChangeDestinationSource*)this_arg_ptr;
16996         LDKCResult_CVec_u8ZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZNoneZ), "LDKCResult_CVec_u8ZNoneZ");
16997         *ret_conv = (this_arg_conv->get_change_destination_script)(this_arg_conv->this_arg);
16998         return tag_ptr(ret_conv, true);
16999 }
17000
17001 typedef struct LDKKVStore_JCalls {
17002         atomic_size_t refcnt;
17003         JavaVM *vm;
17004         jweak o;
17005         jmethodID read_meth;
17006         jmethodID write_meth;
17007         jmethodID remove_meth;
17008         jmethodID list_meth;
17009 } LDKKVStore_JCalls;
17010 static void LDKKVStore_JCalls_free(void* this_arg) {
17011         LDKKVStore_JCalls *j_calls = (LDKKVStore_JCalls*) this_arg;
17012         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
17013                 JNIEnv *env;
17014                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
17015                 if (get_jenv_res == JNI_EDETACHED) {
17016                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
17017                 } else {
17018                         DO_ASSERT(get_jenv_res == JNI_OK);
17019                 }
17020                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
17021                 if (get_jenv_res == JNI_EDETACHED) {
17022                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
17023                 }
17024                 FREE(j_calls);
17025         }
17026 }
17027 LDKCResult_CVec_u8ZIOErrorZ read_LDKKVStore_jcall(const void* this_arg, LDKStr primary_namespace, LDKStr secondary_namespace, LDKStr key) {
17028         LDKKVStore_JCalls *j_calls = (LDKKVStore_JCalls*) this_arg;
17029         JNIEnv *env;
17030         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
17031         if (get_jenv_res == JNI_EDETACHED) {
17032                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
17033         } else {
17034                 DO_ASSERT(get_jenv_res == JNI_OK);
17035         }
17036         LDKStr primary_namespace_str = primary_namespace;
17037         jstring primary_namespace_conv = str_ref_to_java(env, primary_namespace_str.chars, primary_namespace_str.len);
17038         Str_free(primary_namespace_str);
17039         LDKStr secondary_namespace_str = secondary_namespace;
17040         jstring secondary_namespace_conv = str_ref_to_java(env, secondary_namespace_str.chars, secondary_namespace_str.len);
17041         Str_free(secondary_namespace_str);
17042         LDKStr key_str = key;
17043         jstring key_conv = str_ref_to_java(env, key_str.chars, key_str.len);
17044         Str_free(key_str);
17045         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
17046         CHECK(obj != NULL);
17047         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->read_meth, primary_namespace_conv, secondary_namespace_conv, key_conv);
17048         if (UNLIKELY((*env)->ExceptionCheck(env))) {
17049                 (*env)->ExceptionDescribe(env);
17050                 (*env)->FatalError(env, "A call to read in LDKKVStore from rust threw an exception.");
17051         }
17052         void* ret_ptr = untag_ptr(ret);
17053         CHECK_ACCESS(ret_ptr);
17054         LDKCResult_CVec_u8ZIOErrorZ ret_conv = *(LDKCResult_CVec_u8ZIOErrorZ*)(ret_ptr);
17055         FREE(untag_ptr(ret));
17056         if (get_jenv_res == JNI_EDETACHED) {
17057                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
17058         }
17059         return ret_conv;
17060 }
17061 LDKCResult_NoneIOErrorZ write_LDKKVStore_jcall(const void* this_arg, LDKStr primary_namespace, LDKStr secondary_namespace, LDKStr key, LDKu8slice buf) {
17062         LDKKVStore_JCalls *j_calls = (LDKKVStore_JCalls*) this_arg;
17063         JNIEnv *env;
17064         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
17065         if (get_jenv_res == JNI_EDETACHED) {
17066                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
17067         } else {
17068                 DO_ASSERT(get_jenv_res == JNI_OK);
17069         }
17070         LDKStr primary_namespace_str = primary_namespace;
17071         jstring primary_namespace_conv = str_ref_to_java(env, primary_namespace_str.chars, primary_namespace_str.len);
17072         Str_free(primary_namespace_str);
17073         LDKStr secondary_namespace_str = secondary_namespace;
17074         jstring secondary_namespace_conv = str_ref_to_java(env, secondary_namespace_str.chars, secondary_namespace_str.len);
17075         Str_free(secondary_namespace_str);
17076         LDKStr key_str = key;
17077         jstring key_conv = str_ref_to_java(env, key_str.chars, key_str.len);
17078         Str_free(key_str);
17079         LDKu8slice buf_var = buf;
17080         int8_tArray buf_arr = (*env)->NewByteArray(env, buf_var.datalen);
17081         (*env)->SetByteArrayRegion(env, buf_arr, 0, buf_var.datalen, buf_var.data);
17082         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
17083         CHECK(obj != NULL);
17084         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->write_meth, primary_namespace_conv, secondary_namespace_conv, key_conv, buf_arr);
17085         if (UNLIKELY((*env)->ExceptionCheck(env))) {
17086                 (*env)->ExceptionDescribe(env);
17087                 (*env)->FatalError(env, "A call to write in LDKKVStore from rust threw an exception.");
17088         }
17089         void* ret_ptr = untag_ptr(ret);
17090         CHECK_ACCESS(ret_ptr);
17091         LDKCResult_NoneIOErrorZ ret_conv = *(LDKCResult_NoneIOErrorZ*)(ret_ptr);
17092         FREE(untag_ptr(ret));
17093         if (get_jenv_res == JNI_EDETACHED) {
17094                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
17095         }
17096         return ret_conv;
17097 }
17098 LDKCResult_NoneIOErrorZ remove_LDKKVStore_jcall(const void* this_arg, LDKStr primary_namespace, LDKStr secondary_namespace, LDKStr key, bool lazy) {
17099         LDKKVStore_JCalls *j_calls = (LDKKVStore_JCalls*) this_arg;
17100         JNIEnv *env;
17101         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
17102         if (get_jenv_res == JNI_EDETACHED) {
17103                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
17104         } else {
17105                 DO_ASSERT(get_jenv_res == JNI_OK);
17106         }
17107         LDKStr primary_namespace_str = primary_namespace;
17108         jstring primary_namespace_conv = str_ref_to_java(env, primary_namespace_str.chars, primary_namespace_str.len);
17109         Str_free(primary_namespace_str);
17110         LDKStr secondary_namespace_str = secondary_namespace;
17111         jstring secondary_namespace_conv = str_ref_to_java(env, secondary_namespace_str.chars, secondary_namespace_str.len);
17112         Str_free(secondary_namespace_str);
17113         LDKStr key_str = key;
17114         jstring key_conv = str_ref_to_java(env, key_str.chars, key_str.len);
17115         Str_free(key_str);
17116         jboolean lazy_conv = lazy;
17117         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
17118         CHECK(obj != NULL);
17119         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->remove_meth, primary_namespace_conv, secondary_namespace_conv, key_conv, lazy_conv);
17120         if (UNLIKELY((*env)->ExceptionCheck(env))) {
17121                 (*env)->ExceptionDescribe(env);
17122                 (*env)->FatalError(env, "A call to remove in LDKKVStore from rust threw an exception.");
17123         }
17124         void* ret_ptr = untag_ptr(ret);
17125         CHECK_ACCESS(ret_ptr);
17126         LDKCResult_NoneIOErrorZ ret_conv = *(LDKCResult_NoneIOErrorZ*)(ret_ptr);
17127         FREE(untag_ptr(ret));
17128         if (get_jenv_res == JNI_EDETACHED) {
17129                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
17130         }
17131         return ret_conv;
17132 }
17133 LDKCResult_CVec_StrZIOErrorZ list_LDKKVStore_jcall(const void* this_arg, LDKStr primary_namespace, LDKStr secondary_namespace) {
17134         LDKKVStore_JCalls *j_calls = (LDKKVStore_JCalls*) this_arg;
17135         JNIEnv *env;
17136         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
17137         if (get_jenv_res == JNI_EDETACHED) {
17138                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
17139         } else {
17140                 DO_ASSERT(get_jenv_res == JNI_OK);
17141         }
17142         LDKStr primary_namespace_str = primary_namespace;
17143         jstring primary_namespace_conv = str_ref_to_java(env, primary_namespace_str.chars, primary_namespace_str.len);
17144         Str_free(primary_namespace_str);
17145         LDKStr secondary_namespace_str = secondary_namespace;
17146         jstring secondary_namespace_conv = str_ref_to_java(env, secondary_namespace_str.chars, secondary_namespace_str.len);
17147         Str_free(secondary_namespace_str);
17148         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
17149         CHECK(obj != NULL);
17150         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->list_meth, primary_namespace_conv, secondary_namespace_conv);
17151         if (UNLIKELY((*env)->ExceptionCheck(env))) {
17152                 (*env)->ExceptionDescribe(env);
17153                 (*env)->FatalError(env, "A call to list in LDKKVStore from rust threw an exception.");
17154         }
17155         void* ret_ptr = untag_ptr(ret);
17156         CHECK_ACCESS(ret_ptr);
17157         LDKCResult_CVec_StrZIOErrorZ ret_conv = *(LDKCResult_CVec_StrZIOErrorZ*)(ret_ptr);
17158         FREE(untag_ptr(ret));
17159         if (get_jenv_res == JNI_EDETACHED) {
17160                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
17161         }
17162         return ret_conv;
17163 }
17164 static void LDKKVStore_JCalls_cloned(LDKKVStore* new_obj) {
17165         LDKKVStore_JCalls *j_calls = (LDKKVStore_JCalls*) new_obj->this_arg;
17166         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
17167 }
17168 static inline LDKKVStore LDKKVStore_init (JNIEnv *env, jclass clz, jobject o) {
17169         jclass c = (*env)->GetObjectClass(env, o);
17170         CHECK(c != NULL);
17171         LDKKVStore_JCalls *calls = MALLOC(sizeof(LDKKVStore_JCalls), "LDKKVStore_JCalls");
17172         atomic_init(&calls->refcnt, 1);
17173         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
17174         calls->o = (*env)->NewWeakGlobalRef(env, o);
17175         calls->read_meth = (*env)->GetMethodID(env, c, "read", "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)J");
17176         CHECK(calls->read_meth != NULL);
17177         calls->write_meth = (*env)->GetMethodID(env, c, "write", "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;[B)J");
17178         CHECK(calls->write_meth != NULL);
17179         calls->remove_meth = (*env)->GetMethodID(env, c, "remove", "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Z)J");
17180         CHECK(calls->remove_meth != NULL);
17181         calls->list_meth = (*env)->GetMethodID(env, c, "list", "(Ljava/lang/String;Ljava/lang/String;)J");
17182         CHECK(calls->list_meth != NULL);
17183
17184         LDKKVStore ret = {
17185                 .this_arg = (void*) calls,
17186                 .read = read_LDKKVStore_jcall,
17187                 .write = write_LDKKVStore_jcall,
17188                 .remove = remove_LDKKVStore_jcall,
17189                 .list = list_LDKKVStore_jcall,
17190                 .free = LDKKVStore_JCalls_free,
17191         };
17192         return ret;
17193 }
17194 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKKVStore_1new(JNIEnv *env, jclass clz, jobject o) {
17195         LDKKVStore *res_ptr = MALLOC(sizeof(LDKKVStore), "LDKKVStore");
17196         *res_ptr = LDKKVStore_init(env, clz, o);
17197         return tag_ptr(res_ptr, true);
17198 }
17199 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) {
17200         void* this_arg_ptr = untag_ptr(this_arg);
17201         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17202         LDKKVStore* this_arg_conv = (LDKKVStore*)this_arg_ptr;
17203         LDKStr primary_namespace_conv = java_to_owned_str(env, primary_namespace);
17204         LDKStr secondary_namespace_conv = java_to_owned_str(env, secondary_namespace);
17205         LDKStr key_conv = java_to_owned_str(env, key);
17206         LDKCResult_CVec_u8ZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZIOErrorZ), "LDKCResult_CVec_u8ZIOErrorZ");
17207         *ret_conv = (this_arg_conv->read)(this_arg_conv->this_arg, primary_namespace_conv, secondary_namespace_conv, key_conv);
17208         return tag_ptr(ret_conv, true);
17209 }
17210
17211 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) {
17212         void* this_arg_ptr = untag_ptr(this_arg);
17213         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17214         LDKKVStore* this_arg_conv = (LDKKVStore*)this_arg_ptr;
17215         LDKStr primary_namespace_conv = java_to_owned_str(env, primary_namespace);
17216         LDKStr secondary_namespace_conv = java_to_owned_str(env, secondary_namespace);
17217         LDKStr key_conv = java_to_owned_str(env, key);
17218         LDKu8slice buf_ref;
17219         buf_ref.datalen = (*env)->GetArrayLength(env, buf);
17220         buf_ref.data = (*env)->GetByteArrayElements (env, buf, NULL);
17221         LDKCResult_NoneIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneIOErrorZ), "LDKCResult_NoneIOErrorZ");
17222         *ret_conv = (this_arg_conv->write)(this_arg_conv->this_arg, primary_namespace_conv, secondary_namespace_conv, key_conv, buf_ref);
17223         (*env)->ReleaseByteArrayElements(env, buf, (int8_t*)buf_ref.data, 0);
17224         return tag_ptr(ret_conv, true);
17225 }
17226
17227 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) {
17228         void* this_arg_ptr = untag_ptr(this_arg);
17229         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17230         LDKKVStore* this_arg_conv = (LDKKVStore*)this_arg_ptr;
17231         LDKStr primary_namespace_conv = java_to_owned_str(env, primary_namespace);
17232         LDKStr secondary_namespace_conv = java_to_owned_str(env, secondary_namespace);
17233         LDKStr key_conv = java_to_owned_str(env, key);
17234         LDKCResult_NoneIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneIOErrorZ), "LDKCResult_NoneIOErrorZ");
17235         *ret_conv = (this_arg_conv->remove)(this_arg_conv->this_arg, primary_namespace_conv, secondary_namespace_conv, key_conv, lazy);
17236         return tag_ptr(ret_conv, true);
17237 }
17238
17239 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) {
17240         void* this_arg_ptr = untag_ptr(this_arg);
17241         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17242         LDKKVStore* this_arg_conv = (LDKKVStore*)this_arg_ptr;
17243         LDKStr primary_namespace_conv = java_to_owned_str(env, primary_namespace);
17244         LDKStr secondary_namespace_conv = java_to_owned_str(env, secondary_namespace);
17245         LDKCResult_CVec_StrZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_StrZIOErrorZ), "LDKCResult_CVec_StrZIOErrorZ");
17246         *ret_conv = (this_arg_conv->list)(this_arg_conv->this_arg, primary_namespace_conv, secondary_namespace_conv);
17247         return tag_ptr(ret_conv, true);
17248 }
17249
17250 typedef struct LDKOutputSpender_JCalls {
17251         atomic_size_t refcnt;
17252         JavaVM *vm;
17253         jweak o;
17254         jmethodID spend_spendable_outputs_meth;
17255 } LDKOutputSpender_JCalls;
17256 static void LDKOutputSpender_JCalls_free(void* this_arg) {
17257         LDKOutputSpender_JCalls *j_calls = (LDKOutputSpender_JCalls*) this_arg;
17258         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
17259                 JNIEnv *env;
17260                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
17261                 if (get_jenv_res == JNI_EDETACHED) {
17262                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
17263                 } else {
17264                         DO_ASSERT(get_jenv_res == JNI_OK);
17265                 }
17266                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
17267                 if (get_jenv_res == JNI_EDETACHED) {
17268                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
17269                 }
17270                 FREE(j_calls);
17271         }
17272 }
17273 LDKCResult_TransactionNoneZ spend_spendable_outputs_LDKOutputSpender_jcall(const void* this_arg, LDKCVec_SpendableOutputDescriptorZ descriptors, LDKCVec_TxOutZ outputs, LDKCVec_u8Z change_destination_script, uint32_t feerate_sat_per_1000_weight, LDKCOption_u32Z locktime) {
17274         LDKOutputSpender_JCalls *j_calls = (LDKOutputSpender_JCalls*) this_arg;
17275         JNIEnv *env;
17276         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
17277         if (get_jenv_res == JNI_EDETACHED) {
17278                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
17279         } else {
17280                 DO_ASSERT(get_jenv_res == JNI_OK);
17281         }
17282         LDKCVec_SpendableOutputDescriptorZ descriptors_var = descriptors;
17283         int64_tArray descriptors_arr = NULL;
17284         descriptors_arr = (*env)->NewLongArray(env, descriptors_var.datalen);
17285         int64_t *descriptors_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, descriptors_arr, NULL);
17286         for (size_t b = 0; b < descriptors_var.datalen; b++) {
17287                 LDKSpendableOutputDescriptor *descriptors_conv_27_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
17288                 *descriptors_conv_27_copy = descriptors_var.data[b];
17289                 int64_t descriptors_conv_27_ref = tag_ptr(descriptors_conv_27_copy, true);
17290                 descriptors_arr_ptr[b] = descriptors_conv_27_ref;
17291         }
17292         (*env)->ReleasePrimitiveArrayCritical(env, descriptors_arr, descriptors_arr_ptr, 0);
17293         FREE(descriptors_var.data);
17294         LDKCVec_TxOutZ outputs_var = outputs;
17295         int64_tArray outputs_arr = NULL;
17296         outputs_arr = (*env)->NewLongArray(env, outputs_var.datalen);
17297         int64_t *outputs_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, outputs_arr, NULL);
17298         for (size_t h = 0; h < outputs_var.datalen; h++) {
17299                 LDKTxOut* outputs_conv_7_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
17300                 *outputs_conv_7_ref = outputs_var.data[h];
17301                 outputs_arr_ptr[h] = tag_ptr(outputs_conv_7_ref, true);
17302         }
17303         (*env)->ReleasePrimitiveArrayCritical(env, outputs_arr, outputs_arr_ptr, 0);
17304         FREE(outputs_var.data);
17305         LDKCVec_u8Z change_destination_script_var = change_destination_script;
17306         int8_tArray change_destination_script_arr = (*env)->NewByteArray(env, change_destination_script_var.datalen);
17307         (*env)->SetByteArrayRegion(env, change_destination_script_arr, 0, change_destination_script_var.datalen, change_destination_script_var.data);
17308         CVec_u8Z_free(change_destination_script_var);
17309         int32_t feerate_sat_per_1000_weight_conv = feerate_sat_per_1000_weight;
17310         LDKCOption_u32Z *locktime_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
17311         *locktime_copy = locktime;
17312         int64_t locktime_ref = tag_ptr(locktime_copy, true);
17313         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
17314         CHECK(obj != NULL);
17315         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->spend_spendable_outputs_meth, descriptors_arr, outputs_arr, change_destination_script_arr, feerate_sat_per_1000_weight_conv, locktime_ref);
17316         if (UNLIKELY((*env)->ExceptionCheck(env))) {
17317                 (*env)->ExceptionDescribe(env);
17318                 (*env)->FatalError(env, "A call to spend_spendable_outputs in LDKOutputSpender from rust threw an exception.");
17319         }
17320         void* ret_ptr = untag_ptr(ret);
17321         CHECK_ACCESS(ret_ptr);
17322         LDKCResult_TransactionNoneZ ret_conv = *(LDKCResult_TransactionNoneZ*)(ret_ptr);
17323         FREE(untag_ptr(ret));
17324         if (get_jenv_res == JNI_EDETACHED) {
17325                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
17326         }
17327         return ret_conv;
17328 }
17329 static void LDKOutputSpender_JCalls_cloned(LDKOutputSpender* new_obj) {
17330         LDKOutputSpender_JCalls *j_calls = (LDKOutputSpender_JCalls*) new_obj->this_arg;
17331         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
17332 }
17333 static inline LDKOutputSpender LDKOutputSpender_init (JNIEnv *env, jclass clz, jobject o) {
17334         jclass c = (*env)->GetObjectClass(env, o);
17335         CHECK(c != NULL);
17336         LDKOutputSpender_JCalls *calls = MALLOC(sizeof(LDKOutputSpender_JCalls), "LDKOutputSpender_JCalls");
17337         atomic_init(&calls->refcnt, 1);
17338         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
17339         calls->o = (*env)->NewWeakGlobalRef(env, o);
17340         calls->spend_spendable_outputs_meth = (*env)->GetMethodID(env, c, "spend_spendable_outputs", "([J[J[BIJ)J");
17341         CHECK(calls->spend_spendable_outputs_meth != NULL);
17342
17343         LDKOutputSpender ret = {
17344                 .this_arg = (void*) calls,
17345                 .spend_spendable_outputs = spend_spendable_outputs_LDKOutputSpender_jcall,
17346                 .free = LDKOutputSpender_JCalls_free,
17347         };
17348         return ret;
17349 }
17350 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKOutputSpender_1new(JNIEnv *env, jclass clz, jobject o) {
17351         LDKOutputSpender *res_ptr = MALLOC(sizeof(LDKOutputSpender), "LDKOutputSpender");
17352         *res_ptr = LDKOutputSpender_init(env, clz, o);
17353         return tag_ptr(res_ptr, true);
17354 }
17355 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutputSpender_1spend_1spendable_1outputs(JNIEnv *env, jclass clz, int64_t this_arg, int64_tArray descriptors, int64_tArray outputs, int8_tArray change_destination_script, int32_t feerate_sat_per_1000_weight, int64_t locktime) {
17356         void* this_arg_ptr = untag_ptr(this_arg);
17357         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17358         LDKOutputSpender* this_arg_conv = (LDKOutputSpender*)this_arg_ptr;
17359         LDKCVec_SpendableOutputDescriptorZ descriptors_constr;
17360         descriptors_constr.datalen = (*env)->GetArrayLength(env, descriptors);
17361         if (descriptors_constr.datalen > 0)
17362                 descriptors_constr.data = MALLOC(descriptors_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
17363         else
17364                 descriptors_constr.data = NULL;
17365         int64_t* descriptors_vals = (*env)->GetLongArrayElements (env, descriptors, NULL);
17366         for (size_t b = 0; b < descriptors_constr.datalen; b++) {
17367                 int64_t descriptors_conv_27 = descriptors_vals[b];
17368                 void* descriptors_conv_27_ptr = untag_ptr(descriptors_conv_27);
17369                 CHECK_ACCESS(descriptors_conv_27_ptr);
17370                 LDKSpendableOutputDescriptor descriptors_conv_27_conv = *(LDKSpendableOutputDescriptor*)(descriptors_conv_27_ptr);
17371                 descriptors_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)untag_ptr(descriptors_conv_27));
17372                 descriptors_constr.data[b] = descriptors_conv_27_conv;
17373         }
17374         (*env)->ReleaseLongArrayElements(env, descriptors, descriptors_vals, 0);
17375         LDKCVec_TxOutZ outputs_constr;
17376         outputs_constr.datalen = (*env)->GetArrayLength(env, outputs);
17377         if (outputs_constr.datalen > 0)
17378                 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
17379         else
17380                 outputs_constr.data = NULL;
17381         int64_t* outputs_vals = (*env)->GetLongArrayElements (env, outputs, NULL);
17382         for (size_t h = 0; h < outputs_constr.datalen; h++) {
17383                 int64_t outputs_conv_7 = outputs_vals[h];
17384                 void* outputs_conv_7_ptr = untag_ptr(outputs_conv_7);
17385                 CHECK_ACCESS(outputs_conv_7_ptr);
17386                 LDKTxOut outputs_conv_7_conv = *(LDKTxOut*)(outputs_conv_7_ptr);
17387                 outputs_conv_7_conv = TxOut_clone((LDKTxOut*)untag_ptr(outputs_conv_7));
17388                 outputs_constr.data[h] = outputs_conv_7_conv;
17389         }
17390         (*env)->ReleaseLongArrayElements(env, outputs, outputs_vals, 0);
17391         LDKCVec_u8Z change_destination_script_ref;
17392         change_destination_script_ref.datalen = (*env)->GetArrayLength(env, change_destination_script);
17393         change_destination_script_ref.data = MALLOC(change_destination_script_ref.datalen, "LDKCVec_u8Z Bytes");
17394         (*env)->GetByteArrayRegion(env, change_destination_script, 0, change_destination_script_ref.datalen, change_destination_script_ref.data);
17395         void* locktime_ptr = untag_ptr(locktime);
17396         CHECK_ACCESS(locktime_ptr);
17397         LDKCOption_u32Z locktime_conv = *(LDKCOption_u32Z*)(locktime_ptr);
17398         locktime_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(locktime));
17399         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
17400         *ret_conv = (this_arg_conv->spend_spendable_outputs)(this_arg_conv->this_arg, descriptors_constr, outputs_constr, change_destination_script_ref, feerate_sat_per_1000_weight, locktime_conv);
17401         return tag_ptr(ret_conv, true);
17402 }
17403
17404 static inline struct LDKOutputSweeper CResult_OutputSweeperDecodeErrorZ_get_ok(LDKCResult_OutputSweeperDecodeErrorZ *NONNULL_PTR owner){
17405         LDKOutputSweeper ret = *owner->contents.result;
17406         ret.is_owned = false;
17407         return ret;
17408 }
17409 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OutputSweeperDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
17410         LDKCResult_OutputSweeperDecodeErrorZ* owner_conv = (LDKCResult_OutputSweeperDecodeErrorZ*)untag_ptr(owner);
17411         LDKOutputSweeper ret_var = CResult_OutputSweeperDecodeErrorZ_get_ok(owner_conv);
17412         int64_t ret_ref = 0;
17413         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
17414         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
17415         return ret_ref;
17416 }
17417
17418 static inline struct LDKDecodeError CResult_OutputSweeperDecodeErrorZ_get_err(LDKCResult_OutputSweeperDecodeErrorZ *NONNULL_PTR owner){
17419 CHECK(!owner->result_ok);
17420         return DecodeError_clone(&*owner->contents.err);
17421 }
17422 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OutputSweeperDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
17423         LDKCResult_OutputSweeperDecodeErrorZ* owner_conv = (LDKCResult_OutputSweeperDecodeErrorZ*)untag_ptr(owner);
17424         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
17425         *ret_copy = CResult_OutputSweeperDecodeErrorZ_get_err(owner_conv);
17426         int64_t ret_ref = tag_ptr(ret_copy, true);
17427         return ret_ref;
17428 }
17429
17430 static inline struct LDKBestBlock C2Tuple_BestBlockOutputSweeperZ_get_a(LDKC2Tuple_BestBlockOutputSweeperZ *NONNULL_PTR owner){
17431         LDKBestBlock ret = owner->a;
17432         ret.is_owned = false;
17433         return ret;
17434 }
17435 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BestBlockOutputSweeperZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
17436         LDKC2Tuple_BestBlockOutputSweeperZ* owner_conv = (LDKC2Tuple_BestBlockOutputSweeperZ*)untag_ptr(owner);
17437         LDKBestBlock ret_var = C2Tuple_BestBlockOutputSweeperZ_get_a(owner_conv);
17438         int64_t ret_ref = 0;
17439         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
17440         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
17441         return ret_ref;
17442 }
17443
17444 static inline struct LDKOutputSweeper C2Tuple_BestBlockOutputSweeperZ_get_b(LDKC2Tuple_BestBlockOutputSweeperZ *NONNULL_PTR owner){
17445         LDKOutputSweeper ret = owner->b;
17446         ret.is_owned = false;
17447         return ret;
17448 }
17449 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BestBlockOutputSweeperZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
17450         LDKC2Tuple_BestBlockOutputSweeperZ* owner_conv = (LDKC2Tuple_BestBlockOutputSweeperZ*)untag_ptr(owner);
17451         LDKOutputSweeper ret_var = C2Tuple_BestBlockOutputSweeperZ_get_b(owner_conv);
17452         int64_t ret_ref = 0;
17453         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
17454         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
17455         return ret_ref;
17456 }
17457
17458 static inline struct LDKC2Tuple_BestBlockOutputSweeperZ *CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ_get_ok(LDKCResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ *NONNULL_PTR owner){
17459 CHECK(owner->result_ok);
17460         return &*owner->contents.result;
17461 }
17462 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BestBlockOutputSweeperZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
17463         LDKCResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ*)untag_ptr(owner);
17464         int64_t ret_ret = tag_ptr(CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ_get_ok(owner_conv), false);
17465         return ret_ret;
17466 }
17467
17468 static inline struct LDKDecodeError CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ_get_err(LDKCResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ *NONNULL_PTR owner){
17469 CHECK(!owner->result_ok);
17470         return DecodeError_clone(&*owner->contents.err);
17471 }
17472 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BestBlockOutputSweeperZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
17473         LDKCResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ* owner_conv = (LDKCResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ*)untag_ptr(owner);
17474         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
17475         *ret_copy = CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ_get_err(owner_conv);
17476         int64_t ret_ref = tag_ptr(ret_copy, true);
17477         return ret_ref;
17478 }
17479
17480 static inline struct LDKDelayedPaymentBasepoint CResult_DelayedPaymentBasepointDecodeErrorZ_get_ok(LDKCResult_DelayedPaymentBasepointDecodeErrorZ *NONNULL_PTR owner){
17481         LDKDelayedPaymentBasepoint ret = *owner->contents.result;
17482         ret.is_owned = false;
17483         return ret;
17484 }
17485 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentBasepointDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
17486         LDKCResult_DelayedPaymentBasepointDecodeErrorZ* owner_conv = (LDKCResult_DelayedPaymentBasepointDecodeErrorZ*)untag_ptr(owner);
17487         LDKDelayedPaymentBasepoint ret_var = CResult_DelayedPaymentBasepointDecodeErrorZ_get_ok(owner_conv);
17488         int64_t ret_ref = 0;
17489         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
17490         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
17491         return ret_ref;
17492 }
17493
17494 static inline struct LDKDecodeError CResult_DelayedPaymentBasepointDecodeErrorZ_get_err(LDKCResult_DelayedPaymentBasepointDecodeErrorZ *NONNULL_PTR owner){
17495 CHECK(!owner->result_ok);
17496         return DecodeError_clone(&*owner->contents.err);
17497 }
17498 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentBasepointDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
17499         LDKCResult_DelayedPaymentBasepointDecodeErrorZ* owner_conv = (LDKCResult_DelayedPaymentBasepointDecodeErrorZ*)untag_ptr(owner);
17500         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
17501         *ret_copy = CResult_DelayedPaymentBasepointDecodeErrorZ_get_err(owner_conv);
17502         int64_t ret_ref = tag_ptr(ret_copy, true);
17503         return ret_ref;
17504 }
17505
17506 static inline struct LDKDelayedPaymentKey CResult_DelayedPaymentKeyDecodeErrorZ_get_ok(LDKCResult_DelayedPaymentKeyDecodeErrorZ *NONNULL_PTR owner){
17507         LDKDelayedPaymentKey ret = *owner->contents.result;
17508         ret.is_owned = false;
17509         return ret;
17510 }
17511 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentKeyDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
17512         LDKCResult_DelayedPaymentKeyDecodeErrorZ* owner_conv = (LDKCResult_DelayedPaymentKeyDecodeErrorZ*)untag_ptr(owner);
17513         LDKDelayedPaymentKey ret_var = CResult_DelayedPaymentKeyDecodeErrorZ_get_ok(owner_conv);
17514         int64_t ret_ref = 0;
17515         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
17516         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
17517         return ret_ref;
17518 }
17519
17520 static inline struct LDKDecodeError CResult_DelayedPaymentKeyDecodeErrorZ_get_err(LDKCResult_DelayedPaymentKeyDecodeErrorZ *NONNULL_PTR owner){
17521 CHECK(!owner->result_ok);
17522         return DecodeError_clone(&*owner->contents.err);
17523 }
17524 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentKeyDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
17525         LDKCResult_DelayedPaymentKeyDecodeErrorZ* owner_conv = (LDKCResult_DelayedPaymentKeyDecodeErrorZ*)untag_ptr(owner);
17526         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
17527         *ret_copy = CResult_DelayedPaymentKeyDecodeErrorZ_get_err(owner_conv);
17528         int64_t ret_ref = tag_ptr(ret_copy, true);
17529         return ret_ref;
17530 }
17531
17532 static inline struct LDKHtlcBasepoint CResult_HtlcBasepointDecodeErrorZ_get_ok(LDKCResult_HtlcBasepointDecodeErrorZ *NONNULL_PTR owner){
17533         LDKHtlcBasepoint ret = *owner->contents.result;
17534         ret.is_owned = false;
17535         return ret;
17536 }
17537 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HtlcBasepointDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
17538         LDKCResult_HtlcBasepointDecodeErrorZ* owner_conv = (LDKCResult_HtlcBasepointDecodeErrorZ*)untag_ptr(owner);
17539         LDKHtlcBasepoint ret_var = CResult_HtlcBasepointDecodeErrorZ_get_ok(owner_conv);
17540         int64_t ret_ref = 0;
17541         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
17542         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
17543         return ret_ref;
17544 }
17545
17546 static inline struct LDKDecodeError CResult_HtlcBasepointDecodeErrorZ_get_err(LDKCResult_HtlcBasepointDecodeErrorZ *NONNULL_PTR owner){
17547 CHECK(!owner->result_ok);
17548         return DecodeError_clone(&*owner->contents.err);
17549 }
17550 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HtlcBasepointDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
17551         LDKCResult_HtlcBasepointDecodeErrorZ* owner_conv = (LDKCResult_HtlcBasepointDecodeErrorZ*)untag_ptr(owner);
17552         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
17553         *ret_copy = CResult_HtlcBasepointDecodeErrorZ_get_err(owner_conv);
17554         int64_t ret_ref = tag_ptr(ret_copy, true);
17555         return ret_ref;
17556 }
17557
17558 static inline struct LDKHtlcKey CResult_HtlcKeyDecodeErrorZ_get_ok(LDKCResult_HtlcKeyDecodeErrorZ *NONNULL_PTR owner){
17559         LDKHtlcKey ret = *owner->contents.result;
17560         ret.is_owned = false;
17561         return ret;
17562 }
17563 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HtlcKeyDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
17564         LDKCResult_HtlcKeyDecodeErrorZ* owner_conv = (LDKCResult_HtlcKeyDecodeErrorZ*)untag_ptr(owner);
17565         LDKHtlcKey ret_var = CResult_HtlcKeyDecodeErrorZ_get_ok(owner_conv);
17566         int64_t ret_ref = 0;
17567         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
17568         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
17569         return ret_ref;
17570 }
17571
17572 static inline struct LDKDecodeError CResult_HtlcKeyDecodeErrorZ_get_err(LDKCResult_HtlcKeyDecodeErrorZ *NONNULL_PTR owner){
17573 CHECK(!owner->result_ok);
17574         return DecodeError_clone(&*owner->contents.err);
17575 }
17576 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HtlcKeyDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
17577         LDKCResult_HtlcKeyDecodeErrorZ* owner_conv = (LDKCResult_HtlcKeyDecodeErrorZ*)untag_ptr(owner);
17578         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
17579         *ret_copy = CResult_HtlcKeyDecodeErrorZ_get_err(owner_conv);
17580         int64_t ret_ref = tag_ptr(ret_copy, true);
17581         return ret_ref;
17582 }
17583
17584 static inline struct LDKRevocationBasepoint CResult_RevocationBasepointDecodeErrorZ_get_ok(LDKCResult_RevocationBasepointDecodeErrorZ *NONNULL_PTR owner){
17585         LDKRevocationBasepoint ret = *owner->contents.result;
17586         ret.is_owned = false;
17587         return ret;
17588 }
17589 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevocationBasepointDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
17590         LDKCResult_RevocationBasepointDecodeErrorZ* owner_conv = (LDKCResult_RevocationBasepointDecodeErrorZ*)untag_ptr(owner);
17591         LDKRevocationBasepoint ret_var = CResult_RevocationBasepointDecodeErrorZ_get_ok(owner_conv);
17592         int64_t ret_ref = 0;
17593         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
17594         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
17595         return ret_ref;
17596 }
17597
17598 static inline struct LDKDecodeError CResult_RevocationBasepointDecodeErrorZ_get_err(LDKCResult_RevocationBasepointDecodeErrorZ *NONNULL_PTR owner){
17599 CHECK(!owner->result_ok);
17600         return DecodeError_clone(&*owner->contents.err);
17601 }
17602 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevocationBasepointDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
17603         LDKCResult_RevocationBasepointDecodeErrorZ* owner_conv = (LDKCResult_RevocationBasepointDecodeErrorZ*)untag_ptr(owner);
17604         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
17605         *ret_copy = CResult_RevocationBasepointDecodeErrorZ_get_err(owner_conv);
17606         int64_t ret_ref = tag_ptr(ret_copy, true);
17607         return ret_ref;
17608 }
17609
17610 static inline struct LDKRevocationKey CResult_RevocationKeyDecodeErrorZ_get_ok(LDKCResult_RevocationKeyDecodeErrorZ *NONNULL_PTR owner){
17611         LDKRevocationKey ret = *owner->contents.result;
17612         ret.is_owned = false;
17613         return ret;
17614 }
17615 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevocationKeyDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
17616         LDKCResult_RevocationKeyDecodeErrorZ* owner_conv = (LDKCResult_RevocationKeyDecodeErrorZ*)untag_ptr(owner);
17617         LDKRevocationKey ret_var = CResult_RevocationKeyDecodeErrorZ_get_ok(owner_conv);
17618         int64_t ret_ref = 0;
17619         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
17620         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
17621         return ret_ref;
17622 }
17623
17624 static inline struct LDKDecodeError CResult_RevocationKeyDecodeErrorZ_get_err(LDKCResult_RevocationKeyDecodeErrorZ *NONNULL_PTR owner){
17625 CHECK(!owner->result_ok);
17626         return DecodeError_clone(&*owner->contents.err);
17627 }
17628 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevocationKeyDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
17629         LDKCResult_RevocationKeyDecodeErrorZ* owner_conv = (LDKCResult_RevocationKeyDecodeErrorZ*)untag_ptr(owner);
17630         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
17631         *ret_copy = CResult_RevocationKeyDecodeErrorZ_get_err(owner_conv);
17632         int64_t ret_ref = tag_ptr(ret_copy, true);
17633         return ret_ref;
17634 }
17635
17636 static inline struct LDKLockedChannelMonitor CResult_LockedChannelMonitorNoneZ_get_ok(LDKCResult_LockedChannelMonitorNoneZ *NONNULL_PTR owner){
17637         LDKLockedChannelMonitor ret = *owner->contents.result;
17638         ret.is_owned = false;
17639         return ret;
17640 }
17641 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1LockedChannelMonitorNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
17642         LDKCResult_LockedChannelMonitorNoneZ* owner_conv = (LDKCResult_LockedChannelMonitorNoneZ*)untag_ptr(owner);
17643         LDKLockedChannelMonitor ret_var = CResult_LockedChannelMonitorNoneZ_get_ok(owner_conv);
17644         int64_t ret_ref = 0;
17645         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
17646         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
17647         return ret_ref;
17648 }
17649
17650 static inline void CResult_LockedChannelMonitorNoneZ_get_err(LDKCResult_LockedChannelMonitorNoneZ *NONNULL_PTR owner){
17651 CHECK(!owner->result_ok);
17652         return *owner->contents.err;
17653 }
17654 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1LockedChannelMonitorNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
17655         LDKCResult_LockedChannelMonitorNoneZ* owner_conv = (LDKCResult_LockedChannelMonitorNoneZ*)untag_ptr(owner);
17656         CResult_LockedChannelMonitorNoneZ_get_err(owner_conv);
17657 }
17658
17659 static inline struct LDKOutPoint C2Tuple_OutPointChannelIdZ_get_a(LDKC2Tuple_OutPointChannelIdZ *NONNULL_PTR owner){
17660         LDKOutPoint ret = owner->a;
17661         ret.is_owned = false;
17662         return ret;
17663 }
17664 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointChannelIdZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
17665         LDKC2Tuple_OutPointChannelIdZ* owner_conv = (LDKC2Tuple_OutPointChannelIdZ*)untag_ptr(owner);
17666         LDKOutPoint ret_var = C2Tuple_OutPointChannelIdZ_get_a(owner_conv);
17667         int64_t ret_ref = 0;
17668         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
17669         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
17670         return ret_ref;
17671 }
17672
17673 static inline struct LDKChannelId C2Tuple_OutPointChannelIdZ_get_b(LDKC2Tuple_OutPointChannelIdZ *NONNULL_PTR owner){
17674         LDKChannelId ret = owner->b;
17675         ret.is_owned = false;
17676         return ret;
17677 }
17678 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointChannelIdZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
17679         LDKC2Tuple_OutPointChannelIdZ* owner_conv = (LDKC2Tuple_OutPointChannelIdZ*)untag_ptr(owner);
17680         LDKChannelId ret_var = C2Tuple_OutPointChannelIdZ_get_b(owner_conv);
17681         int64_t ret_ref = 0;
17682         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
17683         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
17684         return ret_ref;
17685 }
17686
17687 static inline LDKCVec_C2Tuple_OutPointChannelIdZZ CVec_C2Tuple_OutPointChannelIdZZ_clone(const LDKCVec_C2Tuple_OutPointChannelIdZZ *orig) {
17688         LDKCVec_C2Tuple_OutPointChannelIdZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_OutPointChannelIdZ) * orig->datalen, "LDKCVec_C2Tuple_OutPointChannelIdZZ clone bytes"), .datalen = orig->datalen };
17689         for (size_t i = 0; i < ret.datalen; i++) {
17690                 ret.data[i] = C2Tuple_OutPointChannelIdZ_clone(&orig->data[i]);
17691         }
17692         return ret;
17693 }
17694 static inline LDKCVec_MonitorUpdateIdZ CVec_MonitorUpdateIdZ_clone(const LDKCVec_MonitorUpdateIdZ *orig) {
17695         LDKCVec_MonitorUpdateIdZ ret = { .data = MALLOC(sizeof(LDKMonitorUpdateId) * orig->datalen, "LDKCVec_MonitorUpdateIdZ clone bytes"), .datalen = orig->datalen };
17696         for (size_t i = 0; i < ret.datalen; i++) {
17697                 ret.data[i] = MonitorUpdateId_clone(&orig->data[i]);
17698         }
17699         return ret;
17700 }
17701 static inline struct LDKOutPoint C2Tuple_OutPointCVec_MonitorUpdateIdZZ_get_a(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ *NONNULL_PTR owner){
17702         LDKOutPoint ret = owner->a;
17703         ret.is_owned = false;
17704         return ret;
17705 }
17706 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointCVec_1MonitorUpdateIdZZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) {
17707         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* owner_conv = (LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ*)untag_ptr(owner);
17708         LDKOutPoint ret_var = C2Tuple_OutPointCVec_MonitorUpdateIdZZ_get_a(owner_conv);
17709         int64_t ret_ref = 0;
17710         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
17711         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
17712         return ret_ref;
17713 }
17714
17715 static inline struct LDKCVec_MonitorUpdateIdZ C2Tuple_OutPointCVec_MonitorUpdateIdZZ_get_b(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ *NONNULL_PTR owner){
17716         return CVec_MonitorUpdateIdZ_clone(&owner->b);
17717 }
17718 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointCVec_1MonitorUpdateIdZZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) {
17719         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* owner_conv = (LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ*)untag_ptr(owner);
17720         LDKCVec_MonitorUpdateIdZ ret_var = C2Tuple_OutPointCVec_MonitorUpdateIdZZ_get_b(owner_conv);
17721         int64_tArray ret_arr = NULL;
17722         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
17723         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
17724         for (size_t r = 0; r < ret_var.datalen; r++) {
17725                 LDKMonitorUpdateId ret_conv_17_var = ret_var.data[r];
17726                 int64_t ret_conv_17_ref = 0;
17727                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_17_var);
17728                 ret_conv_17_ref = tag_ptr(ret_conv_17_var.inner, ret_conv_17_var.is_owned);
17729                 ret_arr_ptr[r] = ret_conv_17_ref;
17730         }
17731         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
17732         FREE(ret_var.data);
17733         return ret_arr;
17734 }
17735
17736 static inline LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ_clone(const LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ *orig) {
17737         LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ) * orig->datalen, "LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ clone bytes"), .datalen = orig->datalen };
17738         for (size_t i = 0; i < ret.datalen; i++) {
17739                 ret.data[i] = C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone(&orig->data[i]);
17740         }
17741         return ret;
17742 }
17743 typedef struct LDKPersister_JCalls {
17744         atomic_size_t refcnt;
17745         JavaVM *vm;
17746         jweak o;
17747         jmethodID persist_manager_meth;
17748         jmethodID persist_graph_meth;
17749         jmethodID persist_scorer_meth;
17750 } LDKPersister_JCalls;
17751 static void LDKPersister_JCalls_free(void* this_arg) {
17752         LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) this_arg;
17753         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
17754                 JNIEnv *env;
17755                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
17756                 if (get_jenv_res == JNI_EDETACHED) {
17757                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
17758                 } else {
17759                         DO_ASSERT(get_jenv_res == JNI_OK);
17760                 }
17761                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
17762                 if (get_jenv_res == JNI_EDETACHED) {
17763                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
17764                 }
17765                 FREE(j_calls);
17766         }
17767 }
17768 LDKCResult_NoneIOErrorZ persist_manager_LDKPersister_jcall(const void* this_arg, const LDKChannelManager * channel_manager) {
17769         LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) this_arg;
17770         JNIEnv *env;
17771         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
17772         if (get_jenv_res == JNI_EDETACHED) {
17773                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
17774         } else {
17775                 DO_ASSERT(get_jenv_res == JNI_OK);
17776         }
17777         LDKChannelManager channel_manager_var = *channel_manager;
17778         int64_t channel_manager_ref = 0;
17779         // WARNING: we may need a move here but no clone is available for LDKChannelManager
17780         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_manager_var);
17781         channel_manager_ref = tag_ptr(channel_manager_var.inner, channel_manager_var.is_owned);
17782         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
17783         CHECK(obj != NULL);
17784         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->persist_manager_meth, channel_manager_ref);
17785         if (UNLIKELY((*env)->ExceptionCheck(env))) {
17786                 (*env)->ExceptionDescribe(env);
17787                 (*env)->FatalError(env, "A call to persist_manager in LDKPersister from rust threw an exception.");
17788         }
17789         void* ret_ptr = untag_ptr(ret);
17790         CHECK_ACCESS(ret_ptr);
17791         LDKCResult_NoneIOErrorZ ret_conv = *(LDKCResult_NoneIOErrorZ*)(ret_ptr);
17792         FREE(untag_ptr(ret));
17793         if (get_jenv_res == JNI_EDETACHED) {
17794                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
17795         }
17796         return ret_conv;
17797 }
17798 LDKCResult_NoneIOErrorZ persist_graph_LDKPersister_jcall(const void* this_arg, const LDKNetworkGraph * network_graph) {
17799         LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) this_arg;
17800         JNIEnv *env;
17801         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
17802         if (get_jenv_res == JNI_EDETACHED) {
17803                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
17804         } else {
17805                 DO_ASSERT(get_jenv_res == JNI_OK);
17806         }
17807         LDKNetworkGraph network_graph_var = *network_graph;
17808         int64_t network_graph_ref = 0;
17809         // WARNING: we may need a move here but no clone is available for LDKNetworkGraph
17810         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_var);
17811         network_graph_ref = tag_ptr(network_graph_var.inner, network_graph_var.is_owned);
17812         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
17813         CHECK(obj != NULL);
17814         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->persist_graph_meth, network_graph_ref);
17815         if (UNLIKELY((*env)->ExceptionCheck(env))) {
17816                 (*env)->ExceptionDescribe(env);
17817                 (*env)->FatalError(env, "A call to persist_graph in LDKPersister from rust threw an exception.");
17818         }
17819         void* ret_ptr = untag_ptr(ret);
17820         CHECK_ACCESS(ret_ptr);
17821         LDKCResult_NoneIOErrorZ ret_conv = *(LDKCResult_NoneIOErrorZ*)(ret_ptr);
17822         FREE(untag_ptr(ret));
17823         if (get_jenv_res == JNI_EDETACHED) {
17824                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
17825         }
17826         return ret_conv;
17827 }
17828 LDKCResult_NoneIOErrorZ persist_scorer_LDKPersister_jcall(const void* this_arg, const LDKWriteableScore * scorer) {
17829         LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) this_arg;
17830         JNIEnv *env;
17831         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
17832         if (get_jenv_res == JNI_EDETACHED) {
17833                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
17834         } else {
17835                 DO_ASSERT(get_jenv_res == JNI_OK);
17836         }
17837         // WARNING: This object doesn't live past this scope, needs clone!
17838         int64_t ret_scorer = tag_ptr(scorer, false);
17839         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
17840         CHECK(obj != NULL);
17841         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->persist_scorer_meth, ret_scorer);
17842         if (UNLIKELY((*env)->ExceptionCheck(env))) {
17843                 (*env)->ExceptionDescribe(env);
17844                 (*env)->FatalError(env, "A call to persist_scorer in LDKPersister from rust threw an exception.");
17845         }
17846         void* ret_ptr = untag_ptr(ret);
17847         CHECK_ACCESS(ret_ptr);
17848         LDKCResult_NoneIOErrorZ ret_conv = *(LDKCResult_NoneIOErrorZ*)(ret_ptr);
17849         FREE(untag_ptr(ret));
17850         if (get_jenv_res == JNI_EDETACHED) {
17851                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
17852         }
17853         return ret_conv;
17854 }
17855 static void LDKPersister_JCalls_cloned(LDKPersister* new_obj) {
17856         LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) new_obj->this_arg;
17857         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
17858 }
17859 static inline LDKPersister LDKPersister_init (JNIEnv *env, jclass clz, jobject o) {
17860         jclass c = (*env)->GetObjectClass(env, o);
17861         CHECK(c != NULL);
17862         LDKPersister_JCalls *calls = MALLOC(sizeof(LDKPersister_JCalls), "LDKPersister_JCalls");
17863         atomic_init(&calls->refcnt, 1);
17864         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
17865         calls->o = (*env)->NewWeakGlobalRef(env, o);
17866         calls->persist_manager_meth = (*env)->GetMethodID(env, c, "persist_manager", "(J)J");
17867         CHECK(calls->persist_manager_meth != NULL);
17868         calls->persist_graph_meth = (*env)->GetMethodID(env, c, "persist_graph", "(J)J");
17869         CHECK(calls->persist_graph_meth != NULL);
17870         calls->persist_scorer_meth = (*env)->GetMethodID(env, c, "persist_scorer", "(J)J");
17871         CHECK(calls->persist_scorer_meth != NULL);
17872
17873         LDKPersister ret = {
17874                 .this_arg = (void*) calls,
17875                 .persist_manager = persist_manager_LDKPersister_jcall,
17876                 .persist_graph = persist_graph_LDKPersister_jcall,
17877                 .persist_scorer = persist_scorer_LDKPersister_jcall,
17878                 .free = LDKPersister_JCalls_free,
17879         };
17880         return ret;
17881 }
17882 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKPersister_1new(JNIEnv *env, jclass clz, jobject o) {
17883         LDKPersister *res_ptr = MALLOC(sizeof(LDKPersister), "LDKPersister");
17884         *res_ptr = LDKPersister_init(env, clz, o);
17885         return tag_ptr(res_ptr, true);
17886 }
17887 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Persister_1persist_1manager(JNIEnv *env, jclass clz, int64_t this_arg, int64_t channel_manager) {
17888         void* this_arg_ptr = untag_ptr(this_arg);
17889         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17890         LDKPersister* this_arg_conv = (LDKPersister*)this_arg_ptr;
17891         LDKChannelManager channel_manager_conv;
17892         channel_manager_conv.inner = untag_ptr(channel_manager);
17893         channel_manager_conv.is_owned = ptr_is_owned(channel_manager);
17894         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_manager_conv);
17895         channel_manager_conv.is_owned = false;
17896         LDKCResult_NoneIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneIOErrorZ), "LDKCResult_NoneIOErrorZ");
17897         *ret_conv = (this_arg_conv->persist_manager)(this_arg_conv->this_arg, &channel_manager_conv);
17898         return tag_ptr(ret_conv, true);
17899 }
17900
17901 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Persister_1persist_1graph(JNIEnv *env, jclass clz, int64_t this_arg, int64_t network_graph) {
17902         void* this_arg_ptr = untag_ptr(this_arg);
17903         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17904         LDKPersister* this_arg_conv = (LDKPersister*)this_arg_ptr;
17905         LDKNetworkGraph network_graph_conv;
17906         network_graph_conv.inner = untag_ptr(network_graph);
17907         network_graph_conv.is_owned = ptr_is_owned(network_graph);
17908         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
17909         network_graph_conv.is_owned = false;
17910         LDKCResult_NoneIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneIOErrorZ), "LDKCResult_NoneIOErrorZ");
17911         *ret_conv = (this_arg_conv->persist_graph)(this_arg_conv->this_arg, &network_graph_conv);
17912         return tag_ptr(ret_conv, true);
17913 }
17914
17915 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Persister_1persist_1scorer(JNIEnv *env, jclass clz, int64_t this_arg, int64_t scorer) {
17916         void* this_arg_ptr = untag_ptr(this_arg);
17917         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
17918         LDKPersister* this_arg_conv = (LDKPersister*)this_arg_ptr;
17919         void* scorer_ptr = untag_ptr(scorer);
17920         if (ptr_is_owned(scorer)) { CHECK_ACCESS(scorer_ptr); }
17921         LDKWriteableScore* scorer_conv = (LDKWriteableScore*)scorer_ptr;
17922         LDKCResult_NoneIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneIOErrorZ), "LDKCResult_NoneIOErrorZ");
17923         *ret_conv = (this_arg_conv->persist_scorer)(this_arg_conv->this_arg, scorer_conv);
17924         return tag_ptr(ret_conv, true);
17925 }
17926
17927 typedef struct LDKPersist_JCalls {
17928         atomic_size_t refcnt;
17929         JavaVM *vm;
17930         jweak o;
17931         jmethodID persist_new_channel_meth;
17932         jmethodID update_persisted_channel_meth;
17933         jmethodID archive_persisted_channel_meth;
17934 } LDKPersist_JCalls;
17935 static void LDKPersist_JCalls_free(void* this_arg) {
17936         LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
17937         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
17938                 JNIEnv *env;
17939                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
17940                 if (get_jenv_res == JNI_EDETACHED) {
17941                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
17942                 } else {
17943                         DO_ASSERT(get_jenv_res == JNI_OK);
17944                 }
17945                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
17946                 if (get_jenv_res == JNI_EDETACHED) {
17947                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
17948                 }
17949                 FREE(j_calls);
17950         }
17951 }
17952 LDKChannelMonitorUpdateStatus persist_new_channel_LDKPersist_jcall(const void* this_arg, LDKOutPoint channel_funding_outpoint, const LDKChannelMonitor * data, LDKMonitorUpdateId update_id) {
17953         LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
17954         JNIEnv *env;
17955         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
17956         if (get_jenv_res == JNI_EDETACHED) {
17957                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
17958         } else {
17959                 DO_ASSERT(get_jenv_res == JNI_OK);
17960         }
17961         LDKOutPoint channel_funding_outpoint_var = channel_funding_outpoint;
17962         int64_t channel_funding_outpoint_ref = 0;
17963         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_funding_outpoint_var);
17964         channel_funding_outpoint_ref = tag_ptr(channel_funding_outpoint_var.inner, channel_funding_outpoint_var.is_owned);
17965         LDKChannelMonitor data_var = *data;
17966         int64_t data_ref = 0;
17967         data_var = ChannelMonitor_clone(&data_var);
17968         CHECK_INNER_FIELD_ACCESS_OR_NULL(data_var);
17969         data_ref = tag_ptr(data_var.inner, data_var.is_owned);
17970         LDKMonitorUpdateId update_id_var = update_id;
17971         int64_t update_id_ref = 0;
17972         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_var);
17973         update_id_ref = tag_ptr(update_id_var.inner, update_id_var.is_owned);
17974         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
17975         CHECK(obj != NULL);
17976         jclass ret = (*env)->CallObjectMethod(env, obj, j_calls->persist_new_channel_meth, channel_funding_outpoint_ref, data_ref, update_id_ref);
17977         if (UNLIKELY((*env)->ExceptionCheck(env))) {
17978                 (*env)->ExceptionDescribe(env);
17979                 (*env)->FatalError(env, "A call to persist_new_channel in LDKPersist from rust threw an exception.");
17980         }
17981         LDKChannelMonitorUpdateStatus ret_conv = LDKChannelMonitorUpdateStatus_from_java(env, ret);
17982         if (get_jenv_res == JNI_EDETACHED) {
17983                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
17984         }
17985         return ret_conv;
17986 }
17987 LDKChannelMonitorUpdateStatus update_persisted_channel_LDKPersist_jcall(const void* this_arg, LDKOutPoint channel_funding_outpoint, LDKChannelMonitorUpdate update, const LDKChannelMonitor * data, LDKMonitorUpdateId update_id) {
17988         LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
17989         JNIEnv *env;
17990         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
17991         if (get_jenv_res == JNI_EDETACHED) {
17992                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
17993         } else {
17994                 DO_ASSERT(get_jenv_res == JNI_OK);
17995         }
17996         LDKOutPoint channel_funding_outpoint_var = channel_funding_outpoint;
17997         int64_t channel_funding_outpoint_ref = 0;
17998         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_funding_outpoint_var);
17999         channel_funding_outpoint_ref = tag_ptr(channel_funding_outpoint_var.inner, channel_funding_outpoint_var.is_owned);
18000         LDKChannelMonitorUpdate update_var = update;
18001         int64_t update_ref = 0;
18002         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_var);
18003         update_ref = tag_ptr(update_var.inner, update_var.is_owned);
18004         LDKChannelMonitor data_var = *data;
18005         int64_t data_ref = 0;
18006         data_var = ChannelMonitor_clone(&data_var);
18007         CHECK_INNER_FIELD_ACCESS_OR_NULL(data_var);
18008         data_ref = tag_ptr(data_var.inner, data_var.is_owned);
18009         LDKMonitorUpdateId update_id_var = update_id;
18010         int64_t update_id_ref = 0;
18011         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_var);
18012         update_id_ref = tag_ptr(update_id_var.inner, update_id_var.is_owned);
18013         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
18014         CHECK(obj != NULL);
18015         jclass ret = (*env)->CallObjectMethod(env, obj, j_calls->update_persisted_channel_meth, channel_funding_outpoint_ref, update_ref, data_ref, update_id_ref);
18016         if (UNLIKELY((*env)->ExceptionCheck(env))) {
18017                 (*env)->ExceptionDescribe(env);
18018                 (*env)->FatalError(env, "A call to update_persisted_channel in LDKPersist from rust threw an exception.");
18019         }
18020         LDKChannelMonitorUpdateStatus ret_conv = LDKChannelMonitorUpdateStatus_from_java(env, ret);
18021         if (get_jenv_res == JNI_EDETACHED) {
18022                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
18023         }
18024         return ret_conv;
18025 }
18026 void archive_persisted_channel_LDKPersist_jcall(const void* this_arg, LDKOutPoint channel_funding_outpoint) {
18027         LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
18028         JNIEnv *env;
18029         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
18030         if (get_jenv_res == JNI_EDETACHED) {
18031                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
18032         } else {
18033                 DO_ASSERT(get_jenv_res == JNI_OK);
18034         }
18035         LDKOutPoint channel_funding_outpoint_var = channel_funding_outpoint;
18036         int64_t channel_funding_outpoint_ref = 0;
18037         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_funding_outpoint_var);
18038         channel_funding_outpoint_ref = tag_ptr(channel_funding_outpoint_var.inner, channel_funding_outpoint_var.is_owned);
18039         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
18040         CHECK(obj != NULL);
18041         (*env)->CallVoidMethod(env, obj, j_calls->archive_persisted_channel_meth, channel_funding_outpoint_ref);
18042         if (UNLIKELY((*env)->ExceptionCheck(env))) {
18043                 (*env)->ExceptionDescribe(env);
18044                 (*env)->FatalError(env, "A call to archive_persisted_channel in LDKPersist from rust threw an exception.");
18045         }
18046         if (get_jenv_res == JNI_EDETACHED) {
18047                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
18048         }
18049 }
18050 static void LDKPersist_JCalls_cloned(LDKPersist* new_obj) {
18051         LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) new_obj->this_arg;
18052         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
18053 }
18054 static inline LDKPersist LDKPersist_init (JNIEnv *env, jclass clz, jobject o) {
18055         jclass c = (*env)->GetObjectClass(env, o);
18056         CHECK(c != NULL);
18057         LDKPersist_JCalls *calls = MALLOC(sizeof(LDKPersist_JCalls), "LDKPersist_JCalls");
18058         atomic_init(&calls->refcnt, 1);
18059         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
18060         calls->o = (*env)->NewWeakGlobalRef(env, o);
18061         calls->persist_new_channel_meth = (*env)->GetMethodID(env, c, "persist_new_channel", "(JJJ)Lorg/ldk/enums/ChannelMonitorUpdateStatus;");
18062         CHECK(calls->persist_new_channel_meth != NULL);
18063         calls->update_persisted_channel_meth = (*env)->GetMethodID(env, c, "update_persisted_channel", "(JJJJ)Lorg/ldk/enums/ChannelMonitorUpdateStatus;");
18064         CHECK(calls->update_persisted_channel_meth != NULL);
18065         calls->archive_persisted_channel_meth = (*env)->GetMethodID(env, c, "archive_persisted_channel", "(J)V");
18066         CHECK(calls->archive_persisted_channel_meth != NULL);
18067
18068         LDKPersist ret = {
18069                 .this_arg = (void*) calls,
18070                 .persist_new_channel = persist_new_channel_LDKPersist_jcall,
18071                 .update_persisted_channel = update_persisted_channel_LDKPersist_jcall,
18072                 .archive_persisted_channel = archive_persisted_channel_LDKPersist_jcall,
18073                 .free = LDKPersist_JCalls_free,
18074         };
18075         return ret;
18076 }
18077 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKPersist_1new(JNIEnv *env, jclass clz, jobject o) {
18078         LDKPersist *res_ptr = MALLOC(sizeof(LDKPersist), "LDKPersist");
18079         *res_ptr = LDKPersist_init(env, clz, o);
18080         return tag_ptr(res_ptr, true);
18081 }
18082 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Persist_1persist_1new_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int64_t channel_funding_outpoint, int64_t data, int64_t update_id) {
18083         void* this_arg_ptr = untag_ptr(this_arg);
18084         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
18085         LDKPersist* this_arg_conv = (LDKPersist*)this_arg_ptr;
18086         LDKOutPoint channel_funding_outpoint_conv;
18087         channel_funding_outpoint_conv.inner = untag_ptr(channel_funding_outpoint);
18088         channel_funding_outpoint_conv.is_owned = ptr_is_owned(channel_funding_outpoint);
18089         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_funding_outpoint_conv);
18090         channel_funding_outpoint_conv = OutPoint_clone(&channel_funding_outpoint_conv);
18091         LDKChannelMonitor data_conv;
18092         data_conv.inner = untag_ptr(data);
18093         data_conv.is_owned = ptr_is_owned(data);
18094         CHECK_INNER_FIELD_ACCESS_OR_NULL(data_conv);
18095         data_conv.is_owned = false;
18096         LDKMonitorUpdateId update_id_conv;
18097         update_id_conv.inner = untag_ptr(update_id);
18098         update_id_conv.is_owned = ptr_is_owned(update_id);
18099         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_conv);
18100         update_id_conv = MonitorUpdateId_clone(&update_id_conv);
18101         jclass ret_conv = LDKChannelMonitorUpdateStatus_to_java(env, (this_arg_conv->persist_new_channel)(this_arg_conv->this_arg, channel_funding_outpoint_conv, &data_conv, update_id_conv));
18102         return ret_conv;
18103 }
18104
18105 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Persist_1update_1persisted_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int64_t channel_funding_outpoint, int64_t update, int64_t data, int64_t update_id) {
18106         void* this_arg_ptr = untag_ptr(this_arg);
18107         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
18108         LDKPersist* this_arg_conv = (LDKPersist*)this_arg_ptr;
18109         LDKOutPoint channel_funding_outpoint_conv;
18110         channel_funding_outpoint_conv.inner = untag_ptr(channel_funding_outpoint);
18111         channel_funding_outpoint_conv.is_owned = ptr_is_owned(channel_funding_outpoint);
18112         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_funding_outpoint_conv);
18113         channel_funding_outpoint_conv = OutPoint_clone(&channel_funding_outpoint_conv);
18114         LDKChannelMonitorUpdate update_conv;
18115         update_conv.inner = untag_ptr(update);
18116         update_conv.is_owned = ptr_is_owned(update);
18117         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_conv);
18118         update_conv = ChannelMonitorUpdate_clone(&update_conv);
18119         LDKChannelMonitor data_conv;
18120         data_conv.inner = untag_ptr(data);
18121         data_conv.is_owned = ptr_is_owned(data);
18122         CHECK_INNER_FIELD_ACCESS_OR_NULL(data_conv);
18123         data_conv.is_owned = false;
18124         LDKMonitorUpdateId update_id_conv;
18125         update_id_conv.inner = untag_ptr(update_id);
18126         update_id_conv.is_owned = ptr_is_owned(update_id);
18127         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_conv);
18128         update_id_conv = MonitorUpdateId_clone(&update_id_conv);
18129         jclass ret_conv = LDKChannelMonitorUpdateStatus_to_java(env, (this_arg_conv->update_persisted_channel)(this_arg_conv->this_arg, channel_funding_outpoint_conv, update_conv, &data_conv, update_id_conv));
18130         return ret_conv;
18131 }
18132
18133 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Persist_1archive_1persisted_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int64_t channel_funding_outpoint) {
18134         void* this_arg_ptr = untag_ptr(this_arg);
18135         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
18136         LDKPersist* this_arg_conv = (LDKPersist*)this_arg_ptr;
18137         LDKOutPoint channel_funding_outpoint_conv;
18138         channel_funding_outpoint_conv.inner = untag_ptr(channel_funding_outpoint);
18139         channel_funding_outpoint_conv.is_owned = ptr_is_owned(channel_funding_outpoint);
18140         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_funding_outpoint_conv);
18141         channel_funding_outpoint_conv = OutPoint_clone(&channel_funding_outpoint_conv);
18142         (this_arg_conv->archive_persisted_channel)(this_arg_conv->this_arg, channel_funding_outpoint_conv);
18143 }
18144
18145 typedef struct LDKListen_JCalls {
18146         atomic_size_t refcnt;
18147         JavaVM *vm;
18148         jweak o;
18149         jmethodID filtered_block_connected_meth;
18150         jmethodID block_connected_meth;
18151         jmethodID block_disconnected_meth;
18152 } LDKListen_JCalls;
18153 static void LDKListen_JCalls_free(void* this_arg) {
18154         LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
18155         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
18156                 JNIEnv *env;
18157                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
18158                 if (get_jenv_res == JNI_EDETACHED) {
18159                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
18160                 } else {
18161                         DO_ASSERT(get_jenv_res == JNI_OK);
18162                 }
18163                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
18164                 if (get_jenv_res == JNI_EDETACHED) {
18165                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
18166                 }
18167                 FREE(j_calls);
18168         }
18169 }
18170 void filtered_block_connected_LDKListen_jcall(const void* this_arg, const uint8_t (* header)[80], LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height) {
18171         LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
18172         JNIEnv *env;
18173         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
18174         if (get_jenv_res == JNI_EDETACHED) {
18175                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
18176         } else {
18177                 DO_ASSERT(get_jenv_res == JNI_OK);
18178         }
18179         int8_tArray header_arr = (*env)->NewByteArray(env, 80);
18180         (*env)->SetByteArrayRegion(env, header_arr, 0, 80, *header);
18181         LDKCVec_C2Tuple_usizeTransactionZZ txdata_var = txdata;
18182         int64_tArray txdata_arr = NULL;
18183         txdata_arr = (*env)->NewLongArray(env, txdata_var.datalen);
18184         int64_t *txdata_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, txdata_arr, NULL);
18185         for (size_t c = 0; c < txdata_var.datalen; c++) {
18186                 LDKC2Tuple_usizeTransactionZ* txdata_conv_28_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
18187                 *txdata_conv_28_conv = txdata_var.data[c];
18188                 txdata_arr_ptr[c] = tag_ptr(txdata_conv_28_conv, true);
18189         }
18190         (*env)->ReleasePrimitiveArrayCritical(env, txdata_arr, txdata_arr_ptr, 0);
18191         FREE(txdata_var.data);
18192         int32_t height_conv = height;
18193         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
18194         CHECK(obj != NULL);
18195         (*env)->CallVoidMethod(env, obj, j_calls->filtered_block_connected_meth, header_arr, txdata_arr, height_conv);
18196         if (UNLIKELY((*env)->ExceptionCheck(env))) {
18197                 (*env)->ExceptionDescribe(env);
18198                 (*env)->FatalError(env, "A call to filtered_block_connected in LDKListen from rust threw an exception.");
18199         }
18200         if (get_jenv_res == JNI_EDETACHED) {
18201                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
18202         }
18203 }
18204 void block_connected_LDKListen_jcall(const void* this_arg, LDKu8slice block, uint32_t height) {
18205         LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
18206         JNIEnv *env;
18207         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
18208         if (get_jenv_res == JNI_EDETACHED) {
18209                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
18210         } else {
18211                 DO_ASSERT(get_jenv_res == JNI_OK);
18212         }
18213         LDKu8slice block_var = block;
18214         int8_tArray block_arr = (*env)->NewByteArray(env, block_var.datalen);
18215         (*env)->SetByteArrayRegion(env, block_arr, 0, block_var.datalen, block_var.data);
18216         int32_t height_conv = height;
18217         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
18218         CHECK(obj != NULL);
18219         (*env)->CallVoidMethod(env, obj, j_calls->block_connected_meth, block_arr, height_conv);
18220         if (UNLIKELY((*env)->ExceptionCheck(env))) {
18221                 (*env)->ExceptionDescribe(env);
18222                 (*env)->FatalError(env, "A call to block_connected in LDKListen from rust threw an exception.");
18223         }
18224         if (get_jenv_res == JNI_EDETACHED) {
18225                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
18226         }
18227 }
18228 void block_disconnected_LDKListen_jcall(const void* this_arg, const uint8_t (* header)[80], uint32_t height) {
18229         LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
18230         JNIEnv *env;
18231         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
18232         if (get_jenv_res == JNI_EDETACHED) {
18233                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
18234         } else {
18235                 DO_ASSERT(get_jenv_res == JNI_OK);
18236         }
18237         int8_tArray header_arr = (*env)->NewByteArray(env, 80);
18238         (*env)->SetByteArrayRegion(env, header_arr, 0, 80, *header);
18239         int32_t height_conv = height;
18240         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
18241         CHECK(obj != NULL);
18242         (*env)->CallVoidMethod(env, obj, j_calls->block_disconnected_meth, header_arr, height_conv);
18243         if (UNLIKELY((*env)->ExceptionCheck(env))) {
18244                 (*env)->ExceptionDescribe(env);
18245                 (*env)->FatalError(env, "A call to block_disconnected in LDKListen from rust threw an exception.");
18246         }
18247         if (get_jenv_res == JNI_EDETACHED) {
18248                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
18249         }
18250 }
18251 static void LDKListen_JCalls_cloned(LDKListen* new_obj) {
18252         LDKListen_JCalls *j_calls = (LDKListen_JCalls*) new_obj->this_arg;
18253         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
18254 }
18255 static inline LDKListen LDKListen_init (JNIEnv *env, jclass clz, jobject o) {
18256         jclass c = (*env)->GetObjectClass(env, o);
18257         CHECK(c != NULL);
18258         LDKListen_JCalls *calls = MALLOC(sizeof(LDKListen_JCalls), "LDKListen_JCalls");
18259         atomic_init(&calls->refcnt, 1);
18260         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
18261         calls->o = (*env)->NewWeakGlobalRef(env, o);
18262         calls->filtered_block_connected_meth = (*env)->GetMethodID(env, c, "filtered_block_connected", "([B[JI)V");
18263         CHECK(calls->filtered_block_connected_meth != NULL);
18264         calls->block_connected_meth = (*env)->GetMethodID(env, c, "block_connected", "([BI)V");
18265         CHECK(calls->block_connected_meth != NULL);
18266         calls->block_disconnected_meth = (*env)->GetMethodID(env, c, "block_disconnected", "([BI)V");
18267         CHECK(calls->block_disconnected_meth != NULL);
18268
18269         LDKListen ret = {
18270                 .this_arg = (void*) calls,
18271                 .filtered_block_connected = filtered_block_connected_LDKListen_jcall,
18272                 .block_connected = block_connected_LDKListen_jcall,
18273                 .block_disconnected = block_disconnected_LDKListen_jcall,
18274                 .free = LDKListen_JCalls_free,
18275         };
18276         return ret;
18277 }
18278 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKListen_1new(JNIEnv *env, jclass clz, jobject o) {
18279         LDKListen *res_ptr = MALLOC(sizeof(LDKListen), "LDKListen");
18280         *res_ptr = LDKListen_init(env, clz, o);
18281         return tag_ptr(res_ptr, true);
18282 }
18283 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) {
18284         void* this_arg_ptr = untag_ptr(this_arg);
18285         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
18286         LDKListen* this_arg_conv = (LDKListen*)this_arg_ptr;
18287         uint8_t header_arr[80];
18288         CHECK((*env)->GetArrayLength(env, header) == 80);
18289         (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
18290         uint8_t (*header_ref)[80] = &header_arr;
18291         LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
18292         txdata_constr.datalen = (*env)->GetArrayLength(env, txdata);
18293         if (txdata_constr.datalen > 0)
18294                 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
18295         else
18296                 txdata_constr.data = NULL;
18297         int64_t* txdata_vals = (*env)->GetLongArrayElements (env, txdata, NULL);
18298         for (size_t c = 0; c < txdata_constr.datalen; c++) {
18299                 int64_t txdata_conv_28 = txdata_vals[c];
18300                 void* txdata_conv_28_ptr = untag_ptr(txdata_conv_28);
18301                 CHECK_ACCESS(txdata_conv_28_ptr);
18302                 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
18303                 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)untag_ptr(txdata_conv_28));
18304                 txdata_constr.data[c] = txdata_conv_28_conv;
18305         }
18306         (*env)->ReleaseLongArrayElements(env, txdata, txdata_vals, 0);
18307         (this_arg_conv->filtered_block_connected)(this_arg_conv->this_arg, header_ref, txdata_constr, height);
18308 }
18309
18310 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) {
18311         void* this_arg_ptr = untag_ptr(this_arg);
18312         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
18313         LDKListen* this_arg_conv = (LDKListen*)this_arg_ptr;
18314         LDKu8slice block_ref;
18315         block_ref.datalen = (*env)->GetArrayLength(env, block);
18316         block_ref.data = (*env)->GetByteArrayElements (env, block, NULL);
18317         (this_arg_conv->block_connected)(this_arg_conv->this_arg, block_ref, height);
18318         (*env)->ReleaseByteArrayElements(env, block, (int8_t*)block_ref.data, 0);
18319 }
18320
18321 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) {
18322         void* this_arg_ptr = untag_ptr(this_arg);
18323         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
18324         LDKListen* this_arg_conv = (LDKListen*)this_arg_ptr;
18325         uint8_t header_arr[80];
18326         CHECK((*env)->GetArrayLength(env, header) == 80);
18327         (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
18328         uint8_t (*header_ref)[80] = &header_arr;
18329         (this_arg_conv->block_disconnected)(this_arg_conv->this_arg, header_ref, height);
18330 }
18331
18332 typedef struct LDKConfirm_JCalls {
18333         atomic_size_t refcnt;
18334         JavaVM *vm;
18335         jweak o;
18336         jmethodID transactions_confirmed_meth;
18337         jmethodID transaction_unconfirmed_meth;
18338         jmethodID best_block_updated_meth;
18339         jmethodID get_relevant_txids_meth;
18340 } LDKConfirm_JCalls;
18341 static void LDKConfirm_JCalls_free(void* this_arg) {
18342         LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
18343         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
18344                 JNIEnv *env;
18345                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
18346                 if (get_jenv_res == JNI_EDETACHED) {
18347                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
18348                 } else {
18349                         DO_ASSERT(get_jenv_res == JNI_OK);
18350                 }
18351                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
18352                 if (get_jenv_res == JNI_EDETACHED) {
18353                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
18354                 }
18355                 FREE(j_calls);
18356         }
18357 }
18358 void transactions_confirmed_LDKConfirm_jcall(const void* this_arg, const uint8_t (* header)[80], LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height) {
18359         LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
18360         JNIEnv *env;
18361         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
18362         if (get_jenv_res == JNI_EDETACHED) {
18363                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
18364         } else {
18365                 DO_ASSERT(get_jenv_res == JNI_OK);
18366         }
18367         int8_tArray header_arr = (*env)->NewByteArray(env, 80);
18368         (*env)->SetByteArrayRegion(env, header_arr, 0, 80, *header);
18369         LDKCVec_C2Tuple_usizeTransactionZZ txdata_var = txdata;
18370         int64_tArray txdata_arr = NULL;
18371         txdata_arr = (*env)->NewLongArray(env, txdata_var.datalen);
18372         int64_t *txdata_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, txdata_arr, NULL);
18373         for (size_t c = 0; c < txdata_var.datalen; c++) {
18374                 LDKC2Tuple_usizeTransactionZ* txdata_conv_28_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
18375                 *txdata_conv_28_conv = txdata_var.data[c];
18376                 txdata_arr_ptr[c] = tag_ptr(txdata_conv_28_conv, true);
18377         }
18378         (*env)->ReleasePrimitiveArrayCritical(env, txdata_arr, txdata_arr_ptr, 0);
18379         FREE(txdata_var.data);
18380         int32_t height_conv = height;
18381         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
18382         CHECK(obj != NULL);
18383         (*env)->CallVoidMethod(env, obj, j_calls->transactions_confirmed_meth, header_arr, txdata_arr, height_conv);
18384         if (UNLIKELY((*env)->ExceptionCheck(env))) {
18385                 (*env)->ExceptionDescribe(env);
18386                 (*env)->FatalError(env, "A call to transactions_confirmed in LDKConfirm from rust threw an exception.");
18387         }
18388         if (get_jenv_res == JNI_EDETACHED) {
18389                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
18390         }
18391 }
18392 void transaction_unconfirmed_LDKConfirm_jcall(const void* this_arg, const uint8_t (* txid)[32]) {
18393         LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
18394         JNIEnv *env;
18395         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
18396         if (get_jenv_res == JNI_EDETACHED) {
18397                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
18398         } else {
18399                 DO_ASSERT(get_jenv_res == JNI_OK);
18400         }
18401         int8_tArray txid_arr = (*env)->NewByteArray(env, 32);
18402         (*env)->SetByteArrayRegion(env, txid_arr, 0, 32, *txid);
18403         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
18404         CHECK(obj != NULL);
18405         (*env)->CallVoidMethod(env, obj, j_calls->transaction_unconfirmed_meth, txid_arr);
18406         if (UNLIKELY((*env)->ExceptionCheck(env))) {
18407                 (*env)->ExceptionDescribe(env);
18408                 (*env)->FatalError(env, "A call to transaction_unconfirmed in LDKConfirm from rust threw an exception.");
18409         }
18410         if (get_jenv_res == JNI_EDETACHED) {
18411                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
18412         }
18413 }
18414 void best_block_updated_LDKConfirm_jcall(const void* this_arg, const uint8_t (* header)[80], uint32_t height) {
18415         LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
18416         JNIEnv *env;
18417         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
18418         if (get_jenv_res == JNI_EDETACHED) {
18419                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
18420         } else {
18421                 DO_ASSERT(get_jenv_res == JNI_OK);
18422         }
18423         int8_tArray header_arr = (*env)->NewByteArray(env, 80);
18424         (*env)->SetByteArrayRegion(env, header_arr, 0, 80, *header);
18425         int32_t height_conv = height;
18426         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
18427         CHECK(obj != NULL);
18428         (*env)->CallVoidMethod(env, obj, j_calls->best_block_updated_meth, header_arr, height_conv);
18429         if (UNLIKELY((*env)->ExceptionCheck(env))) {
18430                 (*env)->ExceptionDescribe(env);
18431                 (*env)->FatalError(env, "A call to best_block_updated in LDKConfirm from rust threw an exception.");
18432         }
18433         if (get_jenv_res == JNI_EDETACHED) {
18434                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
18435         }
18436 }
18437 LDKCVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ get_relevant_txids_LDKConfirm_jcall(const void* this_arg) {
18438         LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
18439         JNIEnv *env;
18440         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
18441         if (get_jenv_res == JNI_EDETACHED) {
18442                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
18443         } else {
18444                 DO_ASSERT(get_jenv_res == JNI_OK);
18445         }
18446         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
18447         CHECK(obj != NULL);
18448         int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_relevant_txids_meth);
18449         if (UNLIKELY((*env)->ExceptionCheck(env))) {
18450                 (*env)->ExceptionDescribe(env);
18451                 (*env)->FatalError(env, "A call to get_relevant_txids in LDKConfirm from rust threw an exception.");
18452         }
18453         LDKCVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ ret_constr;
18454         ret_constr.datalen = (*env)->GetArrayLength(env, ret);
18455         if (ret_constr.datalen > 0)
18456                 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ), "LDKCVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ Elements");
18457         else
18458                 ret_constr.data = NULL;
18459         int64_t* ret_vals = (*env)->GetLongArrayElements (env, ret, NULL);
18460         for (size_t c = 0; c < ret_constr.datalen; c++) {
18461                 int64_t ret_conv_54 = ret_vals[c];
18462                 void* ret_conv_54_ptr = untag_ptr(ret_conv_54);
18463                 CHECK_ACCESS(ret_conv_54_ptr);
18464                 LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ ret_conv_54_conv = *(LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ*)(ret_conv_54_ptr);
18465                 FREE(untag_ptr(ret_conv_54));
18466                 ret_constr.data[c] = ret_conv_54_conv;
18467         }
18468         (*env)->ReleaseLongArrayElements(env, ret, ret_vals, 0);
18469         if (get_jenv_res == JNI_EDETACHED) {
18470                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
18471         }
18472         return ret_constr;
18473 }
18474 static void LDKConfirm_JCalls_cloned(LDKConfirm* new_obj) {
18475         LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) new_obj->this_arg;
18476         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
18477 }
18478 static inline LDKConfirm LDKConfirm_init (JNIEnv *env, jclass clz, jobject o) {
18479         jclass c = (*env)->GetObjectClass(env, o);
18480         CHECK(c != NULL);
18481         LDKConfirm_JCalls *calls = MALLOC(sizeof(LDKConfirm_JCalls), "LDKConfirm_JCalls");
18482         atomic_init(&calls->refcnt, 1);
18483         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
18484         calls->o = (*env)->NewWeakGlobalRef(env, o);
18485         calls->transactions_confirmed_meth = (*env)->GetMethodID(env, c, "transactions_confirmed", "([B[JI)V");
18486         CHECK(calls->transactions_confirmed_meth != NULL);
18487         calls->transaction_unconfirmed_meth = (*env)->GetMethodID(env, c, "transaction_unconfirmed", "([B)V");
18488         CHECK(calls->transaction_unconfirmed_meth != NULL);
18489         calls->best_block_updated_meth = (*env)->GetMethodID(env, c, "best_block_updated", "([BI)V");
18490         CHECK(calls->best_block_updated_meth != NULL);
18491         calls->get_relevant_txids_meth = (*env)->GetMethodID(env, c, "get_relevant_txids", "()[J");
18492         CHECK(calls->get_relevant_txids_meth != NULL);
18493
18494         LDKConfirm ret = {
18495                 .this_arg = (void*) calls,
18496                 .transactions_confirmed = transactions_confirmed_LDKConfirm_jcall,
18497                 .transaction_unconfirmed = transaction_unconfirmed_LDKConfirm_jcall,
18498                 .best_block_updated = best_block_updated_LDKConfirm_jcall,
18499                 .get_relevant_txids = get_relevant_txids_LDKConfirm_jcall,
18500                 .free = LDKConfirm_JCalls_free,
18501         };
18502         return ret;
18503 }
18504 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKConfirm_1new(JNIEnv *env, jclass clz, jobject o) {
18505         LDKConfirm *res_ptr = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
18506         *res_ptr = LDKConfirm_init(env, clz, o);
18507         return tag_ptr(res_ptr, true);
18508 }
18509 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) {
18510         void* this_arg_ptr = untag_ptr(this_arg);
18511         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
18512         LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
18513         uint8_t header_arr[80];
18514         CHECK((*env)->GetArrayLength(env, header) == 80);
18515         (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
18516         uint8_t (*header_ref)[80] = &header_arr;
18517         LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
18518         txdata_constr.datalen = (*env)->GetArrayLength(env, txdata);
18519         if (txdata_constr.datalen > 0)
18520                 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
18521         else
18522                 txdata_constr.data = NULL;
18523         int64_t* txdata_vals = (*env)->GetLongArrayElements (env, txdata, NULL);
18524         for (size_t c = 0; c < txdata_constr.datalen; c++) {
18525                 int64_t txdata_conv_28 = txdata_vals[c];
18526                 void* txdata_conv_28_ptr = untag_ptr(txdata_conv_28);
18527                 CHECK_ACCESS(txdata_conv_28_ptr);
18528                 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
18529                 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)untag_ptr(txdata_conv_28));
18530                 txdata_constr.data[c] = txdata_conv_28_conv;
18531         }
18532         (*env)->ReleaseLongArrayElements(env, txdata, txdata_vals, 0);
18533         (this_arg_conv->transactions_confirmed)(this_arg_conv->this_arg, header_ref, txdata_constr, height);
18534 }
18535
18536 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Confirm_1transaction_1unconfirmed(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray txid) {
18537         void* this_arg_ptr = untag_ptr(this_arg);
18538         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
18539         LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
18540         uint8_t txid_arr[32];
18541         CHECK((*env)->GetArrayLength(env, txid) == 32);
18542         (*env)->GetByteArrayRegion(env, txid, 0, 32, txid_arr);
18543         uint8_t (*txid_ref)[32] = &txid_arr;
18544         (this_arg_conv->transaction_unconfirmed)(this_arg_conv->this_arg, txid_ref);
18545 }
18546
18547 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) {
18548         void* this_arg_ptr = untag_ptr(this_arg);
18549         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
18550         LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
18551         uint8_t header_arr[80];
18552         CHECK((*env)->GetArrayLength(env, header) == 80);
18553         (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
18554         uint8_t (*header_ref)[80] = &header_arr;
18555         (this_arg_conv->best_block_updated)(this_arg_conv->this_arg, header_ref, height);
18556 }
18557
18558 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_Confirm_1get_1relevant_1txids(JNIEnv *env, jclass clz, int64_t this_arg) {
18559         void* this_arg_ptr = untag_ptr(this_arg);
18560         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
18561         LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr;
18562         LDKCVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ ret_var = (this_arg_conv->get_relevant_txids)(this_arg_conv->this_arg);
18563         int64_tArray ret_arr = NULL;
18564         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
18565         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
18566         for (size_t c = 0; c < ret_var.datalen; c++) {
18567                 LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ* ret_conv_54_conv = MALLOC(sizeof(LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ), "LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ");
18568                 *ret_conv_54_conv = ret_var.data[c];
18569                 ret_arr_ptr[c] = tag_ptr(ret_conv_54_conv, true);
18570         }
18571         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
18572         FREE(ret_var.data);
18573         return ret_arr;
18574 }
18575
18576 static jclass LDKSpendingDelay_Relative_class = NULL;
18577 static jmethodID LDKSpendingDelay_Relative_meth = NULL;
18578 static jclass LDKSpendingDelay_Absolute_class = NULL;
18579 static jmethodID LDKSpendingDelay_Absolute_meth = NULL;
18580 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKSpendingDelay_init (JNIEnv *env, jclass clz) {
18581         LDKSpendingDelay_Relative_class =
18582                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSpendingDelay$Relative"));
18583         CHECK(LDKSpendingDelay_Relative_class != NULL);
18584         LDKSpendingDelay_Relative_meth = (*env)->GetMethodID(env, LDKSpendingDelay_Relative_class, "<init>", "(I)V");
18585         CHECK(LDKSpendingDelay_Relative_meth != NULL);
18586         LDKSpendingDelay_Absolute_class =
18587                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSpendingDelay$Absolute"));
18588         CHECK(LDKSpendingDelay_Absolute_class != NULL);
18589         LDKSpendingDelay_Absolute_meth = (*env)->GetMethodID(env, LDKSpendingDelay_Absolute_class, "<init>", "(I)V");
18590         CHECK(LDKSpendingDelay_Absolute_meth != NULL);
18591 }
18592 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKSpendingDelay_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
18593         LDKSpendingDelay *obj = (LDKSpendingDelay*)untag_ptr(ptr);
18594         switch(obj->tag) {
18595                 case LDKSpendingDelay_Relative: {
18596                         int32_t num_blocks_conv = obj->relative.num_blocks;
18597                         return (*env)->NewObject(env, LDKSpendingDelay_Relative_class, LDKSpendingDelay_Relative_meth, num_blocks_conv);
18598                 }
18599                 case LDKSpendingDelay_Absolute: {
18600                         int32_t height_conv = obj->absolute.height;
18601                         return (*env)->NewObject(env, LDKSpendingDelay_Absolute_class, LDKSpendingDelay_Absolute_meth, height_conv);
18602                 }
18603                 default: abort();
18604         }
18605 }
18606 typedef struct LDKFutureCallback_JCalls {
18607         atomic_size_t refcnt;
18608         JavaVM *vm;
18609         jweak o;
18610         jmethodID call_meth;
18611 } LDKFutureCallback_JCalls;
18612 static void LDKFutureCallback_JCalls_free(void* this_arg) {
18613         LDKFutureCallback_JCalls *j_calls = (LDKFutureCallback_JCalls*) this_arg;
18614         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
18615                 JNIEnv *env;
18616                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
18617                 if (get_jenv_res == JNI_EDETACHED) {
18618                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
18619                 } else {
18620                         DO_ASSERT(get_jenv_res == JNI_OK);
18621                 }
18622                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
18623                 if (get_jenv_res == JNI_EDETACHED) {
18624                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
18625                 }
18626                 FREE(j_calls);
18627         }
18628 }
18629 void call_LDKFutureCallback_jcall(const void* this_arg) {
18630         LDKFutureCallback_JCalls *j_calls = (LDKFutureCallback_JCalls*) this_arg;
18631         JNIEnv *env;
18632         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
18633         if (get_jenv_res == JNI_EDETACHED) {
18634                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
18635         } else {
18636                 DO_ASSERT(get_jenv_res == JNI_OK);
18637         }
18638         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
18639         CHECK(obj != NULL);
18640         (*env)->CallVoidMethod(env, obj, j_calls->call_meth);
18641         if (UNLIKELY((*env)->ExceptionCheck(env))) {
18642                 (*env)->ExceptionDescribe(env);
18643                 (*env)->FatalError(env, "A call to call in LDKFutureCallback from rust threw an exception.");
18644         }
18645         if (get_jenv_res == JNI_EDETACHED) {
18646                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
18647         }
18648 }
18649 static void LDKFutureCallback_JCalls_cloned(LDKFutureCallback* new_obj) {
18650         LDKFutureCallback_JCalls *j_calls = (LDKFutureCallback_JCalls*) new_obj->this_arg;
18651         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
18652 }
18653 static inline LDKFutureCallback LDKFutureCallback_init (JNIEnv *env, jclass clz, jobject o) {
18654         jclass c = (*env)->GetObjectClass(env, o);
18655         CHECK(c != NULL);
18656         LDKFutureCallback_JCalls *calls = MALLOC(sizeof(LDKFutureCallback_JCalls), "LDKFutureCallback_JCalls");
18657         atomic_init(&calls->refcnt, 1);
18658         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
18659         calls->o = (*env)->NewWeakGlobalRef(env, o);
18660         calls->call_meth = (*env)->GetMethodID(env, c, "call", "()V");
18661         CHECK(calls->call_meth != NULL);
18662
18663         LDKFutureCallback ret = {
18664                 .this_arg = (void*) calls,
18665                 .call = call_LDKFutureCallback_jcall,
18666                 .free = LDKFutureCallback_JCalls_free,
18667         };
18668         return ret;
18669 }
18670 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKFutureCallback_1new(JNIEnv *env, jclass clz, jobject o) {
18671         LDKFutureCallback *res_ptr = MALLOC(sizeof(LDKFutureCallback), "LDKFutureCallback");
18672         *res_ptr = LDKFutureCallback_init(env, clz, o);
18673         return tag_ptr(res_ptr, true);
18674 }
18675 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FutureCallback_1call(JNIEnv *env, jclass clz, int64_t this_arg) {
18676         void* this_arg_ptr = untag_ptr(this_arg);
18677         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
18678         LDKFutureCallback* this_arg_conv = (LDKFutureCallback*)this_arg_ptr;
18679         (this_arg_conv->call)(this_arg_conv->this_arg);
18680 }
18681
18682 typedef struct LDKEventHandler_JCalls {
18683         atomic_size_t refcnt;
18684         JavaVM *vm;
18685         jweak o;
18686         jmethodID handle_event_meth;
18687 } LDKEventHandler_JCalls;
18688 static void LDKEventHandler_JCalls_free(void* this_arg) {
18689         LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) this_arg;
18690         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
18691                 JNIEnv *env;
18692                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
18693                 if (get_jenv_res == JNI_EDETACHED) {
18694                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
18695                 } else {
18696                         DO_ASSERT(get_jenv_res == JNI_OK);
18697                 }
18698                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
18699                 if (get_jenv_res == JNI_EDETACHED) {
18700                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
18701                 }
18702                 FREE(j_calls);
18703         }
18704 }
18705 void handle_event_LDKEventHandler_jcall(const void* this_arg, LDKEvent event) {
18706         LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) this_arg;
18707         JNIEnv *env;
18708         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
18709         if (get_jenv_res == JNI_EDETACHED) {
18710                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
18711         } else {
18712                 DO_ASSERT(get_jenv_res == JNI_OK);
18713         }
18714         LDKEvent *event_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
18715         *event_copy = event;
18716         int64_t event_ref = tag_ptr(event_copy, true);
18717         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
18718         CHECK(obj != NULL);
18719         (*env)->CallVoidMethod(env, obj, j_calls->handle_event_meth, event_ref);
18720         if (UNLIKELY((*env)->ExceptionCheck(env))) {
18721                 (*env)->ExceptionDescribe(env);
18722                 (*env)->FatalError(env, "A call to handle_event in LDKEventHandler from rust threw an exception.");
18723         }
18724         if (get_jenv_res == JNI_EDETACHED) {
18725                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
18726         }
18727 }
18728 static void LDKEventHandler_JCalls_cloned(LDKEventHandler* new_obj) {
18729         LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) new_obj->this_arg;
18730         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
18731 }
18732 static inline LDKEventHandler LDKEventHandler_init (JNIEnv *env, jclass clz, jobject o) {
18733         jclass c = (*env)->GetObjectClass(env, o);
18734         CHECK(c != NULL);
18735         LDKEventHandler_JCalls *calls = MALLOC(sizeof(LDKEventHandler_JCalls), "LDKEventHandler_JCalls");
18736         atomic_init(&calls->refcnt, 1);
18737         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
18738         calls->o = (*env)->NewWeakGlobalRef(env, o);
18739         calls->handle_event_meth = (*env)->GetMethodID(env, c, "handle_event", "(J)V");
18740         CHECK(calls->handle_event_meth != NULL);
18741
18742         LDKEventHandler ret = {
18743                 .this_arg = (void*) calls,
18744                 .handle_event = handle_event_LDKEventHandler_jcall,
18745                 .free = LDKEventHandler_JCalls_free,
18746         };
18747         return ret;
18748 }
18749 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKEventHandler_1new(JNIEnv *env, jclass clz, jobject o) {
18750         LDKEventHandler *res_ptr = MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
18751         *res_ptr = LDKEventHandler_init(env, clz, o);
18752         return tag_ptr(res_ptr, true);
18753 }
18754 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EventHandler_1handle_1event(JNIEnv *env, jclass clz, int64_t this_arg, int64_t event) {
18755         void* this_arg_ptr = untag_ptr(this_arg);
18756         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
18757         LDKEventHandler* this_arg_conv = (LDKEventHandler*)this_arg_ptr;
18758         void* event_ptr = untag_ptr(event);
18759         CHECK_ACCESS(event_ptr);
18760         LDKEvent event_conv = *(LDKEvent*)(event_ptr);
18761         event_conv = Event_clone((LDKEvent*)untag_ptr(event));
18762         (this_arg_conv->handle_event)(this_arg_conv->this_arg, event_conv);
18763 }
18764
18765 typedef struct LDKEventsProvider_JCalls {
18766         atomic_size_t refcnt;
18767         JavaVM *vm;
18768         jweak o;
18769         jmethodID process_pending_events_meth;
18770 } LDKEventsProvider_JCalls;
18771 static void LDKEventsProvider_JCalls_free(void* this_arg) {
18772         LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
18773         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
18774                 JNIEnv *env;
18775                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
18776                 if (get_jenv_res == JNI_EDETACHED) {
18777                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
18778                 } else {
18779                         DO_ASSERT(get_jenv_res == JNI_OK);
18780                 }
18781                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
18782                 if (get_jenv_res == JNI_EDETACHED) {
18783                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
18784                 }
18785                 FREE(j_calls);
18786         }
18787 }
18788 void process_pending_events_LDKEventsProvider_jcall(const void* this_arg, LDKEventHandler handler) {
18789         LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
18790         JNIEnv *env;
18791         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
18792         if (get_jenv_res == JNI_EDETACHED) {
18793                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
18794         } else {
18795                 DO_ASSERT(get_jenv_res == JNI_OK);
18796         }
18797         LDKEventHandler* handler_ret = MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
18798         *handler_ret = handler;
18799         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
18800         CHECK(obj != NULL);
18801         (*env)->CallVoidMethod(env, obj, j_calls->process_pending_events_meth, tag_ptr(handler_ret, true));
18802         if (UNLIKELY((*env)->ExceptionCheck(env))) {
18803                 (*env)->ExceptionDescribe(env);
18804                 (*env)->FatalError(env, "A call to process_pending_events in LDKEventsProvider from rust threw an exception.");
18805         }
18806         if (get_jenv_res == JNI_EDETACHED) {
18807                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
18808         }
18809 }
18810 static void LDKEventsProvider_JCalls_cloned(LDKEventsProvider* new_obj) {
18811         LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) new_obj->this_arg;
18812         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
18813 }
18814 static inline LDKEventsProvider LDKEventsProvider_init (JNIEnv *env, jclass clz, jobject o) {
18815         jclass c = (*env)->GetObjectClass(env, o);
18816         CHECK(c != NULL);
18817         LDKEventsProvider_JCalls *calls = MALLOC(sizeof(LDKEventsProvider_JCalls), "LDKEventsProvider_JCalls");
18818         atomic_init(&calls->refcnt, 1);
18819         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
18820         calls->o = (*env)->NewWeakGlobalRef(env, o);
18821         calls->process_pending_events_meth = (*env)->GetMethodID(env, c, "process_pending_events", "(J)V");
18822         CHECK(calls->process_pending_events_meth != NULL);
18823
18824         LDKEventsProvider ret = {
18825                 .this_arg = (void*) calls,
18826                 .process_pending_events = process_pending_events_LDKEventsProvider_jcall,
18827                 .free = LDKEventsProvider_JCalls_free,
18828         };
18829         return ret;
18830 }
18831 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKEventsProvider_1new(JNIEnv *env, jclass clz, jobject o) {
18832         LDKEventsProvider *res_ptr = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
18833         *res_ptr = LDKEventsProvider_init(env, clz, o);
18834         return tag_ptr(res_ptr, true);
18835 }
18836 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EventsProvider_1process_1pending_1events(JNIEnv *env, jclass clz, int64_t this_arg, int64_t handler) {
18837         void* this_arg_ptr = untag_ptr(this_arg);
18838         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
18839         LDKEventsProvider* this_arg_conv = (LDKEventsProvider*)this_arg_ptr;
18840         void* handler_ptr = untag_ptr(handler);
18841         CHECK_ACCESS(handler_ptr);
18842         LDKEventHandler handler_conv = *(LDKEventHandler*)(handler_ptr);
18843         if (handler_conv.free == LDKEventHandler_JCalls_free) {
18844                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
18845                 LDKEventHandler_JCalls_cloned(&handler_conv);
18846         }
18847         (this_arg_conv->process_pending_events)(this_arg_conv->this_arg, handler_conv);
18848 }
18849
18850 static jclass LDKFailureCode_TemporaryNodeFailure_class = NULL;
18851 static jmethodID LDKFailureCode_TemporaryNodeFailure_meth = NULL;
18852 static jclass LDKFailureCode_RequiredNodeFeatureMissing_class = NULL;
18853 static jmethodID LDKFailureCode_RequiredNodeFeatureMissing_meth = NULL;
18854 static jclass LDKFailureCode_IncorrectOrUnknownPaymentDetails_class = NULL;
18855 static jmethodID LDKFailureCode_IncorrectOrUnknownPaymentDetails_meth = NULL;
18856 static jclass LDKFailureCode_InvalidOnionPayload_class = NULL;
18857 static jmethodID LDKFailureCode_InvalidOnionPayload_meth = NULL;
18858 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKFailureCode_init (JNIEnv *env, jclass clz) {
18859         LDKFailureCode_TemporaryNodeFailure_class =
18860                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKFailureCode$TemporaryNodeFailure"));
18861         CHECK(LDKFailureCode_TemporaryNodeFailure_class != NULL);
18862         LDKFailureCode_TemporaryNodeFailure_meth = (*env)->GetMethodID(env, LDKFailureCode_TemporaryNodeFailure_class, "<init>", "()V");
18863         CHECK(LDKFailureCode_TemporaryNodeFailure_meth != NULL);
18864         LDKFailureCode_RequiredNodeFeatureMissing_class =
18865                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKFailureCode$RequiredNodeFeatureMissing"));
18866         CHECK(LDKFailureCode_RequiredNodeFeatureMissing_class != NULL);
18867         LDKFailureCode_RequiredNodeFeatureMissing_meth = (*env)->GetMethodID(env, LDKFailureCode_RequiredNodeFeatureMissing_class, "<init>", "()V");
18868         CHECK(LDKFailureCode_RequiredNodeFeatureMissing_meth != NULL);
18869         LDKFailureCode_IncorrectOrUnknownPaymentDetails_class =
18870                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKFailureCode$IncorrectOrUnknownPaymentDetails"));
18871         CHECK(LDKFailureCode_IncorrectOrUnknownPaymentDetails_class != NULL);
18872         LDKFailureCode_IncorrectOrUnknownPaymentDetails_meth = (*env)->GetMethodID(env, LDKFailureCode_IncorrectOrUnknownPaymentDetails_class, "<init>", "()V");
18873         CHECK(LDKFailureCode_IncorrectOrUnknownPaymentDetails_meth != NULL);
18874         LDKFailureCode_InvalidOnionPayload_class =
18875                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKFailureCode$InvalidOnionPayload"));
18876         CHECK(LDKFailureCode_InvalidOnionPayload_class != NULL);
18877         LDKFailureCode_InvalidOnionPayload_meth = (*env)->GetMethodID(env, LDKFailureCode_InvalidOnionPayload_class, "<init>", "(J)V");
18878         CHECK(LDKFailureCode_InvalidOnionPayload_meth != NULL);
18879 }
18880 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKFailureCode_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
18881         LDKFailureCode *obj = (LDKFailureCode*)untag_ptr(ptr);
18882         switch(obj->tag) {
18883                 case LDKFailureCode_TemporaryNodeFailure: {
18884                         return (*env)->NewObject(env, LDKFailureCode_TemporaryNodeFailure_class, LDKFailureCode_TemporaryNodeFailure_meth);
18885                 }
18886                 case LDKFailureCode_RequiredNodeFeatureMissing: {
18887                         return (*env)->NewObject(env, LDKFailureCode_RequiredNodeFeatureMissing_class, LDKFailureCode_RequiredNodeFeatureMissing_meth);
18888                 }
18889                 case LDKFailureCode_IncorrectOrUnknownPaymentDetails: {
18890                         return (*env)->NewObject(env, LDKFailureCode_IncorrectOrUnknownPaymentDetails_class, LDKFailureCode_IncorrectOrUnknownPaymentDetails_meth);
18891                 }
18892                 case LDKFailureCode_InvalidOnionPayload: {
18893                         int64_t invalid_onion_payload_ref = tag_ptr(&obj->invalid_onion_payload, false);
18894                         return (*env)->NewObject(env, LDKFailureCode_InvalidOnionPayload_class, LDKFailureCode_InvalidOnionPayload_meth, invalid_onion_payload_ref);
18895                 }
18896                 default: abort();
18897         }
18898 }
18899 typedef struct LDKMessageSendEventsProvider_JCalls {
18900         atomic_size_t refcnt;
18901         JavaVM *vm;
18902         jweak o;
18903         jmethodID get_and_clear_pending_msg_events_meth;
18904 } LDKMessageSendEventsProvider_JCalls;
18905 static void LDKMessageSendEventsProvider_JCalls_free(void* this_arg) {
18906         LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
18907         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
18908                 JNIEnv *env;
18909                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
18910                 if (get_jenv_res == JNI_EDETACHED) {
18911                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
18912                 } else {
18913                         DO_ASSERT(get_jenv_res == JNI_OK);
18914                 }
18915                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
18916                 if (get_jenv_res == JNI_EDETACHED) {
18917                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
18918                 }
18919                 FREE(j_calls);
18920         }
18921 }
18922 LDKCVec_MessageSendEventZ get_and_clear_pending_msg_events_LDKMessageSendEventsProvider_jcall(const void* this_arg) {
18923         LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
18924         JNIEnv *env;
18925         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
18926         if (get_jenv_res == JNI_EDETACHED) {
18927                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
18928         } else {
18929                 DO_ASSERT(get_jenv_res == JNI_OK);
18930         }
18931         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
18932         CHECK(obj != NULL);
18933         int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_and_clear_pending_msg_events_meth);
18934         if (UNLIKELY((*env)->ExceptionCheck(env))) {
18935                 (*env)->ExceptionDescribe(env);
18936                 (*env)->FatalError(env, "A call to get_and_clear_pending_msg_events in LDKMessageSendEventsProvider from rust threw an exception.");
18937         }
18938         LDKCVec_MessageSendEventZ ret_constr;
18939         ret_constr.datalen = (*env)->GetArrayLength(env, ret);
18940         if (ret_constr.datalen > 0)
18941                 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKMessageSendEvent), "LDKCVec_MessageSendEventZ Elements");
18942         else
18943                 ret_constr.data = NULL;
18944         int64_t* ret_vals = (*env)->GetLongArrayElements (env, ret, NULL);
18945         for (size_t s = 0; s < ret_constr.datalen; s++) {
18946                 int64_t ret_conv_18 = ret_vals[s];
18947                 void* ret_conv_18_ptr = untag_ptr(ret_conv_18);
18948                 CHECK_ACCESS(ret_conv_18_ptr);
18949                 LDKMessageSendEvent ret_conv_18_conv = *(LDKMessageSendEvent*)(ret_conv_18_ptr);
18950                 FREE(untag_ptr(ret_conv_18));
18951                 ret_constr.data[s] = ret_conv_18_conv;
18952         }
18953         (*env)->ReleaseLongArrayElements(env, ret, ret_vals, 0);
18954         if (get_jenv_res == JNI_EDETACHED) {
18955                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
18956         }
18957         return ret_constr;
18958 }
18959 static void LDKMessageSendEventsProvider_JCalls_cloned(LDKMessageSendEventsProvider* new_obj) {
18960         LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) new_obj->this_arg;
18961         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
18962 }
18963 static inline LDKMessageSendEventsProvider LDKMessageSendEventsProvider_init (JNIEnv *env, jclass clz, jobject o) {
18964         jclass c = (*env)->GetObjectClass(env, o);
18965         CHECK(c != NULL);
18966         LDKMessageSendEventsProvider_JCalls *calls = MALLOC(sizeof(LDKMessageSendEventsProvider_JCalls), "LDKMessageSendEventsProvider_JCalls");
18967         atomic_init(&calls->refcnt, 1);
18968         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
18969         calls->o = (*env)->NewWeakGlobalRef(env, o);
18970         calls->get_and_clear_pending_msg_events_meth = (*env)->GetMethodID(env, c, "get_and_clear_pending_msg_events", "()[J");
18971         CHECK(calls->get_and_clear_pending_msg_events_meth != NULL);
18972
18973         LDKMessageSendEventsProvider ret = {
18974                 .this_arg = (void*) calls,
18975                 .get_and_clear_pending_msg_events = get_and_clear_pending_msg_events_LDKMessageSendEventsProvider_jcall,
18976                 .free = LDKMessageSendEventsProvider_JCalls_free,
18977         };
18978         return ret;
18979 }
18980 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKMessageSendEventsProvider_1new(JNIEnv *env, jclass clz, jobject o) {
18981         LDKMessageSendEventsProvider *res_ptr = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
18982         *res_ptr = LDKMessageSendEventsProvider_init(env, clz, o);
18983         return tag_ptr(res_ptr, true);
18984 }
18985 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_MessageSendEventsProvider_1get_1and_1clear_1pending_1msg_1events(JNIEnv *env, jclass clz, int64_t this_arg) {
18986         void* this_arg_ptr = untag_ptr(this_arg);
18987         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
18988         LDKMessageSendEventsProvider* this_arg_conv = (LDKMessageSendEventsProvider*)this_arg_ptr;
18989         LDKCVec_MessageSendEventZ ret_var = (this_arg_conv->get_and_clear_pending_msg_events)(this_arg_conv->this_arg);
18990         int64_tArray ret_arr = NULL;
18991         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
18992         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
18993         for (size_t s = 0; s < ret_var.datalen; s++) {
18994                 LDKMessageSendEvent *ret_conv_18_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
18995                 *ret_conv_18_copy = ret_var.data[s];
18996                 int64_t ret_conv_18_ref = tag_ptr(ret_conv_18_copy, true);
18997                 ret_arr_ptr[s] = ret_conv_18_ref;
18998         }
18999         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
19000         FREE(ret_var.data);
19001         return ret_arr;
19002 }
19003
19004 typedef struct LDKChannelMessageHandler_JCalls {
19005         atomic_size_t refcnt;
19006         JavaVM *vm;
19007         jweak o;
19008         LDKMessageSendEventsProvider_JCalls* MessageSendEventsProvider;
19009         jmethodID handle_open_channel_meth;
19010         jmethodID handle_open_channel_v2_meth;
19011         jmethodID handle_accept_channel_meth;
19012         jmethodID handle_accept_channel_v2_meth;
19013         jmethodID handle_funding_created_meth;
19014         jmethodID handle_funding_signed_meth;
19015         jmethodID handle_channel_ready_meth;
19016         jmethodID handle_shutdown_meth;
19017         jmethodID handle_closing_signed_meth;
19018         jmethodID handle_stfu_meth;
19019         jmethodID handle_tx_add_input_meth;
19020         jmethodID handle_tx_add_output_meth;
19021         jmethodID handle_tx_remove_input_meth;
19022         jmethodID handle_tx_remove_output_meth;
19023         jmethodID handle_tx_complete_meth;
19024         jmethodID handle_tx_signatures_meth;
19025         jmethodID handle_tx_init_rbf_meth;
19026         jmethodID handle_tx_ack_rbf_meth;
19027         jmethodID handle_tx_abort_meth;
19028         jmethodID handle_update_add_htlc_meth;
19029         jmethodID handle_update_fulfill_htlc_meth;
19030         jmethodID handle_update_fail_htlc_meth;
19031         jmethodID handle_update_fail_malformed_htlc_meth;
19032         jmethodID handle_commitment_signed_meth;
19033         jmethodID handle_revoke_and_ack_meth;
19034         jmethodID handle_update_fee_meth;
19035         jmethodID handle_announcement_signatures_meth;
19036         jmethodID peer_disconnected_meth;
19037         jmethodID peer_connected_meth;
19038         jmethodID handle_channel_reestablish_meth;
19039         jmethodID handle_channel_update_meth;
19040         jmethodID handle_error_meth;
19041         jmethodID provided_node_features_meth;
19042         jmethodID provided_init_features_meth;
19043         jmethodID get_chain_hashes_meth;
19044 } LDKChannelMessageHandler_JCalls;
19045 static void LDKChannelMessageHandler_JCalls_free(void* this_arg) {
19046         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
19047         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
19048                 JNIEnv *env;
19049                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
19050                 if (get_jenv_res == JNI_EDETACHED) {
19051                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
19052                 } else {
19053                         DO_ASSERT(get_jenv_res == JNI_OK);
19054                 }
19055                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
19056                 if (get_jenv_res == JNI_EDETACHED) {
19057                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
19058                 }
19059                 FREE(j_calls);
19060         }
19061 }
19062 void handle_open_channel_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKOpenChannel * msg) {
19063         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
19064         JNIEnv *env;
19065         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
19066         if (get_jenv_res == JNI_EDETACHED) {
19067                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
19068         } else {
19069                 DO_ASSERT(get_jenv_res == JNI_OK);
19070         }
19071         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
19072         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
19073         LDKOpenChannel msg_var = *msg;
19074         int64_t msg_ref = 0;
19075         msg_var = OpenChannel_clone(&msg_var);
19076         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
19077         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
19078         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
19079         CHECK(obj != NULL);
19080         (*env)->CallVoidMethod(env, obj, j_calls->handle_open_channel_meth, their_node_id_arr, msg_ref);
19081         if (UNLIKELY((*env)->ExceptionCheck(env))) {
19082                 (*env)->ExceptionDescribe(env);
19083                 (*env)->FatalError(env, "A call to handle_open_channel in LDKChannelMessageHandler from rust threw an exception.");
19084         }
19085         if (get_jenv_res == JNI_EDETACHED) {
19086                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
19087         }
19088 }
19089 void handle_open_channel_v2_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKOpenChannelV2 * msg) {
19090         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
19091         JNIEnv *env;
19092         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
19093         if (get_jenv_res == JNI_EDETACHED) {
19094                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
19095         } else {
19096                 DO_ASSERT(get_jenv_res == JNI_OK);
19097         }
19098         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
19099         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
19100         LDKOpenChannelV2 msg_var = *msg;
19101         int64_t msg_ref = 0;
19102         msg_var = OpenChannelV2_clone(&msg_var);
19103         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
19104         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
19105         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
19106         CHECK(obj != NULL);
19107         (*env)->CallVoidMethod(env, obj, j_calls->handle_open_channel_v2_meth, their_node_id_arr, msg_ref);
19108         if (UNLIKELY((*env)->ExceptionCheck(env))) {
19109                 (*env)->ExceptionDescribe(env);
19110                 (*env)->FatalError(env, "A call to handle_open_channel_v2 in LDKChannelMessageHandler from rust threw an exception.");
19111         }
19112         if (get_jenv_res == JNI_EDETACHED) {
19113                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
19114         }
19115 }
19116 void handle_accept_channel_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKAcceptChannel * msg) {
19117         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
19118         JNIEnv *env;
19119         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
19120         if (get_jenv_res == JNI_EDETACHED) {
19121                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
19122         } else {
19123                 DO_ASSERT(get_jenv_res == JNI_OK);
19124         }
19125         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
19126         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
19127         LDKAcceptChannel msg_var = *msg;
19128         int64_t msg_ref = 0;
19129         msg_var = AcceptChannel_clone(&msg_var);
19130         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
19131         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
19132         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
19133         CHECK(obj != NULL);
19134         (*env)->CallVoidMethod(env, obj, j_calls->handle_accept_channel_meth, their_node_id_arr, msg_ref);
19135         if (UNLIKELY((*env)->ExceptionCheck(env))) {
19136                 (*env)->ExceptionDescribe(env);
19137                 (*env)->FatalError(env, "A call to handle_accept_channel in LDKChannelMessageHandler from rust threw an exception.");
19138         }
19139         if (get_jenv_res == JNI_EDETACHED) {
19140                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
19141         }
19142 }
19143 void handle_accept_channel_v2_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKAcceptChannelV2 * msg) {
19144         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
19145         JNIEnv *env;
19146         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
19147         if (get_jenv_res == JNI_EDETACHED) {
19148                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
19149         } else {
19150                 DO_ASSERT(get_jenv_res == JNI_OK);
19151         }
19152         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
19153         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
19154         LDKAcceptChannelV2 msg_var = *msg;
19155         int64_t msg_ref = 0;
19156         msg_var = AcceptChannelV2_clone(&msg_var);
19157         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
19158         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
19159         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
19160         CHECK(obj != NULL);
19161         (*env)->CallVoidMethod(env, obj, j_calls->handle_accept_channel_v2_meth, their_node_id_arr, msg_ref);
19162         if (UNLIKELY((*env)->ExceptionCheck(env))) {
19163                 (*env)->ExceptionDescribe(env);
19164                 (*env)->FatalError(env, "A call to handle_accept_channel_v2 in LDKChannelMessageHandler from rust threw an exception.");
19165         }
19166         if (get_jenv_res == JNI_EDETACHED) {
19167                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
19168         }
19169 }
19170 void handle_funding_created_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingCreated * msg) {
19171         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
19172         JNIEnv *env;
19173         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
19174         if (get_jenv_res == JNI_EDETACHED) {
19175                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
19176         } else {
19177                 DO_ASSERT(get_jenv_res == JNI_OK);
19178         }
19179         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
19180         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
19181         LDKFundingCreated msg_var = *msg;
19182         int64_t msg_ref = 0;
19183         msg_var = FundingCreated_clone(&msg_var);
19184         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
19185         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
19186         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
19187         CHECK(obj != NULL);
19188         (*env)->CallVoidMethod(env, obj, j_calls->handle_funding_created_meth, their_node_id_arr, msg_ref);
19189         if (UNLIKELY((*env)->ExceptionCheck(env))) {
19190                 (*env)->ExceptionDescribe(env);
19191                 (*env)->FatalError(env, "A call to handle_funding_created in LDKChannelMessageHandler from rust threw an exception.");
19192         }
19193         if (get_jenv_res == JNI_EDETACHED) {
19194                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
19195         }
19196 }
19197 void handle_funding_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingSigned * msg) {
19198         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
19199         JNIEnv *env;
19200         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
19201         if (get_jenv_res == JNI_EDETACHED) {
19202                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
19203         } else {
19204                 DO_ASSERT(get_jenv_res == JNI_OK);
19205         }
19206         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
19207         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
19208         LDKFundingSigned msg_var = *msg;
19209         int64_t msg_ref = 0;
19210         msg_var = FundingSigned_clone(&msg_var);
19211         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
19212         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
19213         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
19214         CHECK(obj != NULL);
19215         (*env)->CallVoidMethod(env, obj, j_calls->handle_funding_signed_meth, their_node_id_arr, msg_ref);
19216         if (UNLIKELY((*env)->ExceptionCheck(env))) {
19217                 (*env)->ExceptionDescribe(env);
19218                 (*env)->FatalError(env, "A call to handle_funding_signed in LDKChannelMessageHandler from rust threw an exception.");
19219         }
19220         if (get_jenv_res == JNI_EDETACHED) {
19221                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
19222         }
19223 }
19224 void handle_channel_ready_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelReady * msg) {
19225         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
19226         JNIEnv *env;
19227         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
19228         if (get_jenv_res == JNI_EDETACHED) {
19229                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
19230         } else {
19231                 DO_ASSERT(get_jenv_res == JNI_OK);
19232         }
19233         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
19234         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
19235         LDKChannelReady msg_var = *msg;
19236         int64_t msg_ref = 0;
19237         msg_var = ChannelReady_clone(&msg_var);
19238         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
19239         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
19240         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
19241         CHECK(obj != NULL);
19242         (*env)->CallVoidMethod(env, obj, j_calls->handle_channel_ready_meth, their_node_id_arr, msg_ref);
19243         if (UNLIKELY((*env)->ExceptionCheck(env))) {
19244                 (*env)->ExceptionDescribe(env);
19245                 (*env)->FatalError(env, "A call to handle_channel_ready in LDKChannelMessageHandler from rust threw an exception.");
19246         }
19247         if (get_jenv_res == JNI_EDETACHED) {
19248                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
19249         }
19250 }
19251 void handle_shutdown_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKShutdown * msg) {
19252         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
19253         JNIEnv *env;
19254         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
19255         if (get_jenv_res == JNI_EDETACHED) {
19256                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
19257         } else {
19258                 DO_ASSERT(get_jenv_res == JNI_OK);
19259         }
19260         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
19261         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
19262         LDKShutdown msg_var = *msg;
19263         int64_t msg_ref = 0;
19264         msg_var = Shutdown_clone(&msg_var);
19265         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
19266         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
19267         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
19268         CHECK(obj != NULL);
19269         (*env)->CallVoidMethod(env, obj, j_calls->handle_shutdown_meth, their_node_id_arr, msg_ref);
19270         if (UNLIKELY((*env)->ExceptionCheck(env))) {
19271                 (*env)->ExceptionDescribe(env);
19272                 (*env)->FatalError(env, "A call to handle_shutdown in LDKChannelMessageHandler from rust threw an exception.");
19273         }
19274         if (get_jenv_res == JNI_EDETACHED) {
19275                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
19276         }
19277 }
19278 void handle_closing_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKClosingSigned * msg) {
19279         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
19280         JNIEnv *env;
19281         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
19282         if (get_jenv_res == JNI_EDETACHED) {
19283                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
19284         } else {
19285                 DO_ASSERT(get_jenv_res == JNI_OK);
19286         }
19287         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
19288         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
19289         LDKClosingSigned msg_var = *msg;
19290         int64_t msg_ref = 0;
19291         msg_var = ClosingSigned_clone(&msg_var);
19292         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
19293         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
19294         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
19295         CHECK(obj != NULL);
19296         (*env)->CallVoidMethod(env, obj, j_calls->handle_closing_signed_meth, their_node_id_arr, msg_ref);
19297         if (UNLIKELY((*env)->ExceptionCheck(env))) {
19298                 (*env)->ExceptionDescribe(env);
19299                 (*env)->FatalError(env, "A call to handle_closing_signed in LDKChannelMessageHandler from rust threw an exception.");
19300         }
19301         if (get_jenv_res == JNI_EDETACHED) {
19302                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
19303         }
19304 }
19305 void handle_stfu_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKStfu * msg) {
19306         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
19307         JNIEnv *env;
19308         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
19309         if (get_jenv_res == JNI_EDETACHED) {
19310                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
19311         } else {
19312                 DO_ASSERT(get_jenv_res == JNI_OK);
19313         }
19314         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
19315         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
19316         LDKStfu msg_var = *msg;
19317         int64_t msg_ref = 0;
19318         msg_var = Stfu_clone(&msg_var);
19319         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
19320         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
19321         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
19322         CHECK(obj != NULL);
19323         (*env)->CallVoidMethod(env, obj, j_calls->handle_stfu_meth, their_node_id_arr, msg_ref);
19324         if (UNLIKELY((*env)->ExceptionCheck(env))) {
19325                 (*env)->ExceptionDescribe(env);
19326                 (*env)->FatalError(env, "A call to handle_stfu in LDKChannelMessageHandler from rust threw an exception.");
19327         }
19328         if (get_jenv_res == JNI_EDETACHED) {
19329                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
19330         }
19331 }
19332 void handle_tx_add_input_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKTxAddInput * msg) {
19333         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
19334         JNIEnv *env;
19335         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
19336         if (get_jenv_res == JNI_EDETACHED) {
19337                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
19338         } else {
19339                 DO_ASSERT(get_jenv_res == JNI_OK);
19340         }
19341         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
19342         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
19343         LDKTxAddInput msg_var = *msg;
19344         int64_t msg_ref = 0;
19345         msg_var = TxAddInput_clone(&msg_var);
19346         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
19347         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
19348         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
19349         CHECK(obj != NULL);
19350         (*env)->CallVoidMethod(env, obj, j_calls->handle_tx_add_input_meth, their_node_id_arr, msg_ref);
19351         if (UNLIKELY((*env)->ExceptionCheck(env))) {
19352                 (*env)->ExceptionDescribe(env);
19353                 (*env)->FatalError(env, "A call to handle_tx_add_input in LDKChannelMessageHandler from rust threw an exception.");
19354         }
19355         if (get_jenv_res == JNI_EDETACHED) {
19356                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
19357         }
19358 }
19359 void handle_tx_add_output_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKTxAddOutput * msg) {
19360         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
19361         JNIEnv *env;
19362         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
19363         if (get_jenv_res == JNI_EDETACHED) {
19364                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
19365         } else {
19366                 DO_ASSERT(get_jenv_res == JNI_OK);
19367         }
19368         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
19369         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
19370         LDKTxAddOutput msg_var = *msg;
19371         int64_t msg_ref = 0;
19372         msg_var = TxAddOutput_clone(&msg_var);
19373         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
19374         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
19375         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
19376         CHECK(obj != NULL);
19377         (*env)->CallVoidMethod(env, obj, j_calls->handle_tx_add_output_meth, their_node_id_arr, msg_ref);
19378         if (UNLIKELY((*env)->ExceptionCheck(env))) {
19379                 (*env)->ExceptionDescribe(env);
19380                 (*env)->FatalError(env, "A call to handle_tx_add_output in LDKChannelMessageHandler from rust threw an exception.");
19381         }
19382         if (get_jenv_res == JNI_EDETACHED) {
19383                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
19384         }
19385 }
19386 void handle_tx_remove_input_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKTxRemoveInput * msg) {
19387         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
19388         JNIEnv *env;
19389         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
19390         if (get_jenv_res == JNI_EDETACHED) {
19391                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
19392         } else {
19393                 DO_ASSERT(get_jenv_res == JNI_OK);
19394         }
19395         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
19396         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
19397         LDKTxRemoveInput msg_var = *msg;
19398         int64_t msg_ref = 0;
19399         msg_var = TxRemoveInput_clone(&msg_var);
19400         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
19401         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
19402         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
19403         CHECK(obj != NULL);
19404         (*env)->CallVoidMethod(env, obj, j_calls->handle_tx_remove_input_meth, their_node_id_arr, msg_ref);
19405         if (UNLIKELY((*env)->ExceptionCheck(env))) {
19406                 (*env)->ExceptionDescribe(env);
19407                 (*env)->FatalError(env, "A call to handle_tx_remove_input in LDKChannelMessageHandler from rust threw an exception.");
19408         }
19409         if (get_jenv_res == JNI_EDETACHED) {
19410                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
19411         }
19412 }
19413 void handle_tx_remove_output_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKTxRemoveOutput * msg) {
19414         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
19415         JNIEnv *env;
19416         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
19417         if (get_jenv_res == JNI_EDETACHED) {
19418                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
19419         } else {
19420                 DO_ASSERT(get_jenv_res == JNI_OK);
19421         }
19422         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
19423         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
19424         LDKTxRemoveOutput msg_var = *msg;
19425         int64_t msg_ref = 0;
19426         msg_var = TxRemoveOutput_clone(&msg_var);
19427         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
19428         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
19429         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
19430         CHECK(obj != NULL);
19431         (*env)->CallVoidMethod(env, obj, j_calls->handle_tx_remove_output_meth, their_node_id_arr, msg_ref);
19432         if (UNLIKELY((*env)->ExceptionCheck(env))) {
19433                 (*env)->ExceptionDescribe(env);
19434                 (*env)->FatalError(env, "A call to handle_tx_remove_output in LDKChannelMessageHandler from rust threw an exception.");
19435         }
19436         if (get_jenv_res == JNI_EDETACHED) {
19437                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
19438         }
19439 }
19440 void handle_tx_complete_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKTxComplete * msg) {
19441         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
19442         JNIEnv *env;
19443         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
19444         if (get_jenv_res == JNI_EDETACHED) {
19445                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
19446         } else {
19447                 DO_ASSERT(get_jenv_res == JNI_OK);
19448         }
19449         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
19450         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
19451         LDKTxComplete msg_var = *msg;
19452         int64_t msg_ref = 0;
19453         msg_var = TxComplete_clone(&msg_var);
19454         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
19455         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
19456         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
19457         CHECK(obj != NULL);
19458         (*env)->CallVoidMethod(env, obj, j_calls->handle_tx_complete_meth, their_node_id_arr, msg_ref);
19459         if (UNLIKELY((*env)->ExceptionCheck(env))) {
19460                 (*env)->ExceptionDescribe(env);
19461                 (*env)->FatalError(env, "A call to handle_tx_complete in LDKChannelMessageHandler from rust threw an exception.");
19462         }
19463         if (get_jenv_res == JNI_EDETACHED) {
19464                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
19465         }
19466 }
19467 void handle_tx_signatures_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKTxSignatures * msg) {
19468         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
19469         JNIEnv *env;
19470         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
19471         if (get_jenv_res == JNI_EDETACHED) {
19472                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
19473         } else {
19474                 DO_ASSERT(get_jenv_res == JNI_OK);
19475         }
19476         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
19477         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
19478         LDKTxSignatures msg_var = *msg;
19479         int64_t msg_ref = 0;
19480         msg_var = TxSignatures_clone(&msg_var);
19481         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
19482         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
19483         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
19484         CHECK(obj != NULL);
19485         (*env)->CallVoidMethod(env, obj, j_calls->handle_tx_signatures_meth, their_node_id_arr, msg_ref);
19486         if (UNLIKELY((*env)->ExceptionCheck(env))) {
19487                 (*env)->ExceptionDescribe(env);
19488                 (*env)->FatalError(env, "A call to handle_tx_signatures in LDKChannelMessageHandler from rust threw an exception.");
19489         }
19490         if (get_jenv_res == JNI_EDETACHED) {
19491                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
19492         }
19493 }
19494 void handle_tx_init_rbf_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKTxInitRbf * msg) {
19495         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
19496         JNIEnv *env;
19497         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
19498         if (get_jenv_res == JNI_EDETACHED) {
19499                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
19500         } else {
19501                 DO_ASSERT(get_jenv_res == JNI_OK);
19502         }
19503         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
19504         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
19505         LDKTxInitRbf msg_var = *msg;
19506         int64_t msg_ref = 0;
19507         msg_var = TxInitRbf_clone(&msg_var);
19508         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
19509         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
19510         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
19511         CHECK(obj != NULL);
19512         (*env)->CallVoidMethod(env, obj, j_calls->handle_tx_init_rbf_meth, their_node_id_arr, msg_ref);
19513         if (UNLIKELY((*env)->ExceptionCheck(env))) {
19514                 (*env)->ExceptionDescribe(env);
19515                 (*env)->FatalError(env, "A call to handle_tx_init_rbf in LDKChannelMessageHandler from rust threw an exception.");
19516         }
19517         if (get_jenv_res == JNI_EDETACHED) {
19518                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
19519         }
19520 }
19521 void handle_tx_ack_rbf_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKTxAckRbf * msg) {
19522         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
19523         JNIEnv *env;
19524         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
19525         if (get_jenv_res == JNI_EDETACHED) {
19526                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
19527         } else {
19528                 DO_ASSERT(get_jenv_res == JNI_OK);
19529         }
19530         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
19531         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
19532         LDKTxAckRbf msg_var = *msg;
19533         int64_t msg_ref = 0;
19534         msg_var = TxAckRbf_clone(&msg_var);
19535         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
19536         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
19537         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
19538         CHECK(obj != NULL);
19539         (*env)->CallVoidMethod(env, obj, j_calls->handle_tx_ack_rbf_meth, their_node_id_arr, msg_ref);
19540         if (UNLIKELY((*env)->ExceptionCheck(env))) {
19541                 (*env)->ExceptionDescribe(env);
19542                 (*env)->FatalError(env, "A call to handle_tx_ack_rbf in LDKChannelMessageHandler from rust threw an exception.");
19543         }
19544         if (get_jenv_res == JNI_EDETACHED) {
19545                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
19546         }
19547 }
19548 void handle_tx_abort_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKTxAbort * msg) {
19549         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
19550         JNIEnv *env;
19551         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
19552         if (get_jenv_res == JNI_EDETACHED) {
19553                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
19554         } else {
19555                 DO_ASSERT(get_jenv_res == JNI_OK);
19556         }
19557         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
19558         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
19559         LDKTxAbort msg_var = *msg;
19560         int64_t msg_ref = 0;
19561         msg_var = TxAbort_clone(&msg_var);
19562         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
19563         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
19564         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
19565         CHECK(obj != NULL);
19566         (*env)->CallVoidMethod(env, obj, j_calls->handle_tx_abort_meth, their_node_id_arr, msg_ref);
19567         if (UNLIKELY((*env)->ExceptionCheck(env))) {
19568                 (*env)->ExceptionDescribe(env);
19569                 (*env)->FatalError(env, "A call to handle_tx_abort in LDKChannelMessageHandler from rust threw an exception.");
19570         }
19571         if (get_jenv_res == JNI_EDETACHED) {
19572                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
19573         }
19574 }
19575 void handle_update_add_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateAddHTLC * msg) {
19576         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
19577         JNIEnv *env;
19578         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
19579         if (get_jenv_res == JNI_EDETACHED) {
19580                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
19581         } else {
19582                 DO_ASSERT(get_jenv_res == JNI_OK);
19583         }
19584         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
19585         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
19586         LDKUpdateAddHTLC msg_var = *msg;
19587         int64_t msg_ref = 0;
19588         msg_var = UpdateAddHTLC_clone(&msg_var);
19589         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
19590         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
19591         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
19592         CHECK(obj != NULL);
19593         (*env)->CallVoidMethod(env, obj, j_calls->handle_update_add_htlc_meth, their_node_id_arr, msg_ref);
19594         if (UNLIKELY((*env)->ExceptionCheck(env))) {
19595                 (*env)->ExceptionDescribe(env);
19596                 (*env)->FatalError(env, "A call to handle_update_add_htlc in LDKChannelMessageHandler from rust threw an exception.");
19597         }
19598         if (get_jenv_res == JNI_EDETACHED) {
19599                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
19600         }
19601 }
19602 void handle_update_fulfill_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFulfillHTLC * msg) {
19603         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
19604         JNIEnv *env;
19605         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
19606         if (get_jenv_res == JNI_EDETACHED) {
19607                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
19608         } else {
19609                 DO_ASSERT(get_jenv_res == JNI_OK);
19610         }
19611         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
19612         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
19613         LDKUpdateFulfillHTLC msg_var = *msg;
19614         int64_t msg_ref = 0;
19615         msg_var = UpdateFulfillHTLC_clone(&msg_var);
19616         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
19617         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
19618         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
19619         CHECK(obj != NULL);
19620         (*env)->CallVoidMethod(env, obj, j_calls->handle_update_fulfill_htlc_meth, their_node_id_arr, msg_ref);
19621         if (UNLIKELY((*env)->ExceptionCheck(env))) {
19622                 (*env)->ExceptionDescribe(env);
19623                 (*env)->FatalError(env, "A call to handle_update_fulfill_htlc in LDKChannelMessageHandler from rust threw an exception.");
19624         }
19625         if (get_jenv_res == JNI_EDETACHED) {
19626                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
19627         }
19628 }
19629 void handle_update_fail_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailHTLC * msg) {
19630         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
19631         JNIEnv *env;
19632         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
19633         if (get_jenv_res == JNI_EDETACHED) {
19634                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
19635         } else {
19636                 DO_ASSERT(get_jenv_res == JNI_OK);
19637         }
19638         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
19639         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
19640         LDKUpdateFailHTLC msg_var = *msg;
19641         int64_t msg_ref = 0;
19642         msg_var = UpdateFailHTLC_clone(&msg_var);
19643         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
19644         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
19645         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
19646         CHECK(obj != NULL);
19647         (*env)->CallVoidMethod(env, obj, j_calls->handle_update_fail_htlc_meth, their_node_id_arr, msg_ref);
19648         if (UNLIKELY((*env)->ExceptionCheck(env))) {
19649                 (*env)->ExceptionDescribe(env);
19650                 (*env)->FatalError(env, "A call to handle_update_fail_htlc in LDKChannelMessageHandler from rust threw an exception.");
19651         }
19652         if (get_jenv_res == JNI_EDETACHED) {
19653                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
19654         }
19655 }
19656 void handle_update_fail_malformed_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailMalformedHTLC * msg) {
19657         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
19658         JNIEnv *env;
19659         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
19660         if (get_jenv_res == JNI_EDETACHED) {
19661                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
19662         } else {
19663                 DO_ASSERT(get_jenv_res == JNI_OK);
19664         }
19665         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
19666         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
19667         LDKUpdateFailMalformedHTLC msg_var = *msg;
19668         int64_t msg_ref = 0;
19669         msg_var = UpdateFailMalformedHTLC_clone(&msg_var);
19670         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
19671         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
19672         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
19673         CHECK(obj != NULL);
19674         (*env)->CallVoidMethod(env, obj, j_calls->handle_update_fail_malformed_htlc_meth, their_node_id_arr, msg_ref);
19675         if (UNLIKELY((*env)->ExceptionCheck(env))) {
19676                 (*env)->ExceptionDescribe(env);
19677                 (*env)->FatalError(env, "A call to handle_update_fail_malformed_htlc in LDKChannelMessageHandler from rust threw an exception.");
19678         }
19679         if (get_jenv_res == JNI_EDETACHED) {
19680                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
19681         }
19682 }
19683 void handle_commitment_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKCommitmentSigned * msg) {
19684         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
19685         JNIEnv *env;
19686         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
19687         if (get_jenv_res == JNI_EDETACHED) {
19688                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
19689         } else {
19690                 DO_ASSERT(get_jenv_res == JNI_OK);
19691         }
19692         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
19693         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
19694         LDKCommitmentSigned msg_var = *msg;
19695         int64_t msg_ref = 0;
19696         msg_var = CommitmentSigned_clone(&msg_var);
19697         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
19698         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
19699         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
19700         CHECK(obj != NULL);
19701         (*env)->CallVoidMethod(env, obj, j_calls->handle_commitment_signed_meth, their_node_id_arr, msg_ref);
19702         if (UNLIKELY((*env)->ExceptionCheck(env))) {
19703                 (*env)->ExceptionDescribe(env);
19704                 (*env)->FatalError(env, "A call to handle_commitment_signed in LDKChannelMessageHandler from rust threw an exception.");
19705         }
19706         if (get_jenv_res == JNI_EDETACHED) {
19707                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
19708         }
19709 }
19710 void handle_revoke_and_ack_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKRevokeAndACK * msg) {
19711         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
19712         JNIEnv *env;
19713         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
19714         if (get_jenv_res == JNI_EDETACHED) {
19715                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
19716         } else {
19717                 DO_ASSERT(get_jenv_res == JNI_OK);
19718         }
19719         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
19720         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
19721         LDKRevokeAndACK msg_var = *msg;
19722         int64_t msg_ref = 0;
19723         msg_var = RevokeAndACK_clone(&msg_var);
19724         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
19725         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
19726         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
19727         CHECK(obj != NULL);
19728         (*env)->CallVoidMethod(env, obj, j_calls->handle_revoke_and_ack_meth, their_node_id_arr, msg_ref);
19729         if (UNLIKELY((*env)->ExceptionCheck(env))) {
19730                 (*env)->ExceptionDescribe(env);
19731                 (*env)->FatalError(env, "A call to handle_revoke_and_ack in LDKChannelMessageHandler from rust threw an exception.");
19732         }
19733         if (get_jenv_res == JNI_EDETACHED) {
19734                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
19735         }
19736 }
19737 void handle_update_fee_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFee * msg) {
19738         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
19739         JNIEnv *env;
19740         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
19741         if (get_jenv_res == JNI_EDETACHED) {
19742                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
19743         } else {
19744                 DO_ASSERT(get_jenv_res == JNI_OK);
19745         }
19746         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
19747         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
19748         LDKUpdateFee msg_var = *msg;
19749         int64_t msg_ref = 0;
19750         msg_var = UpdateFee_clone(&msg_var);
19751         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
19752         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
19753         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
19754         CHECK(obj != NULL);
19755         (*env)->CallVoidMethod(env, obj, j_calls->handle_update_fee_meth, their_node_id_arr, msg_ref);
19756         if (UNLIKELY((*env)->ExceptionCheck(env))) {
19757                 (*env)->ExceptionDescribe(env);
19758                 (*env)->FatalError(env, "A call to handle_update_fee in LDKChannelMessageHandler from rust threw an exception.");
19759         }
19760         if (get_jenv_res == JNI_EDETACHED) {
19761                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
19762         }
19763 }
19764 void handle_announcement_signatures_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKAnnouncementSignatures * msg) {
19765         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
19766         JNIEnv *env;
19767         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
19768         if (get_jenv_res == JNI_EDETACHED) {
19769                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
19770         } else {
19771                 DO_ASSERT(get_jenv_res == JNI_OK);
19772         }
19773         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
19774         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
19775         LDKAnnouncementSignatures msg_var = *msg;
19776         int64_t msg_ref = 0;
19777         msg_var = AnnouncementSignatures_clone(&msg_var);
19778         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
19779         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
19780         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
19781         CHECK(obj != NULL);
19782         (*env)->CallVoidMethod(env, obj, j_calls->handle_announcement_signatures_meth, their_node_id_arr, msg_ref);
19783         if (UNLIKELY((*env)->ExceptionCheck(env))) {
19784                 (*env)->ExceptionDescribe(env);
19785                 (*env)->FatalError(env, "A call to handle_announcement_signatures in LDKChannelMessageHandler from rust threw an exception.");
19786         }
19787         if (get_jenv_res == JNI_EDETACHED) {
19788                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
19789         }
19790 }
19791 void peer_disconnected_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id) {
19792         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
19793         JNIEnv *env;
19794         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
19795         if (get_jenv_res == JNI_EDETACHED) {
19796                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
19797         } else {
19798                 DO_ASSERT(get_jenv_res == JNI_OK);
19799         }
19800         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
19801         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
19802         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
19803         CHECK(obj != NULL);
19804         (*env)->CallVoidMethod(env, obj, j_calls->peer_disconnected_meth, their_node_id_arr);
19805         if (UNLIKELY((*env)->ExceptionCheck(env))) {
19806                 (*env)->ExceptionDescribe(env);
19807                 (*env)->FatalError(env, "A call to peer_disconnected in LDKChannelMessageHandler from rust threw an exception.");
19808         }
19809         if (get_jenv_res == JNI_EDETACHED) {
19810                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
19811         }
19812 }
19813 LDKCResult_NoneNoneZ peer_connected_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * msg, bool inbound) {
19814         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
19815         JNIEnv *env;
19816         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
19817         if (get_jenv_res == JNI_EDETACHED) {
19818                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
19819         } else {
19820                 DO_ASSERT(get_jenv_res == JNI_OK);
19821         }
19822         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
19823         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
19824         LDKInit msg_var = *msg;
19825         int64_t msg_ref = 0;
19826         msg_var = Init_clone(&msg_var);
19827         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
19828         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
19829         jboolean inbound_conv = inbound;
19830         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
19831         CHECK(obj != NULL);
19832         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->peer_connected_meth, their_node_id_arr, msg_ref, inbound_conv);
19833         if (UNLIKELY((*env)->ExceptionCheck(env))) {
19834                 (*env)->ExceptionDescribe(env);
19835                 (*env)->FatalError(env, "A call to peer_connected in LDKChannelMessageHandler from rust threw an exception.");
19836         }
19837         void* ret_ptr = untag_ptr(ret);
19838         CHECK_ACCESS(ret_ptr);
19839         LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(ret_ptr);
19840         FREE(untag_ptr(ret));
19841         if (get_jenv_res == JNI_EDETACHED) {
19842                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
19843         }
19844         return ret_conv;
19845 }
19846 void handle_channel_reestablish_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelReestablish * msg) {
19847         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
19848         JNIEnv *env;
19849         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
19850         if (get_jenv_res == JNI_EDETACHED) {
19851                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
19852         } else {
19853                 DO_ASSERT(get_jenv_res == JNI_OK);
19854         }
19855         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
19856         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
19857         LDKChannelReestablish msg_var = *msg;
19858         int64_t msg_ref = 0;
19859         msg_var = ChannelReestablish_clone(&msg_var);
19860         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
19861         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
19862         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
19863         CHECK(obj != NULL);
19864         (*env)->CallVoidMethod(env, obj, j_calls->handle_channel_reestablish_meth, their_node_id_arr, msg_ref);
19865         if (UNLIKELY((*env)->ExceptionCheck(env))) {
19866                 (*env)->ExceptionDescribe(env);
19867                 (*env)->FatalError(env, "A call to handle_channel_reestablish in LDKChannelMessageHandler from rust threw an exception.");
19868         }
19869         if (get_jenv_res == JNI_EDETACHED) {
19870                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
19871         }
19872 }
19873 void handle_channel_update_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelUpdate * msg) {
19874         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
19875         JNIEnv *env;
19876         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
19877         if (get_jenv_res == JNI_EDETACHED) {
19878                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
19879         } else {
19880                 DO_ASSERT(get_jenv_res == JNI_OK);
19881         }
19882         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
19883         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
19884         LDKChannelUpdate msg_var = *msg;
19885         int64_t msg_ref = 0;
19886         msg_var = ChannelUpdate_clone(&msg_var);
19887         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
19888         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
19889         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
19890         CHECK(obj != NULL);
19891         (*env)->CallVoidMethod(env, obj, j_calls->handle_channel_update_meth, their_node_id_arr, msg_ref);
19892         if (UNLIKELY((*env)->ExceptionCheck(env))) {
19893                 (*env)->ExceptionDescribe(env);
19894                 (*env)->FatalError(env, "A call to handle_channel_update in LDKChannelMessageHandler from rust threw an exception.");
19895         }
19896         if (get_jenv_res == JNI_EDETACHED) {
19897                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
19898         }
19899 }
19900 void handle_error_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKErrorMessage * msg) {
19901         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
19902         JNIEnv *env;
19903         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
19904         if (get_jenv_res == JNI_EDETACHED) {
19905                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
19906         } else {
19907                 DO_ASSERT(get_jenv_res == JNI_OK);
19908         }
19909         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
19910         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
19911         LDKErrorMessage msg_var = *msg;
19912         int64_t msg_ref = 0;
19913         msg_var = ErrorMessage_clone(&msg_var);
19914         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
19915         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
19916         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
19917         CHECK(obj != NULL);
19918         (*env)->CallVoidMethod(env, obj, j_calls->handle_error_meth, their_node_id_arr, msg_ref);
19919         if (UNLIKELY((*env)->ExceptionCheck(env))) {
19920                 (*env)->ExceptionDescribe(env);
19921                 (*env)->FatalError(env, "A call to handle_error in LDKChannelMessageHandler from rust threw an exception.");
19922         }
19923         if (get_jenv_res == JNI_EDETACHED) {
19924                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
19925         }
19926 }
19927 LDKNodeFeatures provided_node_features_LDKChannelMessageHandler_jcall(const void* this_arg) {
19928         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
19929         JNIEnv *env;
19930         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
19931         if (get_jenv_res == JNI_EDETACHED) {
19932                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
19933         } else {
19934                 DO_ASSERT(get_jenv_res == JNI_OK);
19935         }
19936         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
19937         CHECK(obj != NULL);
19938         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->provided_node_features_meth);
19939         if (UNLIKELY((*env)->ExceptionCheck(env))) {
19940                 (*env)->ExceptionDescribe(env);
19941                 (*env)->FatalError(env, "A call to provided_node_features in LDKChannelMessageHandler from rust threw an exception.");
19942         }
19943         LDKNodeFeatures ret_conv;
19944         ret_conv.inner = untag_ptr(ret);
19945         ret_conv.is_owned = ptr_is_owned(ret);
19946         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
19947         if (get_jenv_res == JNI_EDETACHED) {
19948                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
19949         }
19950         return ret_conv;
19951 }
19952 LDKInitFeatures provided_init_features_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id) {
19953         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
19954         JNIEnv *env;
19955         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
19956         if (get_jenv_res == JNI_EDETACHED) {
19957                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
19958         } else {
19959                 DO_ASSERT(get_jenv_res == JNI_OK);
19960         }
19961         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
19962         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
19963         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
19964         CHECK(obj != NULL);
19965         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->provided_init_features_meth, their_node_id_arr);
19966         if (UNLIKELY((*env)->ExceptionCheck(env))) {
19967                 (*env)->ExceptionDescribe(env);
19968                 (*env)->FatalError(env, "A call to provided_init_features in LDKChannelMessageHandler from rust threw an exception.");
19969         }
19970         LDKInitFeatures ret_conv;
19971         ret_conv.inner = untag_ptr(ret);
19972         ret_conv.is_owned = ptr_is_owned(ret);
19973         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
19974         if (get_jenv_res == JNI_EDETACHED) {
19975                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
19976         }
19977         return ret_conv;
19978 }
19979 LDKCOption_CVec_ThirtyTwoBytesZZ get_chain_hashes_LDKChannelMessageHandler_jcall(const void* this_arg) {
19980         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
19981         JNIEnv *env;
19982         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
19983         if (get_jenv_res == JNI_EDETACHED) {
19984                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
19985         } else {
19986                 DO_ASSERT(get_jenv_res == JNI_OK);
19987         }
19988         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
19989         CHECK(obj != NULL);
19990         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->get_chain_hashes_meth);
19991         if (UNLIKELY((*env)->ExceptionCheck(env))) {
19992                 (*env)->ExceptionDescribe(env);
19993                 (*env)->FatalError(env, "A call to get_chain_hashes in LDKChannelMessageHandler from rust threw an exception.");
19994         }
19995         void* ret_ptr = untag_ptr(ret);
19996         CHECK_ACCESS(ret_ptr);
19997         LDKCOption_CVec_ThirtyTwoBytesZZ ret_conv = *(LDKCOption_CVec_ThirtyTwoBytesZZ*)(ret_ptr);
19998         FREE(untag_ptr(ret));
19999         if (get_jenv_res == JNI_EDETACHED) {
20000                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
20001         }
20002         return ret_conv;
20003 }
20004 static void LDKChannelMessageHandler_JCalls_cloned(LDKChannelMessageHandler* new_obj) {
20005         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) new_obj->this_arg;
20006         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
20007         atomic_fetch_add_explicit(&j_calls->MessageSendEventsProvider->refcnt, 1, memory_order_release);
20008 }
20009 static inline LDKChannelMessageHandler LDKChannelMessageHandler_init (JNIEnv *env, jclass clz, jobject o, jobject MessageSendEventsProvider) {
20010         jclass c = (*env)->GetObjectClass(env, o);
20011         CHECK(c != NULL);
20012         LDKChannelMessageHandler_JCalls *calls = MALLOC(sizeof(LDKChannelMessageHandler_JCalls), "LDKChannelMessageHandler_JCalls");
20013         atomic_init(&calls->refcnt, 1);
20014         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
20015         calls->o = (*env)->NewWeakGlobalRef(env, o);
20016         calls->handle_open_channel_meth = (*env)->GetMethodID(env, c, "handle_open_channel", "([BJ)V");
20017         CHECK(calls->handle_open_channel_meth != NULL);
20018         calls->handle_open_channel_v2_meth = (*env)->GetMethodID(env, c, "handle_open_channel_v2", "([BJ)V");
20019         CHECK(calls->handle_open_channel_v2_meth != NULL);
20020         calls->handle_accept_channel_meth = (*env)->GetMethodID(env, c, "handle_accept_channel", "([BJ)V");
20021         CHECK(calls->handle_accept_channel_meth != NULL);
20022         calls->handle_accept_channel_v2_meth = (*env)->GetMethodID(env, c, "handle_accept_channel_v2", "([BJ)V");
20023         CHECK(calls->handle_accept_channel_v2_meth != NULL);
20024         calls->handle_funding_created_meth = (*env)->GetMethodID(env, c, "handle_funding_created", "([BJ)V");
20025         CHECK(calls->handle_funding_created_meth != NULL);
20026         calls->handle_funding_signed_meth = (*env)->GetMethodID(env, c, "handle_funding_signed", "([BJ)V");
20027         CHECK(calls->handle_funding_signed_meth != NULL);
20028         calls->handle_channel_ready_meth = (*env)->GetMethodID(env, c, "handle_channel_ready", "([BJ)V");
20029         CHECK(calls->handle_channel_ready_meth != NULL);
20030         calls->handle_shutdown_meth = (*env)->GetMethodID(env, c, "handle_shutdown", "([BJ)V");
20031         CHECK(calls->handle_shutdown_meth != NULL);
20032         calls->handle_closing_signed_meth = (*env)->GetMethodID(env, c, "handle_closing_signed", "([BJ)V");
20033         CHECK(calls->handle_closing_signed_meth != NULL);
20034         calls->handle_stfu_meth = (*env)->GetMethodID(env, c, "handle_stfu", "([BJ)V");
20035         CHECK(calls->handle_stfu_meth != NULL);
20036         calls->handle_tx_add_input_meth = (*env)->GetMethodID(env, c, "handle_tx_add_input", "([BJ)V");
20037         CHECK(calls->handle_tx_add_input_meth != NULL);
20038         calls->handle_tx_add_output_meth = (*env)->GetMethodID(env, c, "handle_tx_add_output", "([BJ)V");
20039         CHECK(calls->handle_tx_add_output_meth != NULL);
20040         calls->handle_tx_remove_input_meth = (*env)->GetMethodID(env, c, "handle_tx_remove_input", "([BJ)V");
20041         CHECK(calls->handle_tx_remove_input_meth != NULL);
20042         calls->handle_tx_remove_output_meth = (*env)->GetMethodID(env, c, "handle_tx_remove_output", "([BJ)V");
20043         CHECK(calls->handle_tx_remove_output_meth != NULL);
20044         calls->handle_tx_complete_meth = (*env)->GetMethodID(env, c, "handle_tx_complete", "([BJ)V");
20045         CHECK(calls->handle_tx_complete_meth != NULL);
20046         calls->handle_tx_signatures_meth = (*env)->GetMethodID(env, c, "handle_tx_signatures", "([BJ)V");
20047         CHECK(calls->handle_tx_signatures_meth != NULL);
20048         calls->handle_tx_init_rbf_meth = (*env)->GetMethodID(env, c, "handle_tx_init_rbf", "([BJ)V");
20049         CHECK(calls->handle_tx_init_rbf_meth != NULL);
20050         calls->handle_tx_ack_rbf_meth = (*env)->GetMethodID(env, c, "handle_tx_ack_rbf", "([BJ)V");
20051         CHECK(calls->handle_tx_ack_rbf_meth != NULL);
20052         calls->handle_tx_abort_meth = (*env)->GetMethodID(env, c, "handle_tx_abort", "([BJ)V");
20053         CHECK(calls->handle_tx_abort_meth != NULL);
20054         calls->handle_update_add_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_add_htlc", "([BJ)V");
20055         CHECK(calls->handle_update_add_htlc_meth != NULL);
20056         calls->handle_update_fulfill_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_fulfill_htlc", "([BJ)V");
20057         CHECK(calls->handle_update_fulfill_htlc_meth != NULL);
20058         calls->handle_update_fail_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_fail_htlc", "([BJ)V");
20059         CHECK(calls->handle_update_fail_htlc_meth != NULL);
20060         calls->handle_update_fail_malformed_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_fail_malformed_htlc", "([BJ)V");
20061         CHECK(calls->handle_update_fail_malformed_htlc_meth != NULL);
20062         calls->handle_commitment_signed_meth = (*env)->GetMethodID(env, c, "handle_commitment_signed", "([BJ)V");
20063         CHECK(calls->handle_commitment_signed_meth != NULL);
20064         calls->handle_revoke_and_ack_meth = (*env)->GetMethodID(env, c, "handle_revoke_and_ack", "([BJ)V");
20065         CHECK(calls->handle_revoke_and_ack_meth != NULL);
20066         calls->handle_update_fee_meth = (*env)->GetMethodID(env, c, "handle_update_fee", "([BJ)V");
20067         CHECK(calls->handle_update_fee_meth != NULL);
20068         calls->handle_announcement_signatures_meth = (*env)->GetMethodID(env, c, "handle_announcement_signatures", "([BJ)V");
20069         CHECK(calls->handle_announcement_signatures_meth != NULL);
20070         calls->peer_disconnected_meth = (*env)->GetMethodID(env, c, "peer_disconnected", "([B)V");
20071         CHECK(calls->peer_disconnected_meth != NULL);
20072         calls->peer_connected_meth = (*env)->GetMethodID(env, c, "peer_connected", "([BJZ)J");
20073         CHECK(calls->peer_connected_meth != NULL);
20074         calls->handle_channel_reestablish_meth = (*env)->GetMethodID(env, c, "handle_channel_reestablish", "([BJ)V");
20075         CHECK(calls->handle_channel_reestablish_meth != NULL);
20076         calls->handle_channel_update_meth = (*env)->GetMethodID(env, c, "handle_channel_update", "([BJ)V");
20077         CHECK(calls->handle_channel_update_meth != NULL);
20078         calls->handle_error_meth = (*env)->GetMethodID(env, c, "handle_error", "([BJ)V");
20079         CHECK(calls->handle_error_meth != NULL);
20080         calls->provided_node_features_meth = (*env)->GetMethodID(env, c, "provided_node_features", "()J");
20081         CHECK(calls->provided_node_features_meth != NULL);
20082         calls->provided_init_features_meth = (*env)->GetMethodID(env, c, "provided_init_features", "([B)J");
20083         CHECK(calls->provided_init_features_meth != NULL);
20084         calls->get_chain_hashes_meth = (*env)->GetMethodID(env, c, "get_chain_hashes", "()J");
20085         CHECK(calls->get_chain_hashes_meth != NULL);
20086
20087         LDKChannelMessageHandler ret = {
20088                 .this_arg = (void*) calls,
20089                 .handle_open_channel = handle_open_channel_LDKChannelMessageHandler_jcall,
20090                 .handle_open_channel_v2 = handle_open_channel_v2_LDKChannelMessageHandler_jcall,
20091                 .handle_accept_channel = handle_accept_channel_LDKChannelMessageHandler_jcall,
20092                 .handle_accept_channel_v2 = handle_accept_channel_v2_LDKChannelMessageHandler_jcall,
20093                 .handle_funding_created = handle_funding_created_LDKChannelMessageHandler_jcall,
20094                 .handle_funding_signed = handle_funding_signed_LDKChannelMessageHandler_jcall,
20095                 .handle_channel_ready = handle_channel_ready_LDKChannelMessageHandler_jcall,
20096                 .handle_shutdown = handle_shutdown_LDKChannelMessageHandler_jcall,
20097                 .handle_closing_signed = handle_closing_signed_LDKChannelMessageHandler_jcall,
20098                 .handle_stfu = handle_stfu_LDKChannelMessageHandler_jcall,
20099                 .handle_tx_add_input = handle_tx_add_input_LDKChannelMessageHandler_jcall,
20100                 .handle_tx_add_output = handle_tx_add_output_LDKChannelMessageHandler_jcall,
20101                 .handle_tx_remove_input = handle_tx_remove_input_LDKChannelMessageHandler_jcall,
20102                 .handle_tx_remove_output = handle_tx_remove_output_LDKChannelMessageHandler_jcall,
20103                 .handle_tx_complete = handle_tx_complete_LDKChannelMessageHandler_jcall,
20104                 .handle_tx_signatures = handle_tx_signatures_LDKChannelMessageHandler_jcall,
20105                 .handle_tx_init_rbf = handle_tx_init_rbf_LDKChannelMessageHandler_jcall,
20106                 .handle_tx_ack_rbf = handle_tx_ack_rbf_LDKChannelMessageHandler_jcall,
20107                 .handle_tx_abort = handle_tx_abort_LDKChannelMessageHandler_jcall,
20108                 .handle_update_add_htlc = handle_update_add_htlc_LDKChannelMessageHandler_jcall,
20109                 .handle_update_fulfill_htlc = handle_update_fulfill_htlc_LDKChannelMessageHandler_jcall,
20110                 .handle_update_fail_htlc = handle_update_fail_htlc_LDKChannelMessageHandler_jcall,
20111                 .handle_update_fail_malformed_htlc = handle_update_fail_malformed_htlc_LDKChannelMessageHandler_jcall,
20112                 .handle_commitment_signed = handle_commitment_signed_LDKChannelMessageHandler_jcall,
20113                 .handle_revoke_and_ack = handle_revoke_and_ack_LDKChannelMessageHandler_jcall,
20114                 .handle_update_fee = handle_update_fee_LDKChannelMessageHandler_jcall,
20115                 .handle_announcement_signatures = handle_announcement_signatures_LDKChannelMessageHandler_jcall,
20116                 .peer_disconnected = peer_disconnected_LDKChannelMessageHandler_jcall,
20117                 .peer_connected = peer_connected_LDKChannelMessageHandler_jcall,
20118                 .handle_channel_reestablish = handle_channel_reestablish_LDKChannelMessageHandler_jcall,
20119                 .handle_channel_update = handle_channel_update_LDKChannelMessageHandler_jcall,
20120                 .handle_error = handle_error_LDKChannelMessageHandler_jcall,
20121                 .provided_node_features = provided_node_features_LDKChannelMessageHandler_jcall,
20122                 .provided_init_features = provided_init_features_LDKChannelMessageHandler_jcall,
20123                 .get_chain_hashes = get_chain_hashes_LDKChannelMessageHandler_jcall,
20124                 .free = LDKChannelMessageHandler_JCalls_free,
20125                 .MessageSendEventsProvider = LDKMessageSendEventsProvider_init(env, clz, MessageSendEventsProvider),
20126         };
20127         calls->MessageSendEventsProvider = ret.MessageSendEventsProvider.this_arg;
20128         return ret;
20129 }
20130 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1new(JNIEnv *env, jclass clz, jobject o, jobject MessageSendEventsProvider) {
20131         LDKChannelMessageHandler *res_ptr = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
20132         *res_ptr = LDKChannelMessageHandler_init(env, clz, o, MessageSendEventsProvider);
20133         return tag_ptr(res_ptr, true);
20134 }
20135 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1get_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t arg) {
20136         LDKChannelMessageHandler *inp = (LDKChannelMessageHandler *)untag_ptr(arg);
20137         return tag_ptr(&inp->MessageSendEventsProvider, false);
20138 }
20139 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) {
20140         void* this_arg_ptr = untag_ptr(this_arg);
20141         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
20142         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
20143         LDKPublicKey their_node_id_ref;
20144         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
20145         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
20146         LDKOpenChannel msg_conv;
20147         msg_conv.inner = untag_ptr(msg);
20148         msg_conv.is_owned = ptr_is_owned(msg);
20149         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
20150         msg_conv.is_owned = false;
20151         (this_arg_conv->handle_open_channel)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
20152 }
20153
20154 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) {
20155         void* this_arg_ptr = untag_ptr(this_arg);
20156         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
20157         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
20158         LDKPublicKey their_node_id_ref;
20159         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
20160         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
20161         LDKOpenChannelV2 msg_conv;
20162         msg_conv.inner = untag_ptr(msg);
20163         msg_conv.is_owned = ptr_is_owned(msg);
20164         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
20165         msg_conv.is_owned = false;
20166         (this_arg_conv->handle_open_channel_v2)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
20167 }
20168
20169 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) {
20170         void* this_arg_ptr = untag_ptr(this_arg);
20171         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
20172         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
20173         LDKPublicKey their_node_id_ref;
20174         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
20175         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
20176         LDKAcceptChannel msg_conv;
20177         msg_conv.inner = untag_ptr(msg);
20178         msg_conv.is_owned = ptr_is_owned(msg);
20179         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
20180         msg_conv.is_owned = false;
20181         (this_arg_conv->handle_accept_channel)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
20182 }
20183
20184 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) {
20185         void* this_arg_ptr = untag_ptr(this_arg);
20186         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
20187         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
20188         LDKPublicKey their_node_id_ref;
20189         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
20190         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
20191         LDKAcceptChannelV2 msg_conv;
20192         msg_conv.inner = untag_ptr(msg);
20193         msg_conv.is_owned = ptr_is_owned(msg);
20194         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
20195         msg_conv.is_owned = false;
20196         (this_arg_conv->handle_accept_channel_v2)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
20197 }
20198
20199 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) {
20200         void* this_arg_ptr = untag_ptr(this_arg);
20201         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
20202         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
20203         LDKPublicKey their_node_id_ref;
20204         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
20205         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
20206         LDKFundingCreated msg_conv;
20207         msg_conv.inner = untag_ptr(msg);
20208         msg_conv.is_owned = ptr_is_owned(msg);
20209         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
20210         msg_conv.is_owned = false;
20211         (this_arg_conv->handle_funding_created)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
20212 }
20213
20214 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) {
20215         void* this_arg_ptr = untag_ptr(this_arg);
20216         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
20217         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
20218         LDKPublicKey their_node_id_ref;
20219         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
20220         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
20221         LDKFundingSigned msg_conv;
20222         msg_conv.inner = untag_ptr(msg);
20223         msg_conv.is_owned = ptr_is_owned(msg);
20224         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
20225         msg_conv.is_owned = false;
20226         (this_arg_conv->handle_funding_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
20227 }
20228
20229 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) {
20230         void* this_arg_ptr = untag_ptr(this_arg);
20231         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
20232         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
20233         LDKPublicKey their_node_id_ref;
20234         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
20235         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
20236         LDKChannelReady msg_conv;
20237         msg_conv.inner = untag_ptr(msg);
20238         msg_conv.is_owned = ptr_is_owned(msg);
20239         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
20240         msg_conv.is_owned = false;
20241         (this_arg_conv->handle_channel_ready)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
20242 }
20243
20244 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) {
20245         void* this_arg_ptr = untag_ptr(this_arg);
20246         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
20247         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
20248         LDKPublicKey their_node_id_ref;
20249         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
20250         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
20251         LDKShutdown msg_conv;
20252         msg_conv.inner = untag_ptr(msg);
20253         msg_conv.is_owned = ptr_is_owned(msg);
20254         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
20255         msg_conv.is_owned = false;
20256         (this_arg_conv->handle_shutdown)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
20257 }
20258
20259 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) {
20260         void* this_arg_ptr = untag_ptr(this_arg);
20261         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
20262         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
20263         LDKPublicKey their_node_id_ref;
20264         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
20265         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
20266         LDKClosingSigned msg_conv;
20267         msg_conv.inner = untag_ptr(msg);
20268         msg_conv.is_owned = ptr_is_owned(msg);
20269         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
20270         msg_conv.is_owned = false;
20271         (this_arg_conv->handle_closing_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
20272 }
20273
20274 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) {
20275         void* this_arg_ptr = untag_ptr(this_arg);
20276         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
20277         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
20278         LDKPublicKey their_node_id_ref;
20279         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
20280         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
20281         LDKStfu msg_conv;
20282         msg_conv.inner = untag_ptr(msg);
20283         msg_conv.is_owned = ptr_is_owned(msg);
20284         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
20285         msg_conv.is_owned = false;
20286         (this_arg_conv->handle_stfu)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
20287 }
20288
20289 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) {
20290         void* this_arg_ptr = untag_ptr(this_arg);
20291         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
20292         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
20293         LDKPublicKey their_node_id_ref;
20294         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
20295         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
20296         LDKTxAddInput msg_conv;
20297         msg_conv.inner = untag_ptr(msg);
20298         msg_conv.is_owned = ptr_is_owned(msg);
20299         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
20300         msg_conv.is_owned = false;
20301         (this_arg_conv->handle_tx_add_input)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
20302 }
20303
20304 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) {
20305         void* this_arg_ptr = untag_ptr(this_arg);
20306         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
20307         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
20308         LDKPublicKey their_node_id_ref;
20309         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
20310         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
20311         LDKTxAddOutput msg_conv;
20312         msg_conv.inner = untag_ptr(msg);
20313         msg_conv.is_owned = ptr_is_owned(msg);
20314         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
20315         msg_conv.is_owned = false;
20316         (this_arg_conv->handle_tx_add_output)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
20317 }
20318
20319 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) {
20320         void* this_arg_ptr = untag_ptr(this_arg);
20321         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
20322         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
20323         LDKPublicKey their_node_id_ref;
20324         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
20325         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
20326         LDKTxRemoveInput msg_conv;
20327         msg_conv.inner = untag_ptr(msg);
20328         msg_conv.is_owned = ptr_is_owned(msg);
20329         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
20330         msg_conv.is_owned = false;
20331         (this_arg_conv->handle_tx_remove_input)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
20332 }
20333
20334 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) {
20335         void* this_arg_ptr = untag_ptr(this_arg);
20336         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
20337         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
20338         LDKPublicKey their_node_id_ref;
20339         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
20340         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
20341         LDKTxRemoveOutput msg_conv;
20342         msg_conv.inner = untag_ptr(msg);
20343         msg_conv.is_owned = ptr_is_owned(msg);
20344         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
20345         msg_conv.is_owned = false;
20346         (this_arg_conv->handle_tx_remove_output)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
20347 }
20348
20349 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) {
20350         void* this_arg_ptr = untag_ptr(this_arg);
20351         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
20352         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
20353         LDKPublicKey their_node_id_ref;
20354         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
20355         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
20356         LDKTxComplete msg_conv;
20357         msg_conv.inner = untag_ptr(msg);
20358         msg_conv.is_owned = ptr_is_owned(msg);
20359         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
20360         msg_conv.is_owned = false;
20361         (this_arg_conv->handle_tx_complete)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
20362 }
20363
20364 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) {
20365         void* this_arg_ptr = untag_ptr(this_arg);
20366         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
20367         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
20368         LDKPublicKey their_node_id_ref;
20369         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
20370         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
20371         LDKTxSignatures msg_conv;
20372         msg_conv.inner = untag_ptr(msg);
20373         msg_conv.is_owned = ptr_is_owned(msg);
20374         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
20375         msg_conv.is_owned = false;
20376         (this_arg_conv->handle_tx_signatures)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
20377 }
20378
20379 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) {
20380         void* this_arg_ptr = untag_ptr(this_arg);
20381         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
20382         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
20383         LDKPublicKey their_node_id_ref;
20384         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
20385         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
20386         LDKTxInitRbf msg_conv;
20387         msg_conv.inner = untag_ptr(msg);
20388         msg_conv.is_owned = ptr_is_owned(msg);
20389         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
20390         msg_conv.is_owned = false;
20391         (this_arg_conv->handle_tx_init_rbf)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
20392 }
20393
20394 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) {
20395         void* this_arg_ptr = untag_ptr(this_arg);
20396         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
20397         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
20398         LDKPublicKey their_node_id_ref;
20399         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
20400         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
20401         LDKTxAckRbf msg_conv;
20402         msg_conv.inner = untag_ptr(msg);
20403         msg_conv.is_owned = ptr_is_owned(msg);
20404         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
20405         msg_conv.is_owned = false;
20406         (this_arg_conv->handle_tx_ack_rbf)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
20407 }
20408
20409 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) {
20410         void* this_arg_ptr = untag_ptr(this_arg);
20411         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
20412         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
20413         LDKPublicKey their_node_id_ref;
20414         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
20415         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
20416         LDKTxAbort msg_conv;
20417         msg_conv.inner = untag_ptr(msg);
20418         msg_conv.is_owned = ptr_is_owned(msg);
20419         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
20420         msg_conv.is_owned = false;
20421         (this_arg_conv->handle_tx_abort)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
20422 }
20423
20424 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) {
20425         void* this_arg_ptr = untag_ptr(this_arg);
20426         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
20427         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
20428         LDKPublicKey their_node_id_ref;
20429         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
20430         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
20431         LDKUpdateAddHTLC msg_conv;
20432         msg_conv.inner = untag_ptr(msg);
20433         msg_conv.is_owned = ptr_is_owned(msg);
20434         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
20435         msg_conv.is_owned = false;
20436         (this_arg_conv->handle_update_add_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
20437 }
20438
20439 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) {
20440         void* this_arg_ptr = untag_ptr(this_arg);
20441         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
20442         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
20443         LDKPublicKey their_node_id_ref;
20444         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
20445         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
20446         LDKUpdateFulfillHTLC msg_conv;
20447         msg_conv.inner = untag_ptr(msg);
20448         msg_conv.is_owned = ptr_is_owned(msg);
20449         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
20450         msg_conv.is_owned = false;
20451         (this_arg_conv->handle_update_fulfill_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
20452 }
20453
20454 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) {
20455         void* this_arg_ptr = untag_ptr(this_arg);
20456         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
20457         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
20458         LDKPublicKey their_node_id_ref;
20459         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
20460         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
20461         LDKUpdateFailHTLC msg_conv;
20462         msg_conv.inner = untag_ptr(msg);
20463         msg_conv.is_owned = ptr_is_owned(msg);
20464         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
20465         msg_conv.is_owned = false;
20466         (this_arg_conv->handle_update_fail_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
20467 }
20468
20469 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) {
20470         void* this_arg_ptr = untag_ptr(this_arg);
20471         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
20472         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
20473         LDKPublicKey their_node_id_ref;
20474         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
20475         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
20476         LDKUpdateFailMalformedHTLC msg_conv;
20477         msg_conv.inner = untag_ptr(msg);
20478         msg_conv.is_owned = ptr_is_owned(msg);
20479         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
20480         msg_conv.is_owned = false;
20481         (this_arg_conv->handle_update_fail_malformed_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
20482 }
20483
20484 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) {
20485         void* this_arg_ptr = untag_ptr(this_arg);
20486         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
20487         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
20488         LDKPublicKey their_node_id_ref;
20489         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
20490         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
20491         LDKCommitmentSigned msg_conv;
20492         msg_conv.inner = untag_ptr(msg);
20493         msg_conv.is_owned = ptr_is_owned(msg);
20494         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
20495         msg_conv.is_owned = false;
20496         (this_arg_conv->handle_commitment_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
20497 }
20498
20499 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) {
20500         void* this_arg_ptr = untag_ptr(this_arg);
20501         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
20502         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
20503         LDKPublicKey their_node_id_ref;
20504         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
20505         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
20506         LDKRevokeAndACK msg_conv;
20507         msg_conv.inner = untag_ptr(msg);
20508         msg_conv.is_owned = ptr_is_owned(msg);
20509         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
20510         msg_conv.is_owned = false;
20511         (this_arg_conv->handle_revoke_and_ack)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
20512 }
20513
20514 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) {
20515         void* this_arg_ptr = untag_ptr(this_arg);
20516         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
20517         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
20518         LDKPublicKey their_node_id_ref;
20519         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
20520         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
20521         LDKUpdateFee msg_conv;
20522         msg_conv.inner = untag_ptr(msg);
20523         msg_conv.is_owned = ptr_is_owned(msg);
20524         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
20525         msg_conv.is_owned = false;
20526         (this_arg_conv->handle_update_fee)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
20527 }
20528
20529 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) {
20530         void* this_arg_ptr = untag_ptr(this_arg);
20531         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
20532         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
20533         LDKPublicKey their_node_id_ref;
20534         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
20535         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
20536         LDKAnnouncementSignatures msg_conv;
20537         msg_conv.inner = untag_ptr(msg);
20538         msg_conv.is_owned = ptr_is_owned(msg);
20539         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
20540         msg_conv.is_owned = false;
20541         (this_arg_conv->handle_announcement_signatures)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
20542 }
20543
20544 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1peer_1disconnected(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id) {
20545         void* this_arg_ptr = untag_ptr(this_arg);
20546         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
20547         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
20548         LDKPublicKey their_node_id_ref;
20549         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
20550         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
20551         (this_arg_conv->peer_disconnected)(this_arg_conv->this_arg, their_node_id_ref);
20552 }
20553
20554 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) {
20555         void* this_arg_ptr = untag_ptr(this_arg);
20556         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
20557         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
20558         LDKPublicKey their_node_id_ref;
20559         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
20560         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
20561         LDKInit msg_conv;
20562         msg_conv.inner = untag_ptr(msg);
20563         msg_conv.is_owned = ptr_is_owned(msg);
20564         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
20565         msg_conv.is_owned = false;
20566         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
20567         *ret_conv = (this_arg_conv->peer_connected)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv, inbound);
20568         return tag_ptr(ret_conv, true);
20569 }
20570
20571 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) {
20572         void* this_arg_ptr = untag_ptr(this_arg);
20573         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
20574         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
20575         LDKPublicKey their_node_id_ref;
20576         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
20577         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
20578         LDKChannelReestablish msg_conv;
20579         msg_conv.inner = untag_ptr(msg);
20580         msg_conv.is_owned = ptr_is_owned(msg);
20581         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
20582         msg_conv.is_owned = false;
20583         (this_arg_conv->handle_channel_reestablish)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
20584 }
20585
20586 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) {
20587         void* this_arg_ptr = untag_ptr(this_arg);
20588         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
20589         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
20590         LDKPublicKey their_node_id_ref;
20591         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
20592         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
20593         LDKChannelUpdate msg_conv;
20594         msg_conv.inner = untag_ptr(msg);
20595         msg_conv.is_owned = ptr_is_owned(msg);
20596         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
20597         msg_conv.is_owned = false;
20598         (this_arg_conv->handle_channel_update)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
20599 }
20600
20601 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) {
20602         void* this_arg_ptr = untag_ptr(this_arg);
20603         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
20604         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
20605         LDKPublicKey their_node_id_ref;
20606         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
20607         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
20608         LDKErrorMessage msg_conv;
20609         msg_conv.inner = untag_ptr(msg);
20610         msg_conv.is_owned = ptr_is_owned(msg);
20611         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
20612         msg_conv.is_owned = false;
20613         (this_arg_conv->handle_error)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
20614 }
20615
20616 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1provided_1node_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
20617         void* this_arg_ptr = untag_ptr(this_arg);
20618         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
20619         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
20620         LDKNodeFeatures ret_var = (this_arg_conv->provided_node_features)(this_arg_conv->this_arg);
20621         int64_t ret_ref = 0;
20622         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
20623         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
20624         return ret_ref;
20625 }
20626
20627 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) {
20628         void* this_arg_ptr = untag_ptr(this_arg);
20629         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
20630         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
20631         LDKPublicKey their_node_id_ref;
20632         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
20633         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
20634         LDKInitFeatures ret_var = (this_arg_conv->provided_init_features)(this_arg_conv->this_arg, their_node_id_ref);
20635         int64_t ret_ref = 0;
20636         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
20637         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
20638         return ret_ref;
20639 }
20640
20641 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1get_1chain_1hashes(JNIEnv *env, jclass clz, int64_t this_arg) {
20642         void* this_arg_ptr = untag_ptr(this_arg);
20643         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
20644         LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr;
20645         LDKCOption_CVec_ThirtyTwoBytesZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_ThirtyTwoBytesZZ), "LDKCOption_CVec_ThirtyTwoBytesZZ");
20646         *ret_copy = (this_arg_conv->get_chain_hashes)(this_arg_conv->this_arg);
20647         int64_t ret_ref = tag_ptr(ret_copy, true);
20648         return ret_ref;
20649 }
20650
20651 typedef struct LDKOffersMessageHandler_JCalls {
20652         atomic_size_t refcnt;
20653         JavaVM *vm;
20654         jweak o;
20655         jmethodID handle_message_meth;
20656         jmethodID release_pending_messages_meth;
20657 } LDKOffersMessageHandler_JCalls;
20658 static void LDKOffersMessageHandler_JCalls_free(void* this_arg) {
20659         LDKOffersMessageHandler_JCalls *j_calls = (LDKOffersMessageHandler_JCalls*) this_arg;
20660         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
20661                 JNIEnv *env;
20662                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
20663                 if (get_jenv_res == JNI_EDETACHED) {
20664                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
20665                 } else {
20666                         DO_ASSERT(get_jenv_res == JNI_OK);
20667                 }
20668                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
20669                 if (get_jenv_res == JNI_EDETACHED) {
20670                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
20671                 }
20672                 FREE(j_calls);
20673         }
20674 }
20675 LDKCOption_OffersMessageZ handle_message_LDKOffersMessageHandler_jcall(const void* this_arg, LDKOffersMessage message) {
20676         LDKOffersMessageHandler_JCalls *j_calls = (LDKOffersMessageHandler_JCalls*) this_arg;
20677         JNIEnv *env;
20678         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
20679         if (get_jenv_res == JNI_EDETACHED) {
20680                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
20681         } else {
20682                 DO_ASSERT(get_jenv_res == JNI_OK);
20683         }
20684         LDKOffersMessage *message_copy = MALLOC(sizeof(LDKOffersMessage), "LDKOffersMessage");
20685         *message_copy = message;
20686         int64_t message_ref = tag_ptr(message_copy, true);
20687         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
20688         CHECK(obj != NULL);
20689         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_message_meth, message_ref);
20690         if (UNLIKELY((*env)->ExceptionCheck(env))) {
20691                 (*env)->ExceptionDescribe(env);
20692                 (*env)->FatalError(env, "A call to handle_message in LDKOffersMessageHandler from rust threw an exception.");
20693         }
20694         void* ret_ptr = untag_ptr(ret);
20695         CHECK_ACCESS(ret_ptr);
20696         LDKCOption_OffersMessageZ ret_conv = *(LDKCOption_OffersMessageZ*)(ret_ptr);
20697         FREE(untag_ptr(ret));
20698         if (get_jenv_res == JNI_EDETACHED) {
20699                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
20700         }
20701         return ret_conv;
20702 }
20703 LDKCVec_C3Tuple_OffersMessageDestinationBlindedPathZZ release_pending_messages_LDKOffersMessageHandler_jcall(const void* this_arg) {
20704         LDKOffersMessageHandler_JCalls *j_calls = (LDKOffersMessageHandler_JCalls*) this_arg;
20705         JNIEnv *env;
20706         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
20707         if (get_jenv_res == JNI_EDETACHED) {
20708                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
20709         } else {
20710                 DO_ASSERT(get_jenv_res == JNI_OK);
20711         }
20712         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
20713         CHECK(obj != NULL);
20714         int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->release_pending_messages_meth);
20715         if (UNLIKELY((*env)->ExceptionCheck(env))) {
20716                 (*env)->ExceptionDescribe(env);
20717                 (*env)->FatalError(env, "A call to release_pending_messages in LDKOffersMessageHandler from rust threw an exception.");
20718         }
20719         LDKCVec_C3Tuple_OffersMessageDestinationBlindedPathZZ ret_constr;
20720         ret_constr.datalen = (*env)->GetArrayLength(env, ret);
20721         if (ret_constr.datalen > 0)
20722                 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC3Tuple_OffersMessageDestinationBlindedPathZ), "LDKCVec_C3Tuple_OffersMessageDestinationBlindedPathZZ Elements");
20723         else
20724                 ret_constr.data = NULL;
20725         int64_t* ret_vals = (*env)->GetLongArrayElements (env, ret, NULL);
20726         for (size_t x = 0; x < ret_constr.datalen; x++) {
20727                 int64_t ret_conv_49 = ret_vals[x];
20728                 void* ret_conv_49_ptr = untag_ptr(ret_conv_49);
20729                 CHECK_ACCESS(ret_conv_49_ptr);
20730                 LDKC3Tuple_OffersMessageDestinationBlindedPathZ ret_conv_49_conv = *(LDKC3Tuple_OffersMessageDestinationBlindedPathZ*)(ret_conv_49_ptr);
20731                 FREE(untag_ptr(ret_conv_49));
20732                 ret_constr.data[x] = ret_conv_49_conv;
20733         }
20734         (*env)->ReleaseLongArrayElements(env, ret, ret_vals, 0);
20735         if (get_jenv_res == JNI_EDETACHED) {
20736                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
20737         }
20738         return ret_constr;
20739 }
20740 static void LDKOffersMessageHandler_JCalls_cloned(LDKOffersMessageHandler* new_obj) {
20741         LDKOffersMessageHandler_JCalls *j_calls = (LDKOffersMessageHandler_JCalls*) new_obj->this_arg;
20742         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
20743 }
20744 static inline LDKOffersMessageHandler LDKOffersMessageHandler_init (JNIEnv *env, jclass clz, jobject o) {
20745         jclass c = (*env)->GetObjectClass(env, o);
20746         CHECK(c != NULL);
20747         LDKOffersMessageHandler_JCalls *calls = MALLOC(sizeof(LDKOffersMessageHandler_JCalls), "LDKOffersMessageHandler_JCalls");
20748         atomic_init(&calls->refcnt, 1);
20749         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
20750         calls->o = (*env)->NewWeakGlobalRef(env, o);
20751         calls->handle_message_meth = (*env)->GetMethodID(env, c, "handle_message", "(J)J");
20752         CHECK(calls->handle_message_meth != NULL);
20753         calls->release_pending_messages_meth = (*env)->GetMethodID(env, c, "release_pending_messages", "()[J");
20754         CHECK(calls->release_pending_messages_meth != NULL);
20755
20756         LDKOffersMessageHandler ret = {
20757                 .this_arg = (void*) calls,
20758                 .handle_message = handle_message_LDKOffersMessageHandler_jcall,
20759                 .release_pending_messages = release_pending_messages_LDKOffersMessageHandler_jcall,
20760                 .free = LDKOffersMessageHandler_JCalls_free,
20761         };
20762         return ret;
20763 }
20764 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKOffersMessageHandler_1new(JNIEnv *env, jclass clz, jobject o) {
20765         LDKOffersMessageHandler *res_ptr = MALLOC(sizeof(LDKOffersMessageHandler), "LDKOffersMessageHandler");
20766         *res_ptr = LDKOffersMessageHandler_init(env, clz, o);
20767         return tag_ptr(res_ptr, true);
20768 }
20769 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OffersMessageHandler_1handle_1message(JNIEnv *env, jclass clz, int64_t this_arg, int64_t message) {
20770         void* this_arg_ptr = untag_ptr(this_arg);
20771         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
20772         LDKOffersMessageHandler* this_arg_conv = (LDKOffersMessageHandler*)this_arg_ptr;
20773         void* message_ptr = untag_ptr(message);
20774         CHECK_ACCESS(message_ptr);
20775         LDKOffersMessage message_conv = *(LDKOffersMessage*)(message_ptr);
20776         message_conv = OffersMessage_clone((LDKOffersMessage*)untag_ptr(message));
20777         LDKCOption_OffersMessageZ *ret_copy = MALLOC(sizeof(LDKCOption_OffersMessageZ), "LDKCOption_OffersMessageZ");
20778         *ret_copy = (this_arg_conv->handle_message)(this_arg_conv->this_arg, message_conv);
20779         int64_t ret_ref = tag_ptr(ret_copy, true);
20780         return ret_ref;
20781 }
20782
20783 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_OffersMessageHandler_1release_1pending_1messages(JNIEnv *env, jclass clz, int64_t this_arg) {
20784         void* this_arg_ptr = untag_ptr(this_arg);
20785         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
20786         LDKOffersMessageHandler* this_arg_conv = (LDKOffersMessageHandler*)this_arg_ptr;
20787         LDKCVec_C3Tuple_OffersMessageDestinationBlindedPathZZ ret_var = (this_arg_conv->release_pending_messages)(this_arg_conv->this_arg);
20788         int64_tArray ret_arr = NULL;
20789         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
20790         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
20791         for (size_t x = 0; x < ret_var.datalen; x++) {
20792                 LDKC3Tuple_OffersMessageDestinationBlindedPathZ* ret_conv_49_conv = MALLOC(sizeof(LDKC3Tuple_OffersMessageDestinationBlindedPathZ), "LDKC3Tuple_OffersMessageDestinationBlindedPathZ");
20793                 *ret_conv_49_conv = ret_var.data[x];
20794                 ret_arr_ptr[x] = tag_ptr(ret_conv_49_conv, true);
20795         }
20796         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
20797         FREE(ret_var.data);
20798         return ret_arr;
20799 }
20800
20801 typedef struct LDKNodeIdLookUp_JCalls {
20802         atomic_size_t refcnt;
20803         JavaVM *vm;
20804         jweak o;
20805         jmethodID next_node_id_meth;
20806 } LDKNodeIdLookUp_JCalls;
20807 static void LDKNodeIdLookUp_JCalls_free(void* this_arg) {
20808         LDKNodeIdLookUp_JCalls *j_calls = (LDKNodeIdLookUp_JCalls*) this_arg;
20809         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
20810                 JNIEnv *env;
20811                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
20812                 if (get_jenv_res == JNI_EDETACHED) {
20813                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
20814                 } else {
20815                         DO_ASSERT(get_jenv_res == JNI_OK);
20816                 }
20817                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
20818                 if (get_jenv_res == JNI_EDETACHED) {
20819                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
20820                 }
20821                 FREE(j_calls);
20822         }
20823 }
20824 LDKPublicKey next_node_id_LDKNodeIdLookUp_jcall(const void* this_arg, uint64_t short_channel_id) {
20825         LDKNodeIdLookUp_JCalls *j_calls = (LDKNodeIdLookUp_JCalls*) this_arg;
20826         JNIEnv *env;
20827         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
20828         if (get_jenv_res == JNI_EDETACHED) {
20829                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
20830         } else {
20831                 DO_ASSERT(get_jenv_res == JNI_OK);
20832         }
20833         int64_t short_channel_id_conv = short_channel_id;
20834         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
20835         CHECK(obj != NULL);
20836         int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->next_node_id_meth, short_channel_id_conv);
20837         if (UNLIKELY((*env)->ExceptionCheck(env))) {
20838                 (*env)->ExceptionDescribe(env);
20839                 (*env)->FatalError(env, "A call to next_node_id in LDKNodeIdLookUp from rust threw an exception.");
20840         }
20841         LDKPublicKey ret_ref;
20842         CHECK((*env)->GetArrayLength(env, ret) == 33);
20843         (*env)->GetByteArrayRegion(env, ret, 0, 33, ret_ref.compressed_form);
20844         if (get_jenv_res == JNI_EDETACHED) {
20845                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
20846         }
20847         return ret_ref;
20848 }
20849 static void LDKNodeIdLookUp_JCalls_cloned(LDKNodeIdLookUp* new_obj) {
20850         LDKNodeIdLookUp_JCalls *j_calls = (LDKNodeIdLookUp_JCalls*) new_obj->this_arg;
20851         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
20852 }
20853 static inline LDKNodeIdLookUp LDKNodeIdLookUp_init (JNIEnv *env, jclass clz, jobject o) {
20854         jclass c = (*env)->GetObjectClass(env, o);
20855         CHECK(c != NULL);
20856         LDKNodeIdLookUp_JCalls *calls = MALLOC(sizeof(LDKNodeIdLookUp_JCalls), "LDKNodeIdLookUp_JCalls");
20857         atomic_init(&calls->refcnt, 1);
20858         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
20859         calls->o = (*env)->NewWeakGlobalRef(env, o);
20860         calls->next_node_id_meth = (*env)->GetMethodID(env, c, "next_node_id", "(J)[B");
20861         CHECK(calls->next_node_id_meth != NULL);
20862
20863         LDKNodeIdLookUp ret = {
20864                 .this_arg = (void*) calls,
20865                 .next_node_id = next_node_id_LDKNodeIdLookUp_jcall,
20866                 .free = LDKNodeIdLookUp_JCalls_free,
20867         };
20868         return ret;
20869 }
20870 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKNodeIdLookUp_1new(JNIEnv *env, jclass clz, jobject o) {
20871         LDKNodeIdLookUp *res_ptr = MALLOC(sizeof(LDKNodeIdLookUp), "LDKNodeIdLookUp");
20872         *res_ptr = LDKNodeIdLookUp_init(env, clz, o);
20873         return tag_ptr(res_ptr, true);
20874 }
20875 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeIdLookUp_1next_1node_1id(JNIEnv *env, jclass clz, int64_t this_arg, int64_t short_channel_id) {
20876         void* this_arg_ptr = untag_ptr(this_arg);
20877         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
20878         LDKNodeIdLookUp* this_arg_conv = (LDKNodeIdLookUp*)this_arg_ptr;
20879         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
20880         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, (this_arg_conv->next_node_id)(this_arg_conv->this_arg, short_channel_id).compressed_form);
20881         return ret_arr;
20882 }
20883
20884 typedef struct LDKRoutingMessageHandler_JCalls {
20885         atomic_size_t refcnt;
20886         JavaVM *vm;
20887         jweak o;
20888         LDKMessageSendEventsProvider_JCalls* MessageSendEventsProvider;
20889         jmethodID handle_node_announcement_meth;
20890         jmethodID handle_channel_announcement_meth;
20891         jmethodID handle_channel_update_meth;
20892         jmethodID get_next_channel_announcement_meth;
20893         jmethodID get_next_node_announcement_meth;
20894         jmethodID peer_connected_meth;
20895         jmethodID handle_reply_channel_range_meth;
20896         jmethodID handle_reply_short_channel_ids_end_meth;
20897         jmethodID handle_query_channel_range_meth;
20898         jmethodID handle_query_short_channel_ids_meth;
20899         jmethodID processing_queue_high_meth;
20900         jmethodID provided_node_features_meth;
20901         jmethodID provided_init_features_meth;
20902 } LDKRoutingMessageHandler_JCalls;
20903 static void LDKRoutingMessageHandler_JCalls_free(void* this_arg) {
20904         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
20905         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
20906                 JNIEnv *env;
20907                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
20908                 if (get_jenv_res == JNI_EDETACHED) {
20909                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
20910                 } else {
20911                         DO_ASSERT(get_jenv_res == JNI_OK);
20912                 }
20913                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
20914                 if (get_jenv_res == JNI_EDETACHED) {
20915                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
20916                 }
20917                 FREE(j_calls);
20918         }
20919 }
20920 LDKCResult_boolLightningErrorZ handle_node_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKNodeAnnouncement * msg) {
20921         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
20922         JNIEnv *env;
20923         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
20924         if (get_jenv_res == JNI_EDETACHED) {
20925                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
20926         } else {
20927                 DO_ASSERT(get_jenv_res == JNI_OK);
20928         }
20929         LDKNodeAnnouncement msg_var = *msg;
20930         int64_t msg_ref = 0;
20931         msg_var = NodeAnnouncement_clone(&msg_var);
20932         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
20933         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
20934         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
20935         CHECK(obj != NULL);
20936         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_node_announcement_meth, msg_ref);
20937         if (UNLIKELY((*env)->ExceptionCheck(env))) {
20938                 (*env)->ExceptionDescribe(env);
20939                 (*env)->FatalError(env, "A call to handle_node_announcement in LDKRoutingMessageHandler from rust threw an exception.");
20940         }
20941         void* ret_ptr = untag_ptr(ret);
20942         CHECK_ACCESS(ret_ptr);
20943         LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(ret_ptr);
20944         FREE(untag_ptr(ret));
20945         if (get_jenv_res == JNI_EDETACHED) {
20946                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
20947         }
20948         return ret_conv;
20949 }
20950 LDKCResult_boolLightningErrorZ handle_channel_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKChannelAnnouncement * msg) {
20951         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
20952         JNIEnv *env;
20953         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
20954         if (get_jenv_res == JNI_EDETACHED) {
20955                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
20956         } else {
20957                 DO_ASSERT(get_jenv_res == JNI_OK);
20958         }
20959         LDKChannelAnnouncement msg_var = *msg;
20960         int64_t msg_ref = 0;
20961         msg_var = ChannelAnnouncement_clone(&msg_var);
20962         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
20963         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
20964         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
20965         CHECK(obj != NULL);
20966         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_channel_announcement_meth, msg_ref);
20967         if (UNLIKELY((*env)->ExceptionCheck(env))) {
20968                 (*env)->ExceptionDescribe(env);
20969                 (*env)->FatalError(env, "A call to handle_channel_announcement in LDKRoutingMessageHandler from rust threw an exception.");
20970         }
20971         void* ret_ptr = untag_ptr(ret);
20972         CHECK_ACCESS(ret_ptr);
20973         LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(ret_ptr);
20974         FREE(untag_ptr(ret));
20975         if (get_jenv_res == JNI_EDETACHED) {
20976                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
20977         }
20978         return ret_conv;
20979 }
20980 LDKCResult_boolLightningErrorZ handle_channel_update_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKChannelUpdate * msg) {
20981         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
20982         JNIEnv *env;
20983         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
20984         if (get_jenv_res == JNI_EDETACHED) {
20985                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
20986         } else {
20987                 DO_ASSERT(get_jenv_res == JNI_OK);
20988         }
20989         LDKChannelUpdate msg_var = *msg;
20990         int64_t msg_ref = 0;
20991         msg_var = ChannelUpdate_clone(&msg_var);
20992         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
20993         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
20994         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
20995         CHECK(obj != NULL);
20996         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_channel_update_meth, msg_ref);
20997         if (UNLIKELY((*env)->ExceptionCheck(env))) {
20998                 (*env)->ExceptionDescribe(env);
20999                 (*env)->FatalError(env, "A call to handle_channel_update in LDKRoutingMessageHandler from rust threw an exception.");
21000         }
21001         void* ret_ptr = untag_ptr(ret);
21002         CHECK_ACCESS(ret_ptr);
21003         LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(ret_ptr);
21004         FREE(untag_ptr(ret));
21005         if (get_jenv_res == JNI_EDETACHED) {
21006                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
21007         }
21008         return ret_conv;
21009 }
21010 LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ get_next_channel_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, uint64_t starting_point) {
21011         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
21012         JNIEnv *env;
21013         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
21014         if (get_jenv_res == JNI_EDETACHED) {
21015                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
21016         } else {
21017                 DO_ASSERT(get_jenv_res == JNI_OK);
21018         }
21019         int64_t starting_point_conv = starting_point;
21020         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
21021         CHECK(obj != NULL);
21022         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->get_next_channel_announcement_meth, starting_point_conv);
21023         if (UNLIKELY((*env)->ExceptionCheck(env))) {
21024                 (*env)->ExceptionDescribe(env);
21025                 (*env)->FatalError(env, "A call to get_next_channel_announcement in LDKRoutingMessageHandler from rust threw an exception.");
21026         }
21027         void* ret_ptr = untag_ptr(ret);
21028         CHECK_ACCESS(ret_ptr);
21029         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret_conv = *(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ*)(ret_ptr);
21030         FREE(untag_ptr(ret));
21031         if (get_jenv_res == JNI_EDETACHED) {
21032                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
21033         }
21034         return ret_conv;
21035 }
21036 LDKNodeAnnouncement get_next_node_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKNodeId starting_point) {
21037         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
21038         JNIEnv *env;
21039         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
21040         if (get_jenv_res == JNI_EDETACHED) {
21041                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
21042         } else {
21043                 DO_ASSERT(get_jenv_res == JNI_OK);
21044         }
21045         LDKNodeId starting_point_var = starting_point;
21046         int64_t starting_point_ref = 0;
21047         CHECK_INNER_FIELD_ACCESS_OR_NULL(starting_point_var);
21048         starting_point_ref = tag_ptr(starting_point_var.inner, starting_point_var.is_owned);
21049         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
21050         CHECK(obj != NULL);
21051         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->get_next_node_announcement_meth, starting_point_ref);
21052         if (UNLIKELY((*env)->ExceptionCheck(env))) {
21053                 (*env)->ExceptionDescribe(env);
21054                 (*env)->FatalError(env, "A call to get_next_node_announcement in LDKRoutingMessageHandler from rust threw an exception.");
21055         }
21056         LDKNodeAnnouncement ret_conv;
21057         ret_conv.inner = untag_ptr(ret);
21058         ret_conv.is_owned = ptr_is_owned(ret);
21059         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
21060         if (get_jenv_res == JNI_EDETACHED) {
21061                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
21062         }
21063         return ret_conv;
21064 }
21065 LDKCResult_NoneNoneZ peer_connected_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * init, bool inbound) {
21066         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
21067         JNIEnv *env;
21068         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
21069         if (get_jenv_res == JNI_EDETACHED) {
21070                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
21071         } else {
21072                 DO_ASSERT(get_jenv_res == JNI_OK);
21073         }
21074         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
21075         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
21076         LDKInit init_var = *init;
21077         int64_t init_ref = 0;
21078         init_var = Init_clone(&init_var);
21079         CHECK_INNER_FIELD_ACCESS_OR_NULL(init_var);
21080         init_ref = tag_ptr(init_var.inner, init_var.is_owned);
21081         jboolean inbound_conv = inbound;
21082         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
21083         CHECK(obj != NULL);
21084         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->peer_connected_meth, their_node_id_arr, init_ref, inbound_conv);
21085         if (UNLIKELY((*env)->ExceptionCheck(env))) {
21086                 (*env)->ExceptionDescribe(env);
21087                 (*env)->FatalError(env, "A call to peer_connected in LDKRoutingMessageHandler from rust threw an exception.");
21088         }
21089         void* ret_ptr = untag_ptr(ret);
21090         CHECK_ACCESS(ret_ptr);
21091         LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(ret_ptr);
21092         FREE(untag_ptr(ret));
21093         if (get_jenv_res == JNI_EDETACHED) {
21094                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
21095         }
21096         return ret_conv;
21097 }
21098 LDKCResult_NoneLightningErrorZ handle_reply_channel_range_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKReplyChannelRange msg) {
21099         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
21100         JNIEnv *env;
21101         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
21102         if (get_jenv_res == JNI_EDETACHED) {
21103                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
21104         } else {
21105                 DO_ASSERT(get_jenv_res == JNI_OK);
21106         }
21107         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
21108         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
21109         LDKReplyChannelRange msg_var = msg;
21110         int64_t msg_ref = 0;
21111         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
21112         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
21113         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
21114         CHECK(obj != NULL);
21115         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_reply_channel_range_meth, their_node_id_arr, msg_ref);
21116         if (UNLIKELY((*env)->ExceptionCheck(env))) {
21117                 (*env)->ExceptionDescribe(env);
21118                 (*env)->FatalError(env, "A call to handle_reply_channel_range in LDKRoutingMessageHandler from rust threw an exception.");
21119         }
21120         void* ret_ptr = untag_ptr(ret);
21121         CHECK_ACCESS(ret_ptr);
21122         LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
21123         FREE(untag_ptr(ret));
21124         if (get_jenv_res == JNI_EDETACHED) {
21125                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
21126         }
21127         return ret_conv;
21128 }
21129 LDKCResult_NoneLightningErrorZ handle_reply_short_channel_ids_end_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKReplyShortChannelIdsEnd msg) {
21130         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
21131         JNIEnv *env;
21132         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
21133         if (get_jenv_res == JNI_EDETACHED) {
21134                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
21135         } else {
21136                 DO_ASSERT(get_jenv_res == JNI_OK);
21137         }
21138         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
21139         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
21140         LDKReplyShortChannelIdsEnd msg_var = msg;
21141         int64_t msg_ref = 0;
21142         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
21143         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
21144         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
21145         CHECK(obj != NULL);
21146         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_reply_short_channel_ids_end_meth, their_node_id_arr, msg_ref);
21147         if (UNLIKELY((*env)->ExceptionCheck(env))) {
21148                 (*env)->ExceptionDescribe(env);
21149                 (*env)->FatalError(env, "A call to handle_reply_short_channel_ids_end in LDKRoutingMessageHandler from rust threw an exception.");
21150         }
21151         void* ret_ptr = untag_ptr(ret);
21152         CHECK_ACCESS(ret_ptr);
21153         LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
21154         FREE(untag_ptr(ret));
21155         if (get_jenv_res == JNI_EDETACHED) {
21156                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
21157         }
21158         return ret_conv;
21159 }
21160 LDKCResult_NoneLightningErrorZ handle_query_channel_range_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKQueryChannelRange msg) {
21161         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
21162         JNIEnv *env;
21163         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
21164         if (get_jenv_res == JNI_EDETACHED) {
21165                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
21166         } else {
21167                 DO_ASSERT(get_jenv_res == JNI_OK);
21168         }
21169         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
21170         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
21171         LDKQueryChannelRange msg_var = msg;
21172         int64_t msg_ref = 0;
21173         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
21174         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
21175         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
21176         CHECK(obj != NULL);
21177         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_query_channel_range_meth, their_node_id_arr, msg_ref);
21178         if (UNLIKELY((*env)->ExceptionCheck(env))) {
21179                 (*env)->ExceptionDescribe(env);
21180                 (*env)->FatalError(env, "A call to handle_query_channel_range in LDKRoutingMessageHandler from rust threw an exception.");
21181         }
21182         void* ret_ptr = untag_ptr(ret);
21183         CHECK_ACCESS(ret_ptr);
21184         LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
21185         FREE(untag_ptr(ret));
21186         if (get_jenv_res == JNI_EDETACHED) {
21187                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
21188         }
21189         return ret_conv;
21190 }
21191 LDKCResult_NoneLightningErrorZ handle_query_short_channel_ids_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKQueryShortChannelIds msg) {
21192         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
21193         JNIEnv *env;
21194         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
21195         if (get_jenv_res == JNI_EDETACHED) {
21196                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
21197         } else {
21198                 DO_ASSERT(get_jenv_res == JNI_OK);
21199         }
21200         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
21201         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
21202         LDKQueryShortChannelIds msg_var = msg;
21203         int64_t msg_ref = 0;
21204         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
21205         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
21206         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
21207         CHECK(obj != NULL);
21208         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_query_short_channel_ids_meth, their_node_id_arr, msg_ref);
21209         if (UNLIKELY((*env)->ExceptionCheck(env))) {
21210                 (*env)->ExceptionDescribe(env);
21211                 (*env)->FatalError(env, "A call to handle_query_short_channel_ids in LDKRoutingMessageHandler from rust threw an exception.");
21212         }
21213         void* ret_ptr = untag_ptr(ret);
21214         CHECK_ACCESS(ret_ptr);
21215         LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
21216         FREE(untag_ptr(ret));
21217         if (get_jenv_res == JNI_EDETACHED) {
21218                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
21219         }
21220         return ret_conv;
21221 }
21222 bool processing_queue_high_LDKRoutingMessageHandler_jcall(const void* this_arg) {
21223         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
21224         JNIEnv *env;
21225         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
21226         if (get_jenv_res == JNI_EDETACHED) {
21227                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
21228         } else {
21229                 DO_ASSERT(get_jenv_res == JNI_OK);
21230         }
21231         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
21232         CHECK(obj != NULL);
21233         jboolean ret = (*env)->CallBooleanMethod(env, obj, j_calls->processing_queue_high_meth);
21234         if (UNLIKELY((*env)->ExceptionCheck(env))) {
21235                 (*env)->ExceptionDescribe(env);
21236                 (*env)->FatalError(env, "A call to processing_queue_high in LDKRoutingMessageHandler from rust threw an exception.");
21237         }
21238         if (get_jenv_res == JNI_EDETACHED) {
21239                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
21240         }
21241         return ret;
21242 }
21243 LDKNodeFeatures provided_node_features_LDKRoutingMessageHandler_jcall(const void* this_arg) {
21244         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
21245         JNIEnv *env;
21246         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
21247         if (get_jenv_res == JNI_EDETACHED) {
21248                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
21249         } else {
21250                 DO_ASSERT(get_jenv_res == JNI_OK);
21251         }
21252         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
21253         CHECK(obj != NULL);
21254         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->provided_node_features_meth);
21255         if (UNLIKELY((*env)->ExceptionCheck(env))) {
21256                 (*env)->ExceptionDescribe(env);
21257                 (*env)->FatalError(env, "A call to provided_node_features in LDKRoutingMessageHandler from rust threw an exception.");
21258         }
21259         LDKNodeFeatures ret_conv;
21260         ret_conv.inner = untag_ptr(ret);
21261         ret_conv.is_owned = ptr_is_owned(ret);
21262         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
21263         if (get_jenv_res == JNI_EDETACHED) {
21264                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
21265         }
21266         return ret_conv;
21267 }
21268 LDKInitFeatures provided_init_features_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id) {
21269         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
21270         JNIEnv *env;
21271         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
21272         if (get_jenv_res == JNI_EDETACHED) {
21273                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
21274         } else {
21275                 DO_ASSERT(get_jenv_res == JNI_OK);
21276         }
21277         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
21278         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
21279         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
21280         CHECK(obj != NULL);
21281         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->provided_init_features_meth, their_node_id_arr);
21282         if (UNLIKELY((*env)->ExceptionCheck(env))) {
21283                 (*env)->ExceptionDescribe(env);
21284                 (*env)->FatalError(env, "A call to provided_init_features in LDKRoutingMessageHandler from rust threw an exception.");
21285         }
21286         LDKInitFeatures ret_conv;
21287         ret_conv.inner = untag_ptr(ret);
21288         ret_conv.is_owned = ptr_is_owned(ret);
21289         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
21290         if (get_jenv_res == JNI_EDETACHED) {
21291                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
21292         }
21293         return ret_conv;
21294 }
21295 static void LDKRoutingMessageHandler_JCalls_cloned(LDKRoutingMessageHandler* new_obj) {
21296         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) new_obj->this_arg;
21297         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
21298         atomic_fetch_add_explicit(&j_calls->MessageSendEventsProvider->refcnt, 1, memory_order_release);
21299 }
21300 static inline LDKRoutingMessageHandler LDKRoutingMessageHandler_init (JNIEnv *env, jclass clz, jobject o, jobject MessageSendEventsProvider) {
21301         jclass c = (*env)->GetObjectClass(env, o);
21302         CHECK(c != NULL);
21303         LDKRoutingMessageHandler_JCalls *calls = MALLOC(sizeof(LDKRoutingMessageHandler_JCalls), "LDKRoutingMessageHandler_JCalls");
21304         atomic_init(&calls->refcnt, 1);
21305         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
21306         calls->o = (*env)->NewWeakGlobalRef(env, o);
21307         calls->handle_node_announcement_meth = (*env)->GetMethodID(env, c, "handle_node_announcement", "(J)J");
21308         CHECK(calls->handle_node_announcement_meth != NULL);
21309         calls->handle_channel_announcement_meth = (*env)->GetMethodID(env, c, "handle_channel_announcement", "(J)J");
21310         CHECK(calls->handle_channel_announcement_meth != NULL);
21311         calls->handle_channel_update_meth = (*env)->GetMethodID(env, c, "handle_channel_update", "(J)J");
21312         CHECK(calls->handle_channel_update_meth != NULL);
21313         calls->get_next_channel_announcement_meth = (*env)->GetMethodID(env, c, "get_next_channel_announcement", "(J)J");
21314         CHECK(calls->get_next_channel_announcement_meth != NULL);
21315         calls->get_next_node_announcement_meth = (*env)->GetMethodID(env, c, "get_next_node_announcement", "(J)J");
21316         CHECK(calls->get_next_node_announcement_meth != NULL);
21317         calls->peer_connected_meth = (*env)->GetMethodID(env, c, "peer_connected", "([BJZ)J");
21318         CHECK(calls->peer_connected_meth != NULL);
21319         calls->handle_reply_channel_range_meth = (*env)->GetMethodID(env, c, "handle_reply_channel_range", "([BJ)J");
21320         CHECK(calls->handle_reply_channel_range_meth != NULL);
21321         calls->handle_reply_short_channel_ids_end_meth = (*env)->GetMethodID(env, c, "handle_reply_short_channel_ids_end", "([BJ)J");
21322         CHECK(calls->handle_reply_short_channel_ids_end_meth != NULL);
21323         calls->handle_query_channel_range_meth = (*env)->GetMethodID(env, c, "handle_query_channel_range", "([BJ)J");
21324         CHECK(calls->handle_query_channel_range_meth != NULL);
21325         calls->handle_query_short_channel_ids_meth = (*env)->GetMethodID(env, c, "handle_query_short_channel_ids", "([BJ)J");
21326         CHECK(calls->handle_query_short_channel_ids_meth != NULL);
21327         calls->processing_queue_high_meth = (*env)->GetMethodID(env, c, "processing_queue_high", "()Z");
21328         CHECK(calls->processing_queue_high_meth != NULL);
21329         calls->provided_node_features_meth = (*env)->GetMethodID(env, c, "provided_node_features", "()J");
21330         CHECK(calls->provided_node_features_meth != NULL);
21331         calls->provided_init_features_meth = (*env)->GetMethodID(env, c, "provided_init_features", "([B)J");
21332         CHECK(calls->provided_init_features_meth != NULL);
21333
21334         LDKRoutingMessageHandler ret = {
21335                 .this_arg = (void*) calls,
21336                 .handle_node_announcement = handle_node_announcement_LDKRoutingMessageHandler_jcall,
21337                 .handle_channel_announcement = handle_channel_announcement_LDKRoutingMessageHandler_jcall,
21338                 .handle_channel_update = handle_channel_update_LDKRoutingMessageHandler_jcall,
21339                 .get_next_channel_announcement = get_next_channel_announcement_LDKRoutingMessageHandler_jcall,
21340                 .get_next_node_announcement = get_next_node_announcement_LDKRoutingMessageHandler_jcall,
21341                 .peer_connected = peer_connected_LDKRoutingMessageHandler_jcall,
21342                 .handle_reply_channel_range = handle_reply_channel_range_LDKRoutingMessageHandler_jcall,
21343                 .handle_reply_short_channel_ids_end = handle_reply_short_channel_ids_end_LDKRoutingMessageHandler_jcall,
21344                 .handle_query_channel_range = handle_query_channel_range_LDKRoutingMessageHandler_jcall,
21345                 .handle_query_short_channel_ids = handle_query_short_channel_ids_LDKRoutingMessageHandler_jcall,
21346                 .processing_queue_high = processing_queue_high_LDKRoutingMessageHandler_jcall,
21347                 .provided_node_features = provided_node_features_LDKRoutingMessageHandler_jcall,
21348                 .provided_init_features = provided_init_features_LDKRoutingMessageHandler_jcall,
21349                 .free = LDKRoutingMessageHandler_JCalls_free,
21350                 .MessageSendEventsProvider = LDKMessageSendEventsProvider_init(env, clz, MessageSendEventsProvider),
21351         };
21352         calls->MessageSendEventsProvider = ret.MessageSendEventsProvider.this_arg;
21353         return ret;
21354 }
21355 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKRoutingMessageHandler_1new(JNIEnv *env, jclass clz, jobject o, jobject MessageSendEventsProvider) {
21356         LDKRoutingMessageHandler *res_ptr = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
21357         *res_ptr = LDKRoutingMessageHandler_init(env, clz, o, MessageSendEventsProvider);
21358         return tag_ptr(res_ptr, true);
21359 }
21360 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKRoutingMessageHandler_1get_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t arg) {
21361         LDKRoutingMessageHandler *inp = (LDKRoutingMessageHandler *)untag_ptr(arg);
21362         return tag_ptr(&inp->MessageSendEventsProvider, false);
21363 }
21364 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1node_1announcement(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
21365         void* this_arg_ptr = untag_ptr(this_arg);
21366         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
21367         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
21368         LDKNodeAnnouncement msg_conv;
21369         msg_conv.inner = untag_ptr(msg);
21370         msg_conv.is_owned = ptr_is_owned(msg);
21371         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
21372         msg_conv.is_owned = false;
21373         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
21374         *ret_conv = (this_arg_conv->handle_node_announcement)(this_arg_conv->this_arg, &msg_conv);
21375         return tag_ptr(ret_conv, true);
21376 }
21377
21378 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1channel_1announcement(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
21379         void* this_arg_ptr = untag_ptr(this_arg);
21380         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
21381         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
21382         LDKChannelAnnouncement msg_conv;
21383         msg_conv.inner = untag_ptr(msg);
21384         msg_conv.is_owned = ptr_is_owned(msg);
21385         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
21386         msg_conv.is_owned = false;
21387         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
21388         *ret_conv = (this_arg_conv->handle_channel_announcement)(this_arg_conv->this_arg, &msg_conv);
21389         return tag_ptr(ret_conv, true);
21390 }
21391
21392 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1channel_1update(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
21393         void* this_arg_ptr = untag_ptr(this_arg);
21394         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
21395         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
21396         LDKChannelUpdate msg_conv;
21397         msg_conv.inner = untag_ptr(msg);
21398         msg_conv.is_owned = ptr_is_owned(msg);
21399         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
21400         msg_conv.is_owned = false;
21401         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
21402         *ret_conv = (this_arg_conv->handle_channel_update)(this_arg_conv->this_arg, &msg_conv);
21403         return tag_ptr(ret_conv, true);
21404 }
21405
21406 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) {
21407         void* this_arg_ptr = untag_ptr(this_arg);
21408         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
21409         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
21410         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *ret_copy = MALLOC(sizeof(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ), "LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ");
21411         *ret_copy = (this_arg_conv->get_next_channel_announcement)(this_arg_conv->this_arg, starting_point);
21412         int64_t ret_ref = tag_ptr(ret_copy, true);
21413         return ret_ref;
21414 }
21415
21416 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) {
21417         void* this_arg_ptr = untag_ptr(this_arg);
21418         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
21419         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
21420         LDKNodeId starting_point_conv;
21421         starting_point_conv.inner = untag_ptr(starting_point);
21422         starting_point_conv.is_owned = ptr_is_owned(starting_point);
21423         CHECK_INNER_FIELD_ACCESS_OR_NULL(starting_point_conv);
21424         starting_point_conv = NodeId_clone(&starting_point_conv);
21425         LDKNodeAnnouncement ret_var = (this_arg_conv->get_next_node_announcement)(this_arg_conv->this_arg, starting_point_conv);
21426         int64_t ret_ref = 0;
21427         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21428         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
21429         return ret_ref;
21430 }
21431
21432 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) {
21433         void* this_arg_ptr = untag_ptr(this_arg);
21434         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
21435         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
21436         LDKPublicKey their_node_id_ref;
21437         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
21438         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
21439         LDKInit init_conv;
21440         init_conv.inner = untag_ptr(init);
21441         init_conv.is_owned = ptr_is_owned(init);
21442         CHECK_INNER_FIELD_ACCESS_OR_NULL(init_conv);
21443         init_conv.is_owned = false;
21444         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
21445         *ret_conv = (this_arg_conv->peer_connected)(this_arg_conv->this_arg, their_node_id_ref, &init_conv, inbound);
21446         return tag_ptr(ret_conv, true);
21447 }
21448
21449 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) {
21450         void* this_arg_ptr = untag_ptr(this_arg);
21451         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
21452         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
21453         LDKPublicKey their_node_id_ref;
21454         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
21455         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
21456         LDKReplyChannelRange msg_conv;
21457         msg_conv.inner = untag_ptr(msg);
21458         msg_conv.is_owned = ptr_is_owned(msg);
21459         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
21460         msg_conv = ReplyChannelRange_clone(&msg_conv);
21461         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
21462         *ret_conv = (this_arg_conv->handle_reply_channel_range)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
21463         return tag_ptr(ret_conv, true);
21464 }
21465
21466 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) {
21467         void* this_arg_ptr = untag_ptr(this_arg);
21468         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
21469         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
21470         LDKPublicKey their_node_id_ref;
21471         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
21472         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
21473         LDKReplyShortChannelIdsEnd msg_conv;
21474         msg_conv.inner = untag_ptr(msg);
21475         msg_conv.is_owned = ptr_is_owned(msg);
21476         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
21477         msg_conv = ReplyShortChannelIdsEnd_clone(&msg_conv);
21478         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
21479         *ret_conv = (this_arg_conv->handle_reply_short_channel_ids_end)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
21480         return tag_ptr(ret_conv, true);
21481 }
21482
21483 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) {
21484         void* this_arg_ptr = untag_ptr(this_arg);
21485         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
21486         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
21487         LDKPublicKey their_node_id_ref;
21488         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
21489         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
21490         LDKQueryChannelRange msg_conv;
21491         msg_conv.inner = untag_ptr(msg);
21492         msg_conv.is_owned = ptr_is_owned(msg);
21493         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
21494         msg_conv = QueryChannelRange_clone(&msg_conv);
21495         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
21496         *ret_conv = (this_arg_conv->handle_query_channel_range)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
21497         return tag_ptr(ret_conv, true);
21498 }
21499
21500 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) {
21501         void* this_arg_ptr = untag_ptr(this_arg);
21502         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
21503         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
21504         LDKPublicKey their_node_id_ref;
21505         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
21506         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
21507         LDKQueryShortChannelIds msg_conv;
21508         msg_conv.inner = untag_ptr(msg);
21509         msg_conv.is_owned = ptr_is_owned(msg);
21510         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
21511         msg_conv = QueryShortChannelIds_clone(&msg_conv);
21512         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
21513         *ret_conv = (this_arg_conv->handle_query_short_channel_ids)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
21514         return tag_ptr(ret_conv, true);
21515 }
21516
21517 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1processing_1queue_1high(JNIEnv *env, jclass clz, int64_t this_arg) {
21518         void* this_arg_ptr = untag_ptr(this_arg);
21519         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
21520         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
21521         jboolean ret_conv = (this_arg_conv->processing_queue_high)(this_arg_conv->this_arg);
21522         return ret_conv;
21523 }
21524
21525 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1provided_1node_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
21526         void* this_arg_ptr = untag_ptr(this_arg);
21527         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
21528         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
21529         LDKNodeFeatures ret_var = (this_arg_conv->provided_node_features)(this_arg_conv->this_arg);
21530         int64_t ret_ref = 0;
21531         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21532         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
21533         return ret_ref;
21534 }
21535
21536 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) {
21537         void* this_arg_ptr = untag_ptr(this_arg);
21538         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
21539         LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr;
21540         LDKPublicKey their_node_id_ref;
21541         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
21542         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
21543         LDKInitFeatures ret_var = (this_arg_conv->provided_init_features)(this_arg_conv->this_arg, their_node_id_ref);
21544         int64_t ret_ref = 0;
21545         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21546         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
21547         return ret_ref;
21548 }
21549
21550 typedef struct LDKOnionMessageHandler_JCalls {
21551         atomic_size_t refcnt;
21552         JavaVM *vm;
21553         jweak o;
21554         jmethodID get_and_clear_connections_needed_meth;
21555         jmethodID handle_onion_message_meth;
21556         jmethodID next_onion_message_for_peer_meth;
21557         jmethodID peer_connected_meth;
21558         jmethodID peer_disconnected_meth;
21559         jmethodID timer_tick_occurred_meth;
21560         jmethodID provided_node_features_meth;
21561         jmethodID provided_init_features_meth;
21562 } LDKOnionMessageHandler_JCalls;
21563 static void LDKOnionMessageHandler_JCalls_free(void* this_arg) {
21564         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
21565         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
21566                 JNIEnv *env;
21567                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
21568                 if (get_jenv_res == JNI_EDETACHED) {
21569                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
21570                 } else {
21571                         DO_ASSERT(get_jenv_res == JNI_OK);
21572                 }
21573                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
21574                 if (get_jenv_res == JNI_EDETACHED) {
21575                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
21576                 }
21577                 FREE(j_calls);
21578         }
21579 }
21580 LDKCVec_C2Tuple_PublicKeyCVec_SocketAddressZZZ get_and_clear_connections_needed_LDKOnionMessageHandler_jcall(const void* this_arg) {
21581         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
21582         JNIEnv *env;
21583         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
21584         if (get_jenv_res == JNI_EDETACHED) {
21585                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
21586         } else {
21587                 DO_ASSERT(get_jenv_res == JNI_OK);
21588         }
21589         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
21590         CHECK(obj != NULL);
21591         int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_and_clear_connections_needed_meth);
21592         if (UNLIKELY((*env)->ExceptionCheck(env))) {
21593                 (*env)->ExceptionDescribe(env);
21594                 (*env)->FatalError(env, "A call to get_and_clear_connections_needed in LDKOnionMessageHandler from rust threw an exception.");
21595         }
21596         LDKCVec_C2Tuple_PublicKeyCVec_SocketAddressZZZ ret_constr;
21597         ret_constr.datalen = (*env)->GetArrayLength(env, ret);
21598         if (ret_constr.datalen > 0)
21599                 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC2Tuple_PublicKeyCVec_SocketAddressZZ), "LDKCVec_C2Tuple_PublicKeyCVec_SocketAddressZZZ Elements");
21600         else
21601                 ret_constr.data = NULL;
21602         int64_t* ret_vals = (*env)->GetLongArrayElements (env, ret, NULL);
21603         for (size_t o = 0; o < ret_constr.datalen; o++) {
21604                 int64_t ret_conv_40 = ret_vals[o];
21605                 void* ret_conv_40_ptr = untag_ptr(ret_conv_40);
21606                 CHECK_ACCESS(ret_conv_40_ptr);
21607                 LDKC2Tuple_PublicKeyCVec_SocketAddressZZ ret_conv_40_conv = *(LDKC2Tuple_PublicKeyCVec_SocketAddressZZ*)(ret_conv_40_ptr);
21608                 FREE(untag_ptr(ret_conv_40));
21609                 ret_constr.data[o] = ret_conv_40_conv;
21610         }
21611         (*env)->ReleaseLongArrayElements(env, ret, ret_vals, 0);
21612         if (get_jenv_res == JNI_EDETACHED) {
21613                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
21614         }
21615         return ret_constr;
21616 }
21617 void handle_onion_message_LDKOnionMessageHandler_jcall(const void* this_arg, LDKPublicKey peer_node_id, const LDKOnionMessage * msg) {
21618         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
21619         JNIEnv *env;
21620         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
21621         if (get_jenv_res == JNI_EDETACHED) {
21622                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
21623         } else {
21624                 DO_ASSERT(get_jenv_res == JNI_OK);
21625         }
21626         int8_tArray peer_node_id_arr = (*env)->NewByteArray(env, 33);
21627         (*env)->SetByteArrayRegion(env, peer_node_id_arr, 0, 33, peer_node_id.compressed_form);
21628         LDKOnionMessage msg_var = *msg;
21629         int64_t msg_ref = 0;
21630         msg_var = OnionMessage_clone(&msg_var);
21631         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var);
21632         msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned);
21633         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
21634         CHECK(obj != NULL);
21635         (*env)->CallVoidMethod(env, obj, j_calls->handle_onion_message_meth, peer_node_id_arr, msg_ref);
21636         if (UNLIKELY((*env)->ExceptionCheck(env))) {
21637                 (*env)->ExceptionDescribe(env);
21638                 (*env)->FatalError(env, "A call to handle_onion_message in LDKOnionMessageHandler from rust threw an exception.");
21639         }
21640         if (get_jenv_res == JNI_EDETACHED) {
21641                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
21642         }
21643 }
21644 LDKOnionMessage next_onion_message_for_peer_LDKOnionMessageHandler_jcall(const void* this_arg, LDKPublicKey peer_node_id) {
21645         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
21646         JNIEnv *env;
21647         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
21648         if (get_jenv_res == JNI_EDETACHED) {
21649                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
21650         } else {
21651                 DO_ASSERT(get_jenv_res == JNI_OK);
21652         }
21653         int8_tArray peer_node_id_arr = (*env)->NewByteArray(env, 33);
21654         (*env)->SetByteArrayRegion(env, peer_node_id_arr, 0, 33, peer_node_id.compressed_form);
21655         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
21656         CHECK(obj != NULL);
21657         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->next_onion_message_for_peer_meth, peer_node_id_arr);
21658         if (UNLIKELY((*env)->ExceptionCheck(env))) {
21659                 (*env)->ExceptionDescribe(env);
21660                 (*env)->FatalError(env, "A call to next_onion_message_for_peer in LDKOnionMessageHandler from rust threw an exception.");
21661         }
21662         LDKOnionMessage ret_conv;
21663         ret_conv.inner = untag_ptr(ret);
21664         ret_conv.is_owned = ptr_is_owned(ret);
21665         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
21666         if (get_jenv_res == JNI_EDETACHED) {
21667                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
21668         }
21669         return ret_conv;
21670 }
21671 LDKCResult_NoneNoneZ peer_connected_LDKOnionMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * init, bool inbound) {
21672         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
21673         JNIEnv *env;
21674         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
21675         if (get_jenv_res == JNI_EDETACHED) {
21676                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
21677         } else {
21678                 DO_ASSERT(get_jenv_res == JNI_OK);
21679         }
21680         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
21681         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
21682         LDKInit init_var = *init;
21683         int64_t init_ref = 0;
21684         init_var = Init_clone(&init_var);
21685         CHECK_INNER_FIELD_ACCESS_OR_NULL(init_var);
21686         init_ref = tag_ptr(init_var.inner, init_var.is_owned);
21687         jboolean inbound_conv = inbound;
21688         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
21689         CHECK(obj != NULL);
21690         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->peer_connected_meth, their_node_id_arr, init_ref, inbound_conv);
21691         if (UNLIKELY((*env)->ExceptionCheck(env))) {
21692                 (*env)->ExceptionDescribe(env);
21693                 (*env)->FatalError(env, "A call to peer_connected in LDKOnionMessageHandler from rust threw an exception.");
21694         }
21695         void* ret_ptr = untag_ptr(ret);
21696         CHECK_ACCESS(ret_ptr);
21697         LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(ret_ptr);
21698         FREE(untag_ptr(ret));
21699         if (get_jenv_res == JNI_EDETACHED) {
21700                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
21701         }
21702         return ret_conv;
21703 }
21704 void peer_disconnected_LDKOnionMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id) {
21705         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
21706         JNIEnv *env;
21707         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
21708         if (get_jenv_res == JNI_EDETACHED) {
21709                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
21710         } else {
21711                 DO_ASSERT(get_jenv_res == JNI_OK);
21712         }
21713         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
21714         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
21715         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
21716         CHECK(obj != NULL);
21717         (*env)->CallVoidMethod(env, obj, j_calls->peer_disconnected_meth, their_node_id_arr);
21718         if (UNLIKELY((*env)->ExceptionCheck(env))) {
21719                 (*env)->ExceptionDescribe(env);
21720                 (*env)->FatalError(env, "A call to peer_disconnected in LDKOnionMessageHandler from rust threw an exception.");
21721         }
21722         if (get_jenv_res == JNI_EDETACHED) {
21723                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
21724         }
21725 }
21726 void timer_tick_occurred_LDKOnionMessageHandler_jcall(const void* this_arg) {
21727         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
21728         JNIEnv *env;
21729         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
21730         if (get_jenv_res == JNI_EDETACHED) {
21731                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
21732         } else {
21733                 DO_ASSERT(get_jenv_res == JNI_OK);
21734         }
21735         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
21736         CHECK(obj != NULL);
21737         (*env)->CallVoidMethod(env, obj, j_calls->timer_tick_occurred_meth);
21738         if (UNLIKELY((*env)->ExceptionCheck(env))) {
21739                 (*env)->ExceptionDescribe(env);
21740                 (*env)->FatalError(env, "A call to timer_tick_occurred in LDKOnionMessageHandler from rust threw an exception.");
21741         }
21742         if (get_jenv_res == JNI_EDETACHED) {
21743                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
21744         }
21745 }
21746 LDKNodeFeatures provided_node_features_LDKOnionMessageHandler_jcall(const void* this_arg) {
21747         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
21748         JNIEnv *env;
21749         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
21750         if (get_jenv_res == JNI_EDETACHED) {
21751                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
21752         } else {
21753                 DO_ASSERT(get_jenv_res == JNI_OK);
21754         }
21755         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
21756         CHECK(obj != NULL);
21757         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->provided_node_features_meth);
21758         if (UNLIKELY((*env)->ExceptionCheck(env))) {
21759                 (*env)->ExceptionDescribe(env);
21760                 (*env)->FatalError(env, "A call to provided_node_features in LDKOnionMessageHandler from rust threw an exception.");
21761         }
21762         LDKNodeFeatures ret_conv;
21763         ret_conv.inner = untag_ptr(ret);
21764         ret_conv.is_owned = ptr_is_owned(ret);
21765         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
21766         if (get_jenv_res == JNI_EDETACHED) {
21767                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
21768         }
21769         return ret_conv;
21770 }
21771 LDKInitFeatures provided_init_features_LDKOnionMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id) {
21772         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg;
21773         JNIEnv *env;
21774         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
21775         if (get_jenv_res == JNI_EDETACHED) {
21776                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
21777         } else {
21778                 DO_ASSERT(get_jenv_res == JNI_OK);
21779         }
21780         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
21781         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
21782         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
21783         CHECK(obj != NULL);
21784         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->provided_init_features_meth, their_node_id_arr);
21785         if (UNLIKELY((*env)->ExceptionCheck(env))) {
21786                 (*env)->ExceptionDescribe(env);
21787                 (*env)->FatalError(env, "A call to provided_init_features in LDKOnionMessageHandler from rust threw an exception.");
21788         }
21789         LDKInitFeatures ret_conv;
21790         ret_conv.inner = untag_ptr(ret);
21791         ret_conv.is_owned = ptr_is_owned(ret);
21792         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
21793         if (get_jenv_res == JNI_EDETACHED) {
21794                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
21795         }
21796         return ret_conv;
21797 }
21798 static void LDKOnionMessageHandler_JCalls_cloned(LDKOnionMessageHandler* new_obj) {
21799         LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) new_obj->this_arg;
21800         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
21801 }
21802 static inline LDKOnionMessageHandler LDKOnionMessageHandler_init (JNIEnv *env, jclass clz, jobject o) {
21803         jclass c = (*env)->GetObjectClass(env, o);
21804         CHECK(c != NULL);
21805         LDKOnionMessageHandler_JCalls *calls = MALLOC(sizeof(LDKOnionMessageHandler_JCalls), "LDKOnionMessageHandler_JCalls");
21806         atomic_init(&calls->refcnt, 1);
21807         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
21808         calls->o = (*env)->NewWeakGlobalRef(env, o);
21809         calls->get_and_clear_connections_needed_meth = (*env)->GetMethodID(env, c, "get_and_clear_connections_needed", "()[J");
21810         CHECK(calls->get_and_clear_connections_needed_meth != NULL);
21811         calls->handle_onion_message_meth = (*env)->GetMethodID(env, c, "handle_onion_message", "([BJ)V");
21812         CHECK(calls->handle_onion_message_meth != NULL);
21813         calls->next_onion_message_for_peer_meth = (*env)->GetMethodID(env, c, "next_onion_message_for_peer", "([B)J");
21814         CHECK(calls->next_onion_message_for_peer_meth != NULL);
21815         calls->peer_connected_meth = (*env)->GetMethodID(env, c, "peer_connected", "([BJZ)J");
21816         CHECK(calls->peer_connected_meth != NULL);
21817         calls->peer_disconnected_meth = (*env)->GetMethodID(env, c, "peer_disconnected", "([B)V");
21818         CHECK(calls->peer_disconnected_meth != NULL);
21819         calls->timer_tick_occurred_meth = (*env)->GetMethodID(env, c, "timer_tick_occurred", "()V");
21820         CHECK(calls->timer_tick_occurred_meth != NULL);
21821         calls->provided_node_features_meth = (*env)->GetMethodID(env, c, "provided_node_features", "()J");
21822         CHECK(calls->provided_node_features_meth != NULL);
21823         calls->provided_init_features_meth = (*env)->GetMethodID(env, c, "provided_init_features", "([B)J");
21824         CHECK(calls->provided_init_features_meth != NULL);
21825
21826         LDKOnionMessageHandler ret = {
21827                 .this_arg = (void*) calls,
21828                 .get_and_clear_connections_needed = get_and_clear_connections_needed_LDKOnionMessageHandler_jcall,
21829                 .handle_onion_message = handle_onion_message_LDKOnionMessageHandler_jcall,
21830                 .next_onion_message_for_peer = next_onion_message_for_peer_LDKOnionMessageHandler_jcall,
21831                 .peer_connected = peer_connected_LDKOnionMessageHandler_jcall,
21832                 .peer_disconnected = peer_disconnected_LDKOnionMessageHandler_jcall,
21833                 .timer_tick_occurred = timer_tick_occurred_LDKOnionMessageHandler_jcall,
21834                 .provided_node_features = provided_node_features_LDKOnionMessageHandler_jcall,
21835                 .provided_init_features = provided_init_features_LDKOnionMessageHandler_jcall,
21836                 .free = LDKOnionMessageHandler_JCalls_free,
21837         };
21838         return ret;
21839 }
21840 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKOnionMessageHandler_1new(JNIEnv *env, jclass clz, jobject o) {
21841         LDKOnionMessageHandler *res_ptr = MALLOC(sizeof(LDKOnionMessageHandler), "LDKOnionMessageHandler");
21842         *res_ptr = LDKOnionMessageHandler_init(env, clz, o);
21843         return tag_ptr(res_ptr, true);
21844 }
21845 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_OnionMessageHandler_1get_1and_1clear_1connections_1needed(JNIEnv *env, jclass clz, int64_t this_arg) {
21846         void* this_arg_ptr = untag_ptr(this_arg);
21847         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
21848         LDKOnionMessageHandler* this_arg_conv = (LDKOnionMessageHandler*)this_arg_ptr;
21849         LDKCVec_C2Tuple_PublicKeyCVec_SocketAddressZZZ ret_var = (this_arg_conv->get_and_clear_connections_needed)(this_arg_conv->this_arg);
21850         int64_tArray ret_arr = NULL;
21851         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
21852         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
21853         for (size_t o = 0; o < ret_var.datalen; o++) {
21854                 LDKC2Tuple_PublicKeyCVec_SocketAddressZZ* ret_conv_40_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyCVec_SocketAddressZZ), "LDKC2Tuple_PublicKeyCVec_SocketAddressZZ");
21855                 *ret_conv_40_conv = ret_var.data[o];
21856                 ret_arr_ptr[o] = tag_ptr(ret_conv_40_conv, true);
21857         }
21858         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
21859         FREE(ret_var.data);
21860         return ret_arr;
21861 }
21862
21863 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) {
21864         void* this_arg_ptr = untag_ptr(this_arg);
21865         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
21866         LDKOnionMessageHandler* this_arg_conv = (LDKOnionMessageHandler*)this_arg_ptr;
21867         LDKPublicKey peer_node_id_ref;
21868         CHECK((*env)->GetArrayLength(env, peer_node_id) == 33);
21869         (*env)->GetByteArrayRegion(env, peer_node_id, 0, 33, peer_node_id_ref.compressed_form);
21870         LDKOnionMessage msg_conv;
21871         msg_conv.inner = untag_ptr(msg);
21872         msg_conv.is_owned = ptr_is_owned(msg);
21873         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
21874         msg_conv.is_owned = false;
21875         (this_arg_conv->handle_onion_message)(this_arg_conv->this_arg, peer_node_id_ref, &msg_conv);
21876 }
21877
21878 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) {
21879         void* this_arg_ptr = untag_ptr(this_arg);
21880         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
21881         LDKOnionMessageHandler* this_arg_conv = (LDKOnionMessageHandler*)this_arg_ptr;
21882         LDKPublicKey peer_node_id_ref;
21883         CHECK((*env)->GetArrayLength(env, peer_node_id) == 33);
21884         (*env)->GetByteArrayRegion(env, peer_node_id, 0, 33, peer_node_id_ref.compressed_form);
21885         LDKOnionMessage ret_var = (this_arg_conv->next_onion_message_for_peer)(this_arg_conv->this_arg, peer_node_id_ref);
21886         int64_t ret_ref = 0;
21887         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21888         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
21889         return ret_ref;
21890 }
21891
21892 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) {
21893         void* this_arg_ptr = untag_ptr(this_arg);
21894         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
21895         LDKOnionMessageHandler* this_arg_conv = (LDKOnionMessageHandler*)this_arg_ptr;
21896         LDKPublicKey their_node_id_ref;
21897         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
21898         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
21899         LDKInit init_conv;
21900         init_conv.inner = untag_ptr(init);
21901         init_conv.is_owned = ptr_is_owned(init);
21902         CHECK_INNER_FIELD_ACCESS_OR_NULL(init_conv);
21903         init_conv.is_owned = false;
21904         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
21905         *ret_conv = (this_arg_conv->peer_connected)(this_arg_conv->this_arg, their_node_id_ref, &init_conv, inbound);
21906         return tag_ptr(ret_conv, true);
21907 }
21908
21909 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OnionMessageHandler_1peer_1disconnected(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id) {
21910         void* this_arg_ptr = untag_ptr(this_arg);
21911         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
21912         LDKOnionMessageHandler* this_arg_conv = (LDKOnionMessageHandler*)this_arg_ptr;
21913         LDKPublicKey their_node_id_ref;
21914         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
21915         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
21916         (this_arg_conv->peer_disconnected)(this_arg_conv->this_arg, their_node_id_ref);
21917 }
21918
21919 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OnionMessageHandler_1timer_1tick_1occurred(JNIEnv *env, jclass clz, int64_t this_arg) {
21920         void* this_arg_ptr = untag_ptr(this_arg);
21921         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
21922         LDKOnionMessageHandler* this_arg_conv = (LDKOnionMessageHandler*)this_arg_ptr;
21923         (this_arg_conv->timer_tick_occurred)(this_arg_conv->this_arg);
21924 }
21925
21926 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OnionMessageHandler_1provided_1node_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
21927         void* this_arg_ptr = untag_ptr(this_arg);
21928         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
21929         LDKOnionMessageHandler* this_arg_conv = (LDKOnionMessageHandler*)this_arg_ptr;
21930         LDKNodeFeatures ret_var = (this_arg_conv->provided_node_features)(this_arg_conv->this_arg);
21931         int64_t ret_ref = 0;
21932         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21933         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
21934         return ret_ref;
21935 }
21936
21937 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) {
21938         void* this_arg_ptr = untag_ptr(this_arg);
21939         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
21940         LDKOnionMessageHandler* this_arg_conv = (LDKOnionMessageHandler*)this_arg_ptr;
21941         LDKPublicKey their_node_id_ref;
21942         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
21943         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
21944         LDKInitFeatures ret_var = (this_arg_conv->provided_init_features)(this_arg_conv->this_arg, their_node_id_ref);
21945         int64_t ret_ref = 0;
21946         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
21947         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
21948         return ret_ref;
21949 }
21950
21951 typedef struct LDKCustomMessageReader_JCalls {
21952         atomic_size_t refcnt;
21953         JavaVM *vm;
21954         jweak o;
21955         jmethodID read_meth;
21956 } LDKCustomMessageReader_JCalls;
21957 static void LDKCustomMessageReader_JCalls_free(void* this_arg) {
21958         LDKCustomMessageReader_JCalls *j_calls = (LDKCustomMessageReader_JCalls*) this_arg;
21959         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
21960                 JNIEnv *env;
21961                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
21962                 if (get_jenv_res == JNI_EDETACHED) {
21963                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
21964                 } else {
21965                         DO_ASSERT(get_jenv_res == JNI_OK);
21966                 }
21967                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
21968                 if (get_jenv_res == JNI_EDETACHED) {
21969                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
21970                 }
21971                 FREE(j_calls);
21972         }
21973 }
21974 LDKCResult_COption_TypeZDecodeErrorZ read_LDKCustomMessageReader_jcall(const void* this_arg, uint16_t message_type, LDKu8slice buffer) {
21975         LDKCustomMessageReader_JCalls *j_calls = (LDKCustomMessageReader_JCalls*) this_arg;
21976         JNIEnv *env;
21977         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
21978         if (get_jenv_res == JNI_EDETACHED) {
21979                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
21980         } else {
21981                 DO_ASSERT(get_jenv_res == JNI_OK);
21982         }
21983         int16_t message_type_conv = message_type;
21984         LDKu8slice buffer_var = buffer;
21985         int8_tArray buffer_arr = (*env)->NewByteArray(env, buffer_var.datalen);
21986         (*env)->SetByteArrayRegion(env, buffer_arr, 0, buffer_var.datalen, buffer_var.data);
21987         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
21988         CHECK(obj != NULL);
21989         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->read_meth, message_type_conv, buffer_arr);
21990         if (UNLIKELY((*env)->ExceptionCheck(env))) {
21991                 (*env)->ExceptionDescribe(env);
21992                 (*env)->FatalError(env, "A call to read in LDKCustomMessageReader from rust threw an exception.");
21993         }
21994         void* ret_ptr = untag_ptr(ret);
21995         CHECK_ACCESS(ret_ptr);
21996         LDKCResult_COption_TypeZDecodeErrorZ ret_conv = *(LDKCResult_COption_TypeZDecodeErrorZ*)(ret_ptr);
21997         FREE(untag_ptr(ret));
21998         if (get_jenv_res == JNI_EDETACHED) {
21999                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
22000         }
22001         return ret_conv;
22002 }
22003 static void LDKCustomMessageReader_JCalls_cloned(LDKCustomMessageReader* new_obj) {
22004         LDKCustomMessageReader_JCalls *j_calls = (LDKCustomMessageReader_JCalls*) new_obj->this_arg;
22005         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
22006 }
22007 static inline LDKCustomMessageReader LDKCustomMessageReader_init (JNIEnv *env, jclass clz, jobject o) {
22008         jclass c = (*env)->GetObjectClass(env, o);
22009         CHECK(c != NULL);
22010         LDKCustomMessageReader_JCalls *calls = MALLOC(sizeof(LDKCustomMessageReader_JCalls), "LDKCustomMessageReader_JCalls");
22011         atomic_init(&calls->refcnt, 1);
22012         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
22013         calls->o = (*env)->NewWeakGlobalRef(env, o);
22014         calls->read_meth = (*env)->GetMethodID(env, c, "read", "(S[B)J");
22015         CHECK(calls->read_meth != NULL);
22016
22017         LDKCustomMessageReader ret = {
22018                 .this_arg = (void*) calls,
22019                 .read = read_LDKCustomMessageReader_jcall,
22020                 .free = LDKCustomMessageReader_JCalls_free,
22021         };
22022         return ret;
22023 }
22024 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCustomMessageReader_1new(JNIEnv *env, jclass clz, jobject o) {
22025         LDKCustomMessageReader *res_ptr = MALLOC(sizeof(LDKCustomMessageReader), "LDKCustomMessageReader");
22026         *res_ptr = LDKCustomMessageReader_init(env, clz, o);
22027         return tag_ptr(res_ptr, true);
22028 }
22029 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) {
22030         void* this_arg_ptr = untag_ptr(this_arg);
22031         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
22032         LDKCustomMessageReader* this_arg_conv = (LDKCustomMessageReader*)this_arg_ptr;
22033         LDKu8slice buffer_ref;
22034         buffer_ref.datalen = (*env)->GetArrayLength(env, buffer);
22035         buffer_ref.data = (*env)->GetByteArrayElements (env, buffer, NULL);
22036         LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
22037         *ret_conv = (this_arg_conv->read)(this_arg_conv->this_arg, message_type, buffer_ref);
22038         (*env)->ReleaseByteArrayElements(env, buffer, (int8_t*)buffer_ref.data, 0);
22039         return tag_ptr(ret_conv, true);
22040 }
22041
22042 typedef struct LDKCustomMessageHandler_JCalls {
22043         atomic_size_t refcnt;
22044         JavaVM *vm;
22045         jweak o;
22046         LDKCustomMessageReader_JCalls* CustomMessageReader;
22047         jmethodID handle_custom_message_meth;
22048         jmethodID get_and_clear_pending_msg_meth;
22049         jmethodID provided_node_features_meth;
22050         jmethodID provided_init_features_meth;
22051 } LDKCustomMessageHandler_JCalls;
22052 static void LDKCustomMessageHandler_JCalls_free(void* this_arg) {
22053         LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
22054         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
22055                 JNIEnv *env;
22056                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
22057                 if (get_jenv_res == JNI_EDETACHED) {
22058                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
22059                 } else {
22060                         DO_ASSERT(get_jenv_res == JNI_OK);
22061                 }
22062                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
22063                 if (get_jenv_res == JNI_EDETACHED) {
22064                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
22065                 }
22066                 FREE(j_calls);
22067         }
22068 }
22069 LDKCResult_NoneLightningErrorZ handle_custom_message_LDKCustomMessageHandler_jcall(const void* this_arg, LDKType msg, LDKPublicKey sender_node_id) {
22070         LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
22071         JNIEnv *env;
22072         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
22073         if (get_jenv_res == JNI_EDETACHED) {
22074                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
22075         } else {
22076                 DO_ASSERT(get_jenv_res == JNI_OK);
22077         }
22078         LDKType* msg_ret = MALLOC(sizeof(LDKType), "LDKType");
22079         *msg_ret = msg;
22080         int8_tArray sender_node_id_arr = (*env)->NewByteArray(env, 33);
22081         (*env)->SetByteArrayRegion(env, sender_node_id_arr, 0, 33, sender_node_id.compressed_form);
22082         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
22083         CHECK(obj != NULL);
22084         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_custom_message_meth, tag_ptr(msg_ret, true), sender_node_id_arr);
22085         if (UNLIKELY((*env)->ExceptionCheck(env))) {
22086                 (*env)->ExceptionDescribe(env);
22087                 (*env)->FatalError(env, "A call to handle_custom_message in LDKCustomMessageHandler from rust threw an exception.");
22088         }
22089         void* ret_ptr = untag_ptr(ret);
22090         CHECK_ACCESS(ret_ptr);
22091         LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr);
22092         FREE(untag_ptr(ret));
22093         if (get_jenv_res == JNI_EDETACHED) {
22094                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
22095         }
22096         return ret_conv;
22097 }
22098 LDKCVec_C2Tuple_PublicKeyTypeZZ get_and_clear_pending_msg_LDKCustomMessageHandler_jcall(const void* this_arg) {
22099         LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
22100         JNIEnv *env;
22101         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
22102         if (get_jenv_res == JNI_EDETACHED) {
22103                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
22104         } else {
22105                 DO_ASSERT(get_jenv_res == JNI_OK);
22106         }
22107         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
22108         CHECK(obj != NULL);
22109         int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_and_clear_pending_msg_meth);
22110         if (UNLIKELY((*env)->ExceptionCheck(env))) {
22111                 (*env)->ExceptionDescribe(env);
22112                 (*env)->FatalError(env, "A call to get_and_clear_pending_msg in LDKCustomMessageHandler from rust threw an exception.");
22113         }
22114         LDKCVec_C2Tuple_PublicKeyTypeZZ ret_constr;
22115         ret_constr.datalen = (*env)->GetArrayLength(env, ret);
22116         if (ret_constr.datalen > 0)
22117                 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKCVec_C2Tuple_PublicKeyTypeZZ Elements");
22118         else
22119                 ret_constr.data = NULL;
22120         int64_t* ret_vals = (*env)->GetLongArrayElements (env, ret, NULL);
22121         for (size_t z = 0; z < ret_constr.datalen; z++) {
22122                 int64_t ret_conv_25 = ret_vals[z];
22123                 void* ret_conv_25_ptr = untag_ptr(ret_conv_25);
22124                 CHECK_ACCESS(ret_conv_25_ptr);
22125                 LDKC2Tuple_PublicKeyTypeZ ret_conv_25_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(ret_conv_25_ptr);
22126                 FREE(untag_ptr(ret_conv_25));
22127                 ret_constr.data[z] = ret_conv_25_conv;
22128         }
22129         (*env)->ReleaseLongArrayElements(env, ret, ret_vals, 0);
22130         if (get_jenv_res == JNI_EDETACHED) {
22131                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
22132         }
22133         return ret_constr;
22134 }
22135 LDKNodeFeatures provided_node_features_LDKCustomMessageHandler_jcall(const void* this_arg) {
22136         LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
22137         JNIEnv *env;
22138         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
22139         if (get_jenv_res == JNI_EDETACHED) {
22140                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
22141         } else {
22142                 DO_ASSERT(get_jenv_res == JNI_OK);
22143         }
22144         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
22145         CHECK(obj != NULL);
22146         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->provided_node_features_meth);
22147         if (UNLIKELY((*env)->ExceptionCheck(env))) {
22148                 (*env)->ExceptionDescribe(env);
22149                 (*env)->FatalError(env, "A call to provided_node_features in LDKCustomMessageHandler from rust threw an exception.");
22150         }
22151         LDKNodeFeatures ret_conv;
22152         ret_conv.inner = untag_ptr(ret);
22153         ret_conv.is_owned = ptr_is_owned(ret);
22154         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
22155         if (get_jenv_res == JNI_EDETACHED) {
22156                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
22157         }
22158         return ret_conv;
22159 }
22160 LDKInitFeatures provided_init_features_LDKCustomMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id) {
22161         LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
22162         JNIEnv *env;
22163         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
22164         if (get_jenv_res == JNI_EDETACHED) {
22165                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
22166         } else {
22167                 DO_ASSERT(get_jenv_res == JNI_OK);
22168         }
22169         int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
22170         (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
22171         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
22172         CHECK(obj != NULL);
22173         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->provided_init_features_meth, their_node_id_arr);
22174         if (UNLIKELY((*env)->ExceptionCheck(env))) {
22175                 (*env)->ExceptionDescribe(env);
22176                 (*env)->FatalError(env, "A call to provided_init_features in LDKCustomMessageHandler from rust threw an exception.");
22177         }
22178         LDKInitFeatures ret_conv;
22179         ret_conv.inner = untag_ptr(ret);
22180         ret_conv.is_owned = ptr_is_owned(ret);
22181         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv);
22182         if (get_jenv_res == JNI_EDETACHED) {
22183                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
22184         }
22185         return ret_conv;
22186 }
22187 static void LDKCustomMessageHandler_JCalls_cloned(LDKCustomMessageHandler* new_obj) {
22188         LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) new_obj->this_arg;
22189         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
22190         atomic_fetch_add_explicit(&j_calls->CustomMessageReader->refcnt, 1, memory_order_release);
22191 }
22192 static inline LDKCustomMessageHandler LDKCustomMessageHandler_init (JNIEnv *env, jclass clz, jobject o, jobject CustomMessageReader) {
22193         jclass c = (*env)->GetObjectClass(env, o);
22194         CHECK(c != NULL);
22195         LDKCustomMessageHandler_JCalls *calls = MALLOC(sizeof(LDKCustomMessageHandler_JCalls), "LDKCustomMessageHandler_JCalls");
22196         atomic_init(&calls->refcnt, 1);
22197         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
22198         calls->o = (*env)->NewWeakGlobalRef(env, o);
22199         calls->handle_custom_message_meth = (*env)->GetMethodID(env, c, "handle_custom_message", "(J[B)J");
22200         CHECK(calls->handle_custom_message_meth != NULL);
22201         calls->get_and_clear_pending_msg_meth = (*env)->GetMethodID(env, c, "get_and_clear_pending_msg", "()[J");
22202         CHECK(calls->get_and_clear_pending_msg_meth != NULL);
22203         calls->provided_node_features_meth = (*env)->GetMethodID(env, c, "provided_node_features", "()J");
22204         CHECK(calls->provided_node_features_meth != NULL);
22205         calls->provided_init_features_meth = (*env)->GetMethodID(env, c, "provided_init_features", "([B)J");
22206         CHECK(calls->provided_init_features_meth != NULL);
22207
22208         LDKCustomMessageHandler ret = {
22209                 .this_arg = (void*) calls,
22210                 .handle_custom_message = handle_custom_message_LDKCustomMessageHandler_jcall,
22211                 .get_and_clear_pending_msg = get_and_clear_pending_msg_LDKCustomMessageHandler_jcall,
22212                 .provided_node_features = provided_node_features_LDKCustomMessageHandler_jcall,
22213                 .provided_init_features = provided_init_features_LDKCustomMessageHandler_jcall,
22214                 .free = LDKCustomMessageHandler_JCalls_free,
22215                 .CustomMessageReader = LDKCustomMessageReader_init(env, clz, CustomMessageReader),
22216         };
22217         calls->CustomMessageReader = ret.CustomMessageReader.this_arg;
22218         return ret;
22219 }
22220 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCustomMessageHandler_1new(JNIEnv *env, jclass clz, jobject o, jobject CustomMessageReader) {
22221         LDKCustomMessageHandler *res_ptr = MALLOC(sizeof(LDKCustomMessageHandler), "LDKCustomMessageHandler");
22222         *res_ptr = LDKCustomMessageHandler_init(env, clz, o, CustomMessageReader);
22223         return tag_ptr(res_ptr, true);
22224 }
22225 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCustomMessageHandler_1get_1CustomMessageReader(JNIEnv *env, jclass clz, int64_t arg) {
22226         LDKCustomMessageHandler *inp = (LDKCustomMessageHandler *)untag_ptr(arg);
22227         return tag_ptr(&inp->CustomMessageReader, false);
22228 }
22229 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) {
22230         void* this_arg_ptr = untag_ptr(this_arg);
22231         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
22232         LDKCustomMessageHandler* this_arg_conv = (LDKCustomMessageHandler*)this_arg_ptr;
22233         void* msg_ptr = untag_ptr(msg);
22234         CHECK_ACCESS(msg_ptr);
22235         LDKType msg_conv = *(LDKType*)(msg_ptr);
22236         if (msg_conv.free == LDKType_JCalls_free) {
22237                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
22238                 LDKType_JCalls_cloned(&msg_conv);
22239         }
22240         LDKPublicKey sender_node_id_ref;
22241         CHECK((*env)->GetArrayLength(env, sender_node_id) == 33);
22242         (*env)->GetByteArrayRegion(env, sender_node_id, 0, 33, sender_node_id_ref.compressed_form);
22243         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
22244         *ret_conv = (this_arg_conv->handle_custom_message)(this_arg_conv->this_arg, msg_conv, sender_node_id_ref);
22245         return tag_ptr(ret_conv, true);
22246 }
22247
22248 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_CustomMessageHandler_1get_1and_1clear_1pending_1msg(JNIEnv *env, jclass clz, int64_t this_arg) {
22249         void* this_arg_ptr = untag_ptr(this_arg);
22250         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
22251         LDKCustomMessageHandler* this_arg_conv = (LDKCustomMessageHandler*)this_arg_ptr;
22252         LDKCVec_C2Tuple_PublicKeyTypeZZ ret_var = (this_arg_conv->get_and_clear_pending_msg)(this_arg_conv->this_arg);
22253         int64_tArray ret_arr = NULL;
22254         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
22255         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
22256         for (size_t z = 0; z < ret_var.datalen; z++) {
22257                 LDKC2Tuple_PublicKeyTypeZ* ret_conv_25_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
22258                 *ret_conv_25_conv = ret_var.data[z];
22259                 ret_arr_ptr[z] = tag_ptr(ret_conv_25_conv, true);
22260         }
22261         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
22262         FREE(ret_var.data);
22263         return ret_arr;
22264 }
22265
22266 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CustomMessageHandler_1provided_1node_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
22267         void* this_arg_ptr = untag_ptr(this_arg);
22268         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
22269         LDKCustomMessageHandler* this_arg_conv = (LDKCustomMessageHandler*)this_arg_ptr;
22270         LDKNodeFeatures ret_var = (this_arg_conv->provided_node_features)(this_arg_conv->this_arg);
22271         int64_t ret_ref = 0;
22272         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22273         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
22274         return ret_ref;
22275 }
22276
22277 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) {
22278         void* this_arg_ptr = untag_ptr(this_arg);
22279         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
22280         LDKCustomMessageHandler* this_arg_conv = (LDKCustomMessageHandler*)this_arg_ptr;
22281         LDKPublicKey their_node_id_ref;
22282         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
22283         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
22284         LDKInitFeatures ret_var = (this_arg_conv->provided_init_features)(this_arg_conv->this_arg, their_node_id_ref);
22285         int64_t ret_ref = 0;
22286         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
22287         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
22288         return ret_ref;
22289 }
22290
22291 typedef struct LDKCustomOnionMessageHandler_JCalls {
22292         atomic_size_t refcnt;
22293         JavaVM *vm;
22294         jweak o;
22295         jmethodID handle_custom_message_meth;
22296         jmethodID read_custom_message_meth;
22297         jmethodID release_pending_custom_messages_meth;
22298 } LDKCustomOnionMessageHandler_JCalls;
22299 static void LDKCustomOnionMessageHandler_JCalls_free(void* this_arg) {
22300         LDKCustomOnionMessageHandler_JCalls *j_calls = (LDKCustomOnionMessageHandler_JCalls*) this_arg;
22301         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
22302                 JNIEnv *env;
22303                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
22304                 if (get_jenv_res == JNI_EDETACHED) {
22305                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
22306                 } else {
22307                         DO_ASSERT(get_jenv_res == JNI_OK);
22308                 }
22309                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
22310                 if (get_jenv_res == JNI_EDETACHED) {
22311                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
22312                 }
22313                 FREE(j_calls);
22314         }
22315 }
22316 LDKCOption_OnionMessageContentsZ handle_custom_message_LDKCustomOnionMessageHandler_jcall(const void* this_arg, LDKOnionMessageContents msg) {
22317         LDKCustomOnionMessageHandler_JCalls *j_calls = (LDKCustomOnionMessageHandler_JCalls*) this_arg;
22318         JNIEnv *env;
22319         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
22320         if (get_jenv_res == JNI_EDETACHED) {
22321                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
22322         } else {
22323                 DO_ASSERT(get_jenv_res == JNI_OK);
22324         }
22325         LDKOnionMessageContents* msg_ret = MALLOC(sizeof(LDKOnionMessageContents), "LDKOnionMessageContents");
22326         *msg_ret = msg;
22327         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
22328         CHECK(obj != NULL);
22329         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_custom_message_meth, tag_ptr(msg_ret, true));
22330         if (UNLIKELY((*env)->ExceptionCheck(env))) {
22331                 (*env)->ExceptionDescribe(env);
22332                 (*env)->FatalError(env, "A call to handle_custom_message in LDKCustomOnionMessageHandler from rust threw an exception.");
22333         }
22334         void* ret_ptr = untag_ptr(ret);
22335         CHECK_ACCESS(ret_ptr);
22336         LDKCOption_OnionMessageContentsZ ret_conv = *(LDKCOption_OnionMessageContentsZ*)(ret_ptr);
22337         FREE(untag_ptr(ret));
22338         if (get_jenv_res == JNI_EDETACHED) {
22339                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
22340         }
22341         return ret_conv;
22342 }
22343 LDKCResult_COption_OnionMessageContentsZDecodeErrorZ read_custom_message_LDKCustomOnionMessageHandler_jcall(const void* this_arg, uint64_t message_type, LDKu8slice buffer) {
22344         LDKCustomOnionMessageHandler_JCalls *j_calls = (LDKCustomOnionMessageHandler_JCalls*) this_arg;
22345         JNIEnv *env;
22346         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
22347         if (get_jenv_res == JNI_EDETACHED) {
22348                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
22349         } else {
22350                 DO_ASSERT(get_jenv_res == JNI_OK);
22351         }
22352         int64_t message_type_conv = message_type;
22353         LDKu8slice buffer_var = buffer;
22354         int8_tArray buffer_arr = (*env)->NewByteArray(env, buffer_var.datalen);
22355         (*env)->SetByteArrayRegion(env, buffer_arr, 0, buffer_var.datalen, buffer_var.data);
22356         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
22357         CHECK(obj != NULL);
22358         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->read_custom_message_meth, message_type_conv, buffer_arr);
22359         if (UNLIKELY((*env)->ExceptionCheck(env))) {
22360                 (*env)->ExceptionDescribe(env);
22361                 (*env)->FatalError(env, "A call to read_custom_message in LDKCustomOnionMessageHandler from rust threw an exception.");
22362         }
22363         void* ret_ptr = untag_ptr(ret);
22364         CHECK_ACCESS(ret_ptr);
22365         LDKCResult_COption_OnionMessageContentsZDecodeErrorZ ret_conv = *(LDKCResult_COption_OnionMessageContentsZDecodeErrorZ*)(ret_ptr);
22366         FREE(untag_ptr(ret));
22367         if (get_jenv_res == JNI_EDETACHED) {
22368                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
22369         }
22370         return ret_conv;
22371 }
22372 LDKCVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ release_pending_custom_messages_LDKCustomOnionMessageHandler_jcall(const void* this_arg) {
22373         LDKCustomOnionMessageHandler_JCalls *j_calls = (LDKCustomOnionMessageHandler_JCalls*) this_arg;
22374         JNIEnv *env;
22375         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
22376         if (get_jenv_res == JNI_EDETACHED) {
22377                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
22378         } else {
22379                 DO_ASSERT(get_jenv_res == JNI_OK);
22380         }
22381         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
22382         CHECK(obj != NULL);
22383         int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->release_pending_custom_messages_meth);
22384         if (UNLIKELY((*env)->ExceptionCheck(env))) {
22385                 (*env)->ExceptionDescribe(env);
22386                 (*env)->FatalError(env, "A call to release_pending_custom_messages in LDKCustomOnionMessageHandler from rust threw an exception.");
22387         }
22388         LDKCVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ ret_constr;
22389         ret_constr.datalen = (*env)->GetArrayLength(env, ret);
22390         if (ret_constr.datalen > 0)
22391                 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ), "LDKCVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ Elements");
22392         else
22393                 ret_constr.data = NULL;
22394         int64_t* ret_vals = (*env)->GetLongArrayElements (env, ret, NULL);
22395         for (size_t e = 0; e < ret_constr.datalen; e++) {
22396                 int64_t ret_conv_56 = ret_vals[e];
22397                 void* ret_conv_56_ptr = untag_ptr(ret_conv_56);
22398                 CHECK_ACCESS(ret_conv_56_ptr);
22399                 LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ ret_conv_56_conv = *(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ*)(ret_conv_56_ptr);
22400                 FREE(untag_ptr(ret_conv_56));
22401                 ret_constr.data[e] = ret_conv_56_conv;
22402         }
22403         (*env)->ReleaseLongArrayElements(env, ret, ret_vals, 0);
22404         if (get_jenv_res == JNI_EDETACHED) {
22405                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
22406         }
22407         return ret_constr;
22408 }
22409 static void LDKCustomOnionMessageHandler_JCalls_cloned(LDKCustomOnionMessageHandler* new_obj) {
22410         LDKCustomOnionMessageHandler_JCalls *j_calls = (LDKCustomOnionMessageHandler_JCalls*) new_obj->this_arg;
22411         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
22412 }
22413 static inline LDKCustomOnionMessageHandler LDKCustomOnionMessageHandler_init (JNIEnv *env, jclass clz, jobject o) {
22414         jclass c = (*env)->GetObjectClass(env, o);
22415         CHECK(c != NULL);
22416         LDKCustomOnionMessageHandler_JCalls *calls = MALLOC(sizeof(LDKCustomOnionMessageHandler_JCalls), "LDKCustomOnionMessageHandler_JCalls");
22417         atomic_init(&calls->refcnt, 1);
22418         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
22419         calls->o = (*env)->NewWeakGlobalRef(env, o);
22420         calls->handle_custom_message_meth = (*env)->GetMethodID(env, c, "handle_custom_message", "(J)J");
22421         CHECK(calls->handle_custom_message_meth != NULL);
22422         calls->read_custom_message_meth = (*env)->GetMethodID(env, c, "read_custom_message", "(J[B)J");
22423         CHECK(calls->read_custom_message_meth != NULL);
22424         calls->release_pending_custom_messages_meth = (*env)->GetMethodID(env, c, "release_pending_custom_messages", "()[J");
22425         CHECK(calls->release_pending_custom_messages_meth != NULL);
22426
22427         LDKCustomOnionMessageHandler ret = {
22428                 .this_arg = (void*) calls,
22429                 .handle_custom_message = handle_custom_message_LDKCustomOnionMessageHandler_jcall,
22430                 .read_custom_message = read_custom_message_LDKCustomOnionMessageHandler_jcall,
22431                 .release_pending_custom_messages = release_pending_custom_messages_LDKCustomOnionMessageHandler_jcall,
22432                 .free = LDKCustomOnionMessageHandler_JCalls_free,
22433         };
22434         return ret;
22435 }
22436 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCustomOnionMessageHandler_1new(JNIEnv *env, jclass clz, jobject o) {
22437         LDKCustomOnionMessageHandler *res_ptr = MALLOC(sizeof(LDKCustomOnionMessageHandler), "LDKCustomOnionMessageHandler");
22438         *res_ptr = LDKCustomOnionMessageHandler_init(env, clz, o);
22439         return tag_ptr(res_ptr, true);
22440 }
22441 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CustomOnionMessageHandler_1handle_1custom_1message(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
22442         void* this_arg_ptr = untag_ptr(this_arg);
22443         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
22444         LDKCustomOnionMessageHandler* this_arg_conv = (LDKCustomOnionMessageHandler*)this_arg_ptr;
22445         void* msg_ptr = untag_ptr(msg);
22446         CHECK_ACCESS(msg_ptr);
22447         LDKOnionMessageContents msg_conv = *(LDKOnionMessageContents*)(msg_ptr);
22448         if (msg_conv.free == LDKOnionMessageContents_JCalls_free) {
22449                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
22450                 LDKOnionMessageContents_JCalls_cloned(&msg_conv);
22451         }
22452         LDKCOption_OnionMessageContentsZ *ret_copy = MALLOC(sizeof(LDKCOption_OnionMessageContentsZ), "LDKCOption_OnionMessageContentsZ");
22453         *ret_copy = (this_arg_conv->handle_custom_message)(this_arg_conv->this_arg, msg_conv);
22454         int64_t ret_ref = tag_ptr(ret_copy, true);
22455         return ret_ref;
22456 }
22457
22458 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) {
22459         void* this_arg_ptr = untag_ptr(this_arg);
22460         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
22461         LDKCustomOnionMessageHandler* this_arg_conv = (LDKCustomOnionMessageHandler*)this_arg_ptr;
22462         LDKu8slice buffer_ref;
22463         buffer_ref.datalen = (*env)->GetArrayLength(env, buffer);
22464         buffer_ref.data = (*env)->GetByteArrayElements (env, buffer, NULL);
22465         LDKCResult_COption_OnionMessageContentsZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_OnionMessageContentsZDecodeErrorZ), "LDKCResult_COption_OnionMessageContentsZDecodeErrorZ");
22466         *ret_conv = (this_arg_conv->read_custom_message)(this_arg_conv->this_arg, message_type, buffer_ref);
22467         (*env)->ReleaseByteArrayElements(env, buffer, (int8_t*)buffer_ref.data, 0);
22468         return tag_ptr(ret_conv, true);
22469 }
22470
22471 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_CustomOnionMessageHandler_1release_1pending_1custom_1messages(JNIEnv *env, jclass clz, int64_t this_arg) {
22472         void* this_arg_ptr = untag_ptr(this_arg);
22473         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
22474         LDKCustomOnionMessageHandler* this_arg_conv = (LDKCustomOnionMessageHandler*)this_arg_ptr;
22475         LDKCVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ ret_var = (this_arg_conv->release_pending_custom_messages)(this_arg_conv->this_arg);
22476         int64_tArray ret_arr = NULL;
22477         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
22478         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
22479         for (size_t e = 0; e < ret_var.datalen; e++) {
22480                 LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ* ret_conv_56_conv = MALLOC(sizeof(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ), "LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ");
22481                 *ret_conv_56_conv = ret_var.data[e];
22482                 ret_arr_ptr[e] = tag_ptr(ret_conv_56_conv, true);
22483         }
22484         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
22485         FREE(ret_var.data);
22486         return ret_arr;
22487 }
22488
22489 typedef struct LDKSocketDescriptor_JCalls {
22490         atomic_size_t refcnt;
22491         JavaVM *vm;
22492         jweak o;
22493         jmethodID send_data_meth;
22494         jmethodID disconnect_socket_meth;
22495         jmethodID eq_meth;
22496         jmethodID hash_meth;
22497 } LDKSocketDescriptor_JCalls;
22498 static void LDKSocketDescriptor_JCalls_free(void* this_arg) {
22499         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
22500         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
22501                 JNIEnv *env;
22502                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
22503                 if (get_jenv_res == JNI_EDETACHED) {
22504                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
22505                 } else {
22506                         DO_ASSERT(get_jenv_res == JNI_OK);
22507                 }
22508                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
22509                 if (get_jenv_res == JNI_EDETACHED) {
22510                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
22511                 }
22512                 FREE(j_calls);
22513         }
22514 }
22515 uintptr_t send_data_LDKSocketDescriptor_jcall(void* this_arg, LDKu8slice data, bool resume_read) {
22516         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
22517         JNIEnv *env;
22518         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
22519         if (get_jenv_res == JNI_EDETACHED) {
22520                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
22521         } else {
22522                 DO_ASSERT(get_jenv_res == JNI_OK);
22523         }
22524         LDKu8slice data_var = data;
22525         int8_tArray data_arr = (*env)->NewByteArray(env, data_var.datalen);
22526         (*env)->SetByteArrayRegion(env, data_arr, 0, data_var.datalen, data_var.data);
22527         jboolean resume_read_conv = resume_read;
22528         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
22529         CHECK(obj != NULL);
22530         int64_t ret = (*env)->CallLongMethod(env, obj, j_calls->send_data_meth, data_arr, resume_read_conv);
22531         if (UNLIKELY((*env)->ExceptionCheck(env))) {
22532                 (*env)->ExceptionDescribe(env);
22533                 (*env)->FatalError(env, "A call to send_data in LDKSocketDescriptor from rust threw an exception.");
22534         }
22535         if (get_jenv_res == JNI_EDETACHED) {
22536                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
22537         }
22538         return ret;
22539 }
22540 void disconnect_socket_LDKSocketDescriptor_jcall(void* this_arg) {
22541         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
22542         JNIEnv *env;
22543         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
22544         if (get_jenv_res == JNI_EDETACHED) {
22545                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
22546         } else {
22547                 DO_ASSERT(get_jenv_res == JNI_OK);
22548         }
22549         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
22550         CHECK(obj != NULL);
22551         (*env)->CallVoidMethod(env, obj, j_calls->disconnect_socket_meth);
22552         if (UNLIKELY((*env)->ExceptionCheck(env))) {
22553                 (*env)->ExceptionDescribe(env);
22554                 (*env)->FatalError(env, "A call to disconnect_socket in LDKSocketDescriptor from rust threw an exception.");
22555         }
22556         if (get_jenv_res == JNI_EDETACHED) {
22557                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
22558         }
22559 }
22560 bool eq_LDKSocketDescriptor_jcall(const void* this_arg, const LDKSocketDescriptor * other_arg) {
22561         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
22562         JNIEnv *env;
22563         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
22564         if (get_jenv_res == JNI_EDETACHED) {
22565                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
22566         } else {
22567                 DO_ASSERT(get_jenv_res == JNI_OK);
22568         }
22569         LDKSocketDescriptor *other_arg_clone = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
22570         *other_arg_clone = SocketDescriptor_clone(other_arg);
22571         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
22572         CHECK(obj != NULL);
22573         jboolean ret = (*env)->CallBooleanMethod(env, obj, j_calls->eq_meth, tag_ptr(other_arg_clone, true));
22574         if (UNLIKELY((*env)->ExceptionCheck(env))) {
22575                 (*env)->ExceptionDescribe(env);
22576                 (*env)->FatalError(env, "A call to eq in LDKSocketDescriptor from rust threw an exception.");
22577         }
22578         if (get_jenv_res == JNI_EDETACHED) {
22579                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
22580         }
22581         return ret;
22582 }
22583 uint64_t hash_LDKSocketDescriptor_jcall(const void* this_arg) {
22584         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
22585         JNIEnv *env;
22586         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
22587         if (get_jenv_res == JNI_EDETACHED) {
22588                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
22589         } else {
22590                 DO_ASSERT(get_jenv_res == JNI_OK);
22591         }
22592         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
22593         CHECK(obj != NULL);
22594         int64_t ret = (*env)->CallLongMethod(env, obj, j_calls->hash_meth);
22595         if (UNLIKELY((*env)->ExceptionCheck(env))) {
22596                 (*env)->ExceptionDescribe(env);
22597                 (*env)->FatalError(env, "A call to hash in LDKSocketDescriptor from rust threw an exception.");
22598         }
22599         if (get_jenv_res == JNI_EDETACHED) {
22600                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
22601         }
22602         return ret;
22603 }
22604 static void LDKSocketDescriptor_JCalls_cloned(LDKSocketDescriptor* new_obj) {
22605         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) new_obj->this_arg;
22606         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
22607 }
22608 static inline LDKSocketDescriptor LDKSocketDescriptor_init (JNIEnv *env, jclass clz, jobject o) {
22609         jclass c = (*env)->GetObjectClass(env, o);
22610         CHECK(c != NULL);
22611         LDKSocketDescriptor_JCalls *calls = MALLOC(sizeof(LDKSocketDescriptor_JCalls), "LDKSocketDescriptor_JCalls");
22612         atomic_init(&calls->refcnt, 1);
22613         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
22614         calls->o = (*env)->NewWeakGlobalRef(env, o);
22615         calls->send_data_meth = (*env)->GetMethodID(env, c, "send_data", "([BZ)J");
22616         CHECK(calls->send_data_meth != NULL);
22617         calls->disconnect_socket_meth = (*env)->GetMethodID(env, c, "disconnect_socket", "()V");
22618         CHECK(calls->disconnect_socket_meth != NULL);
22619         calls->eq_meth = (*env)->GetMethodID(env, c, "eq", "(J)Z");
22620         CHECK(calls->eq_meth != NULL);
22621         calls->hash_meth = (*env)->GetMethodID(env, c, "hash", "()J");
22622         CHECK(calls->hash_meth != NULL);
22623
22624         LDKSocketDescriptor ret = {
22625                 .this_arg = (void*) calls,
22626                 .send_data = send_data_LDKSocketDescriptor_jcall,
22627                 .disconnect_socket = disconnect_socket_LDKSocketDescriptor_jcall,
22628                 .eq = eq_LDKSocketDescriptor_jcall,
22629                 .hash = hash_LDKSocketDescriptor_jcall,
22630                 .cloned = LDKSocketDescriptor_JCalls_cloned,
22631                 .free = LDKSocketDescriptor_JCalls_free,
22632         };
22633         return ret;
22634 }
22635 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKSocketDescriptor_1new(JNIEnv *env, jclass clz, jobject o) {
22636         LDKSocketDescriptor *res_ptr = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
22637         *res_ptr = LDKSocketDescriptor_init(env, clz, o);
22638         return tag_ptr(res_ptr, true);
22639 }
22640 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) {
22641         void* this_arg_ptr = untag_ptr(this_arg);
22642         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
22643         LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg_ptr;
22644         LDKu8slice data_ref;
22645         data_ref.datalen = (*env)->GetArrayLength(env, data);
22646         data_ref.data = (*env)->GetByteArrayElements (env, data, NULL);
22647         int64_t ret_conv = (this_arg_conv->send_data)(this_arg_conv->this_arg, data_ref, resume_read);
22648         (*env)->ReleaseByteArrayElements(env, data, (int8_t*)data_ref.data, 0);
22649         return ret_conv;
22650 }
22651
22652 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1disconnect_1socket(JNIEnv *env, jclass clz, int64_t this_arg) {
22653         void* this_arg_ptr = untag_ptr(this_arg);
22654         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
22655         LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg_ptr;
22656         (this_arg_conv->disconnect_socket)(this_arg_conv->this_arg);
22657 }
22658
22659 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
22660         void* this_arg_ptr = untag_ptr(this_arg);
22661         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
22662         LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg_ptr;
22663         int64_t ret_conv = (this_arg_conv->hash)(this_arg_conv->this_arg);
22664         return ret_conv;
22665 }
22666
22667 typedef struct LDKSignBolt12InvoiceFn_JCalls {
22668         atomic_size_t refcnt;
22669         JavaVM *vm;
22670         jweak o;
22671         jmethodID sign_invoice_meth;
22672 } LDKSignBolt12InvoiceFn_JCalls;
22673 static void LDKSignBolt12InvoiceFn_JCalls_free(void* this_arg) {
22674         LDKSignBolt12InvoiceFn_JCalls *j_calls = (LDKSignBolt12InvoiceFn_JCalls*) this_arg;
22675         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
22676                 JNIEnv *env;
22677                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
22678                 if (get_jenv_res == JNI_EDETACHED) {
22679                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
22680                 } else {
22681                         DO_ASSERT(get_jenv_res == JNI_OK);
22682                 }
22683                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
22684                 if (get_jenv_res == JNI_EDETACHED) {
22685                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
22686                 }
22687                 FREE(j_calls);
22688         }
22689 }
22690 LDKCResult_SchnorrSignatureNoneZ sign_invoice_LDKSignBolt12InvoiceFn_jcall(const void* this_arg, const LDKUnsignedBolt12Invoice * message) {
22691         LDKSignBolt12InvoiceFn_JCalls *j_calls = (LDKSignBolt12InvoiceFn_JCalls*) this_arg;
22692         JNIEnv *env;
22693         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
22694         if (get_jenv_res == JNI_EDETACHED) {
22695                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
22696         } else {
22697                 DO_ASSERT(get_jenv_res == JNI_OK);
22698         }
22699         LDKUnsignedBolt12Invoice message_var = *message;
22700         int64_t message_ref = 0;
22701         message_var = UnsignedBolt12Invoice_clone(&message_var);
22702         CHECK_INNER_FIELD_ACCESS_OR_NULL(message_var);
22703         message_ref = tag_ptr(message_var.inner, message_var.is_owned);
22704         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
22705         CHECK(obj != NULL);
22706         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_invoice_meth, message_ref);
22707         if (UNLIKELY((*env)->ExceptionCheck(env))) {
22708                 (*env)->ExceptionDescribe(env);
22709                 (*env)->FatalError(env, "A call to sign_invoice in LDKSignBolt12InvoiceFn from rust threw an exception.");
22710         }
22711         void* ret_ptr = untag_ptr(ret);
22712         CHECK_ACCESS(ret_ptr);
22713         LDKCResult_SchnorrSignatureNoneZ ret_conv = *(LDKCResult_SchnorrSignatureNoneZ*)(ret_ptr);
22714         FREE(untag_ptr(ret));
22715         if (get_jenv_res == JNI_EDETACHED) {
22716                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
22717         }
22718         return ret_conv;
22719 }
22720 static void LDKSignBolt12InvoiceFn_JCalls_cloned(LDKSignBolt12InvoiceFn* new_obj) {
22721         LDKSignBolt12InvoiceFn_JCalls *j_calls = (LDKSignBolt12InvoiceFn_JCalls*) new_obj->this_arg;
22722         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
22723 }
22724 static inline LDKSignBolt12InvoiceFn LDKSignBolt12InvoiceFn_init (JNIEnv *env, jclass clz, jobject o) {
22725         jclass c = (*env)->GetObjectClass(env, o);
22726         CHECK(c != NULL);
22727         LDKSignBolt12InvoiceFn_JCalls *calls = MALLOC(sizeof(LDKSignBolt12InvoiceFn_JCalls), "LDKSignBolt12InvoiceFn_JCalls");
22728         atomic_init(&calls->refcnt, 1);
22729         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
22730         calls->o = (*env)->NewWeakGlobalRef(env, o);
22731         calls->sign_invoice_meth = (*env)->GetMethodID(env, c, "sign_invoice", "(J)J");
22732         CHECK(calls->sign_invoice_meth != NULL);
22733
22734         LDKSignBolt12InvoiceFn ret = {
22735                 .this_arg = (void*) calls,
22736                 .sign_invoice = sign_invoice_LDKSignBolt12InvoiceFn_jcall,
22737                 .free = LDKSignBolt12InvoiceFn_JCalls_free,
22738         };
22739         return ret;
22740 }
22741 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKSignBolt12InvoiceFn_1new(JNIEnv *env, jclass clz, jobject o) {
22742         LDKSignBolt12InvoiceFn *res_ptr = MALLOC(sizeof(LDKSignBolt12InvoiceFn), "LDKSignBolt12InvoiceFn");
22743         *res_ptr = LDKSignBolt12InvoiceFn_init(env, clz, o);
22744         return tag_ptr(res_ptr, true);
22745 }
22746 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignBolt12InvoiceFn_1sign_1invoice(JNIEnv *env, jclass clz, int64_t this_arg, int64_t message) {
22747         void* this_arg_ptr = untag_ptr(this_arg);
22748         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
22749         LDKSignBolt12InvoiceFn* this_arg_conv = (LDKSignBolt12InvoiceFn*)this_arg_ptr;
22750         LDKUnsignedBolt12Invoice message_conv;
22751         message_conv.inner = untag_ptr(message);
22752         message_conv.is_owned = ptr_is_owned(message);
22753         CHECK_INNER_FIELD_ACCESS_OR_NULL(message_conv);
22754         message_conv.is_owned = false;
22755         LDKCResult_SchnorrSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SchnorrSignatureNoneZ), "LDKCResult_SchnorrSignatureNoneZ");
22756         *ret_conv = (this_arg_conv->sign_invoice)(this_arg_conv->this_arg, &message_conv);
22757         return tag_ptr(ret_conv, true);
22758 }
22759
22760 typedef struct LDKSignInvoiceRequestFn_JCalls {
22761         atomic_size_t refcnt;
22762         JavaVM *vm;
22763         jweak o;
22764         jmethodID sign_invoice_request_meth;
22765 } LDKSignInvoiceRequestFn_JCalls;
22766 static void LDKSignInvoiceRequestFn_JCalls_free(void* this_arg) {
22767         LDKSignInvoiceRequestFn_JCalls *j_calls = (LDKSignInvoiceRequestFn_JCalls*) this_arg;
22768         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
22769                 JNIEnv *env;
22770                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
22771                 if (get_jenv_res == JNI_EDETACHED) {
22772                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
22773                 } else {
22774                         DO_ASSERT(get_jenv_res == JNI_OK);
22775                 }
22776                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
22777                 if (get_jenv_res == JNI_EDETACHED) {
22778                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
22779                 }
22780                 FREE(j_calls);
22781         }
22782 }
22783 LDKCResult_SchnorrSignatureNoneZ sign_invoice_request_LDKSignInvoiceRequestFn_jcall(const void* this_arg, const LDKUnsignedInvoiceRequest * message) {
22784         LDKSignInvoiceRequestFn_JCalls *j_calls = (LDKSignInvoiceRequestFn_JCalls*) this_arg;
22785         JNIEnv *env;
22786         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
22787         if (get_jenv_res == JNI_EDETACHED) {
22788                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
22789         } else {
22790                 DO_ASSERT(get_jenv_res == JNI_OK);
22791         }
22792         LDKUnsignedInvoiceRequest message_var = *message;
22793         int64_t message_ref = 0;
22794         message_var = UnsignedInvoiceRequest_clone(&message_var);
22795         CHECK_INNER_FIELD_ACCESS_OR_NULL(message_var);
22796         message_ref = tag_ptr(message_var.inner, message_var.is_owned);
22797         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
22798         CHECK(obj != NULL);
22799         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_invoice_request_meth, message_ref);
22800         if (UNLIKELY((*env)->ExceptionCheck(env))) {
22801                 (*env)->ExceptionDescribe(env);
22802                 (*env)->FatalError(env, "A call to sign_invoice_request in LDKSignInvoiceRequestFn from rust threw an exception.");
22803         }
22804         void* ret_ptr = untag_ptr(ret);
22805         CHECK_ACCESS(ret_ptr);
22806         LDKCResult_SchnorrSignatureNoneZ ret_conv = *(LDKCResult_SchnorrSignatureNoneZ*)(ret_ptr);
22807         FREE(untag_ptr(ret));
22808         if (get_jenv_res == JNI_EDETACHED) {
22809                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
22810         }
22811         return ret_conv;
22812 }
22813 static void LDKSignInvoiceRequestFn_JCalls_cloned(LDKSignInvoiceRequestFn* new_obj) {
22814         LDKSignInvoiceRequestFn_JCalls *j_calls = (LDKSignInvoiceRequestFn_JCalls*) new_obj->this_arg;
22815         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
22816 }
22817 static inline LDKSignInvoiceRequestFn LDKSignInvoiceRequestFn_init (JNIEnv *env, jclass clz, jobject o) {
22818         jclass c = (*env)->GetObjectClass(env, o);
22819         CHECK(c != NULL);
22820         LDKSignInvoiceRequestFn_JCalls *calls = MALLOC(sizeof(LDKSignInvoiceRequestFn_JCalls), "LDKSignInvoiceRequestFn_JCalls");
22821         atomic_init(&calls->refcnt, 1);
22822         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
22823         calls->o = (*env)->NewWeakGlobalRef(env, o);
22824         calls->sign_invoice_request_meth = (*env)->GetMethodID(env, c, "sign_invoice_request", "(J)J");
22825         CHECK(calls->sign_invoice_request_meth != NULL);
22826
22827         LDKSignInvoiceRequestFn ret = {
22828                 .this_arg = (void*) calls,
22829                 .sign_invoice_request = sign_invoice_request_LDKSignInvoiceRequestFn_jcall,
22830                 .free = LDKSignInvoiceRequestFn_JCalls_free,
22831         };
22832         return ret;
22833 }
22834 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKSignInvoiceRequestFn_1new(JNIEnv *env, jclass clz, jobject o) {
22835         LDKSignInvoiceRequestFn *res_ptr = MALLOC(sizeof(LDKSignInvoiceRequestFn), "LDKSignInvoiceRequestFn");
22836         *res_ptr = LDKSignInvoiceRequestFn_init(env, clz, o);
22837         return tag_ptr(res_ptr, true);
22838 }
22839 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignInvoiceRequestFn_1sign_1invoice_1request(JNIEnv *env, jclass clz, int64_t this_arg, int64_t message) {
22840         void* this_arg_ptr = untag_ptr(this_arg);
22841         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
22842         LDKSignInvoiceRequestFn* this_arg_conv = (LDKSignInvoiceRequestFn*)this_arg_ptr;
22843         LDKUnsignedInvoiceRequest message_conv;
22844         message_conv.inner = untag_ptr(message);
22845         message_conv.is_owned = ptr_is_owned(message);
22846         CHECK_INNER_FIELD_ACCESS_OR_NULL(message_conv);
22847         message_conv.is_owned = false;
22848         LDKCResult_SchnorrSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SchnorrSignatureNoneZ), "LDKCResult_SchnorrSignatureNoneZ");
22849         *ret_conv = (this_arg_conv->sign_invoice_request)(this_arg_conv->this_arg, &message_conv);
22850         return tag_ptr(ret_conv, true);
22851 }
22852
22853 static jclass LDKSignError_Signing_class = NULL;
22854 static jmethodID LDKSignError_Signing_meth = NULL;
22855 static jclass LDKSignError_Verification_class = NULL;
22856 static jmethodID LDKSignError_Verification_meth = NULL;
22857 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKSignError_init (JNIEnv *env, jclass clz) {
22858         LDKSignError_Signing_class =
22859                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSignError$Signing"));
22860         CHECK(LDKSignError_Signing_class != NULL);
22861         LDKSignError_Signing_meth = (*env)->GetMethodID(env, LDKSignError_Signing_class, "<init>", "()V");
22862         CHECK(LDKSignError_Signing_meth != NULL);
22863         LDKSignError_Verification_class =
22864                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSignError$Verification"));
22865         CHECK(LDKSignError_Verification_class != NULL);
22866         LDKSignError_Verification_meth = (*env)->GetMethodID(env, LDKSignError_Verification_class, "<init>", "(Lorg/ldk/enums/Secp256k1Error;)V");
22867         CHECK(LDKSignError_Verification_meth != NULL);
22868 }
22869 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKSignError_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
22870         LDKSignError *obj = (LDKSignError*)untag_ptr(ptr);
22871         switch(obj->tag) {
22872                 case LDKSignError_Signing: {
22873                         return (*env)->NewObject(env, LDKSignError_Signing_class, LDKSignError_Signing_meth);
22874                 }
22875                 case LDKSignError_Verification: {
22876                         jclass verification_conv = LDKSecp256k1Error_to_java(env, obj->verification);
22877                         return (*env)->NewObject(env, LDKSignError_Verification_class, LDKSignError_Verification_meth, verification_conv);
22878                 }
22879                 default: abort();
22880         }
22881 }
22882 static jclass LDKEffectiveCapacity_ExactLiquidity_class = NULL;
22883 static jmethodID LDKEffectiveCapacity_ExactLiquidity_meth = NULL;
22884 static jclass LDKEffectiveCapacity_AdvertisedMaxHTLC_class = NULL;
22885 static jmethodID LDKEffectiveCapacity_AdvertisedMaxHTLC_meth = NULL;
22886 static jclass LDKEffectiveCapacity_Total_class = NULL;
22887 static jmethodID LDKEffectiveCapacity_Total_meth = NULL;
22888 static jclass LDKEffectiveCapacity_Infinite_class = NULL;
22889 static jmethodID LDKEffectiveCapacity_Infinite_meth = NULL;
22890 static jclass LDKEffectiveCapacity_HintMaxHTLC_class = NULL;
22891 static jmethodID LDKEffectiveCapacity_HintMaxHTLC_meth = NULL;
22892 static jclass LDKEffectiveCapacity_Unknown_class = NULL;
22893 static jmethodID LDKEffectiveCapacity_Unknown_meth = NULL;
22894 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKEffectiveCapacity_init (JNIEnv *env, jclass clz) {
22895         LDKEffectiveCapacity_ExactLiquidity_class =
22896                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEffectiveCapacity$ExactLiquidity"));
22897         CHECK(LDKEffectiveCapacity_ExactLiquidity_class != NULL);
22898         LDKEffectiveCapacity_ExactLiquidity_meth = (*env)->GetMethodID(env, LDKEffectiveCapacity_ExactLiquidity_class, "<init>", "(J)V");
22899         CHECK(LDKEffectiveCapacity_ExactLiquidity_meth != NULL);
22900         LDKEffectiveCapacity_AdvertisedMaxHTLC_class =
22901                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEffectiveCapacity$AdvertisedMaxHTLC"));
22902         CHECK(LDKEffectiveCapacity_AdvertisedMaxHTLC_class != NULL);
22903         LDKEffectiveCapacity_AdvertisedMaxHTLC_meth = (*env)->GetMethodID(env, LDKEffectiveCapacity_AdvertisedMaxHTLC_class, "<init>", "(J)V");
22904         CHECK(LDKEffectiveCapacity_AdvertisedMaxHTLC_meth != NULL);
22905         LDKEffectiveCapacity_Total_class =
22906                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEffectiveCapacity$Total"));
22907         CHECK(LDKEffectiveCapacity_Total_class != NULL);
22908         LDKEffectiveCapacity_Total_meth = (*env)->GetMethodID(env, LDKEffectiveCapacity_Total_class, "<init>", "(JJ)V");
22909         CHECK(LDKEffectiveCapacity_Total_meth != NULL);
22910         LDKEffectiveCapacity_Infinite_class =
22911                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEffectiveCapacity$Infinite"));
22912         CHECK(LDKEffectiveCapacity_Infinite_class != NULL);
22913         LDKEffectiveCapacity_Infinite_meth = (*env)->GetMethodID(env, LDKEffectiveCapacity_Infinite_class, "<init>", "()V");
22914         CHECK(LDKEffectiveCapacity_Infinite_meth != NULL);
22915         LDKEffectiveCapacity_HintMaxHTLC_class =
22916                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEffectiveCapacity$HintMaxHTLC"));
22917         CHECK(LDKEffectiveCapacity_HintMaxHTLC_class != NULL);
22918         LDKEffectiveCapacity_HintMaxHTLC_meth = (*env)->GetMethodID(env, LDKEffectiveCapacity_HintMaxHTLC_class, "<init>", "(J)V");
22919         CHECK(LDKEffectiveCapacity_HintMaxHTLC_meth != NULL);
22920         LDKEffectiveCapacity_Unknown_class =
22921                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEffectiveCapacity$Unknown"));
22922         CHECK(LDKEffectiveCapacity_Unknown_class != NULL);
22923         LDKEffectiveCapacity_Unknown_meth = (*env)->GetMethodID(env, LDKEffectiveCapacity_Unknown_class, "<init>", "()V");
22924         CHECK(LDKEffectiveCapacity_Unknown_meth != NULL);
22925 }
22926 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKEffectiveCapacity_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
22927         LDKEffectiveCapacity *obj = (LDKEffectiveCapacity*)untag_ptr(ptr);
22928         switch(obj->tag) {
22929                 case LDKEffectiveCapacity_ExactLiquidity: {
22930                         int64_t liquidity_msat_conv = obj->exact_liquidity.liquidity_msat;
22931                         return (*env)->NewObject(env, LDKEffectiveCapacity_ExactLiquidity_class, LDKEffectiveCapacity_ExactLiquidity_meth, liquidity_msat_conv);
22932                 }
22933                 case LDKEffectiveCapacity_AdvertisedMaxHTLC: {
22934                         int64_t amount_msat_conv = obj->advertised_max_htlc.amount_msat;
22935                         return (*env)->NewObject(env, LDKEffectiveCapacity_AdvertisedMaxHTLC_class, LDKEffectiveCapacity_AdvertisedMaxHTLC_meth, amount_msat_conv);
22936                 }
22937                 case LDKEffectiveCapacity_Total: {
22938                         int64_t capacity_msat_conv = obj->total.capacity_msat;
22939                         int64_t htlc_maximum_msat_conv = obj->total.htlc_maximum_msat;
22940                         return (*env)->NewObject(env, LDKEffectiveCapacity_Total_class, LDKEffectiveCapacity_Total_meth, capacity_msat_conv, htlc_maximum_msat_conv);
22941                 }
22942                 case LDKEffectiveCapacity_Infinite: {
22943                         return (*env)->NewObject(env, LDKEffectiveCapacity_Infinite_class, LDKEffectiveCapacity_Infinite_meth);
22944                 }
22945                 case LDKEffectiveCapacity_HintMaxHTLC: {
22946                         int64_t amount_msat_conv = obj->hint_max_htlc.amount_msat;
22947                         return (*env)->NewObject(env, LDKEffectiveCapacity_HintMaxHTLC_class, LDKEffectiveCapacity_HintMaxHTLC_meth, amount_msat_conv);
22948                 }
22949                 case LDKEffectiveCapacity_Unknown: {
22950                         return (*env)->NewObject(env, LDKEffectiveCapacity_Unknown_class, LDKEffectiveCapacity_Unknown_meth);
22951                 }
22952                 default: abort();
22953         }
22954 }
22955 static jclass LDKPayee_Blinded_class = NULL;
22956 static jmethodID LDKPayee_Blinded_meth = NULL;
22957 static jclass LDKPayee_Clear_class = NULL;
22958 static jmethodID LDKPayee_Clear_meth = NULL;
22959 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKPayee_init (JNIEnv *env, jclass clz) {
22960         LDKPayee_Blinded_class =
22961                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPayee$Blinded"));
22962         CHECK(LDKPayee_Blinded_class != NULL);
22963         LDKPayee_Blinded_meth = (*env)->GetMethodID(env, LDKPayee_Blinded_class, "<init>", "([JJ)V");
22964         CHECK(LDKPayee_Blinded_meth != NULL);
22965         LDKPayee_Clear_class =
22966                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPayee$Clear"));
22967         CHECK(LDKPayee_Clear_class != NULL);
22968         LDKPayee_Clear_meth = (*env)->GetMethodID(env, LDKPayee_Clear_class, "<init>", "([B[JJI)V");
22969         CHECK(LDKPayee_Clear_meth != NULL);
22970 }
22971 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKPayee_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
22972         LDKPayee *obj = (LDKPayee*)untag_ptr(ptr);
22973         switch(obj->tag) {
22974                 case LDKPayee_Blinded: {
22975                         LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ route_hints_var = obj->blinded.route_hints;
22976                         int64_tArray route_hints_arr = NULL;
22977                         route_hints_arr = (*env)->NewLongArray(env, route_hints_var.datalen);
22978                         int64_t *route_hints_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, route_hints_arr, NULL);
22979                         for (size_t l = 0; l < route_hints_var.datalen; l++) {
22980                                 LDKC2Tuple_BlindedPayInfoBlindedPathZ* route_hints_conv_37_conv = MALLOC(sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKC2Tuple_BlindedPayInfoBlindedPathZ");
22981                                 *route_hints_conv_37_conv = route_hints_var.data[l];
22982                                 *route_hints_conv_37_conv = C2Tuple_BlindedPayInfoBlindedPathZ_clone(route_hints_conv_37_conv);
22983                                 route_hints_arr_ptr[l] = tag_ptr(route_hints_conv_37_conv, true);
22984                         }
22985                         (*env)->ReleasePrimitiveArrayCritical(env, route_hints_arr, route_hints_arr_ptr, 0);
22986                         LDKBolt12InvoiceFeatures features_var = obj->blinded.features;
22987                         int64_t features_ref = 0;
22988                         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_var);
22989                         features_ref = tag_ptr(features_var.inner, false);
22990                         return (*env)->NewObject(env, LDKPayee_Blinded_class, LDKPayee_Blinded_meth, route_hints_arr, features_ref);
22991                 }
22992                 case LDKPayee_Clear: {
22993                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
22994                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->clear.node_id.compressed_form);
22995                         LDKCVec_RouteHintZ route_hints_var = obj->clear.route_hints;
22996                         int64_tArray route_hints_arr = NULL;
22997                         route_hints_arr = (*env)->NewLongArray(env, route_hints_var.datalen);
22998                         int64_t *route_hints_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, route_hints_arr, NULL);
22999                         for (size_t l = 0; l < route_hints_var.datalen; l++) {
23000                                 LDKRouteHint route_hints_conv_11_var = route_hints_var.data[l];
23001                                 int64_t route_hints_conv_11_ref = 0;
23002                                 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_hints_conv_11_var);
23003                                 route_hints_conv_11_ref = tag_ptr(route_hints_conv_11_var.inner, false);
23004                                 route_hints_arr_ptr[l] = route_hints_conv_11_ref;
23005                         }
23006                         (*env)->ReleasePrimitiveArrayCritical(env, route_hints_arr, route_hints_arr_ptr, 0);
23007                         LDKBolt11InvoiceFeatures features_var = obj->clear.features;
23008                         int64_t features_ref = 0;
23009                         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_var);
23010                         features_ref = tag_ptr(features_var.inner, false);
23011                         int32_t final_cltv_expiry_delta_conv = obj->clear.final_cltv_expiry_delta;
23012                         return (*env)->NewObject(env, LDKPayee_Clear_class, LDKPayee_Clear_meth, node_id_arr, route_hints_arr, features_ref, final_cltv_expiry_delta_conv);
23013                 }
23014                 default: abort();
23015         }
23016 }
23017 typedef struct LDKScore_JCalls {
23018         atomic_size_t refcnt;
23019         JavaVM *vm;
23020         jweak o;
23021         LDKScoreLookUp_JCalls* ScoreLookUp;
23022         LDKScoreUpdate_JCalls* ScoreUpdate;
23023         jmethodID write_meth;
23024 } LDKScore_JCalls;
23025 static void LDKScore_JCalls_free(void* this_arg) {
23026         LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
23027         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
23028                 JNIEnv *env;
23029                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
23030                 if (get_jenv_res == JNI_EDETACHED) {
23031                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
23032                 } else {
23033                         DO_ASSERT(get_jenv_res == JNI_OK);
23034                 }
23035                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
23036                 if (get_jenv_res == JNI_EDETACHED) {
23037                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
23038                 }
23039                 FREE(j_calls);
23040         }
23041 }
23042 LDKCVec_u8Z write_LDKScore_jcall(const void* this_arg) {
23043         LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg;
23044         JNIEnv *env;
23045         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
23046         if (get_jenv_res == JNI_EDETACHED) {
23047                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
23048         } else {
23049                 DO_ASSERT(get_jenv_res == JNI_OK);
23050         }
23051         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
23052         CHECK(obj != NULL);
23053         int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->write_meth);
23054         if (UNLIKELY((*env)->ExceptionCheck(env))) {
23055                 (*env)->ExceptionDescribe(env);
23056                 (*env)->FatalError(env, "A call to write in LDKScore from rust threw an exception.");
23057         }
23058         LDKCVec_u8Z ret_ref;
23059         ret_ref.datalen = (*env)->GetArrayLength(env, ret);
23060         ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
23061         (*env)->GetByteArrayRegion(env, ret, 0, ret_ref.datalen, ret_ref.data);
23062         if (get_jenv_res == JNI_EDETACHED) {
23063                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
23064         }
23065         return ret_ref;
23066 }
23067 static void LDKScore_JCalls_cloned(LDKScore* new_obj) {
23068         LDKScore_JCalls *j_calls = (LDKScore_JCalls*) new_obj->this_arg;
23069         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
23070         atomic_fetch_add_explicit(&j_calls->ScoreLookUp->refcnt, 1, memory_order_release);
23071         atomic_fetch_add_explicit(&j_calls->ScoreUpdate->refcnt, 1, memory_order_release);
23072 }
23073 static inline LDKScore LDKScore_init (JNIEnv *env, jclass clz, jobject o, jobject ScoreLookUp, jobject ScoreUpdate) {
23074         jclass c = (*env)->GetObjectClass(env, o);
23075         CHECK(c != NULL);
23076         LDKScore_JCalls *calls = MALLOC(sizeof(LDKScore_JCalls), "LDKScore_JCalls");
23077         atomic_init(&calls->refcnt, 1);
23078         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
23079         calls->o = (*env)->NewWeakGlobalRef(env, o);
23080         calls->write_meth = (*env)->GetMethodID(env, c, "write", "()[B");
23081         CHECK(calls->write_meth != NULL);
23082
23083         LDKScore ret = {
23084                 .this_arg = (void*) calls,
23085                 .write = write_LDKScore_jcall,
23086                 .free = LDKScore_JCalls_free,
23087                 .ScoreLookUp = LDKScoreLookUp_init(env, clz, ScoreLookUp),
23088                 .ScoreUpdate = LDKScoreUpdate_init(env, clz, ScoreUpdate),
23089         };
23090         calls->ScoreLookUp = ret.ScoreLookUp.this_arg;
23091         calls->ScoreUpdate = ret.ScoreUpdate.this_arg;
23092         return ret;
23093 }
23094 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKScore_1new(JNIEnv *env, jclass clz, jobject o, jobject ScoreLookUp, jobject ScoreUpdate) {
23095         LDKScore *res_ptr = MALLOC(sizeof(LDKScore), "LDKScore");
23096         *res_ptr = LDKScore_init(env, clz, o, ScoreLookUp, ScoreUpdate);
23097         return tag_ptr(res_ptr, true);
23098 }
23099 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKScore_1get_1ScoreLookUp(JNIEnv *env, jclass clz, int64_t arg) {
23100         LDKScore *inp = (LDKScore *)untag_ptr(arg);
23101         return tag_ptr(&inp->ScoreLookUp, false);
23102 }
23103 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKScore_1get_1ScoreUpdate(JNIEnv *env, jclass clz, int64_t arg) {
23104         LDKScore *inp = (LDKScore *)untag_ptr(arg);
23105         return tag_ptr(&inp->ScoreUpdate, false);
23106 }
23107 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Score_1write(JNIEnv *env, jclass clz, int64_t this_arg) {
23108         void* this_arg_ptr = untag_ptr(this_arg);
23109         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
23110         LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr;
23111         LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
23112         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
23113         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
23114         CVec_u8Z_free(ret_var);
23115         return ret_arr;
23116 }
23117
23118 static jclass LDKIntroductionNode_NodeId_class = NULL;
23119 static jmethodID LDKIntroductionNode_NodeId_meth = NULL;
23120 static jclass LDKIntroductionNode_DirectedShortChannelId_class = NULL;
23121 static jmethodID LDKIntroductionNode_DirectedShortChannelId_meth = NULL;
23122 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKIntroductionNode_init (JNIEnv *env, jclass clz) {
23123         LDKIntroductionNode_NodeId_class =
23124                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKIntroductionNode$NodeId"));
23125         CHECK(LDKIntroductionNode_NodeId_class != NULL);
23126         LDKIntroductionNode_NodeId_meth = (*env)->GetMethodID(env, LDKIntroductionNode_NodeId_class, "<init>", "([B)V");
23127         CHECK(LDKIntroductionNode_NodeId_meth != NULL);
23128         LDKIntroductionNode_DirectedShortChannelId_class =
23129                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKIntroductionNode$DirectedShortChannelId"));
23130         CHECK(LDKIntroductionNode_DirectedShortChannelId_class != NULL);
23131         LDKIntroductionNode_DirectedShortChannelId_meth = (*env)->GetMethodID(env, LDKIntroductionNode_DirectedShortChannelId_class, "<init>", "(Lorg/ldk/enums/Direction;J)V");
23132         CHECK(LDKIntroductionNode_DirectedShortChannelId_meth != NULL);
23133 }
23134 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKIntroductionNode_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
23135         LDKIntroductionNode *obj = (LDKIntroductionNode*)untag_ptr(ptr);
23136         switch(obj->tag) {
23137                 case LDKIntroductionNode_NodeId: {
23138                         int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
23139                         (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->node_id.compressed_form);
23140                         return (*env)->NewObject(env, LDKIntroductionNode_NodeId_class, LDKIntroductionNode_NodeId_meth, node_id_arr);
23141                 }
23142                 case LDKIntroductionNode_DirectedShortChannelId: {
23143                         jclass _0_conv = LDKDirection_to_java(env, obj->directed_short_channel_id._0);
23144                         int64_t _1_conv = obj->directed_short_channel_id._1;
23145                         return (*env)->NewObject(env, LDKIntroductionNode_DirectedShortChannelId_class, LDKIntroductionNode_DirectedShortChannelId_meth, _0_conv, _1_conv);
23146                 }
23147                 default: abort();
23148         }
23149 }
23150 typedef struct LDKCoinSelectionSource_JCalls {
23151         atomic_size_t refcnt;
23152         JavaVM *vm;
23153         jweak o;
23154         jmethodID select_confirmed_utxos_meth;
23155         jmethodID sign_psbt_meth;
23156 } LDKCoinSelectionSource_JCalls;
23157 static void LDKCoinSelectionSource_JCalls_free(void* this_arg) {
23158         LDKCoinSelectionSource_JCalls *j_calls = (LDKCoinSelectionSource_JCalls*) this_arg;
23159         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
23160                 JNIEnv *env;
23161                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
23162                 if (get_jenv_res == JNI_EDETACHED) {
23163                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
23164                 } else {
23165                         DO_ASSERT(get_jenv_res == JNI_OK);
23166                 }
23167                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
23168                 if (get_jenv_res == JNI_EDETACHED) {
23169                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
23170                 }
23171                 FREE(j_calls);
23172         }
23173 }
23174 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) {
23175         LDKCoinSelectionSource_JCalls *j_calls = (LDKCoinSelectionSource_JCalls*) this_arg;
23176         JNIEnv *env;
23177         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
23178         if (get_jenv_res == JNI_EDETACHED) {
23179                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
23180         } else {
23181                 DO_ASSERT(get_jenv_res == JNI_OK);
23182         }
23183         int8_tArray claim_id_arr = (*env)->NewByteArray(env, 32);
23184         (*env)->SetByteArrayRegion(env, claim_id_arr, 0, 32, claim_id.data);
23185         LDKCVec_InputZ must_spend_var = must_spend;
23186         int64_tArray must_spend_arr = NULL;
23187         must_spend_arr = (*env)->NewLongArray(env, must_spend_var.datalen);
23188         int64_t *must_spend_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, must_spend_arr, NULL);
23189         for (size_t h = 0; h < must_spend_var.datalen; h++) {
23190                 LDKInput must_spend_conv_7_var = must_spend_var.data[h];
23191                 int64_t must_spend_conv_7_ref = 0;
23192                 CHECK_INNER_FIELD_ACCESS_OR_NULL(must_spend_conv_7_var);
23193                 must_spend_conv_7_ref = tag_ptr(must_spend_conv_7_var.inner, must_spend_conv_7_var.is_owned);
23194                 must_spend_arr_ptr[h] = must_spend_conv_7_ref;
23195         }
23196         (*env)->ReleasePrimitiveArrayCritical(env, must_spend_arr, must_spend_arr_ptr, 0);
23197         FREE(must_spend_var.data);
23198         LDKCVec_TxOutZ must_pay_to_var = must_pay_to;
23199         int64_tArray must_pay_to_arr = NULL;
23200         must_pay_to_arr = (*env)->NewLongArray(env, must_pay_to_var.datalen);
23201         int64_t *must_pay_to_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, must_pay_to_arr, NULL);
23202         for (size_t h = 0; h < must_pay_to_var.datalen; h++) {
23203                 LDKTxOut* must_pay_to_conv_7_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
23204                 *must_pay_to_conv_7_ref = must_pay_to_var.data[h];
23205                 must_pay_to_arr_ptr[h] = tag_ptr(must_pay_to_conv_7_ref, true);
23206         }
23207         (*env)->ReleasePrimitiveArrayCritical(env, must_pay_to_arr, must_pay_to_arr_ptr, 0);
23208         FREE(must_pay_to_var.data);
23209         int32_t target_feerate_sat_per_1000_weight_conv = target_feerate_sat_per_1000_weight;
23210         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
23211         CHECK(obj != NULL);
23212         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);
23213         if (UNLIKELY((*env)->ExceptionCheck(env))) {
23214                 (*env)->ExceptionDescribe(env);
23215                 (*env)->FatalError(env, "A call to select_confirmed_utxos in LDKCoinSelectionSource from rust threw an exception.");
23216         }
23217         void* ret_ptr = untag_ptr(ret);
23218         CHECK_ACCESS(ret_ptr);
23219         LDKCResult_CoinSelectionNoneZ ret_conv = *(LDKCResult_CoinSelectionNoneZ*)(ret_ptr);
23220         FREE(untag_ptr(ret));
23221         if (get_jenv_res == JNI_EDETACHED) {
23222                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
23223         }
23224         return ret_conv;
23225 }
23226 LDKCResult_TransactionNoneZ sign_psbt_LDKCoinSelectionSource_jcall(const void* this_arg, LDKCVec_u8Z psbt) {
23227         LDKCoinSelectionSource_JCalls *j_calls = (LDKCoinSelectionSource_JCalls*) this_arg;
23228         JNIEnv *env;
23229         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
23230         if (get_jenv_res == JNI_EDETACHED) {
23231                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
23232         } else {
23233                 DO_ASSERT(get_jenv_res == JNI_OK);
23234         }
23235         LDKCVec_u8Z psbt_var = psbt;
23236         int8_tArray psbt_arr = (*env)->NewByteArray(env, psbt_var.datalen);
23237         (*env)->SetByteArrayRegion(env, psbt_arr, 0, psbt_var.datalen, psbt_var.data);
23238         CVec_u8Z_free(psbt_var);
23239         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
23240         CHECK(obj != NULL);
23241         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_psbt_meth, psbt_arr);
23242         if (UNLIKELY((*env)->ExceptionCheck(env))) {
23243                 (*env)->ExceptionDescribe(env);
23244                 (*env)->FatalError(env, "A call to sign_psbt in LDKCoinSelectionSource from rust threw an exception.");
23245         }
23246         void* ret_ptr = untag_ptr(ret);
23247         CHECK_ACCESS(ret_ptr);
23248         LDKCResult_TransactionNoneZ ret_conv = *(LDKCResult_TransactionNoneZ*)(ret_ptr);
23249         FREE(untag_ptr(ret));
23250         if (get_jenv_res == JNI_EDETACHED) {
23251                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
23252         }
23253         return ret_conv;
23254 }
23255 static void LDKCoinSelectionSource_JCalls_cloned(LDKCoinSelectionSource* new_obj) {
23256         LDKCoinSelectionSource_JCalls *j_calls = (LDKCoinSelectionSource_JCalls*) new_obj->this_arg;
23257         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
23258 }
23259 static inline LDKCoinSelectionSource LDKCoinSelectionSource_init (JNIEnv *env, jclass clz, jobject o) {
23260         jclass c = (*env)->GetObjectClass(env, o);
23261         CHECK(c != NULL);
23262         LDKCoinSelectionSource_JCalls *calls = MALLOC(sizeof(LDKCoinSelectionSource_JCalls), "LDKCoinSelectionSource_JCalls");
23263         atomic_init(&calls->refcnt, 1);
23264         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
23265         calls->o = (*env)->NewWeakGlobalRef(env, o);
23266         calls->select_confirmed_utxos_meth = (*env)->GetMethodID(env, c, "select_confirmed_utxos", "([B[J[JI)J");
23267         CHECK(calls->select_confirmed_utxos_meth != NULL);
23268         calls->sign_psbt_meth = (*env)->GetMethodID(env, c, "sign_psbt", "([B)J");
23269         CHECK(calls->sign_psbt_meth != NULL);
23270
23271         LDKCoinSelectionSource ret = {
23272                 .this_arg = (void*) calls,
23273                 .select_confirmed_utxos = select_confirmed_utxos_LDKCoinSelectionSource_jcall,
23274                 .sign_psbt = sign_psbt_LDKCoinSelectionSource_jcall,
23275                 .free = LDKCoinSelectionSource_JCalls_free,
23276         };
23277         return ret;
23278 }
23279 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCoinSelectionSource_1new(JNIEnv *env, jclass clz, jobject o) {
23280         LDKCoinSelectionSource *res_ptr = MALLOC(sizeof(LDKCoinSelectionSource), "LDKCoinSelectionSource");
23281         *res_ptr = LDKCoinSelectionSource_init(env, clz, o);
23282         return tag_ptr(res_ptr, true);
23283 }
23284 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) {
23285         void* this_arg_ptr = untag_ptr(this_arg);
23286         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
23287         LDKCoinSelectionSource* this_arg_conv = (LDKCoinSelectionSource*)this_arg_ptr;
23288         LDKThirtyTwoBytes claim_id_ref;
23289         CHECK((*env)->GetArrayLength(env, claim_id) == 32);
23290         (*env)->GetByteArrayRegion(env, claim_id, 0, 32, claim_id_ref.data);
23291         LDKCVec_InputZ must_spend_constr;
23292         must_spend_constr.datalen = (*env)->GetArrayLength(env, must_spend);
23293         if (must_spend_constr.datalen > 0)
23294                 must_spend_constr.data = MALLOC(must_spend_constr.datalen * sizeof(LDKInput), "LDKCVec_InputZ Elements");
23295         else
23296                 must_spend_constr.data = NULL;
23297         int64_t* must_spend_vals = (*env)->GetLongArrayElements (env, must_spend, NULL);
23298         for (size_t h = 0; h < must_spend_constr.datalen; h++) {
23299                 int64_t must_spend_conv_7 = must_spend_vals[h];
23300                 LDKInput must_spend_conv_7_conv;
23301                 must_spend_conv_7_conv.inner = untag_ptr(must_spend_conv_7);
23302                 must_spend_conv_7_conv.is_owned = ptr_is_owned(must_spend_conv_7);
23303                 CHECK_INNER_FIELD_ACCESS_OR_NULL(must_spend_conv_7_conv);
23304                 must_spend_conv_7_conv = Input_clone(&must_spend_conv_7_conv);
23305                 must_spend_constr.data[h] = must_spend_conv_7_conv;
23306         }
23307         (*env)->ReleaseLongArrayElements(env, must_spend, must_spend_vals, 0);
23308         LDKCVec_TxOutZ must_pay_to_constr;
23309         must_pay_to_constr.datalen = (*env)->GetArrayLength(env, must_pay_to);
23310         if (must_pay_to_constr.datalen > 0)
23311                 must_pay_to_constr.data = MALLOC(must_pay_to_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
23312         else
23313                 must_pay_to_constr.data = NULL;
23314         int64_t* must_pay_to_vals = (*env)->GetLongArrayElements (env, must_pay_to, NULL);
23315         for (size_t h = 0; h < must_pay_to_constr.datalen; h++) {
23316                 int64_t must_pay_to_conv_7 = must_pay_to_vals[h];
23317                 void* must_pay_to_conv_7_ptr = untag_ptr(must_pay_to_conv_7);
23318                 CHECK_ACCESS(must_pay_to_conv_7_ptr);
23319                 LDKTxOut must_pay_to_conv_7_conv = *(LDKTxOut*)(must_pay_to_conv_7_ptr);
23320                 must_pay_to_conv_7_conv = TxOut_clone((LDKTxOut*)untag_ptr(must_pay_to_conv_7));
23321                 must_pay_to_constr.data[h] = must_pay_to_conv_7_conv;
23322         }
23323         (*env)->ReleaseLongArrayElements(env, must_pay_to, must_pay_to_vals, 0);
23324         LDKCResult_CoinSelectionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CoinSelectionNoneZ), "LDKCResult_CoinSelectionNoneZ");
23325         *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);
23326         return tag_ptr(ret_conv, true);
23327 }
23328
23329 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CoinSelectionSource_1sign_1psbt(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray psbt) {
23330         void* this_arg_ptr = untag_ptr(this_arg);
23331         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
23332         LDKCoinSelectionSource* this_arg_conv = (LDKCoinSelectionSource*)this_arg_ptr;
23333         LDKCVec_u8Z psbt_ref;
23334         psbt_ref.datalen = (*env)->GetArrayLength(env, psbt);
23335         psbt_ref.data = MALLOC(psbt_ref.datalen, "LDKCVec_u8Z Bytes");
23336         (*env)->GetByteArrayRegion(env, psbt, 0, psbt_ref.datalen, psbt_ref.data);
23337         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
23338         *ret_conv = (this_arg_conv->sign_psbt)(this_arg_conv->this_arg, psbt_ref);
23339         return tag_ptr(ret_conv, true);
23340 }
23341
23342 typedef struct LDKWalletSource_JCalls {
23343         atomic_size_t refcnt;
23344         JavaVM *vm;
23345         jweak o;
23346         jmethodID list_confirmed_utxos_meth;
23347         jmethodID get_change_script_meth;
23348         jmethodID sign_psbt_meth;
23349 } LDKWalletSource_JCalls;
23350 static void LDKWalletSource_JCalls_free(void* this_arg) {
23351         LDKWalletSource_JCalls *j_calls = (LDKWalletSource_JCalls*) this_arg;
23352         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
23353                 JNIEnv *env;
23354                 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
23355                 if (get_jenv_res == JNI_EDETACHED) {
23356                         DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
23357                 } else {
23358                         DO_ASSERT(get_jenv_res == JNI_OK);
23359                 }
23360                 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
23361                 if (get_jenv_res == JNI_EDETACHED) {
23362                         DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
23363                 }
23364                 FREE(j_calls);
23365         }
23366 }
23367 LDKCResult_CVec_UtxoZNoneZ list_confirmed_utxos_LDKWalletSource_jcall(const void* this_arg) {
23368         LDKWalletSource_JCalls *j_calls = (LDKWalletSource_JCalls*) this_arg;
23369         JNIEnv *env;
23370         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
23371         if (get_jenv_res == JNI_EDETACHED) {
23372                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
23373         } else {
23374                 DO_ASSERT(get_jenv_res == JNI_OK);
23375         }
23376         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
23377         CHECK(obj != NULL);
23378         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->list_confirmed_utxos_meth);
23379         if (UNLIKELY((*env)->ExceptionCheck(env))) {
23380                 (*env)->ExceptionDescribe(env);
23381                 (*env)->FatalError(env, "A call to list_confirmed_utxos in LDKWalletSource from rust threw an exception.");
23382         }
23383         void* ret_ptr = untag_ptr(ret);
23384         CHECK_ACCESS(ret_ptr);
23385         LDKCResult_CVec_UtxoZNoneZ ret_conv = *(LDKCResult_CVec_UtxoZNoneZ*)(ret_ptr);
23386         FREE(untag_ptr(ret));
23387         if (get_jenv_res == JNI_EDETACHED) {
23388                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
23389         }
23390         return ret_conv;
23391 }
23392 LDKCResult_CVec_u8ZNoneZ get_change_script_LDKWalletSource_jcall(const void* this_arg) {
23393         LDKWalletSource_JCalls *j_calls = (LDKWalletSource_JCalls*) this_arg;
23394         JNIEnv *env;
23395         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
23396         if (get_jenv_res == JNI_EDETACHED) {
23397                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
23398         } else {
23399                 DO_ASSERT(get_jenv_res == JNI_OK);
23400         }
23401         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
23402         CHECK(obj != NULL);
23403         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->get_change_script_meth);
23404         if (UNLIKELY((*env)->ExceptionCheck(env))) {
23405                 (*env)->ExceptionDescribe(env);
23406                 (*env)->FatalError(env, "A call to get_change_script in LDKWalletSource from rust threw an exception.");
23407         }
23408         void* ret_ptr = untag_ptr(ret);
23409         CHECK_ACCESS(ret_ptr);
23410         LDKCResult_CVec_u8ZNoneZ ret_conv = *(LDKCResult_CVec_u8ZNoneZ*)(ret_ptr);
23411         FREE(untag_ptr(ret));
23412         if (get_jenv_res == JNI_EDETACHED) {
23413                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
23414         }
23415         return ret_conv;
23416 }
23417 LDKCResult_TransactionNoneZ sign_psbt_LDKWalletSource_jcall(const void* this_arg, LDKCVec_u8Z psbt) {
23418         LDKWalletSource_JCalls *j_calls = (LDKWalletSource_JCalls*) this_arg;
23419         JNIEnv *env;
23420         jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
23421         if (get_jenv_res == JNI_EDETACHED) {
23422                 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
23423         } else {
23424                 DO_ASSERT(get_jenv_res == JNI_OK);
23425         }
23426         LDKCVec_u8Z psbt_var = psbt;
23427         int8_tArray psbt_arr = (*env)->NewByteArray(env, psbt_var.datalen);
23428         (*env)->SetByteArrayRegion(env, psbt_arr, 0, psbt_var.datalen, psbt_var.data);
23429         CVec_u8Z_free(psbt_var);
23430         jobject obj = (*env)->NewLocalRef(env, j_calls->o);
23431         CHECK(obj != NULL);
23432         uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_psbt_meth, psbt_arr);
23433         if (UNLIKELY((*env)->ExceptionCheck(env))) {
23434                 (*env)->ExceptionDescribe(env);
23435                 (*env)->FatalError(env, "A call to sign_psbt in LDKWalletSource from rust threw an exception.");
23436         }
23437         void* ret_ptr = untag_ptr(ret);
23438         CHECK_ACCESS(ret_ptr);
23439         LDKCResult_TransactionNoneZ ret_conv = *(LDKCResult_TransactionNoneZ*)(ret_ptr);
23440         FREE(untag_ptr(ret));
23441         if (get_jenv_res == JNI_EDETACHED) {
23442                 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
23443         }
23444         return ret_conv;
23445 }
23446 static void LDKWalletSource_JCalls_cloned(LDKWalletSource* new_obj) {
23447         LDKWalletSource_JCalls *j_calls = (LDKWalletSource_JCalls*) new_obj->this_arg;
23448         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
23449 }
23450 static inline LDKWalletSource LDKWalletSource_init (JNIEnv *env, jclass clz, jobject o) {
23451         jclass c = (*env)->GetObjectClass(env, o);
23452         CHECK(c != NULL);
23453         LDKWalletSource_JCalls *calls = MALLOC(sizeof(LDKWalletSource_JCalls), "LDKWalletSource_JCalls");
23454         atomic_init(&calls->refcnt, 1);
23455         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
23456         calls->o = (*env)->NewWeakGlobalRef(env, o);
23457         calls->list_confirmed_utxos_meth = (*env)->GetMethodID(env, c, "list_confirmed_utxos", "()J");
23458         CHECK(calls->list_confirmed_utxos_meth != NULL);
23459         calls->get_change_script_meth = (*env)->GetMethodID(env, c, "get_change_script", "()J");
23460         CHECK(calls->get_change_script_meth != NULL);
23461         calls->sign_psbt_meth = (*env)->GetMethodID(env, c, "sign_psbt", "([B)J");
23462         CHECK(calls->sign_psbt_meth != NULL);
23463
23464         LDKWalletSource ret = {
23465                 .this_arg = (void*) calls,
23466                 .list_confirmed_utxos = list_confirmed_utxos_LDKWalletSource_jcall,
23467                 .get_change_script = get_change_script_LDKWalletSource_jcall,
23468                 .sign_psbt = sign_psbt_LDKWalletSource_jcall,
23469                 .free = LDKWalletSource_JCalls_free,
23470         };
23471         return ret;
23472 }
23473 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKWalletSource_1new(JNIEnv *env, jclass clz, jobject o) {
23474         LDKWalletSource *res_ptr = MALLOC(sizeof(LDKWalletSource), "LDKWalletSource");
23475         *res_ptr = LDKWalletSource_init(env, clz, o);
23476         return tag_ptr(res_ptr, true);
23477 }
23478 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WalletSource_1list_1confirmed_1utxos(JNIEnv *env, jclass clz, int64_t this_arg) {
23479         void* this_arg_ptr = untag_ptr(this_arg);
23480         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
23481         LDKWalletSource* this_arg_conv = (LDKWalletSource*)this_arg_ptr;
23482         LDKCResult_CVec_UtxoZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_UtxoZNoneZ), "LDKCResult_CVec_UtxoZNoneZ");
23483         *ret_conv = (this_arg_conv->list_confirmed_utxos)(this_arg_conv->this_arg);
23484         return tag_ptr(ret_conv, true);
23485 }
23486
23487 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WalletSource_1get_1change_1script(JNIEnv *env, jclass clz, int64_t this_arg) {
23488         void* this_arg_ptr = untag_ptr(this_arg);
23489         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
23490         LDKWalletSource* this_arg_conv = (LDKWalletSource*)this_arg_ptr;
23491         LDKCResult_CVec_u8ZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZNoneZ), "LDKCResult_CVec_u8ZNoneZ");
23492         *ret_conv = (this_arg_conv->get_change_script)(this_arg_conv->this_arg);
23493         return tag_ptr(ret_conv, true);
23494 }
23495
23496 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WalletSource_1sign_1psbt(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray psbt) {
23497         void* this_arg_ptr = untag_ptr(this_arg);
23498         if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); }
23499         LDKWalletSource* this_arg_conv = (LDKWalletSource*)this_arg_ptr;
23500         LDKCVec_u8Z psbt_ref;
23501         psbt_ref.datalen = (*env)->GetArrayLength(env, psbt);
23502         psbt_ref.data = MALLOC(psbt_ref.datalen, "LDKCVec_u8Z Bytes");
23503         (*env)->GetByteArrayRegion(env, psbt, 0, psbt_ref.datalen, psbt_ref.data);
23504         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
23505         *ret_conv = (this_arg_conv->sign_psbt)(this_arg_conv->this_arg, psbt_ref);
23506         return tag_ptr(ret_conv, true);
23507 }
23508
23509 static jclass LDKGossipSync_P2P_class = NULL;
23510 static jmethodID LDKGossipSync_P2P_meth = NULL;
23511 static jclass LDKGossipSync_Rapid_class = NULL;
23512 static jmethodID LDKGossipSync_Rapid_meth = NULL;
23513 static jclass LDKGossipSync_None_class = NULL;
23514 static jmethodID LDKGossipSync_None_meth = NULL;
23515 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKGossipSync_init (JNIEnv *env, jclass clz) {
23516         LDKGossipSync_P2P_class =
23517                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKGossipSync$P2P"));
23518         CHECK(LDKGossipSync_P2P_class != NULL);
23519         LDKGossipSync_P2P_meth = (*env)->GetMethodID(env, LDKGossipSync_P2P_class, "<init>", "(J)V");
23520         CHECK(LDKGossipSync_P2P_meth != NULL);
23521         LDKGossipSync_Rapid_class =
23522                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKGossipSync$Rapid"));
23523         CHECK(LDKGossipSync_Rapid_class != NULL);
23524         LDKGossipSync_Rapid_meth = (*env)->GetMethodID(env, LDKGossipSync_Rapid_class, "<init>", "(J)V");
23525         CHECK(LDKGossipSync_Rapid_meth != NULL);
23526         LDKGossipSync_None_class =
23527                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKGossipSync$None"));
23528         CHECK(LDKGossipSync_None_class != NULL);
23529         LDKGossipSync_None_meth = (*env)->GetMethodID(env, LDKGossipSync_None_class, "<init>", "()V");
23530         CHECK(LDKGossipSync_None_meth != NULL);
23531 }
23532 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKGossipSync_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
23533         LDKGossipSync *obj = (LDKGossipSync*)untag_ptr(ptr);
23534         switch(obj->tag) {
23535                 case LDKGossipSync_P2P: {
23536                         LDKP2PGossipSync p2p_var = obj->p2p;
23537                         int64_t p2p_ref = 0;
23538                         CHECK_INNER_FIELD_ACCESS_OR_NULL(p2p_var);
23539                         p2p_ref = tag_ptr(p2p_var.inner, false);
23540                         return (*env)->NewObject(env, LDKGossipSync_P2P_class, LDKGossipSync_P2P_meth, p2p_ref);
23541                 }
23542                 case LDKGossipSync_Rapid: {
23543                         LDKRapidGossipSync rapid_var = obj->rapid;
23544                         int64_t rapid_ref = 0;
23545                         CHECK_INNER_FIELD_ACCESS_OR_NULL(rapid_var);
23546                         rapid_ref = tag_ptr(rapid_var.inner, false);
23547                         return (*env)->NewObject(env, LDKGossipSync_Rapid_class, LDKGossipSync_Rapid_meth, rapid_ref);
23548                 }
23549                 case LDKGossipSync_None: {
23550                         return (*env)->NewObject(env, LDKGossipSync_None_class, LDKGossipSync_None_meth);
23551                 }
23552                 default: abort();
23553         }
23554 }
23555 static jclass LDKFallback_SegWitProgram_class = NULL;
23556 static jmethodID LDKFallback_SegWitProgram_meth = NULL;
23557 static jclass LDKFallback_PubKeyHash_class = NULL;
23558 static jmethodID LDKFallback_PubKeyHash_meth = NULL;
23559 static jclass LDKFallback_ScriptHash_class = NULL;
23560 static jmethodID LDKFallback_ScriptHash_meth = NULL;
23561 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKFallback_init (JNIEnv *env, jclass clz) {
23562         LDKFallback_SegWitProgram_class =
23563                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKFallback$SegWitProgram"));
23564         CHECK(LDKFallback_SegWitProgram_class != NULL);
23565         LDKFallback_SegWitProgram_meth = (*env)->GetMethodID(env, LDKFallback_SegWitProgram_class, "<init>", "(B[B)V");
23566         CHECK(LDKFallback_SegWitProgram_meth != NULL);
23567         LDKFallback_PubKeyHash_class =
23568                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKFallback$PubKeyHash"));
23569         CHECK(LDKFallback_PubKeyHash_class != NULL);
23570         LDKFallback_PubKeyHash_meth = (*env)->GetMethodID(env, LDKFallback_PubKeyHash_class, "<init>", "([B)V");
23571         CHECK(LDKFallback_PubKeyHash_meth != NULL);
23572         LDKFallback_ScriptHash_class =
23573                 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKFallback$ScriptHash"));
23574         CHECK(LDKFallback_ScriptHash_class != NULL);
23575         LDKFallback_ScriptHash_meth = (*env)->GetMethodID(env, LDKFallback_ScriptHash_class, "<init>", "([B)V");
23576         CHECK(LDKFallback_ScriptHash_meth != NULL);
23577 }
23578 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKFallback_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
23579         LDKFallback *obj = (LDKFallback*)untag_ptr(ptr);
23580         switch(obj->tag) {
23581                 case LDKFallback_SegWitProgram: {
23582                         uint8_t version_val = obj->seg_wit_program.version._0;
23583                         LDKCVec_u8Z program_var = obj->seg_wit_program.program;
23584                         int8_tArray program_arr = (*env)->NewByteArray(env, program_var.datalen);
23585                         (*env)->SetByteArrayRegion(env, program_arr, 0, program_var.datalen, program_var.data);
23586                         return (*env)->NewObject(env, LDKFallback_SegWitProgram_class, LDKFallback_SegWitProgram_meth, version_val, program_arr);
23587                 }
23588                 case LDKFallback_PubKeyHash: {
23589                         int8_tArray pub_key_hash_arr = (*env)->NewByteArray(env, 20);
23590                         (*env)->SetByteArrayRegion(env, pub_key_hash_arr, 0, 20, obj->pub_key_hash.data);
23591                         return (*env)->NewObject(env, LDKFallback_PubKeyHash_class, LDKFallback_PubKeyHash_meth, pub_key_hash_arr);
23592                 }
23593                 case LDKFallback_ScriptHash: {
23594                         int8_tArray script_hash_arr = (*env)->NewByteArray(env, 20);
23595                         (*env)->SetByteArrayRegion(env, script_hash_arr, 0, 20, obj->script_hash.data);
23596                         return (*env)->NewObject(env, LDKFallback_ScriptHash_class, LDKFallback_ScriptHash_meth, script_hash_arr);
23597                 }
23598                 default: abort();
23599         }
23600 }
23601 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings__1ldk_1get_1compiled_1version(JNIEnv *env, jclass clz) {
23602         LDKStr ret_str = _ldk_get_compiled_version();
23603         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
23604         Str_free(ret_str);
23605         return ret_conv;
23606 }
23607
23608 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings__1ldk_1c_1bindings_1get_1compiled_1version(JNIEnv *env, jclass clz) {
23609         LDKStr ret_str = _ldk_c_bindings_get_compiled_version();
23610         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
23611         Str_free(ret_str);
23612         return ret_conv;
23613 }
23614
23615 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_U128_1le_1bytes(JNIEnv *env, jclass clz, int8_tArray val) {
23616         LDKU128 val_ref;
23617         CHECK((*env)->GetArrayLength(env, val) == 16);
23618         (*env)->GetByteArrayRegion(env, val, 0, 16, val_ref.le_bytes);
23619         int8_tArray ret_arr = (*env)->NewByteArray(env, 16);
23620         (*env)->SetByteArrayRegion(env, ret_arr, 0, 16, U128_le_bytes(val_ref).data);
23621         return ret_arr;
23622 }
23623
23624 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_U128_1new(JNIEnv *env, jclass clz, int8_tArray le_bytes) {
23625         LDKSixteenBytes le_bytes_ref;
23626         CHECK((*env)->GetArrayLength(env, le_bytes) == 16);
23627         (*env)->GetByteArrayRegion(env, le_bytes, 0, 16, le_bytes_ref.data);
23628         int8_tArray ret_arr = (*env)->NewByteArray(env, 16);
23629         (*env)->SetByteArrayRegion(env, ret_arr, 0, 16, U128_new(le_bytes_ref).le_bytes);
23630         return ret_arr;
23631 }
23632
23633 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WitnessProgram_1new(JNIEnv *env, jclass clz, int8_t version, int8_tArray program) {
23634         
23635         LDKCVec_u8Z program_ref;
23636         program_ref.datalen = (*env)->GetArrayLength(env, program);
23637         program_ref.data = MALLOC(program_ref.datalen, "LDKCVec_u8Z Bytes");
23638         (*env)->GetByteArrayRegion(env, program, 0, program_ref.datalen, program_ref.data);
23639         LDKWitnessProgram* ret_ref = MALLOC(sizeof(LDKWitnessProgram), "LDKWitnessProgram");
23640         *ret_ref = WitnessProgram_new((LDKWitnessVersion){ ._0 = version }, program_ref);
23641         return tag_ptr(ret_ref, true);
23642 }
23643
23644 JNIEXPORT int8_t JNICALL Java_org_ldk_impl_bindings_WitnessProgram_1get_1version(JNIEnv *env, jclass clz, int64_t prog) {
23645         LDKWitnessProgram* prog_conv = (LDKWitnessProgram*)untag_ptr(prog);
23646         uint8_t ret_val = WitnessProgram_get_version(prog_conv)._0;
23647         return ret_val;
23648 }
23649
23650 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_WitnessProgram_1get_1program(JNIEnv *env, jclass clz, int64_t prog) {
23651         LDKWitnessProgram* prog_conv = (LDKWitnessProgram*)untag_ptr(prog);
23652         LDKu8slice ret_var = WitnessProgram_get_program(prog_conv);
23653         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
23654         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
23655         return ret_arr;
23656 }
23657
23658 static inline uint64_t WitnessProgram_clone_ptr(LDKWitnessProgram *NONNULL_PTR arg) {
23659         LDKWitnessProgram* ret_ref = MALLOC(sizeof(LDKWitnessProgram), "LDKWitnessProgram");
23660         *ret_ref = WitnessProgram_clone(arg);
23661         return tag_ptr(ret_ref, true);
23662 }
23663 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WitnessProgram_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23664         LDKWitnessProgram* arg_conv = (LDKWitnessProgram*)untag_ptr(arg);
23665         int64_t ret_conv = WitnessProgram_clone_ptr(arg_conv);
23666         return ret_conv;
23667 }
23668
23669 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WitnessProgram_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23670         LDKWitnessProgram* orig_conv = (LDKWitnessProgram*)untag_ptr(orig);
23671         LDKWitnessProgram* ret_ref = MALLOC(sizeof(LDKWitnessProgram), "LDKWitnessProgram");
23672         *ret_ref = WitnessProgram_clone(orig_conv);
23673         return tag_ptr(ret_ref, true);
23674 }
23675
23676 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WitnessProgram_1free(JNIEnv *env, jclass clz, int64_t o) {
23677         if (!ptr_is_owned(o)) return;
23678         void* o_ptr = untag_ptr(o);
23679         CHECK_ACCESS(o_ptr);
23680         LDKWitnessProgram o_conv = *(LDKWitnessProgram*)(o_ptr);
23681         FREE(untag_ptr(o));
23682         WitnessProgram_free(o_conv);
23683 }
23684
23685 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BigEndianScalar_1new(JNIEnv *env, jclass clz, int8_tArray big_endian_bytes) {
23686         LDKThirtyTwoBytes big_endian_bytes_ref;
23687         CHECK((*env)->GetArrayLength(env, big_endian_bytes) == 32);
23688         (*env)->GetByteArrayRegion(env, big_endian_bytes, 0, 32, big_endian_bytes_ref.data);
23689         LDKBigEndianScalar* ret_ref = MALLOC(sizeof(LDKBigEndianScalar), "LDKBigEndianScalar");
23690         *ret_ref = BigEndianScalar_new(big_endian_bytes_ref);
23691         return tag_ptr(ret_ref, true);
23692 }
23693
23694 static inline uint64_t BigEndianScalar_clone_ptr(LDKBigEndianScalar *NONNULL_PTR arg) {
23695         LDKBigEndianScalar* ret_ref = MALLOC(sizeof(LDKBigEndianScalar), "LDKBigEndianScalar");
23696         *ret_ref = BigEndianScalar_clone(arg);
23697         return tag_ptr(ret_ref, true);
23698 }
23699 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BigEndianScalar_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23700         LDKBigEndianScalar* arg_conv = (LDKBigEndianScalar*)untag_ptr(arg);
23701         int64_t ret_conv = BigEndianScalar_clone_ptr(arg_conv);
23702         return ret_conv;
23703 }
23704
23705 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BigEndianScalar_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23706         LDKBigEndianScalar* orig_conv = (LDKBigEndianScalar*)untag_ptr(orig);
23707         LDKBigEndianScalar* ret_ref = MALLOC(sizeof(LDKBigEndianScalar), "LDKBigEndianScalar");
23708         *ret_ref = BigEndianScalar_clone(orig_conv);
23709         return tag_ptr(ret_ref, true);
23710 }
23711
23712 static inline uint64_t Bech32Error_clone_ptr(LDKBech32Error *NONNULL_PTR arg) {
23713         LDKBech32Error *ret_copy = MALLOC(sizeof(LDKBech32Error), "LDKBech32Error");
23714         *ret_copy = Bech32Error_clone(arg);
23715         int64_t ret_ref = tag_ptr(ret_copy, true);
23716         return ret_ref;
23717 }
23718 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bech32Error_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23719         LDKBech32Error* arg_conv = (LDKBech32Error*)untag_ptr(arg);
23720         int64_t ret_conv = Bech32Error_clone_ptr(arg_conv);
23721         return ret_conv;
23722 }
23723
23724 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bech32Error_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23725         LDKBech32Error* orig_conv = (LDKBech32Error*)untag_ptr(orig);
23726         LDKBech32Error *ret_copy = MALLOC(sizeof(LDKBech32Error), "LDKBech32Error");
23727         *ret_copy = Bech32Error_clone(orig_conv);
23728         int64_t ret_ref = tag_ptr(ret_copy, true);
23729         return ret_ref;
23730 }
23731
23732 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Bech32Error_1free(JNIEnv *env, jclass clz, int64_t o) {
23733         if (!ptr_is_owned(o)) return;
23734         void* o_ptr = untag_ptr(o);
23735         CHECK_ACCESS(o_ptr);
23736         LDKBech32Error o_conv = *(LDKBech32Error*)(o_ptr);
23737         FREE(untag_ptr(o));
23738         Bech32Error_free(o_conv);
23739 }
23740
23741 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Transaction_1free(JNIEnv *env, jclass clz, int8_tArray _res) {
23742         LDKTransaction _res_ref;
23743         _res_ref.datalen = (*env)->GetArrayLength(env, _res);
23744         _res_ref.data = MALLOC(_res_ref.datalen, "LDKTransaction Bytes");
23745         (*env)->GetByteArrayRegion(env, _res, 0, _res_ref.datalen, _res_ref.data);
23746         _res_ref.data_is_owned = true;
23747         Transaction_free(_res_ref);
23748 }
23749
23750 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Witness_1free(JNIEnv *env, jclass clz, int8_tArray _res) {
23751         LDKWitness _res_ref;
23752         _res_ref.datalen = (*env)->GetArrayLength(env, _res);
23753         _res_ref.data = MALLOC(_res_ref.datalen, "LDKWitness Bytes");
23754         (*env)->GetByteArrayRegion(env, _res, 0, _res_ref.datalen, _res_ref.data);
23755         _res_ref.data_is_owned = true;
23756         Witness_free(_res_ref);
23757 }
23758
23759 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) {
23760         LDKWitness witness_ref;
23761         witness_ref.datalen = (*env)->GetArrayLength(env, witness);
23762         witness_ref.data = MALLOC(witness_ref.datalen, "LDKWitness Bytes");
23763         (*env)->GetByteArrayRegion(env, witness, 0, witness_ref.datalen, witness_ref.data);
23764         witness_ref.data_is_owned = true;
23765         LDKCVec_u8Z script_sig_ref;
23766         script_sig_ref.datalen = (*env)->GetArrayLength(env, script_sig);
23767         script_sig_ref.data = MALLOC(script_sig_ref.datalen, "LDKCVec_u8Z Bytes");
23768         (*env)->GetByteArrayRegion(env, script_sig, 0, script_sig_ref.datalen, script_sig_ref.data);
23769         LDKThirtyTwoBytes previous_txid_ref;
23770         CHECK((*env)->GetArrayLength(env, previous_txid) == 32);
23771         (*env)->GetByteArrayRegion(env, previous_txid, 0, 32, previous_txid_ref.data);
23772         LDKTxIn* ret_ref = MALLOC(sizeof(LDKTxIn), "LDKTxIn");
23773         *ret_ref = TxIn_new(witness_ref, script_sig_ref, sequence, previous_txid_ref, previous_vout);
23774         return tag_ptr(ret_ref, true);
23775 }
23776
23777 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxIn_1get_1witness(JNIEnv *env, jclass clz, int64_t txin) {
23778         LDKTxIn* txin_conv = (LDKTxIn*)untag_ptr(txin);
23779         LDKWitness ret_var = TxIn_get_witness(txin_conv);
23780         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
23781         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
23782         Witness_free(ret_var);
23783         return ret_arr;
23784 }
23785
23786 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxIn_1get_1script_1sig(JNIEnv *env, jclass clz, int64_t txin) {
23787         LDKTxIn* txin_conv = (LDKTxIn*)untag_ptr(txin);
23788         LDKu8slice ret_var = TxIn_get_script_sig(txin_conv);
23789         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
23790         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
23791         return ret_arr;
23792 }
23793
23794 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_TxIn_1get_1sequence(JNIEnv *env, jclass clz, int64_t txin) {
23795         LDKTxIn* txin_conv = (LDKTxIn*)untag_ptr(txin);
23796         int32_t ret_conv = TxIn_get_sequence(txin_conv);
23797         return ret_conv;
23798 }
23799
23800 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxIn_1get_1previous_1txid(JNIEnv *env, jclass clz, int64_t txin) {
23801         LDKTxIn* txin_conv = (LDKTxIn*)untag_ptr(txin);
23802         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
23803         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, TxIn_get_previous_txid(txin_conv).data);
23804         return ret_arr;
23805 }
23806
23807 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_TxIn_1get_1previous_1vout(JNIEnv *env, jclass clz, int64_t txin) {
23808         LDKTxIn* txin_conv = (LDKTxIn*)untag_ptr(txin);
23809         int32_t ret_conv = TxIn_get_previous_vout(txin_conv);
23810         return ret_conv;
23811 }
23812
23813 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxIn_1free(JNIEnv *env, jclass clz, int64_t _res) {
23814         if (!ptr_is_owned(_res)) return;
23815         void* _res_ptr = untag_ptr(_res);
23816         CHECK_ACCESS(_res_ptr);
23817         LDKTxIn _res_conv = *(LDKTxIn*)(_res_ptr);
23818         FREE(untag_ptr(_res));
23819         TxIn_free(_res_conv);
23820 }
23821
23822 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxOut_1new(JNIEnv *env, jclass clz, int8_tArray script_pubkey, int64_t value) {
23823         LDKCVec_u8Z script_pubkey_ref;
23824         script_pubkey_ref.datalen = (*env)->GetArrayLength(env, script_pubkey);
23825         script_pubkey_ref.data = MALLOC(script_pubkey_ref.datalen, "LDKCVec_u8Z Bytes");
23826         (*env)->GetByteArrayRegion(env, script_pubkey, 0, script_pubkey_ref.datalen, script_pubkey_ref.data);
23827         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
23828         *ret_ref = TxOut_new(script_pubkey_ref, value);
23829         return tag_ptr(ret_ref, true);
23830 }
23831
23832 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxOut_1get_1script_1pubkey(JNIEnv *env, jclass clz, int64_t txout) {
23833         LDKTxOut* txout_conv = (LDKTxOut*)untag_ptr(txout);
23834         LDKu8slice ret_var = TxOut_get_script_pubkey(txout_conv);
23835         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
23836         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
23837         return ret_arr;
23838 }
23839
23840 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxOut_1get_1value(JNIEnv *env, jclass clz, int64_t txout) {
23841         LDKTxOut* txout_conv = (LDKTxOut*)untag_ptr(txout);
23842         int64_t ret_conv = TxOut_get_value(txout_conv);
23843         return ret_conv;
23844 }
23845
23846 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxOut_1free(JNIEnv *env, jclass clz, int64_t _res) {
23847         if (!ptr_is_owned(_res)) return;
23848         void* _res_ptr = untag_ptr(_res);
23849         CHECK_ACCESS(_res_ptr);
23850         LDKTxOut _res_conv = *(LDKTxOut*)(_res_ptr);
23851         FREE(untag_ptr(_res));
23852         TxOut_free(_res_conv);
23853 }
23854
23855 static inline uint64_t TxOut_clone_ptr(LDKTxOut *NONNULL_PTR arg) {
23856         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
23857         *ret_ref = TxOut_clone(arg);
23858         return tag_ptr(ret_ref, true);
23859 }
23860 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxOut_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23861         LDKTxOut* arg_conv = (LDKTxOut*)untag_ptr(arg);
23862         int64_t ret_conv = TxOut_clone_ptr(arg_conv);
23863         return ret_conv;
23864 }
23865
23866 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxOut_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23867         LDKTxOut* orig_conv = (LDKTxOut*)untag_ptr(orig);
23868         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
23869         *ret_ref = TxOut_clone(orig_conv);
23870         return tag_ptr(ret_ref, true);
23871 }
23872
23873 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Str_1free(JNIEnv *env, jclass clz, jstring _res) {
23874         LDKStr dummy = { .chars = NULL, .len = 0, .chars_is_owned = false };
23875         Str_free(dummy);
23876 }
23877
23878 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1u8Z_1free(JNIEnv *env, jclass clz, int8_tArray _res) {
23879         LDKCVec_u8Z _res_ref;
23880         _res_ref.datalen = (*env)->GetArrayLength(env, _res);
23881         _res_ref.data = MALLOC(_res_ref.datalen, "LDKCVec_u8Z Bytes");
23882         (*env)->GetByteArrayRegion(env, _res, 0, _res_ref.datalen, _res_ref.data);
23883         CVec_u8Z_free(_res_ref);
23884 }
23885
23886 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
23887         LDKRefundMaybeWithDerivedMetadataBuilder o_conv;
23888         o_conv.inner = untag_ptr(o);
23889         o_conv.is_owned = ptr_is_owned(o);
23890         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23891         o_conv = RefundMaybeWithDerivedMetadataBuilder_clone(&o_conv);
23892         LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ), "LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ");
23893         *ret_conv = CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ_ok(o_conv);
23894         return tag_ptr(ret_conv, true);
23895 }
23896
23897 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
23898         LDKBolt12SemanticError e_conv = LDKBolt12SemanticError_from_java(env, e);
23899         LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ), "LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ");
23900         *ret_conv = CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ_err(e_conv);
23901         return tag_ptr(ret_conv, true);
23902 }
23903
23904 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
23905         LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ* o_conv = (LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ*)untag_ptr(o);
23906         jboolean ret_conv = CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ_is_ok(o_conv);
23907         return ret_conv;
23908 }
23909
23910 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
23911         if (!ptr_is_owned(_res)) return;
23912         void* _res_ptr = untag_ptr(_res);
23913         CHECK_ACCESS(_res_ptr);
23914         LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ _res_conv = *(LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ*)(_res_ptr);
23915         FREE(untag_ptr(_res));
23916         CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ_free(_res_conv);
23917 }
23918
23919 static inline uint64_t CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ_clone_ptr(LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ *NONNULL_PTR arg) {
23920         LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ), "LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ");
23921         *ret_conv = CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ_clone(arg);
23922         return tag_ptr(ret_conv, true);
23923 }
23924 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23925         LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ* arg_conv = (LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ*)untag_ptr(arg);
23926         int64_t ret_conv = CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ_clone_ptr(arg_conv);
23927         return ret_conv;
23928 }
23929
23930 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23931         LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ* orig_conv = (LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ*)untag_ptr(orig);
23932         LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ), "LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ");
23933         *ret_conv = CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ_clone(orig_conv);
23934         return tag_ptr(ret_conv, true);
23935 }
23936
23937 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RefundBolt12SemanticErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
23938         LDKRefund o_conv;
23939         o_conv.inner = untag_ptr(o);
23940         o_conv.is_owned = ptr_is_owned(o);
23941         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
23942         o_conv = Refund_clone(&o_conv);
23943         LDKCResult_RefundBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RefundBolt12SemanticErrorZ), "LDKCResult_RefundBolt12SemanticErrorZ");
23944         *ret_conv = CResult_RefundBolt12SemanticErrorZ_ok(o_conv);
23945         return tag_ptr(ret_conv, true);
23946 }
23947
23948 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RefundBolt12SemanticErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
23949         LDKBolt12SemanticError e_conv = LDKBolt12SemanticError_from_java(env, e);
23950         LDKCResult_RefundBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RefundBolt12SemanticErrorZ), "LDKCResult_RefundBolt12SemanticErrorZ");
23951         *ret_conv = CResult_RefundBolt12SemanticErrorZ_err(e_conv);
23952         return tag_ptr(ret_conv, true);
23953 }
23954
23955 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RefundBolt12SemanticErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
23956         LDKCResult_RefundBolt12SemanticErrorZ* o_conv = (LDKCResult_RefundBolt12SemanticErrorZ*)untag_ptr(o);
23957         jboolean ret_conv = CResult_RefundBolt12SemanticErrorZ_is_ok(o_conv);
23958         return ret_conv;
23959 }
23960
23961 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RefundBolt12SemanticErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
23962         if (!ptr_is_owned(_res)) return;
23963         void* _res_ptr = untag_ptr(_res);
23964         CHECK_ACCESS(_res_ptr);
23965         LDKCResult_RefundBolt12SemanticErrorZ _res_conv = *(LDKCResult_RefundBolt12SemanticErrorZ*)(_res_ptr);
23966         FREE(untag_ptr(_res));
23967         CResult_RefundBolt12SemanticErrorZ_free(_res_conv);
23968 }
23969
23970 static inline uint64_t CResult_RefundBolt12SemanticErrorZ_clone_ptr(LDKCResult_RefundBolt12SemanticErrorZ *NONNULL_PTR arg) {
23971         LDKCResult_RefundBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RefundBolt12SemanticErrorZ), "LDKCResult_RefundBolt12SemanticErrorZ");
23972         *ret_conv = CResult_RefundBolt12SemanticErrorZ_clone(arg);
23973         return tag_ptr(ret_conv, true);
23974 }
23975 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RefundBolt12SemanticErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
23976         LDKCResult_RefundBolt12SemanticErrorZ* arg_conv = (LDKCResult_RefundBolt12SemanticErrorZ*)untag_ptr(arg);
23977         int64_t ret_conv = CResult_RefundBolt12SemanticErrorZ_clone_ptr(arg_conv);
23978         return ret_conv;
23979 }
23980
23981 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RefundBolt12SemanticErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23982         LDKCResult_RefundBolt12SemanticErrorZ* orig_conv = (LDKCResult_RefundBolt12SemanticErrorZ*)untag_ptr(orig);
23983         LDKCResult_RefundBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RefundBolt12SemanticErrorZ), "LDKCResult_RefundBolt12SemanticErrorZ");
23984         *ret_conv = CResult_RefundBolt12SemanticErrorZ_clone(orig_conv);
23985         return tag_ptr(ret_conv, true);
23986 }
23987
23988 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u64Z_1some(JNIEnv *env, jclass clz, int64_t o) {
23989         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
23990         *ret_copy = COption_u64Z_some(o);
23991         int64_t ret_ref = tag_ptr(ret_copy, true);
23992         return ret_ref;
23993 }
23994
23995 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u64Z_1none(JNIEnv *env, jclass clz) {
23996         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
23997         *ret_copy = COption_u64Z_none();
23998         int64_t ret_ref = tag_ptr(ret_copy, true);
23999         return ret_ref;
24000 }
24001
24002 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1u64Z_1free(JNIEnv *env, jclass clz, int64_t _res) {
24003         if (!ptr_is_owned(_res)) return;
24004         void* _res_ptr = untag_ptr(_res);
24005         CHECK_ACCESS(_res_ptr);
24006         LDKCOption_u64Z _res_conv = *(LDKCOption_u64Z*)(_res_ptr);
24007         FREE(untag_ptr(_res));
24008         COption_u64Z_free(_res_conv);
24009 }
24010
24011 static inline uint64_t COption_u64Z_clone_ptr(LDKCOption_u64Z *NONNULL_PTR arg) {
24012         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
24013         *ret_copy = COption_u64Z_clone(arg);
24014         int64_t ret_ref = tag_ptr(ret_copy, true);
24015         return ret_ref;
24016 }
24017 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u64Z_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24018         LDKCOption_u64Z* arg_conv = (LDKCOption_u64Z*)untag_ptr(arg);
24019         int64_t ret_conv = COption_u64Z_clone_ptr(arg_conv);
24020         return ret_conv;
24021 }
24022
24023 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u64Z_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24024         LDKCOption_u64Z* orig_conv = (LDKCOption_u64Z*)untag_ptr(orig);
24025         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
24026         *ret_copy = COption_u64Z_clone(orig_conv);
24027         int64_t ret_ref = tag_ptr(ret_copy, true);
24028         return ret_ref;
24029 }
24030
24031 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1BlindedPathZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
24032         LDKCVec_BlindedPathZ _res_constr;
24033         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
24034         if (_res_constr.datalen > 0)
24035                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKBlindedPath), "LDKCVec_BlindedPathZ Elements");
24036         else
24037                 _res_constr.data = NULL;
24038         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
24039         for (size_t n = 0; n < _res_constr.datalen; n++) {
24040                 int64_t _res_conv_13 = _res_vals[n];
24041                 LDKBlindedPath _res_conv_13_conv;
24042                 _res_conv_13_conv.inner = untag_ptr(_res_conv_13);
24043                 _res_conv_13_conv.is_owned = ptr_is_owned(_res_conv_13);
24044                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_13_conv);
24045                 _res_constr.data[n] = _res_conv_13_conv;
24046         }
24047         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
24048         CVec_BlindedPathZ_free(_res_constr);
24049 }
24050
24051 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RefundBolt12ParseErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
24052         LDKRefund o_conv;
24053         o_conv.inner = untag_ptr(o);
24054         o_conv.is_owned = ptr_is_owned(o);
24055         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24056         o_conv = Refund_clone(&o_conv);
24057         LDKCResult_RefundBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RefundBolt12ParseErrorZ), "LDKCResult_RefundBolt12ParseErrorZ");
24058         *ret_conv = CResult_RefundBolt12ParseErrorZ_ok(o_conv);
24059         return tag_ptr(ret_conv, true);
24060 }
24061
24062 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RefundBolt12ParseErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
24063         LDKBolt12ParseError e_conv;
24064         e_conv.inner = untag_ptr(e);
24065         e_conv.is_owned = ptr_is_owned(e);
24066         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
24067         e_conv = Bolt12ParseError_clone(&e_conv);
24068         LDKCResult_RefundBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RefundBolt12ParseErrorZ), "LDKCResult_RefundBolt12ParseErrorZ");
24069         *ret_conv = CResult_RefundBolt12ParseErrorZ_err(e_conv);
24070         return tag_ptr(ret_conv, true);
24071 }
24072
24073 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RefundBolt12ParseErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
24074         LDKCResult_RefundBolt12ParseErrorZ* o_conv = (LDKCResult_RefundBolt12ParseErrorZ*)untag_ptr(o);
24075         jboolean ret_conv = CResult_RefundBolt12ParseErrorZ_is_ok(o_conv);
24076         return ret_conv;
24077 }
24078
24079 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RefundBolt12ParseErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
24080         if (!ptr_is_owned(_res)) return;
24081         void* _res_ptr = untag_ptr(_res);
24082         CHECK_ACCESS(_res_ptr);
24083         LDKCResult_RefundBolt12ParseErrorZ _res_conv = *(LDKCResult_RefundBolt12ParseErrorZ*)(_res_ptr);
24084         FREE(untag_ptr(_res));
24085         CResult_RefundBolt12ParseErrorZ_free(_res_conv);
24086 }
24087
24088 static inline uint64_t CResult_RefundBolt12ParseErrorZ_clone_ptr(LDKCResult_RefundBolt12ParseErrorZ *NONNULL_PTR arg) {
24089         LDKCResult_RefundBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RefundBolt12ParseErrorZ), "LDKCResult_RefundBolt12ParseErrorZ");
24090         *ret_conv = CResult_RefundBolt12ParseErrorZ_clone(arg);
24091         return tag_ptr(ret_conv, true);
24092 }
24093 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RefundBolt12ParseErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24094         LDKCResult_RefundBolt12ParseErrorZ* arg_conv = (LDKCResult_RefundBolt12ParseErrorZ*)untag_ptr(arg);
24095         int64_t ret_conv = CResult_RefundBolt12ParseErrorZ_clone_ptr(arg_conv);
24096         return ret_conv;
24097 }
24098
24099 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RefundBolt12ParseErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24100         LDKCResult_RefundBolt12ParseErrorZ* orig_conv = (LDKCResult_RefundBolt12ParseErrorZ*)untag_ptr(orig);
24101         LDKCResult_RefundBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RefundBolt12ParseErrorZ), "LDKCResult_RefundBolt12ParseErrorZ");
24102         *ret_conv = CResult_RefundBolt12ParseErrorZ_clone(orig_conv);
24103         return tag_ptr(ret_conv, true);
24104 }
24105
24106 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RetryDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
24107         void* o_ptr = untag_ptr(o);
24108         CHECK_ACCESS(o_ptr);
24109         LDKRetry o_conv = *(LDKRetry*)(o_ptr);
24110         o_conv = Retry_clone((LDKRetry*)untag_ptr(o));
24111         LDKCResult_RetryDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RetryDecodeErrorZ), "LDKCResult_RetryDecodeErrorZ");
24112         *ret_conv = CResult_RetryDecodeErrorZ_ok(o_conv);
24113         return tag_ptr(ret_conv, true);
24114 }
24115
24116 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RetryDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
24117         void* e_ptr = untag_ptr(e);
24118         CHECK_ACCESS(e_ptr);
24119         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
24120         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
24121         LDKCResult_RetryDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RetryDecodeErrorZ), "LDKCResult_RetryDecodeErrorZ");
24122         *ret_conv = CResult_RetryDecodeErrorZ_err(e_conv);
24123         return tag_ptr(ret_conv, true);
24124 }
24125
24126 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RetryDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
24127         LDKCResult_RetryDecodeErrorZ* o_conv = (LDKCResult_RetryDecodeErrorZ*)untag_ptr(o);
24128         jboolean ret_conv = CResult_RetryDecodeErrorZ_is_ok(o_conv);
24129         return ret_conv;
24130 }
24131
24132 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RetryDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
24133         if (!ptr_is_owned(_res)) return;
24134         void* _res_ptr = untag_ptr(_res);
24135         CHECK_ACCESS(_res_ptr);
24136         LDKCResult_RetryDecodeErrorZ _res_conv = *(LDKCResult_RetryDecodeErrorZ*)(_res_ptr);
24137         FREE(untag_ptr(_res));
24138         CResult_RetryDecodeErrorZ_free(_res_conv);
24139 }
24140
24141 static inline uint64_t CResult_RetryDecodeErrorZ_clone_ptr(LDKCResult_RetryDecodeErrorZ *NONNULL_PTR arg) {
24142         LDKCResult_RetryDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RetryDecodeErrorZ), "LDKCResult_RetryDecodeErrorZ");
24143         *ret_conv = CResult_RetryDecodeErrorZ_clone(arg);
24144         return tag_ptr(ret_conv, true);
24145 }
24146 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RetryDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24147         LDKCResult_RetryDecodeErrorZ* arg_conv = (LDKCResult_RetryDecodeErrorZ*)untag_ptr(arg);
24148         int64_t ret_conv = CResult_RetryDecodeErrorZ_clone_ptr(arg_conv);
24149         return ret_conv;
24150 }
24151
24152 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RetryDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24153         LDKCResult_RetryDecodeErrorZ* orig_conv = (LDKCResult_RetryDecodeErrorZ*)untag_ptr(orig);
24154         LDKCResult_RetryDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RetryDecodeErrorZ), "LDKCResult_RetryDecodeErrorZ");
24155         *ret_conv = CResult_RetryDecodeErrorZ_clone(orig_conv);
24156         return tag_ptr(ret_conv, true);
24157 }
24158
24159 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1ok(JNIEnv *env, jclass clz) {
24160         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
24161         *ret_conv = CResult_NoneAPIErrorZ_ok();
24162         return tag_ptr(ret_conv, true);
24163 }
24164
24165 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
24166         void* e_ptr = untag_ptr(e);
24167         CHECK_ACCESS(e_ptr);
24168         LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
24169         e_conv = APIError_clone((LDKAPIError*)untag_ptr(e));
24170         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
24171         *ret_conv = CResult_NoneAPIErrorZ_err(e_conv);
24172         return tag_ptr(ret_conv, true);
24173 }
24174
24175 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
24176         LDKCResult_NoneAPIErrorZ* o_conv = (LDKCResult_NoneAPIErrorZ*)untag_ptr(o);
24177         jboolean ret_conv = CResult_NoneAPIErrorZ_is_ok(o_conv);
24178         return ret_conv;
24179 }
24180
24181 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
24182         if (!ptr_is_owned(_res)) return;
24183         void* _res_ptr = untag_ptr(_res);
24184         CHECK_ACCESS(_res_ptr);
24185         LDKCResult_NoneAPIErrorZ _res_conv = *(LDKCResult_NoneAPIErrorZ*)(_res_ptr);
24186         FREE(untag_ptr(_res));
24187         CResult_NoneAPIErrorZ_free(_res_conv);
24188 }
24189
24190 static inline uint64_t CResult_NoneAPIErrorZ_clone_ptr(LDKCResult_NoneAPIErrorZ *NONNULL_PTR arg) {
24191         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
24192         *ret_conv = CResult_NoneAPIErrorZ_clone(arg);
24193         return tag_ptr(ret_conv, true);
24194 }
24195 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24196         LDKCResult_NoneAPIErrorZ* arg_conv = (LDKCResult_NoneAPIErrorZ*)untag_ptr(arg);
24197         int64_t ret_conv = CResult_NoneAPIErrorZ_clone_ptr(arg_conv);
24198         return ret_conv;
24199 }
24200
24201 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24202         LDKCResult_NoneAPIErrorZ* orig_conv = (LDKCResult_NoneAPIErrorZ*)untag_ptr(orig);
24203         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
24204         *ret_conv = CResult_NoneAPIErrorZ_clone(orig_conv);
24205         return tag_ptr(ret_conv, true);
24206 }
24207
24208 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1CResult_1NoneAPIErrorZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
24209         LDKCVec_CResult_NoneAPIErrorZZ _res_constr;
24210         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
24211         if (_res_constr.datalen > 0)
24212                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
24213         else
24214                 _res_constr.data = NULL;
24215         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
24216         for (size_t w = 0; w < _res_constr.datalen; w++) {
24217                 int64_t _res_conv_22 = _res_vals[w];
24218                 void* _res_conv_22_ptr = untag_ptr(_res_conv_22);
24219                 CHECK_ACCESS(_res_conv_22_ptr);
24220                 LDKCResult_NoneAPIErrorZ _res_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(_res_conv_22_ptr);
24221                 FREE(untag_ptr(_res_conv_22));
24222                 _res_constr.data[w] = _res_conv_22_conv;
24223         }
24224         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
24225         CVec_CResult_NoneAPIErrorZZ_free(_res_constr);
24226 }
24227
24228 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1APIErrorZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
24229         LDKCVec_APIErrorZ _res_constr;
24230         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
24231         if (_res_constr.datalen > 0)
24232                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKAPIError), "LDKCVec_APIErrorZ Elements");
24233         else
24234                 _res_constr.data = NULL;
24235         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
24236         for (size_t k = 0; k < _res_constr.datalen; k++) {
24237                 int64_t _res_conv_10 = _res_vals[k];
24238                 void* _res_conv_10_ptr = untag_ptr(_res_conv_10);
24239                 CHECK_ACCESS(_res_conv_10_ptr);
24240                 LDKAPIError _res_conv_10_conv = *(LDKAPIError*)(_res_conv_10_ptr);
24241                 FREE(untag_ptr(_res_conv_10));
24242                 _res_constr.data[k] = _res_conv_10_conv;
24243         }
24244         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
24245         CVec_APIErrorZ_free(_res_constr);
24246 }
24247
24248 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1ThirtyTwoBytesZ_1some(JNIEnv *env, jclass clz, int8_tArray o) {
24249         LDKThirtyTwoBytes o_ref;
24250         CHECK((*env)->GetArrayLength(env, o) == 32);
24251         (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.data);
24252         LDKCOption_ThirtyTwoBytesZ *ret_copy = MALLOC(sizeof(LDKCOption_ThirtyTwoBytesZ), "LDKCOption_ThirtyTwoBytesZ");
24253         *ret_copy = COption_ThirtyTwoBytesZ_some(o_ref);
24254         int64_t ret_ref = tag_ptr(ret_copy, true);
24255         return ret_ref;
24256 }
24257
24258 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1ThirtyTwoBytesZ_1none(JNIEnv *env, jclass clz) {
24259         LDKCOption_ThirtyTwoBytesZ *ret_copy = MALLOC(sizeof(LDKCOption_ThirtyTwoBytesZ), "LDKCOption_ThirtyTwoBytesZ");
24260         *ret_copy = COption_ThirtyTwoBytesZ_none();
24261         int64_t ret_ref = tag_ptr(ret_copy, true);
24262         return ret_ref;
24263 }
24264
24265 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1ThirtyTwoBytesZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
24266         if (!ptr_is_owned(_res)) return;
24267         void* _res_ptr = untag_ptr(_res);
24268         CHECK_ACCESS(_res_ptr);
24269         LDKCOption_ThirtyTwoBytesZ _res_conv = *(LDKCOption_ThirtyTwoBytesZ*)(_res_ptr);
24270         FREE(untag_ptr(_res));
24271         COption_ThirtyTwoBytesZ_free(_res_conv);
24272 }
24273
24274 static inline uint64_t COption_ThirtyTwoBytesZ_clone_ptr(LDKCOption_ThirtyTwoBytesZ *NONNULL_PTR arg) {
24275         LDKCOption_ThirtyTwoBytesZ *ret_copy = MALLOC(sizeof(LDKCOption_ThirtyTwoBytesZ), "LDKCOption_ThirtyTwoBytesZ");
24276         *ret_copy = COption_ThirtyTwoBytesZ_clone(arg);
24277         int64_t ret_ref = tag_ptr(ret_copy, true);
24278         return ret_ref;
24279 }
24280 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1ThirtyTwoBytesZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24281         LDKCOption_ThirtyTwoBytesZ* arg_conv = (LDKCOption_ThirtyTwoBytesZ*)untag_ptr(arg);
24282         int64_t ret_conv = COption_ThirtyTwoBytesZ_clone_ptr(arg_conv);
24283         return ret_conv;
24284 }
24285
24286 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1ThirtyTwoBytesZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24287         LDKCOption_ThirtyTwoBytesZ* orig_conv = (LDKCOption_ThirtyTwoBytesZ*)untag_ptr(orig);
24288         LDKCOption_ThirtyTwoBytesZ *ret_copy = MALLOC(sizeof(LDKCOption_ThirtyTwoBytesZ), "LDKCOption_ThirtyTwoBytesZ");
24289         *ret_copy = COption_ThirtyTwoBytesZ_clone(orig_conv);
24290         int64_t ret_ref = tag_ptr(ret_copy, true);
24291         return ret_ref;
24292 }
24293
24294 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1u8ZZ_1some(JNIEnv *env, jclass clz, int8_tArray o) {
24295         LDKCVec_u8Z o_ref;
24296         o_ref.datalen = (*env)->GetArrayLength(env, o);
24297         o_ref.data = MALLOC(o_ref.datalen, "LDKCVec_u8Z Bytes");
24298         (*env)->GetByteArrayRegion(env, o, 0, o_ref.datalen, o_ref.data);
24299         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
24300         *ret_copy = COption_CVec_u8ZZ_some(o_ref);
24301         int64_t ret_ref = tag_ptr(ret_copy, true);
24302         return ret_ref;
24303 }
24304
24305 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1u8ZZ_1none(JNIEnv *env, jclass clz) {
24306         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
24307         *ret_copy = COption_CVec_u8ZZ_none();
24308         int64_t ret_ref = tag_ptr(ret_copy, true);
24309         return ret_ref;
24310 }
24311
24312 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1u8ZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
24313         if (!ptr_is_owned(_res)) return;
24314         void* _res_ptr = untag_ptr(_res);
24315         CHECK_ACCESS(_res_ptr);
24316         LDKCOption_CVec_u8ZZ _res_conv = *(LDKCOption_CVec_u8ZZ*)(_res_ptr);
24317         FREE(untag_ptr(_res));
24318         COption_CVec_u8ZZ_free(_res_conv);
24319 }
24320
24321 static inline uint64_t COption_CVec_u8ZZ_clone_ptr(LDKCOption_CVec_u8ZZ *NONNULL_PTR arg) {
24322         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
24323         *ret_copy = COption_CVec_u8ZZ_clone(arg);
24324         int64_t ret_ref = tag_ptr(ret_copy, true);
24325         return ret_ref;
24326 }
24327 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1u8ZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24328         LDKCOption_CVec_u8ZZ* arg_conv = (LDKCOption_CVec_u8ZZ*)untag_ptr(arg);
24329         int64_t ret_conv = COption_CVec_u8ZZ_clone_ptr(arg_conv);
24330         return ret_conv;
24331 }
24332
24333 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1u8ZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24334         LDKCOption_CVec_u8ZZ* orig_conv = (LDKCOption_CVec_u8ZZ*)untag_ptr(orig);
24335         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
24336         *ret_copy = COption_CVec_u8ZZ_clone(orig_conv);
24337         int64_t ret_ref = tag_ptr(ret_copy, true);
24338         return ret_ref;
24339 }
24340
24341 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecipientOnionFieldsDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
24342         LDKRecipientOnionFields o_conv;
24343         o_conv.inner = untag_ptr(o);
24344         o_conv.is_owned = ptr_is_owned(o);
24345         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24346         o_conv = RecipientOnionFields_clone(&o_conv);
24347         LDKCResult_RecipientOnionFieldsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RecipientOnionFieldsDecodeErrorZ), "LDKCResult_RecipientOnionFieldsDecodeErrorZ");
24348         *ret_conv = CResult_RecipientOnionFieldsDecodeErrorZ_ok(o_conv);
24349         return tag_ptr(ret_conv, true);
24350 }
24351
24352 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecipientOnionFieldsDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
24353         void* e_ptr = untag_ptr(e);
24354         CHECK_ACCESS(e_ptr);
24355         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
24356         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
24357         LDKCResult_RecipientOnionFieldsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RecipientOnionFieldsDecodeErrorZ), "LDKCResult_RecipientOnionFieldsDecodeErrorZ");
24358         *ret_conv = CResult_RecipientOnionFieldsDecodeErrorZ_err(e_conv);
24359         return tag_ptr(ret_conv, true);
24360 }
24361
24362 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RecipientOnionFieldsDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
24363         LDKCResult_RecipientOnionFieldsDecodeErrorZ* o_conv = (LDKCResult_RecipientOnionFieldsDecodeErrorZ*)untag_ptr(o);
24364         jboolean ret_conv = CResult_RecipientOnionFieldsDecodeErrorZ_is_ok(o_conv);
24365         return ret_conv;
24366 }
24367
24368 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RecipientOnionFieldsDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
24369         if (!ptr_is_owned(_res)) return;
24370         void* _res_ptr = untag_ptr(_res);
24371         CHECK_ACCESS(_res_ptr);
24372         LDKCResult_RecipientOnionFieldsDecodeErrorZ _res_conv = *(LDKCResult_RecipientOnionFieldsDecodeErrorZ*)(_res_ptr);
24373         FREE(untag_ptr(_res));
24374         CResult_RecipientOnionFieldsDecodeErrorZ_free(_res_conv);
24375 }
24376
24377 static inline uint64_t CResult_RecipientOnionFieldsDecodeErrorZ_clone_ptr(LDKCResult_RecipientOnionFieldsDecodeErrorZ *NONNULL_PTR arg) {
24378         LDKCResult_RecipientOnionFieldsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RecipientOnionFieldsDecodeErrorZ), "LDKCResult_RecipientOnionFieldsDecodeErrorZ");
24379         *ret_conv = CResult_RecipientOnionFieldsDecodeErrorZ_clone(arg);
24380         return tag_ptr(ret_conv, true);
24381 }
24382 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecipientOnionFieldsDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24383         LDKCResult_RecipientOnionFieldsDecodeErrorZ* arg_conv = (LDKCResult_RecipientOnionFieldsDecodeErrorZ*)untag_ptr(arg);
24384         int64_t ret_conv = CResult_RecipientOnionFieldsDecodeErrorZ_clone_ptr(arg_conv);
24385         return ret_conv;
24386 }
24387
24388 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecipientOnionFieldsDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24389         LDKCResult_RecipientOnionFieldsDecodeErrorZ* orig_conv = (LDKCResult_RecipientOnionFieldsDecodeErrorZ*)untag_ptr(orig);
24390         LDKCResult_RecipientOnionFieldsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RecipientOnionFieldsDecodeErrorZ), "LDKCResult_RecipientOnionFieldsDecodeErrorZ");
24391         *ret_conv = CResult_RecipientOnionFieldsDecodeErrorZ_clone(orig_conv);
24392         return tag_ptr(ret_conv, true);
24393 }
24394
24395 static inline uint64_t C2Tuple_u64CVec_u8ZZ_clone_ptr(LDKC2Tuple_u64CVec_u8ZZ *NONNULL_PTR arg) {
24396         LDKC2Tuple_u64CVec_u8ZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64CVec_u8ZZ), "LDKC2Tuple_u64CVec_u8ZZ");
24397         *ret_conv = C2Tuple_u64CVec_u8ZZ_clone(arg);
24398         return tag_ptr(ret_conv, true);
24399 }
24400 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64CVec_1u8ZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24401         LDKC2Tuple_u64CVec_u8ZZ* arg_conv = (LDKC2Tuple_u64CVec_u8ZZ*)untag_ptr(arg);
24402         int64_t ret_conv = C2Tuple_u64CVec_u8ZZ_clone_ptr(arg_conv);
24403         return ret_conv;
24404 }
24405
24406 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64CVec_1u8ZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24407         LDKC2Tuple_u64CVec_u8ZZ* orig_conv = (LDKC2Tuple_u64CVec_u8ZZ*)untag_ptr(orig);
24408         LDKC2Tuple_u64CVec_u8ZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64CVec_u8ZZ), "LDKC2Tuple_u64CVec_u8ZZ");
24409         *ret_conv = C2Tuple_u64CVec_u8ZZ_clone(orig_conv);
24410         return tag_ptr(ret_conv, true);
24411 }
24412
24413 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64CVec_1u8ZZ_1new(JNIEnv *env, jclass clz, int64_t a, int8_tArray b) {
24414         LDKCVec_u8Z b_ref;
24415         b_ref.datalen = (*env)->GetArrayLength(env, b);
24416         b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
24417         (*env)->GetByteArrayRegion(env, b, 0, b_ref.datalen, b_ref.data);
24418         LDKC2Tuple_u64CVec_u8ZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64CVec_u8ZZ), "LDKC2Tuple_u64CVec_u8ZZ");
24419         *ret_conv = C2Tuple_u64CVec_u8ZZ_new(a, b_ref);
24420         return tag_ptr(ret_conv, true);
24421 }
24422
24423 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64CVec_1u8ZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
24424         if (!ptr_is_owned(_res)) return;
24425         void* _res_ptr = untag_ptr(_res);
24426         CHECK_ACCESS(_res_ptr);
24427         LDKC2Tuple_u64CVec_u8ZZ _res_conv = *(LDKC2Tuple_u64CVec_u8ZZ*)(_res_ptr);
24428         FREE(untag_ptr(_res));
24429         C2Tuple_u64CVec_u8ZZ_free(_res_conv);
24430 }
24431
24432 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1u64CVec_1u8ZZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
24433         LDKCVec_C2Tuple_u64CVec_u8ZZZ _res_constr;
24434         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
24435         if (_res_constr.datalen > 0)
24436                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_u64CVec_u8ZZ), "LDKCVec_C2Tuple_u64CVec_u8ZZZ Elements");
24437         else
24438                 _res_constr.data = NULL;
24439         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
24440         for (size_t x = 0; x < _res_constr.datalen; x++) {
24441                 int64_t _res_conv_23 = _res_vals[x];
24442                 void* _res_conv_23_ptr = untag_ptr(_res_conv_23);
24443                 CHECK_ACCESS(_res_conv_23_ptr);
24444                 LDKC2Tuple_u64CVec_u8ZZ _res_conv_23_conv = *(LDKC2Tuple_u64CVec_u8ZZ*)(_res_conv_23_ptr);
24445                 FREE(untag_ptr(_res_conv_23));
24446                 _res_constr.data[x] = _res_conv_23_conv;
24447         }
24448         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
24449         CVec_C2Tuple_u64CVec_u8ZZZ_free(_res_constr);
24450 }
24451
24452 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecipientOnionFieldsNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
24453         LDKRecipientOnionFields o_conv;
24454         o_conv.inner = untag_ptr(o);
24455         o_conv.is_owned = ptr_is_owned(o);
24456         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24457         o_conv = RecipientOnionFields_clone(&o_conv);
24458         LDKCResult_RecipientOnionFieldsNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecipientOnionFieldsNoneZ), "LDKCResult_RecipientOnionFieldsNoneZ");
24459         *ret_conv = CResult_RecipientOnionFieldsNoneZ_ok(o_conv);
24460         return tag_ptr(ret_conv, true);
24461 }
24462
24463 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecipientOnionFieldsNoneZ_1err(JNIEnv *env, jclass clz) {
24464         LDKCResult_RecipientOnionFieldsNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecipientOnionFieldsNoneZ), "LDKCResult_RecipientOnionFieldsNoneZ");
24465         *ret_conv = CResult_RecipientOnionFieldsNoneZ_err();
24466         return tag_ptr(ret_conv, true);
24467 }
24468
24469 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RecipientOnionFieldsNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
24470         LDKCResult_RecipientOnionFieldsNoneZ* o_conv = (LDKCResult_RecipientOnionFieldsNoneZ*)untag_ptr(o);
24471         jboolean ret_conv = CResult_RecipientOnionFieldsNoneZ_is_ok(o_conv);
24472         return ret_conv;
24473 }
24474
24475 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RecipientOnionFieldsNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
24476         if (!ptr_is_owned(_res)) return;
24477         void* _res_ptr = untag_ptr(_res);
24478         CHECK_ACCESS(_res_ptr);
24479         LDKCResult_RecipientOnionFieldsNoneZ _res_conv = *(LDKCResult_RecipientOnionFieldsNoneZ*)(_res_ptr);
24480         FREE(untag_ptr(_res));
24481         CResult_RecipientOnionFieldsNoneZ_free(_res_conv);
24482 }
24483
24484 static inline uint64_t CResult_RecipientOnionFieldsNoneZ_clone_ptr(LDKCResult_RecipientOnionFieldsNoneZ *NONNULL_PTR arg) {
24485         LDKCResult_RecipientOnionFieldsNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecipientOnionFieldsNoneZ), "LDKCResult_RecipientOnionFieldsNoneZ");
24486         *ret_conv = CResult_RecipientOnionFieldsNoneZ_clone(arg);
24487         return tag_ptr(ret_conv, true);
24488 }
24489 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecipientOnionFieldsNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24490         LDKCResult_RecipientOnionFieldsNoneZ* arg_conv = (LDKCResult_RecipientOnionFieldsNoneZ*)untag_ptr(arg);
24491         int64_t ret_conv = CResult_RecipientOnionFieldsNoneZ_clone_ptr(arg_conv);
24492         return ret_conv;
24493 }
24494
24495 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecipientOnionFieldsNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24496         LDKCResult_RecipientOnionFieldsNoneZ* orig_conv = (LDKCResult_RecipientOnionFieldsNoneZ*)untag_ptr(orig);
24497         LDKCResult_RecipientOnionFieldsNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecipientOnionFieldsNoneZ), "LDKCResult_RecipientOnionFieldsNoneZ");
24498         *ret_conv = CResult_RecipientOnionFieldsNoneZ_clone(orig_conv);
24499         return tag_ptr(ret_conv, true);
24500 }
24501
24502 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedBolt12InvoiceBolt12SemanticErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
24503         LDKUnsignedBolt12Invoice o_conv;
24504         o_conv.inner = untag_ptr(o);
24505         o_conv.is_owned = ptr_is_owned(o);
24506         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24507         o_conv = UnsignedBolt12Invoice_clone(&o_conv);
24508         LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ), "LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ");
24509         *ret_conv = CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ_ok(o_conv);
24510         return tag_ptr(ret_conv, true);
24511 }
24512
24513 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedBolt12InvoiceBolt12SemanticErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
24514         LDKBolt12SemanticError e_conv = LDKBolt12SemanticError_from_java(env, e);
24515         LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ), "LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ");
24516         *ret_conv = CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ_err(e_conv);
24517         return tag_ptr(ret_conv, true);
24518 }
24519
24520 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedBolt12InvoiceBolt12SemanticErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
24521         LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ* o_conv = (LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ*)untag_ptr(o);
24522         jboolean ret_conv = CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ_is_ok(o_conv);
24523         return ret_conv;
24524 }
24525
24526 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedBolt12InvoiceBolt12SemanticErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
24527         if (!ptr_is_owned(_res)) return;
24528         void* _res_ptr = untag_ptr(_res);
24529         CHECK_ACCESS(_res_ptr);
24530         LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ _res_conv = *(LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ*)(_res_ptr);
24531         FREE(untag_ptr(_res));
24532         CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ_free(_res_conv);
24533 }
24534
24535 static inline uint64_t CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ_clone_ptr(LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ *NONNULL_PTR arg) {
24536         LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ), "LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ");
24537         *ret_conv = CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ_clone(arg);
24538         return tag_ptr(ret_conv, true);
24539 }
24540 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedBolt12InvoiceBolt12SemanticErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24541         LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ* arg_conv = (LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ*)untag_ptr(arg);
24542         int64_t ret_conv = CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ_clone_ptr(arg_conv);
24543         return ret_conv;
24544 }
24545
24546 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedBolt12InvoiceBolt12SemanticErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24547         LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ* orig_conv = (LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ*)untag_ptr(orig);
24548         LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ), "LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ");
24549         *ret_conv = CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ_clone(orig_conv);
24550         return tag_ptr(ret_conv, true);
24551 }
24552
24553 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt12InvoiceBolt12SemanticErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
24554         LDKBolt12Invoice o_conv;
24555         o_conv.inner = untag_ptr(o);
24556         o_conv.is_owned = ptr_is_owned(o);
24557         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24558         o_conv = Bolt12Invoice_clone(&o_conv);
24559         LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ), "LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ");
24560         *ret_conv = CResult_Bolt12InvoiceBolt12SemanticErrorZ_ok(o_conv);
24561         return tag_ptr(ret_conv, true);
24562 }
24563
24564 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt12InvoiceBolt12SemanticErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
24565         LDKBolt12SemanticError e_conv = LDKBolt12SemanticError_from_java(env, e);
24566         LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ), "LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ");
24567         *ret_conv = CResult_Bolt12InvoiceBolt12SemanticErrorZ_err(e_conv);
24568         return tag_ptr(ret_conv, true);
24569 }
24570
24571 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt12InvoiceBolt12SemanticErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
24572         LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ* o_conv = (LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ*)untag_ptr(o);
24573         jboolean ret_conv = CResult_Bolt12InvoiceBolt12SemanticErrorZ_is_ok(o_conv);
24574         return ret_conv;
24575 }
24576
24577 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt12InvoiceBolt12SemanticErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
24578         if (!ptr_is_owned(_res)) return;
24579         void* _res_ptr = untag_ptr(_res);
24580         CHECK_ACCESS(_res_ptr);
24581         LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ _res_conv = *(LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ*)(_res_ptr);
24582         FREE(untag_ptr(_res));
24583         CResult_Bolt12InvoiceBolt12SemanticErrorZ_free(_res_conv);
24584 }
24585
24586 static inline uint64_t CResult_Bolt12InvoiceBolt12SemanticErrorZ_clone_ptr(LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ *NONNULL_PTR arg) {
24587         LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ), "LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ");
24588         *ret_conv = CResult_Bolt12InvoiceBolt12SemanticErrorZ_clone(arg);
24589         return tag_ptr(ret_conv, true);
24590 }
24591 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt12InvoiceBolt12SemanticErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24592         LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ* arg_conv = (LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ*)untag_ptr(arg);
24593         int64_t ret_conv = CResult_Bolt12InvoiceBolt12SemanticErrorZ_clone_ptr(arg_conv);
24594         return ret_conv;
24595 }
24596
24597 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt12InvoiceBolt12SemanticErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24598         LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ* orig_conv = (LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ*)untag_ptr(orig);
24599         LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ), "LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ");
24600         *ret_conv = CResult_Bolt12InvoiceBolt12SemanticErrorZ_clone(orig_conv);
24601         return tag_ptr(ret_conv, true);
24602 }
24603
24604 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SchnorrSignatureNoneZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
24605         LDKSchnorrSignature o_ref;
24606         CHECK((*env)->GetArrayLength(env, o) == 64);
24607         (*env)->GetByteArrayRegion(env, o, 0, 64, o_ref.compact_form);
24608         LDKCResult_SchnorrSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SchnorrSignatureNoneZ), "LDKCResult_SchnorrSignatureNoneZ");
24609         *ret_conv = CResult_SchnorrSignatureNoneZ_ok(o_ref);
24610         return tag_ptr(ret_conv, true);
24611 }
24612
24613 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SchnorrSignatureNoneZ_1err(JNIEnv *env, jclass clz) {
24614         LDKCResult_SchnorrSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SchnorrSignatureNoneZ), "LDKCResult_SchnorrSignatureNoneZ");
24615         *ret_conv = CResult_SchnorrSignatureNoneZ_err();
24616         return tag_ptr(ret_conv, true);
24617 }
24618
24619 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1SchnorrSignatureNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
24620         LDKCResult_SchnorrSignatureNoneZ* o_conv = (LDKCResult_SchnorrSignatureNoneZ*)untag_ptr(o);
24621         jboolean ret_conv = CResult_SchnorrSignatureNoneZ_is_ok(o_conv);
24622         return ret_conv;
24623 }
24624
24625 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SchnorrSignatureNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
24626         if (!ptr_is_owned(_res)) return;
24627         void* _res_ptr = untag_ptr(_res);
24628         CHECK_ACCESS(_res_ptr);
24629         LDKCResult_SchnorrSignatureNoneZ _res_conv = *(LDKCResult_SchnorrSignatureNoneZ*)(_res_ptr);
24630         FREE(untag_ptr(_res));
24631         CResult_SchnorrSignatureNoneZ_free(_res_conv);
24632 }
24633
24634 static inline uint64_t CResult_SchnorrSignatureNoneZ_clone_ptr(LDKCResult_SchnorrSignatureNoneZ *NONNULL_PTR arg) {
24635         LDKCResult_SchnorrSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SchnorrSignatureNoneZ), "LDKCResult_SchnorrSignatureNoneZ");
24636         *ret_conv = CResult_SchnorrSignatureNoneZ_clone(arg);
24637         return tag_ptr(ret_conv, true);
24638 }
24639 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SchnorrSignatureNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24640         LDKCResult_SchnorrSignatureNoneZ* arg_conv = (LDKCResult_SchnorrSignatureNoneZ*)untag_ptr(arg);
24641         int64_t ret_conv = CResult_SchnorrSignatureNoneZ_clone_ptr(arg_conv);
24642         return ret_conv;
24643 }
24644
24645 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SchnorrSignatureNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24646         LDKCResult_SchnorrSignatureNoneZ* orig_conv = (LDKCResult_SchnorrSignatureNoneZ*)untag_ptr(orig);
24647         LDKCResult_SchnorrSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SchnorrSignatureNoneZ), "LDKCResult_SchnorrSignatureNoneZ");
24648         *ret_conv = CResult_SchnorrSignatureNoneZ_clone(orig_conv);
24649         return tag_ptr(ret_conv, true);
24650 }
24651
24652 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1ThirtyTwoBytesZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
24653         LDKCVec_ThirtyTwoBytesZ _res_constr;
24654         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
24655         if (_res_constr.datalen > 0)
24656                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_ThirtyTwoBytesZ Elements");
24657         else
24658                 _res_constr.data = NULL;
24659         for (size_t i = 0; i < _res_constr.datalen; i++) {
24660                 int8_tArray _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
24661                 LDKThirtyTwoBytes _res_conv_8_ref;
24662                 CHECK((*env)->GetArrayLength(env, _res_conv_8) == 32);
24663                 (*env)->GetByteArrayRegion(env, _res_conv_8, 0, 32, _res_conv_8_ref.data);
24664                 _res_constr.data[i] = _res_conv_8_ref;
24665         }
24666         CVec_ThirtyTwoBytesZ_free(_res_constr);
24667 }
24668
24669 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1ThirtyTwoBytesZZ_1some(JNIEnv *env, jclass clz, jobjectArray o) {
24670         LDKCVec_ThirtyTwoBytesZ o_constr;
24671         o_constr.datalen = (*env)->GetArrayLength(env, o);
24672         if (o_constr.datalen > 0)
24673                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_ThirtyTwoBytesZ Elements");
24674         else
24675                 o_constr.data = NULL;
24676         for (size_t i = 0; i < o_constr.datalen; i++) {
24677                 int8_tArray o_conv_8 = (*env)->GetObjectArrayElement(env, o, i);
24678                 LDKThirtyTwoBytes o_conv_8_ref;
24679                 CHECK((*env)->GetArrayLength(env, o_conv_8) == 32);
24680                 (*env)->GetByteArrayRegion(env, o_conv_8, 0, 32, o_conv_8_ref.data);
24681                 o_constr.data[i] = o_conv_8_ref;
24682         }
24683         LDKCOption_CVec_ThirtyTwoBytesZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_ThirtyTwoBytesZZ), "LDKCOption_CVec_ThirtyTwoBytesZZ");
24684         *ret_copy = COption_CVec_ThirtyTwoBytesZZ_some(o_constr);
24685         int64_t ret_ref = tag_ptr(ret_copy, true);
24686         return ret_ref;
24687 }
24688
24689 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1ThirtyTwoBytesZZ_1none(JNIEnv *env, jclass clz) {
24690         LDKCOption_CVec_ThirtyTwoBytesZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_ThirtyTwoBytesZZ), "LDKCOption_CVec_ThirtyTwoBytesZZ");
24691         *ret_copy = COption_CVec_ThirtyTwoBytesZZ_none();
24692         int64_t ret_ref = tag_ptr(ret_copy, true);
24693         return ret_ref;
24694 }
24695
24696 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1ThirtyTwoBytesZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
24697         if (!ptr_is_owned(_res)) return;
24698         void* _res_ptr = untag_ptr(_res);
24699         CHECK_ACCESS(_res_ptr);
24700         LDKCOption_CVec_ThirtyTwoBytesZZ _res_conv = *(LDKCOption_CVec_ThirtyTwoBytesZZ*)(_res_ptr);
24701         FREE(untag_ptr(_res));
24702         COption_CVec_ThirtyTwoBytesZZ_free(_res_conv);
24703 }
24704
24705 static inline uint64_t COption_CVec_ThirtyTwoBytesZZ_clone_ptr(LDKCOption_CVec_ThirtyTwoBytesZZ *NONNULL_PTR arg) {
24706         LDKCOption_CVec_ThirtyTwoBytesZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_ThirtyTwoBytesZZ), "LDKCOption_CVec_ThirtyTwoBytesZZ");
24707         *ret_copy = COption_CVec_ThirtyTwoBytesZZ_clone(arg);
24708         int64_t ret_ref = tag_ptr(ret_copy, true);
24709         return ret_ref;
24710 }
24711 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1ThirtyTwoBytesZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24712         LDKCOption_CVec_ThirtyTwoBytesZZ* arg_conv = (LDKCOption_CVec_ThirtyTwoBytesZZ*)untag_ptr(arg);
24713         int64_t ret_conv = COption_CVec_ThirtyTwoBytesZZ_clone_ptr(arg_conv);
24714         return ret_conv;
24715 }
24716
24717 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1ThirtyTwoBytesZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24718         LDKCOption_CVec_ThirtyTwoBytesZZ* orig_conv = (LDKCOption_CVec_ThirtyTwoBytesZZ*)untag_ptr(orig);
24719         LDKCOption_CVec_ThirtyTwoBytesZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_ThirtyTwoBytesZZ), "LDKCOption_CVec_ThirtyTwoBytesZZ");
24720         *ret_copy = COption_CVec_ThirtyTwoBytesZZ_clone(orig_conv);
24721         int64_t ret_ref = tag_ptr(ret_copy, true);
24722         return ret_ref;
24723 }
24724
24725 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1AmountZ_1some(JNIEnv *env, jclass clz, int64_t o) {
24726         void* o_ptr = untag_ptr(o);
24727         CHECK_ACCESS(o_ptr);
24728         LDKAmount o_conv = *(LDKAmount*)(o_ptr);
24729         o_conv = Amount_clone((LDKAmount*)untag_ptr(o));
24730         LDKCOption_AmountZ *ret_copy = MALLOC(sizeof(LDKCOption_AmountZ), "LDKCOption_AmountZ");
24731         *ret_copy = COption_AmountZ_some(o_conv);
24732         int64_t ret_ref = tag_ptr(ret_copy, true);
24733         return ret_ref;
24734 }
24735
24736 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1AmountZ_1none(JNIEnv *env, jclass clz) {
24737         LDKCOption_AmountZ *ret_copy = MALLOC(sizeof(LDKCOption_AmountZ), "LDKCOption_AmountZ");
24738         *ret_copy = COption_AmountZ_none();
24739         int64_t ret_ref = tag_ptr(ret_copy, true);
24740         return ret_ref;
24741 }
24742
24743 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1AmountZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
24744         if (!ptr_is_owned(_res)) return;
24745         void* _res_ptr = untag_ptr(_res);
24746         CHECK_ACCESS(_res_ptr);
24747         LDKCOption_AmountZ _res_conv = *(LDKCOption_AmountZ*)(_res_ptr);
24748         FREE(untag_ptr(_res));
24749         COption_AmountZ_free(_res_conv);
24750 }
24751
24752 static inline uint64_t COption_AmountZ_clone_ptr(LDKCOption_AmountZ *NONNULL_PTR arg) {
24753         LDKCOption_AmountZ *ret_copy = MALLOC(sizeof(LDKCOption_AmountZ), "LDKCOption_AmountZ");
24754         *ret_copy = COption_AmountZ_clone(arg);
24755         int64_t ret_ref = tag_ptr(ret_copy, true);
24756         return ret_ref;
24757 }
24758 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1AmountZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24759         LDKCOption_AmountZ* arg_conv = (LDKCOption_AmountZ*)untag_ptr(arg);
24760         int64_t ret_conv = COption_AmountZ_clone_ptr(arg_conv);
24761         return ret_conv;
24762 }
24763
24764 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1AmountZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24765         LDKCOption_AmountZ* orig_conv = (LDKCOption_AmountZ*)untag_ptr(orig);
24766         LDKCOption_AmountZ *ret_copy = MALLOC(sizeof(LDKCOption_AmountZ), "LDKCOption_AmountZ");
24767         *ret_copy = COption_AmountZ_clone(orig_conv);
24768         int64_t ret_ref = tag_ptr(ret_copy, true);
24769         return ret_ref;
24770 }
24771
24772 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1QuantityZ_1some(JNIEnv *env, jclass clz, int64_t o) {
24773         void* o_ptr = untag_ptr(o);
24774         CHECK_ACCESS(o_ptr);
24775         LDKQuantity o_conv = *(LDKQuantity*)(o_ptr);
24776         o_conv = Quantity_clone((LDKQuantity*)untag_ptr(o));
24777         LDKCOption_QuantityZ *ret_copy = MALLOC(sizeof(LDKCOption_QuantityZ), "LDKCOption_QuantityZ");
24778         *ret_copy = COption_QuantityZ_some(o_conv);
24779         int64_t ret_ref = tag_ptr(ret_copy, true);
24780         return ret_ref;
24781 }
24782
24783 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1QuantityZ_1none(JNIEnv *env, jclass clz) {
24784         LDKCOption_QuantityZ *ret_copy = MALLOC(sizeof(LDKCOption_QuantityZ), "LDKCOption_QuantityZ");
24785         *ret_copy = COption_QuantityZ_none();
24786         int64_t ret_ref = tag_ptr(ret_copy, true);
24787         return ret_ref;
24788 }
24789
24790 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1QuantityZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
24791         if (!ptr_is_owned(_res)) return;
24792         void* _res_ptr = untag_ptr(_res);
24793         CHECK_ACCESS(_res_ptr);
24794         LDKCOption_QuantityZ _res_conv = *(LDKCOption_QuantityZ*)(_res_ptr);
24795         FREE(untag_ptr(_res));
24796         COption_QuantityZ_free(_res_conv);
24797 }
24798
24799 static inline uint64_t COption_QuantityZ_clone_ptr(LDKCOption_QuantityZ *NONNULL_PTR arg) {
24800         LDKCOption_QuantityZ *ret_copy = MALLOC(sizeof(LDKCOption_QuantityZ), "LDKCOption_QuantityZ");
24801         *ret_copy = COption_QuantityZ_clone(arg);
24802         int64_t ret_ref = tag_ptr(ret_copy, true);
24803         return ret_ref;
24804 }
24805 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1QuantityZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24806         LDKCOption_QuantityZ* arg_conv = (LDKCOption_QuantityZ*)untag_ptr(arg);
24807         int64_t ret_conv = COption_QuantityZ_clone_ptr(arg_conv);
24808         return ret_conv;
24809 }
24810
24811 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1QuantityZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24812         LDKCOption_QuantityZ* orig_conv = (LDKCOption_QuantityZ*)untag_ptr(orig);
24813         LDKCOption_QuantityZ *ret_copy = MALLOC(sizeof(LDKCOption_QuantityZ), "LDKCOption_QuantityZ");
24814         *ret_copy = COption_QuantityZ_clone(orig_conv);
24815         int64_t ret_ref = tag_ptr(ret_copy, true);
24816         return ret_ref;
24817 }
24818
24819 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesNoneZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
24820         LDKThirtyTwoBytes o_ref;
24821         CHECK((*env)->GetArrayLength(env, o) == 32);
24822         (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.data);
24823         LDKCResult_ThirtyTwoBytesNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesNoneZ), "LDKCResult_ThirtyTwoBytesNoneZ");
24824         *ret_conv = CResult_ThirtyTwoBytesNoneZ_ok(o_ref);
24825         return tag_ptr(ret_conv, true);
24826 }
24827
24828 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesNoneZ_1err(JNIEnv *env, jclass clz) {
24829         LDKCResult_ThirtyTwoBytesNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesNoneZ), "LDKCResult_ThirtyTwoBytesNoneZ");
24830         *ret_conv = CResult_ThirtyTwoBytesNoneZ_err();
24831         return tag_ptr(ret_conv, true);
24832 }
24833
24834 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
24835         LDKCResult_ThirtyTwoBytesNoneZ* o_conv = (LDKCResult_ThirtyTwoBytesNoneZ*)untag_ptr(o);
24836         jboolean ret_conv = CResult_ThirtyTwoBytesNoneZ_is_ok(o_conv);
24837         return ret_conv;
24838 }
24839
24840 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
24841         if (!ptr_is_owned(_res)) return;
24842         void* _res_ptr = untag_ptr(_res);
24843         CHECK_ACCESS(_res_ptr);
24844         LDKCResult_ThirtyTwoBytesNoneZ _res_conv = *(LDKCResult_ThirtyTwoBytesNoneZ*)(_res_ptr);
24845         FREE(untag_ptr(_res));
24846         CResult_ThirtyTwoBytesNoneZ_free(_res_conv);
24847 }
24848
24849 static inline uint64_t CResult_ThirtyTwoBytesNoneZ_clone_ptr(LDKCResult_ThirtyTwoBytesNoneZ *NONNULL_PTR arg) {
24850         LDKCResult_ThirtyTwoBytesNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesNoneZ), "LDKCResult_ThirtyTwoBytesNoneZ");
24851         *ret_conv = CResult_ThirtyTwoBytesNoneZ_clone(arg);
24852         return tag_ptr(ret_conv, true);
24853 }
24854 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24855         LDKCResult_ThirtyTwoBytesNoneZ* arg_conv = (LDKCResult_ThirtyTwoBytesNoneZ*)untag_ptr(arg);
24856         int64_t ret_conv = CResult_ThirtyTwoBytesNoneZ_clone_ptr(arg_conv);
24857         return ret_conv;
24858 }
24859
24860 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24861         LDKCResult_ThirtyTwoBytesNoneZ* orig_conv = (LDKCResult_ThirtyTwoBytesNoneZ*)untag_ptr(orig);
24862         LDKCResult_ThirtyTwoBytesNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesNoneZ), "LDKCResult_ThirtyTwoBytesNoneZ");
24863         *ret_conv = CResult_ThirtyTwoBytesNoneZ_clone(orig_conv);
24864         return tag_ptr(ret_conv, true);
24865 }
24866
24867 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPayInfoDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
24868         LDKBlindedPayInfo o_conv;
24869         o_conv.inner = untag_ptr(o);
24870         o_conv.is_owned = ptr_is_owned(o);
24871         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24872         o_conv = BlindedPayInfo_clone(&o_conv);
24873         LDKCResult_BlindedPayInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPayInfoDecodeErrorZ), "LDKCResult_BlindedPayInfoDecodeErrorZ");
24874         *ret_conv = CResult_BlindedPayInfoDecodeErrorZ_ok(o_conv);
24875         return tag_ptr(ret_conv, true);
24876 }
24877
24878 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPayInfoDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
24879         void* e_ptr = untag_ptr(e);
24880         CHECK_ACCESS(e_ptr);
24881         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
24882         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
24883         LDKCResult_BlindedPayInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPayInfoDecodeErrorZ), "LDKCResult_BlindedPayInfoDecodeErrorZ");
24884         *ret_conv = CResult_BlindedPayInfoDecodeErrorZ_err(e_conv);
24885         return tag_ptr(ret_conv, true);
24886 }
24887
24888 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPayInfoDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
24889         LDKCResult_BlindedPayInfoDecodeErrorZ* o_conv = (LDKCResult_BlindedPayInfoDecodeErrorZ*)untag_ptr(o);
24890         jboolean ret_conv = CResult_BlindedPayInfoDecodeErrorZ_is_ok(o_conv);
24891         return ret_conv;
24892 }
24893
24894 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPayInfoDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
24895         if (!ptr_is_owned(_res)) return;
24896         void* _res_ptr = untag_ptr(_res);
24897         CHECK_ACCESS(_res_ptr);
24898         LDKCResult_BlindedPayInfoDecodeErrorZ _res_conv = *(LDKCResult_BlindedPayInfoDecodeErrorZ*)(_res_ptr);
24899         FREE(untag_ptr(_res));
24900         CResult_BlindedPayInfoDecodeErrorZ_free(_res_conv);
24901 }
24902
24903 static inline uint64_t CResult_BlindedPayInfoDecodeErrorZ_clone_ptr(LDKCResult_BlindedPayInfoDecodeErrorZ *NONNULL_PTR arg) {
24904         LDKCResult_BlindedPayInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPayInfoDecodeErrorZ), "LDKCResult_BlindedPayInfoDecodeErrorZ");
24905         *ret_conv = CResult_BlindedPayInfoDecodeErrorZ_clone(arg);
24906         return tag_ptr(ret_conv, true);
24907 }
24908 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPayInfoDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24909         LDKCResult_BlindedPayInfoDecodeErrorZ* arg_conv = (LDKCResult_BlindedPayInfoDecodeErrorZ*)untag_ptr(arg);
24910         int64_t ret_conv = CResult_BlindedPayInfoDecodeErrorZ_clone_ptr(arg_conv);
24911         return ret_conv;
24912 }
24913
24914 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPayInfoDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24915         LDKCResult_BlindedPayInfoDecodeErrorZ* orig_conv = (LDKCResult_BlindedPayInfoDecodeErrorZ*)untag_ptr(orig);
24916         LDKCResult_BlindedPayInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPayInfoDecodeErrorZ), "LDKCResult_BlindedPayInfoDecodeErrorZ");
24917         *ret_conv = CResult_BlindedPayInfoDecodeErrorZ_clone(orig_conv);
24918         return tag_ptr(ret_conv, true);
24919 }
24920
24921 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
24922         LDKDelayedPaymentOutputDescriptor o_conv;
24923         o_conv.inner = untag_ptr(o);
24924         o_conv.is_owned = ptr_is_owned(o);
24925         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24926         o_conv = DelayedPaymentOutputDescriptor_clone(&o_conv);
24927         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
24928         *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok(o_conv);
24929         return tag_ptr(ret_conv, true);
24930 }
24931
24932 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
24933         void* e_ptr = untag_ptr(e);
24934         CHECK_ACCESS(e_ptr);
24935         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
24936         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
24937         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
24938         *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err(e_conv);
24939         return tag_ptr(ret_conv, true);
24940 }
24941
24942 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
24943         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* o_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(o);
24944         jboolean ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_is_ok(o_conv);
24945         return ret_conv;
24946 }
24947
24948 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
24949         if (!ptr_is_owned(_res)) return;
24950         void* _res_ptr = untag_ptr(_res);
24951         CHECK_ACCESS(_res_ptr);
24952         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(_res_ptr);
24953         FREE(untag_ptr(_res));
24954         CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free(_res_conv);
24955 }
24956
24957 static inline uint64_t CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone_ptr(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR arg) {
24958         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
24959         *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(arg);
24960         return tag_ptr(ret_conv, true);
24961 }
24962 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
24963         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* arg_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(arg);
24964         int64_t ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone_ptr(arg_conv);
24965         return ret_conv;
24966 }
24967
24968 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24969         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(orig);
24970         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
24971         *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(orig_conv);
24972         return tag_ptr(ret_conv, true);
24973 }
24974
24975 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
24976         LDKStaticPaymentOutputDescriptor o_conv;
24977         o_conv.inner = untag_ptr(o);
24978         o_conv.is_owned = ptr_is_owned(o);
24979         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
24980         o_conv = StaticPaymentOutputDescriptor_clone(&o_conv);
24981         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
24982         *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok(o_conv);
24983         return tag_ptr(ret_conv, true);
24984 }
24985
24986 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
24987         void* e_ptr = untag_ptr(e);
24988         CHECK_ACCESS(e_ptr);
24989         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
24990         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
24991         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
24992         *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err(e_conv);
24993         return tag_ptr(ret_conv, true);
24994 }
24995
24996 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
24997         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* o_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(o);
24998         jboolean ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_is_ok(o_conv);
24999         return ret_conv;
25000 }
25001
25002 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
25003         if (!ptr_is_owned(_res)) return;
25004         void* _res_ptr = untag_ptr(_res);
25005         CHECK_ACCESS(_res_ptr);
25006         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(_res_ptr);
25007         FREE(untag_ptr(_res));
25008         CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free(_res_conv);
25009 }
25010
25011 static inline uint64_t CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone_ptr(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR arg) {
25012         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
25013         *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(arg);
25014         return tag_ptr(ret_conv, true);
25015 }
25016 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25017         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* arg_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(arg);
25018         int64_t ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone_ptr(arg_conv);
25019         return ret_conv;
25020 }
25021
25022 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25023         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)untag_ptr(orig);
25024         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
25025         *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(orig_conv);
25026         return tag_ptr(ret_conv, true);
25027 }
25028
25029 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
25030         void* o_ptr = untag_ptr(o);
25031         CHECK_ACCESS(o_ptr);
25032         LDKSpendableOutputDescriptor o_conv = *(LDKSpendableOutputDescriptor*)(o_ptr);
25033         o_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)untag_ptr(o));
25034         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
25035         *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_ok(o_conv);
25036         return tag_ptr(ret_conv, true);
25037 }
25038
25039 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
25040         void* e_ptr = untag_ptr(e);
25041         CHECK_ACCESS(e_ptr);
25042         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25043         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25044         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
25045         *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_err(e_conv);
25046         return tag_ptr(ret_conv, true);
25047 }
25048
25049 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
25050         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* o_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)untag_ptr(o);
25051         jboolean ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_is_ok(o_conv);
25052         return ret_conv;
25053 }
25054
25055 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
25056         if (!ptr_is_owned(_res)) return;
25057         void* _res_ptr = untag_ptr(_res);
25058         CHECK_ACCESS(_res_ptr);
25059         LDKCResult_SpendableOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(_res_ptr);
25060         FREE(untag_ptr(_res));
25061         CResult_SpendableOutputDescriptorDecodeErrorZ_free(_res_conv);
25062 }
25063
25064 static inline uint64_t CResult_SpendableOutputDescriptorDecodeErrorZ_clone_ptr(LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR arg) {
25065         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
25066         *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_clone(arg);
25067         return tag_ptr(ret_conv, true);
25068 }
25069 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25070         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* arg_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)untag_ptr(arg);
25071         int64_t ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_clone_ptr(arg_conv);
25072         return ret_conv;
25073 }
25074
25075 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25076         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)untag_ptr(orig);
25077         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
25078         *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_clone(orig_conv);
25079         return tag_ptr(ret_conv, true);
25080 }
25081
25082 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1SpendableOutputDescriptorZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
25083         LDKCVec_SpendableOutputDescriptorZ _res_constr;
25084         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
25085         if (_res_constr.datalen > 0)
25086                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
25087         else
25088                 _res_constr.data = NULL;
25089         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
25090         for (size_t b = 0; b < _res_constr.datalen; b++) {
25091                 int64_t _res_conv_27 = _res_vals[b];
25092                 void* _res_conv_27_ptr = untag_ptr(_res_conv_27);
25093                 CHECK_ACCESS(_res_conv_27_ptr);
25094                 LDKSpendableOutputDescriptor _res_conv_27_conv = *(LDKSpendableOutputDescriptor*)(_res_conv_27_ptr);
25095                 FREE(untag_ptr(_res_conv_27));
25096                 _res_constr.data[b] = _res_conv_27_conv;
25097         }
25098         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
25099         CVec_SpendableOutputDescriptorZ_free(_res_constr);
25100 }
25101
25102 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1TxOutZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
25103         LDKCVec_TxOutZ _res_constr;
25104         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
25105         if (_res_constr.datalen > 0)
25106                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
25107         else
25108                 _res_constr.data = NULL;
25109         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
25110         for (size_t h = 0; h < _res_constr.datalen; h++) {
25111                 int64_t _res_conv_7 = _res_vals[h];
25112                 void* _res_conv_7_ptr = untag_ptr(_res_conv_7);
25113                 CHECK_ACCESS(_res_conv_7_ptr);
25114                 LDKTxOut _res_conv_7_conv = *(LDKTxOut*)(_res_conv_7_ptr);
25115                 FREE(untag_ptr(_res_conv_7));
25116                 _res_constr.data[h] = _res_conv_7_conv;
25117         }
25118         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
25119         CVec_TxOutZ_free(_res_constr);
25120 }
25121
25122 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u32Z_1some(JNIEnv *env, jclass clz, int32_t o) {
25123         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
25124         *ret_copy = COption_u32Z_some(o);
25125         int64_t ret_ref = tag_ptr(ret_copy, true);
25126         return ret_ref;
25127 }
25128
25129 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u32Z_1none(JNIEnv *env, jclass clz) {
25130         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
25131         *ret_copy = COption_u32Z_none();
25132         int64_t ret_ref = tag_ptr(ret_copy, true);
25133         return ret_ref;
25134 }
25135
25136 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1u32Z_1free(JNIEnv *env, jclass clz, int64_t _res) {
25137         if (!ptr_is_owned(_res)) return;
25138         void* _res_ptr = untag_ptr(_res);
25139         CHECK_ACCESS(_res_ptr);
25140         LDKCOption_u32Z _res_conv = *(LDKCOption_u32Z*)(_res_ptr);
25141         FREE(untag_ptr(_res));
25142         COption_u32Z_free(_res_conv);
25143 }
25144
25145 static inline uint64_t COption_u32Z_clone_ptr(LDKCOption_u32Z *NONNULL_PTR arg) {
25146         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
25147         *ret_copy = COption_u32Z_clone(arg);
25148         int64_t ret_ref = tag_ptr(ret_copy, true);
25149         return ret_ref;
25150 }
25151 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u32Z_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25152         LDKCOption_u32Z* arg_conv = (LDKCOption_u32Z*)untag_ptr(arg);
25153         int64_t ret_conv = COption_u32Z_clone_ptr(arg_conv);
25154         return ret_conv;
25155 }
25156
25157 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u32Z_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25158         LDKCOption_u32Z* orig_conv = (LDKCOption_u32Z*)untag_ptr(orig);
25159         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
25160         *ret_copy = COption_u32Z_clone(orig_conv);
25161         int64_t ret_ref = tag_ptr(ret_copy, true);
25162         return ret_ref;
25163 }
25164
25165 static inline uint64_t C2Tuple_CVec_u8Zu64Z_clone_ptr(LDKC2Tuple_CVec_u8Zu64Z *NONNULL_PTR arg) {
25166         LDKC2Tuple_CVec_u8Zu64Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_CVec_u8Zu64Z), "LDKC2Tuple_CVec_u8Zu64Z");
25167         *ret_conv = C2Tuple_CVec_u8Zu64Z_clone(arg);
25168         return tag_ptr(ret_conv, true);
25169 }
25170 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1CVec_1u8Zu64Z_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25171         LDKC2Tuple_CVec_u8Zu64Z* arg_conv = (LDKC2Tuple_CVec_u8Zu64Z*)untag_ptr(arg);
25172         int64_t ret_conv = C2Tuple_CVec_u8Zu64Z_clone_ptr(arg_conv);
25173         return ret_conv;
25174 }
25175
25176 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1CVec_1u8Zu64Z_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25177         LDKC2Tuple_CVec_u8Zu64Z* orig_conv = (LDKC2Tuple_CVec_u8Zu64Z*)untag_ptr(orig);
25178         LDKC2Tuple_CVec_u8Zu64Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_CVec_u8Zu64Z), "LDKC2Tuple_CVec_u8Zu64Z");
25179         *ret_conv = C2Tuple_CVec_u8Zu64Z_clone(orig_conv);
25180         return tag_ptr(ret_conv, true);
25181 }
25182
25183 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1CVec_1u8Zu64Z_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_t b) {
25184         LDKCVec_u8Z a_ref;
25185         a_ref.datalen = (*env)->GetArrayLength(env, a);
25186         a_ref.data = MALLOC(a_ref.datalen, "LDKCVec_u8Z Bytes");
25187         (*env)->GetByteArrayRegion(env, a, 0, a_ref.datalen, a_ref.data);
25188         LDKC2Tuple_CVec_u8Zu64Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_CVec_u8Zu64Z), "LDKC2Tuple_CVec_u8Zu64Z");
25189         *ret_conv = C2Tuple_CVec_u8Zu64Z_new(a_ref, b);
25190         return tag_ptr(ret_conv, true);
25191 }
25192
25193 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1CVec_1u8Zu64Z_1free(JNIEnv *env, jclass clz, int64_t _res) {
25194         if (!ptr_is_owned(_res)) return;
25195         void* _res_ptr = untag_ptr(_res);
25196         CHECK_ACCESS(_res_ptr);
25197         LDKC2Tuple_CVec_u8Zu64Z _res_conv = *(LDKC2Tuple_CVec_u8Zu64Z*)(_res_ptr);
25198         FREE(untag_ptr(_res));
25199         C2Tuple_CVec_u8Zu64Z_free(_res_conv);
25200 }
25201
25202 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1CVec_1u8Zu64ZNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
25203         void* o_ptr = untag_ptr(o);
25204         CHECK_ACCESS(o_ptr);
25205         LDKC2Tuple_CVec_u8Zu64Z o_conv = *(LDKC2Tuple_CVec_u8Zu64Z*)(o_ptr);
25206         o_conv = C2Tuple_CVec_u8Zu64Z_clone((LDKC2Tuple_CVec_u8Zu64Z*)untag_ptr(o));
25207         LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ), "LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ");
25208         *ret_conv = CResult_C2Tuple_CVec_u8Zu64ZNoneZ_ok(o_conv);
25209         return tag_ptr(ret_conv, true);
25210 }
25211
25212 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1CVec_1u8Zu64ZNoneZ_1err(JNIEnv *env, jclass clz) {
25213         LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ), "LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ");
25214         *ret_conv = CResult_C2Tuple_CVec_u8Zu64ZNoneZ_err();
25215         return tag_ptr(ret_conv, true);
25216 }
25217
25218 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1CVec_1u8Zu64ZNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
25219         LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ* o_conv = (LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ*)untag_ptr(o);
25220         jboolean ret_conv = CResult_C2Tuple_CVec_u8Zu64ZNoneZ_is_ok(o_conv);
25221         return ret_conv;
25222 }
25223
25224 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1CVec_1u8Zu64ZNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
25225         if (!ptr_is_owned(_res)) return;
25226         void* _res_ptr = untag_ptr(_res);
25227         CHECK_ACCESS(_res_ptr);
25228         LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ _res_conv = *(LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ*)(_res_ptr);
25229         FREE(untag_ptr(_res));
25230         CResult_C2Tuple_CVec_u8Zu64ZNoneZ_free(_res_conv);
25231 }
25232
25233 static inline uint64_t CResult_C2Tuple_CVec_u8Zu64ZNoneZ_clone_ptr(LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ *NONNULL_PTR arg) {
25234         LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ), "LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ");
25235         *ret_conv = CResult_C2Tuple_CVec_u8Zu64ZNoneZ_clone(arg);
25236         return tag_ptr(ret_conv, true);
25237 }
25238 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1CVec_1u8Zu64ZNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25239         LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ* arg_conv = (LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ*)untag_ptr(arg);
25240         int64_t ret_conv = CResult_C2Tuple_CVec_u8Zu64ZNoneZ_clone_ptr(arg_conv);
25241         return ret_conv;
25242 }
25243
25244 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1CVec_1u8Zu64ZNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25245         LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ* orig_conv = (LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ*)untag_ptr(orig);
25246         LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ), "LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ");
25247         *ret_conv = CResult_C2Tuple_CVec_u8Zu64ZNoneZ_clone(orig_conv);
25248         return tag_ptr(ret_conv, true);
25249 }
25250
25251 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDerivationParametersDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
25252         LDKChannelDerivationParameters o_conv;
25253         o_conv.inner = untag_ptr(o);
25254         o_conv.is_owned = ptr_is_owned(o);
25255         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
25256         o_conv = ChannelDerivationParameters_clone(&o_conv);
25257         LDKCResult_ChannelDerivationParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDerivationParametersDecodeErrorZ), "LDKCResult_ChannelDerivationParametersDecodeErrorZ");
25258         *ret_conv = CResult_ChannelDerivationParametersDecodeErrorZ_ok(o_conv);
25259         return tag_ptr(ret_conv, true);
25260 }
25261
25262 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDerivationParametersDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
25263         void* e_ptr = untag_ptr(e);
25264         CHECK_ACCESS(e_ptr);
25265         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25266         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25267         LDKCResult_ChannelDerivationParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDerivationParametersDecodeErrorZ), "LDKCResult_ChannelDerivationParametersDecodeErrorZ");
25268         *ret_conv = CResult_ChannelDerivationParametersDecodeErrorZ_err(e_conv);
25269         return tag_ptr(ret_conv, true);
25270 }
25271
25272 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDerivationParametersDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
25273         LDKCResult_ChannelDerivationParametersDecodeErrorZ* o_conv = (LDKCResult_ChannelDerivationParametersDecodeErrorZ*)untag_ptr(o);
25274         jboolean ret_conv = CResult_ChannelDerivationParametersDecodeErrorZ_is_ok(o_conv);
25275         return ret_conv;
25276 }
25277
25278 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDerivationParametersDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
25279         if (!ptr_is_owned(_res)) return;
25280         void* _res_ptr = untag_ptr(_res);
25281         CHECK_ACCESS(_res_ptr);
25282         LDKCResult_ChannelDerivationParametersDecodeErrorZ _res_conv = *(LDKCResult_ChannelDerivationParametersDecodeErrorZ*)(_res_ptr);
25283         FREE(untag_ptr(_res));
25284         CResult_ChannelDerivationParametersDecodeErrorZ_free(_res_conv);
25285 }
25286
25287 static inline uint64_t CResult_ChannelDerivationParametersDecodeErrorZ_clone_ptr(LDKCResult_ChannelDerivationParametersDecodeErrorZ *NONNULL_PTR arg) {
25288         LDKCResult_ChannelDerivationParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDerivationParametersDecodeErrorZ), "LDKCResult_ChannelDerivationParametersDecodeErrorZ");
25289         *ret_conv = CResult_ChannelDerivationParametersDecodeErrorZ_clone(arg);
25290         return tag_ptr(ret_conv, true);
25291 }
25292 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDerivationParametersDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25293         LDKCResult_ChannelDerivationParametersDecodeErrorZ* arg_conv = (LDKCResult_ChannelDerivationParametersDecodeErrorZ*)untag_ptr(arg);
25294         int64_t ret_conv = CResult_ChannelDerivationParametersDecodeErrorZ_clone_ptr(arg_conv);
25295         return ret_conv;
25296 }
25297
25298 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDerivationParametersDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25299         LDKCResult_ChannelDerivationParametersDecodeErrorZ* orig_conv = (LDKCResult_ChannelDerivationParametersDecodeErrorZ*)untag_ptr(orig);
25300         LDKCResult_ChannelDerivationParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDerivationParametersDecodeErrorZ), "LDKCResult_ChannelDerivationParametersDecodeErrorZ");
25301         *ret_conv = CResult_ChannelDerivationParametersDecodeErrorZ_clone(orig_conv);
25302         return tag_ptr(ret_conv, true);
25303 }
25304
25305 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCDescriptorDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
25306         LDKHTLCDescriptor o_conv;
25307         o_conv.inner = untag_ptr(o);
25308         o_conv.is_owned = ptr_is_owned(o);
25309         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
25310         o_conv = HTLCDescriptor_clone(&o_conv);
25311         LDKCResult_HTLCDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCDescriptorDecodeErrorZ), "LDKCResult_HTLCDescriptorDecodeErrorZ");
25312         *ret_conv = CResult_HTLCDescriptorDecodeErrorZ_ok(o_conv);
25313         return tag_ptr(ret_conv, true);
25314 }
25315
25316 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCDescriptorDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
25317         void* e_ptr = untag_ptr(e);
25318         CHECK_ACCESS(e_ptr);
25319         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25320         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25321         LDKCResult_HTLCDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCDescriptorDecodeErrorZ), "LDKCResult_HTLCDescriptorDecodeErrorZ");
25322         *ret_conv = CResult_HTLCDescriptorDecodeErrorZ_err(e_conv);
25323         return tag_ptr(ret_conv, true);
25324 }
25325
25326 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCDescriptorDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
25327         LDKCResult_HTLCDescriptorDecodeErrorZ* o_conv = (LDKCResult_HTLCDescriptorDecodeErrorZ*)untag_ptr(o);
25328         jboolean ret_conv = CResult_HTLCDescriptorDecodeErrorZ_is_ok(o_conv);
25329         return ret_conv;
25330 }
25331
25332 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCDescriptorDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
25333         if (!ptr_is_owned(_res)) return;
25334         void* _res_ptr = untag_ptr(_res);
25335         CHECK_ACCESS(_res_ptr);
25336         LDKCResult_HTLCDescriptorDecodeErrorZ _res_conv = *(LDKCResult_HTLCDescriptorDecodeErrorZ*)(_res_ptr);
25337         FREE(untag_ptr(_res));
25338         CResult_HTLCDescriptorDecodeErrorZ_free(_res_conv);
25339 }
25340
25341 static inline uint64_t CResult_HTLCDescriptorDecodeErrorZ_clone_ptr(LDKCResult_HTLCDescriptorDecodeErrorZ *NONNULL_PTR arg) {
25342         LDKCResult_HTLCDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCDescriptorDecodeErrorZ), "LDKCResult_HTLCDescriptorDecodeErrorZ");
25343         *ret_conv = CResult_HTLCDescriptorDecodeErrorZ_clone(arg);
25344         return tag_ptr(ret_conv, true);
25345 }
25346 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCDescriptorDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25347         LDKCResult_HTLCDescriptorDecodeErrorZ* arg_conv = (LDKCResult_HTLCDescriptorDecodeErrorZ*)untag_ptr(arg);
25348         int64_t ret_conv = CResult_HTLCDescriptorDecodeErrorZ_clone_ptr(arg_conv);
25349         return ret_conv;
25350 }
25351
25352 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCDescriptorDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25353         LDKCResult_HTLCDescriptorDecodeErrorZ* orig_conv = (LDKCResult_HTLCDescriptorDecodeErrorZ*)untag_ptr(orig);
25354         LDKCResult_HTLCDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCDescriptorDecodeErrorZ), "LDKCResult_HTLCDescriptorDecodeErrorZ");
25355         *ret_conv = CResult_HTLCDescriptorDecodeErrorZ_clone(orig_conv);
25356         return tag_ptr(ret_conv, true);
25357 }
25358
25359 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1ok(JNIEnv *env, jclass clz) {
25360         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
25361         *ret_conv = CResult_NoneNoneZ_ok();
25362         return tag_ptr(ret_conv, true);
25363 }
25364
25365 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1err(JNIEnv *env, jclass clz) {
25366         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
25367         *ret_conv = CResult_NoneNoneZ_err();
25368         return tag_ptr(ret_conv, true);
25369 }
25370
25371 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
25372         LDKCResult_NoneNoneZ* o_conv = (LDKCResult_NoneNoneZ*)untag_ptr(o);
25373         jboolean ret_conv = CResult_NoneNoneZ_is_ok(o_conv);
25374         return ret_conv;
25375 }
25376
25377 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
25378         if (!ptr_is_owned(_res)) return;
25379         void* _res_ptr = untag_ptr(_res);
25380         CHECK_ACCESS(_res_ptr);
25381         LDKCResult_NoneNoneZ _res_conv = *(LDKCResult_NoneNoneZ*)(_res_ptr);
25382         FREE(untag_ptr(_res));
25383         CResult_NoneNoneZ_free(_res_conv);
25384 }
25385
25386 static inline uint64_t CResult_NoneNoneZ_clone_ptr(LDKCResult_NoneNoneZ *NONNULL_PTR arg) {
25387         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
25388         *ret_conv = CResult_NoneNoneZ_clone(arg);
25389         return tag_ptr(ret_conv, true);
25390 }
25391 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25392         LDKCResult_NoneNoneZ* arg_conv = (LDKCResult_NoneNoneZ*)untag_ptr(arg);
25393         int64_t ret_conv = CResult_NoneNoneZ_clone_ptr(arg_conv);
25394         return ret_conv;
25395 }
25396
25397 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25398         LDKCResult_NoneNoneZ* orig_conv = (LDKCResult_NoneNoneZ*)untag_ptr(orig);
25399         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
25400         *ret_conv = CResult_NoneNoneZ_clone(orig_conv);
25401         return tag_ptr(ret_conv, true);
25402 }
25403
25404 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyNoneZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
25405         LDKPublicKey o_ref;
25406         CHECK((*env)->GetArrayLength(env, o) == 33);
25407         (*env)->GetByteArrayRegion(env, o, 0, 33, o_ref.compressed_form);
25408         LDKCResult_PublicKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyNoneZ), "LDKCResult_PublicKeyNoneZ");
25409         *ret_conv = CResult_PublicKeyNoneZ_ok(o_ref);
25410         return tag_ptr(ret_conv, true);
25411 }
25412
25413 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyNoneZ_1err(JNIEnv *env, jclass clz) {
25414         LDKCResult_PublicKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyNoneZ), "LDKCResult_PublicKeyNoneZ");
25415         *ret_conv = CResult_PublicKeyNoneZ_err();
25416         return tag_ptr(ret_conv, true);
25417 }
25418
25419 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
25420         LDKCResult_PublicKeyNoneZ* o_conv = (LDKCResult_PublicKeyNoneZ*)untag_ptr(o);
25421         jboolean ret_conv = CResult_PublicKeyNoneZ_is_ok(o_conv);
25422         return ret_conv;
25423 }
25424
25425 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
25426         if (!ptr_is_owned(_res)) return;
25427         void* _res_ptr = untag_ptr(_res);
25428         CHECK_ACCESS(_res_ptr);
25429         LDKCResult_PublicKeyNoneZ _res_conv = *(LDKCResult_PublicKeyNoneZ*)(_res_ptr);
25430         FREE(untag_ptr(_res));
25431         CResult_PublicKeyNoneZ_free(_res_conv);
25432 }
25433
25434 static inline uint64_t CResult_PublicKeyNoneZ_clone_ptr(LDKCResult_PublicKeyNoneZ *NONNULL_PTR arg) {
25435         LDKCResult_PublicKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyNoneZ), "LDKCResult_PublicKeyNoneZ");
25436         *ret_conv = CResult_PublicKeyNoneZ_clone(arg);
25437         return tag_ptr(ret_conv, true);
25438 }
25439 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25440         LDKCResult_PublicKeyNoneZ* arg_conv = (LDKCResult_PublicKeyNoneZ*)untag_ptr(arg);
25441         int64_t ret_conv = CResult_PublicKeyNoneZ_clone_ptr(arg_conv);
25442         return ret_conv;
25443 }
25444
25445 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25446         LDKCResult_PublicKeyNoneZ* orig_conv = (LDKCResult_PublicKeyNoneZ*)untag_ptr(orig);
25447         LDKCResult_PublicKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyNoneZ), "LDKCResult_PublicKeyNoneZ");
25448         *ret_conv = CResult_PublicKeyNoneZ_clone(orig_conv);
25449         return tag_ptr(ret_conv, true);
25450 }
25451
25452 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1BigEndianScalarZ_1some(JNIEnv *env, jclass clz, int64_t o) {
25453         void* o_ptr = untag_ptr(o);
25454         CHECK_ACCESS(o_ptr);
25455         LDKBigEndianScalar o_conv = *(LDKBigEndianScalar*)(o_ptr);
25456         o_conv = BigEndianScalar_clone((LDKBigEndianScalar*)untag_ptr(o));
25457         LDKCOption_BigEndianScalarZ *ret_copy = MALLOC(sizeof(LDKCOption_BigEndianScalarZ), "LDKCOption_BigEndianScalarZ");
25458         *ret_copy = COption_BigEndianScalarZ_some(o_conv);
25459         int64_t ret_ref = tag_ptr(ret_copy, true);
25460         return ret_ref;
25461 }
25462
25463 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1BigEndianScalarZ_1none(JNIEnv *env, jclass clz) {
25464         LDKCOption_BigEndianScalarZ *ret_copy = MALLOC(sizeof(LDKCOption_BigEndianScalarZ), "LDKCOption_BigEndianScalarZ");
25465         *ret_copy = COption_BigEndianScalarZ_none();
25466         int64_t ret_ref = tag_ptr(ret_copy, true);
25467         return ret_ref;
25468 }
25469
25470 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1BigEndianScalarZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
25471         if (!ptr_is_owned(_res)) return;
25472         void* _res_ptr = untag_ptr(_res);
25473         CHECK_ACCESS(_res_ptr);
25474         LDKCOption_BigEndianScalarZ _res_conv = *(LDKCOption_BigEndianScalarZ*)(_res_ptr);
25475         FREE(untag_ptr(_res));
25476         COption_BigEndianScalarZ_free(_res_conv);
25477 }
25478
25479 static inline uint64_t COption_BigEndianScalarZ_clone_ptr(LDKCOption_BigEndianScalarZ *NONNULL_PTR arg) {
25480         LDKCOption_BigEndianScalarZ *ret_copy = MALLOC(sizeof(LDKCOption_BigEndianScalarZ), "LDKCOption_BigEndianScalarZ");
25481         *ret_copy = COption_BigEndianScalarZ_clone(arg);
25482         int64_t ret_ref = tag_ptr(ret_copy, true);
25483         return ret_ref;
25484 }
25485 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1BigEndianScalarZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25486         LDKCOption_BigEndianScalarZ* arg_conv = (LDKCOption_BigEndianScalarZ*)untag_ptr(arg);
25487         int64_t ret_conv = COption_BigEndianScalarZ_clone_ptr(arg_conv);
25488         return ret_conv;
25489 }
25490
25491 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1BigEndianScalarZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25492         LDKCOption_BigEndianScalarZ* orig_conv = (LDKCOption_BigEndianScalarZ*)untag_ptr(orig);
25493         LDKCOption_BigEndianScalarZ *ret_copy = MALLOC(sizeof(LDKCOption_BigEndianScalarZ), "LDKCOption_BigEndianScalarZ");
25494         *ret_copy = COption_BigEndianScalarZ_clone(orig_conv);
25495         int64_t ret_ref = tag_ptr(ret_copy, true);
25496         return ret_ref;
25497 }
25498
25499 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1U5Z_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
25500         LDKCVec_U5Z _res_constr;
25501         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
25502         if (_res_constr.datalen > 0)
25503                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKU5), "LDKCVec_U5Z Elements");
25504         else
25505                 _res_constr.data = NULL;
25506         int8_t* _res_vals = (*env)->GetByteArrayElements (env, _res, NULL);
25507         for (size_t h = 0; h < _res_constr.datalen; h++) {
25508                 int8_t _res_conv_7 = _res_vals[h];
25509                 
25510                 _res_constr.data[h] = (LDKU5){ ._0 = _res_conv_7 };
25511         }
25512         (*env)->ReleaseByteArrayElements(env, _res, _res_vals, 0);
25513         CVec_U5Z_free(_res_constr);
25514 }
25515
25516 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
25517         LDKRecoverableSignature o_ref;
25518         CHECK((*env)->GetArrayLength(env, o) == 68);
25519         (*env)->GetByteArrayRegion(env, o, 0, 68, o_ref.serialized_form);
25520         LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
25521         *ret_conv = CResult_RecoverableSignatureNoneZ_ok(o_ref);
25522         return tag_ptr(ret_conv, true);
25523 }
25524
25525 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1err(JNIEnv *env, jclass clz) {
25526         LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
25527         *ret_conv = CResult_RecoverableSignatureNoneZ_err();
25528         return tag_ptr(ret_conv, true);
25529 }
25530
25531 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
25532         LDKCResult_RecoverableSignatureNoneZ* o_conv = (LDKCResult_RecoverableSignatureNoneZ*)untag_ptr(o);
25533         jboolean ret_conv = CResult_RecoverableSignatureNoneZ_is_ok(o_conv);
25534         return ret_conv;
25535 }
25536
25537 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
25538         if (!ptr_is_owned(_res)) return;
25539         void* _res_ptr = untag_ptr(_res);
25540         CHECK_ACCESS(_res_ptr);
25541         LDKCResult_RecoverableSignatureNoneZ _res_conv = *(LDKCResult_RecoverableSignatureNoneZ*)(_res_ptr);
25542         FREE(untag_ptr(_res));
25543         CResult_RecoverableSignatureNoneZ_free(_res_conv);
25544 }
25545
25546 static inline uint64_t CResult_RecoverableSignatureNoneZ_clone_ptr(LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR arg) {
25547         LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
25548         *ret_conv = CResult_RecoverableSignatureNoneZ_clone(arg);
25549         return tag_ptr(ret_conv, true);
25550 }
25551 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25552         LDKCResult_RecoverableSignatureNoneZ* arg_conv = (LDKCResult_RecoverableSignatureNoneZ*)untag_ptr(arg);
25553         int64_t ret_conv = CResult_RecoverableSignatureNoneZ_clone_ptr(arg_conv);
25554         return ret_conv;
25555 }
25556
25557 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25558         LDKCResult_RecoverableSignatureNoneZ* orig_conv = (LDKCResult_RecoverableSignatureNoneZ*)untag_ptr(orig);
25559         LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
25560         *ret_conv = CResult_RecoverableSignatureNoneZ_clone(orig_conv);
25561         return tag_ptr(ret_conv, true);
25562 }
25563
25564 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ECDSASignatureNoneZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
25565         LDKECDSASignature o_ref;
25566         CHECK((*env)->GetArrayLength(env, o) == 64);
25567         (*env)->GetByteArrayRegion(env, o, 0, 64, o_ref.compact_form);
25568         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
25569         *ret_conv = CResult_ECDSASignatureNoneZ_ok(o_ref);
25570         return tag_ptr(ret_conv, true);
25571 }
25572
25573 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ECDSASignatureNoneZ_1err(JNIEnv *env, jclass clz) {
25574         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
25575         *ret_conv = CResult_ECDSASignatureNoneZ_err();
25576         return tag_ptr(ret_conv, true);
25577 }
25578
25579 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ECDSASignatureNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
25580         LDKCResult_ECDSASignatureNoneZ* o_conv = (LDKCResult_ECDSASignatureNoneZ*)untag_ptr(o);
25581         jboolean ret_conv = CResult_ECDSASignatureNoneZ_is_ok(o_conv);
25582         return ret_conv;
25583 }
25584
25585 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ECDSASignatureNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
25586         if (!ptr_is_owned(_res)) return;
25587         void* _res_ptr = untag_ptr(_res);
25588         CHECK_ACCESS(_res_ptr);
25589         LDKCResult_ECDSASignatureNoneZ _res_conv = *(LDKCResult_ECDSASignatureNoneZ*)(_res_ptr);
25590         FREE(untag_ptr(_res));
25591         CResult_ECDSASignatureNoneZ_free(_res_conv);
25592 }
25593
25594 static inline uint64_t CResult_ECDSASignatureNoneZ_clone_ptr(LDKCResult_ECDSASignatureNoneZ *NONNULL_PTR arg) {
25595         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
25596         *ret_conv = CResult_ECDSASignatureNoneZ_clone(arg);
25597         return tag_ptr(ret_conv, true);
25598 }
25599 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ECDSASignatureNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25600         LDKCResult_ECDSASignatureNoneZ* arg_conv = (LDKCResult_ECDSASignatureNoneZ*)untag_ptr(arg);
25601         int64_t ret_conv = CResult_ECDSASignatureNoneZ_clone_ptr(arg_conv);
25602         return ret_conv;
25603 }
25604
25605 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ECDSASignatureNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25606         LDKCResult_ECDSASignatureNoneZ* orig_conv = (LDKCResult_ECDSASignatureNoneZ*)untag_ptr(orig);
25607         LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ");
25608         *ret_conv = CResult_ECDSASignatureNoneZ_clone(orig_conv);
25609         return tag_ptr(ret_conv, true);
25610 }
25611
25612 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
25613         LDKTransaction o_ref;
25614         o_ref.datalen = (*env)->GetArrayLength(env, o);
25615         o_ref.data = MALLOC(o_ref.datalen, "LDKTransaction Bytes");
25616         (*env)->GetByteArrayRegion(env, o, 0, o_ref.datalen, o_ref.data);
25617         o_ref.data_is_owned = true;
25618         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
25619         *ret_conv = CResult_TransactionNoneZ_ok(o_ref);
25620         return tag_ptr(ret_conv, true);
25621 }
25622
25623 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1err(JNIEnv *env, jclass clz) {
25624         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
25625         *ret_conv = CResult_TransactionNoneZ_err();
25626         return tag_ptr(ret_conv, true);
25627 }
25628
25629 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
25630         LDKCResult_TransactionNoneZ* o_conv = (LDKCResult_TransactionNoneZ*)untag_ptr(o);
25631         jboolean ret_conv = CResult_TransactionNoneZ_is_ok(o_conv);
25632         return ret_conv;
25633 }
25634
25635 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
25636         if (!ptr_is_owned(_res)) return;
25637         void* _res_ptr = untag_ptr(_res);
25638         CHECK_ACCESS(_res_ptr);
25639         LDKCResult_TransactionNoneZ _res_conv = *(LDKCResult_TransactionNoneZ*)(_res_ptr);
25640         FREE(untag_ptr(_res));
25641         CResult_TransactionNoneZ_free(_res_conv);
25642 }
25643
25644 static inline uint64_t CResult_TransactionNoneZ_clone_ptr(LDKCResult_TransactionNoneZ *NONNULL_PTR arg) {
25645         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
25646         *ret_conv = CResult_TransactionNoneZ_clone(arg);
25647         return tag_ptr(ret_conv, true);
25648 }
25649 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25650         LDKCResult_TransactionNoneZ* arg_conv = (LDKCResult_TransactionNoneZ*)untag_ptr(arg);
25651         int64_t ret_conv = CResult_TransactionNoneZ_clone_ptr(arg_conv);
25652         return ret_conv;
25653 }
25654
25655 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25656         LDKCResult_TransactionNoneZ* orig_conv = (LDKCResult_TransactionNoneZ*)untag_ptr(orig);
25657         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
25658         *ret_conv = CResult_TransactionNoneZ_clone(orig_conv);
25659         return tag_ptr(ret_conv, true);
25660 }
25661
25662 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1WriteableEcdsaChannelSignerDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
25663         void* o_ptr = untag_ptr(o);
25664         CHECK_ACCESS(o_ptr);
25665         LDKWriteableEcdsaChannelSigner o_conv = *(LDKWriteableEcdsaChannelSigner*)(o_ptr);
25666         if (o_conv.free == LDKWriteableEcdsaChannelSigner_JCalls_free) {
25667                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25668                 LDKWriteableEcdsaChannelSigner_JCalls_cloned(&o_conv);
25669         }
25670         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ), "LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ");
25671         *ret_conv = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_ok(o_conv);
25672         return tag_ptr(ret_conv, true);
25673 }
25674
25675 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1WriteableEcdsaChannelSignerDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
25676         void* e_ptr = untag_ptr(e);
25677         CHECK_ACCESS(e_ptr);
25678         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
25679         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
25680         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ), "LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ");
25681         *ret_conv = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_err(e_conv);
25682         return tag_ptr(ret_conv, true);
25683 }
25684
25685 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1WriteableEcdsaChannelSignerDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
25686         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* o_conv = (LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ*)untag_ptr(o);
25687         jboolean ret_conv = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_is_ok(o_conv);
25688         return ret_conv;
25689 }
25690
25691 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1WriteableEcdsaChannelSignerDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
25692         if (!ptr_is_owned(_res)) return;
25693         void* _res_ptr = untag_ptr(_res);
25694         CHECK_ACCESS(_res_ptr);
25695         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ _res_conv = *(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ*)(_res_ptr);
25696         FREE(untag_ptr(_res));
25697         CResult_WriteableEcdsaChannelSignerDecodeErrorZ_free(_res_conv);
25698 }
25699
25700 static inline uint64_t CResult_WriteableEcdsaChannelSignerDecodeErrorZ_clone_ptr(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ *NONNULL_PTR arg) {
25701         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ), "LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ");
25702         *ret_conv = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_clone(arg);
25703         return tag_ptr(ret_conv, true);
25704 }
25705 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1WriteableEcdsaChannelSignerDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25706         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* arg_conv = (LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ*)untag_ptr(arg);
25707         int64_t ret_conv = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_clone_ptr(arg_conv);
25708         return ret_conv;
25709 }
25710
25711 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1WriteableEcdsaChannelSignerDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25712         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* orig_conv = (LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ*)untag_ptr(orig);
25713         LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ), "LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ");
25714         *ret_conv = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_clone(orig_conv);
25715         return tag_ptr(ret_conv, true);
25716 }
25717
25718 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZNoneZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
25719         LDKCVec_u8Z o_ref;
25720         o_ref.datalen = (*env)->GetArrayLength(env, o);
25721         o_ref.data = MALLOC(o_ref.datalen, "LDKCVec_u8Z Bytes");
25722         (*env)->GetByteArrayRegion(env, o, 0, o_ref.datalen, o_ref.data);
25723         LDKCResult_CVec_u8ZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZNoneZ), "LDKCResult_CVec_u8ZNoneZ");
25724         *ret_conv = CResult_CVec_u8ZNoneZ_ok(o_ref);
25725         return tag_ptr(ret_conv, true);
25726 }
25727
25728 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZNoneZ_1err(JNIEnv *env, jclass clz) {
25729         LDKCResult_CVec_u8ZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZNoneZ), "LDKCResult_CVec_u8ZNoneZ");
25730         *ret_conv = CResult_CVec_u8ZNoneZ_err();
25731         return tag_ptr(ret_conv, true);
25732 }
25733
25734 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
25735         LDKCResult_CVec_u8ZNoneZ* o_conv = (LDKCResult_CVec_u8ZNoneZ*)untag_ptr(o);
25736         jboolean ret_conv = CResult_CVec_u8ZNoneZ_is_ok(o_conv);
25737         return ret_conv;
25738 }
25739
25740 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
25741         if (!ptr_is_owned(_res)) return;
25742         void* _res_ptr = untag_ptr(_res);
25743         CHECK_ACCESS(_res_ptr);
25744         LDKCResult_CVec_u8ZNoneZ _res_conv = *(LDKCResult_CVec_u8ZNoneZ*)(_res_ptr);
25745         FREE(untag_ptr(_res));
25746         CResult_CVec_u8ZNoneZ_free(_res_conv);
25747 }
25748
25749 static inline uint64_t CResult_CVec_u8ZNoneZ_clone_ptr(LDKCResult_CVec_u8ZNoneZ *NONNULL_PTR arg) {
25750         LDKCResult_CVec_u8ZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZNoneZ), "LDKCResult_CVec_u8ZNoneZ");
25751         *ret_conv = CResult_CVec_u8ZNoneZ_clone(arg);
25752         return tag_ptr(ret_conv, true);
25753 }
25754 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25755         LDKCResult_CVec_u8ZNoneZ* arg_conv = (LDKCResult_CVec_u8ZNoneZ*)untag_ptr(arg);
25756         int64_t ret_conv = CResult_CVec_u8ZNoneZ_clone_ptr(arg_conv);
25757         return ret_conv;
25758 }
25759
25760 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25761         LDKCResult_CVec_u8ZNoneZ* orig_conv = (LDKCResult_CVec_u8ZNoneZ*)untag_ptr(orig);
25762         LDKCResult_CVec_u8ZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZNoneZ), "LDKCResult_CVec_u8ZNoneZ");
25763         *ret_conv = CResult_CVec_u8ZNoneZ_clone(orig_conv);
25764         return tag_ptr(ret_conv, true);
25765 }
25766
25767 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
25768         LDKShutdownScript o_conv;
25769         o_conv.inner = untag_ptr(o);
25770         o_conv.is_owned = ptr_is_owned(o);
25771         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
25772         o_conv = ShutdownScript_clone(&o_conv);
25773         LDKCResult_ShutdownScriptNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptNoneZ), "LDKCResult_ShutdownScriptNoneZ");
25774         *ret_conv = CResult_ShutdownScriptNoneZ_ok(o_conv);
25775         return tag_ptr(ret_conv, true);
25776 }
25777
25778 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptNoneZ_1err(JNIEnv *env, jclass clz) {
25779         LDKCResult_ShutdownScriptNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptNoneZ), "LDKCResult_ShutdownScriptNoneZ");
25780         *ret_conv = CResult_ShutdownScriptNoneZ_err();
25781         return tag_ptr(ret_conv, true);
25782 }
25783
25784 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
25785         LDKCResult_ShutdownScriptNoneZ* o_conv = (LDKCResult_ShutdownScriptNoneZ*)untag_ptr(o);
25786         jboolean ret_conv = CResult_ShutdownScriptNoneZ_is_ok(o_conv);
25787         return ret_conv;
25788 }
25789
25790 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
25791         if (!ptr_is_owned(_res)) return;
25792         void* _res_ptr = untag_ptr(_res);
25793         CHECK_ACCESS(_res_ptr);
25794         LDKCResult_ShutdownScriptNoneZ _res_conv = *(LDKCResult_ShutdownScriptNoneZ*)(_res_ptr);
25795         FREE(untag_ptr(_res));
25796         CResult_ShutdownScriptNoneZ_free(_res_conv);
25797 }
25798
25799 static inline uint64_t CResult_ShutdownScriptNoneZ_clone_ptr(LDKCResult_ShutdownScriptNoneZ *NONNULL_PTR arg) {
25800         LDKCResult_ShutdownScriptNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptNoneZ), "LDKCResult_ShutdownScriptNoneZ");
25801         *ret_conv = CResult_ShutdownScriptNoneZ_clone(arg);
25802         return tag_ptr(ret_conv, true);
25803 }
25804 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25805         LDKCResult_ShutdownScriptNoneZ* arg_conv = (LDKCResult_ShutdownScriptNoneZ*)untag_ptr(arg);
25806         int64_t ret_conv = CResult_ShutdownScriptNoneZ_clone_ptr(arg_conv);
25807         return ret_conv;
25808 }
25809
25810 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25811         LDKCResult_ShutdownScriptNoneZ* orig_conv = (LDKCResult_ShutdownScriptNoneZ*)untag_ptr(orig);
25812         LDKCResult_ShutdownScriptNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptNoneZ), "LDKCResult_ShutdownScriptNoneZ");
25813         *ret_conv = CResult_ShutdownScriptNoneZ_clone(orig_conv);
25814         return tag_ptr(ret_conv, true);
25815 }
25816
25817 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u16Z_1some(JNIEnv *env, jclass clz, int16_t o) {
25818         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
25819         *ret_copy = COption_u16Z_some(o);
25820         int64_t ret_ref = tag_ptr(ret_copy, true);
25821         return ret_ref;
25822 }
25823
25824 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u16Z_1none(JNIEnv *env, jclass clz) {
25825         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
25826         *ret_copy = COption_u16Z_none();
25827         int64_t ret_ref = tag_ptr(ret_copy, true);
25828         return ret_ref;
25829 }
25830
25831 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1u16Z_1free(JNIEnv *env, jclass clz, int64_t _res) {
25832         if (!ptr_is_owned(_res)) return;
25833         void* _res_ptr = untag_ptr(_res);
25834         CHECK_ACCESS(_res_ptr);
25835         LDKCOption_u16Z _res_conv = *(LDKCOption_u16Z*)(_res_ptr);
25836         FREE(untag_ptr(_res));
25837         COption_u16Z_free(_res_conv);
25838 }
25839
25840 static inline uint64_t COption_u16Z_clone_ptr(LDKCOption_u16Z *NONNULL_PTR arg) {
25841         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
25842         *ret_copy = COption_u16Z_clone(arg);
25843         int64_t ret_ref = tag_ptr(ret_copy, true);
25844         return ret_ref;
25845 }
25846 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u16Z_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25847         LDKCOption_u16Z* arg_conv = (LDKCOption_u16Z*)untag_ptr(arg);
25848         int64_t ret_conv = COption_u16Z_clone_ptr(arg_conv);
25849         return ret_conv;
25850 }
25851
25852 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u16Z_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25853         LDKCOption_u16Z* orig_conv = (LDKCOption_u16Z*)untag_ptr(orig);
25854         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
25855         *ret_copy = COption_u16Z_clone(orig_conv);
25856         int64_t ret_ref = tag_ptr(ret_copy, true);
25857         return ret_ref;
25858 }
25859
25860 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1boolZ_1some(JNIEnv *env, jclass clz, jboolean o) {
25861         LDKCOption_boolZ *ret_copy = MALLOC(sizeof(LDKCOption_boolZ), "LDKCOption_boolZ");
25862         *ret_copy = COption_boolZ_some(o);
25863         int64_t ret_ref = tag_ptr(ret_copy, true);
25864         return ret_ref;
25865 }
25866
25867 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1boolZ_1none(JNIEnv *env, jclass clz) {
25868         LDKCOption_boolZ *ret_copy = MALLOC(sizeof(LDKCOption_boolZ), "LDKCOption_boolZ");
25869         *ret_copy = COption_boolZ_none();
25870         int64_t ret_ref = tag_ptr(ret_copy, true);
25871         return ret_ref;
25872 }
25873
25874 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1boolZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
25875         if (!ptr_is_owned(_res)) return;
25876         void* _res_ptr = untag_ptr(_res);
25877         CHECK_ACCESS(_res_ptr);
25878         LDKCOption_boolZ _res_conv = *(LDKCOption_boolZ*)(_res_ptr);
25879         FREE(untag_ptr(_res));
25880         COption_boolZ_free(_res_conv);
25881 }
25882
25883 static inline uint64_t COption_boolZ_clone_ptr(LDKCOption_boolZ *NONNULL_PTR arg) {
25884         LDKCOption_boolZ *ret_copy = MALLOC(sizeof(LDKCOption_boolZ), "LDKCOption_boolZ");
25885         *ret_copy = COption_boolZ_clone(arg);
25886         int64_t ret_ref = tag_ptr(ret_copy, true);
25887         return ret_ref;
25888 }
25889 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1boolZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25890         LDKCOption_boolZ* arg_conv = (LDKCOption_boolZ*)untag_ptr(arg);
25891         int64_t ret_conv = COption_boolZ_clone_ptr(arg_conv);
25892         return ret_conv;
25893 }
25894
25895 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1boolZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25896         LDKCOption_boolZ* orig_conv = (LDKCOption_boolZ*)untag_ptr(orig);
25897         LDKCOption_boolZ *ret_copy = MALLOC(sizeof(LDKCOption_boolZ), "LDKCOption_boolZ");
25898         *ret_copy = COption_boolZ_clone(orig_conv);
25899         int64_t ret_ref = tag_ptr(ret_copy, true);
25900         return ret_ref;
25901 }
25902
25903 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1WitnessNoneZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
25904         LDKWitness o_ref;
25905         o_ref.datalen = (*env)->GetArrayLength(env, o);
25906         o_ref.data = MALLOC(o_ref.datalen, "LDKWitness Bytes");
25907         (*env)->GetByteArrayRegion(env, o, 0, o_ref.datalen, o_ref.data);
25908         o_ref.data_is_owned = true;
25909         LDKCResult_WitnessNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_WitnessNoneZ), "LDKCResult_WitnessNoneZ");
25910         *ret_conv = CResult_WitnessNoneZ_ok(o_ref);
25911         return tag_ptr(ret_conv, true);
25912 }
25913
25914 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1WitnessNoneZ_1err(JNIEnv *env, jclass clz) {
25915         LDKCResult_WitnessNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_WitnessNoneZ), "LDKCResult_WitnessNoneZ");
25916         *ret_conv = CResult_WitnessNoneZ_err();
25917         return tag_ptr(ret_conv, true);
25918 }
25919
25920 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1WitnessNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
25921         LDKCResult_WitnessNoneZ* o_conv = (LDKCResult_WitnessNoneZ*)untag_ptr(o);
25922         jboolean ret_conv = CResult_WitnessNoneZ_is_ok(o_conv);
25923         return ret_conv;
25924 }
25925
25926 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1WitnessNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
25927         if (!ptr_is_owned(_res)) return;
25928         void* _res_ptr = untag_ptr(_res);
25929         CHECK_ACCESS(_res_ptr);
25930         LDKCResult_WitnessNoneZ _res_conv = *(LDKCResult_WitnessNoneZ*)(_res_ptr);
25931         FREE(untag_ptr(_res));
25932         CResult_WitnessNoneZ_free(_res_conv);
25933 }
25934
25935 static inline uint64_t CResult_WitnessNoneZ_clone_ptr(LDKCResult_WitnessNoneZ *NONNULL_PTR arg) {
25936         LDKCResult_WitnessNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_WitnessNoneZ), "LDKCResult_WitnessNoneZ");
25937         *ret_conv = CResult_WitnessNoneZ_clone(arg);
25938         return tag_ptr(ret_conv, true);
25939 }
25940 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1WitnessNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25941         LDKCResult_WitnessNoneZ* arg_conv = (LDKCResult_WitnessNoneZ*)untag_ptr(arg);
25942         int64_t ret_conv = CResult_WitnessNoneZ_clone_ptr(arg_conv);
25943         return ret_conv;
25944 }
25945
25946 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1WitnessNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25947         LDKCResult_WitnessNoneZ* orig_conv = (LDKCResult_WitnessNoneZ*)untag_ptr(orig);
25948         LDKCResult_WitnessNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_WitnessNoneZ), "LDKCResult_WitnessNoneZ");
25949         *ret_conv = CResult_WitnessNoneZ_clone(orig_conv);
25950         return tag_ptr(ret_conv, true);
25951 }
25952
25953 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1ECDSASignatureZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
25954         LDKCVec_ECDSASignatureZ _res_constr;
25955         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
25956         if (_res_constr.datalen > 0)
25957                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKECDSASignature), "LDKCVec_ECDSASignatureZ Elements");
25958         else
25959                 _res_constr.data = NULL;
25960         for (size_t i = 0; i < _res_constr.datalen; i++) {
25961                 int8_tArray _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
25962                 LDKECDSASignature _res_conv_8_ref;
25963                 CHECK((*env)->GetArrayLength(env, _res_conv_8) == 64);
25964                 (*env)->GetByteArrayRegion(env, _res_conv_8, 0, 64, _res_conv_8_ref.compact_form);
25965                 _res_constr.data[i] = _res_conv_8_ref;
25966         }
25967         CVec_ECDSASignatureZ_free(_res_constr);
25968 }
25969
25970 static inline uint64_t C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_clone_ptr(LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ *NONNULL_PTR arg) {
25971         LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ), "LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ");
25972         *ret_conv = C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_clone(arg);
25973         return tag_ptr(ret_conv, true);
25974 }
25975 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ECDSASignatureCVec_1ECDSASignatureZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
25976         LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ* arg_conv = (LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ*)untag_ptr(arg);
25977         int64_t ret_conv = C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_clone_ptr(arg_conv);
25978         return ret_conv;
25979 }
25980
25981 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ECDSASignatureCVec_1ECDSASignatureZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25982         LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ* orig_conv = (LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ*)untag_ptr(orig);
25983         LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ), "LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ");
25984         *ret_conv = C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_clone(orig_conv);
25985         return tag_ptr(ret_conv, true);
25986 }
25987
25988 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ECDSASignatureCVec_1ECDSASignatureZZ_1new(JNIEnv *env, jclass clz, int8_tArray a, jobjectArray b) {
25989         LDKECDSASignature a_ref;
25990         CHECK((*env)->GetArrayLength(env, a) == 64);
25991         (*env)->GetByteArrayRegion(env, a, 0, 64, a_ref.compact_form);
25992         LDKCVec_ECDSASignatureZ b_constr;
25993         b_constr.datalen = (*env)->GetArrayLength(env, b);
25994         if (b_constr.datalen > 0)
25995                 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKECDSASignature), "LDKCVec_ECDSASignatureZ Elements");
25996         else
25997                 b_constr.data = NULL;
25998         for (size_t i = 0; i < b_constr.datalen; i++) {
25999                 int8_tArray b_conv_8 = (*env)->GetObjectArrayElement(env, b, i);
26000                 LDKECDSASignature b_conv_8_ref;
26001                 CHECK((*env)->GetArrayLength(env, b_conv_8) == 64);
26002                 (*env)->GetByteArrayRegion(env, b_conv_8, 0, 64, b_conv_8_ref.compact_form);
26003                 b_constr.data[i] = b_conv_8_ref;
26004         }
26005         LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ), "LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ");
26006         *ret_conv = C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_new(a_ref, b_constr);
26007         return tag_ptr(ret_conv, true);
26008 }
26009
26010 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ECDSASignatureCVec_1ECDSASignatureZZ_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         LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ _res_conv = *(LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ*)(_res_ptr);
26015         FREE(untag_ptr(_res));
26016         C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_free(_res_conv);
26017 }
26018
26019 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ECDSASignatureCVec_1ECDSASignatureZZNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
26020         void* o_ptr = untag_ptr(o);
26021         CHECK_ACCESS(o_ptr);
26022         LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ o_conv = *(LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ*)(o_ptr);
26023         o_conv = C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_clone((LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ*)untag_ptr(o));
26024         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ), "LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ");
26025         *ret_conv = CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_ok(o_conv);
26026         return tag_ptr(ret_conv, true);
26027 }
26028
26029 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ECDSASignatureCVec_1ECDSASignatureZZNoneZ_1err(JNIEnv *env, jclass clz) {
26030         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ), "LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ");
26031         *ret_conv = CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_err();
26032         return tag_ptr(ret_conv, true);
26033 }
26034
26035 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ECDSASignatureCVec_1ECDSASignatureZZNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
26036         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ* o_conv = (LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ*)untag_ptr(o);
26037         jboolean ret_conv = CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_is_ok(o_conv);
26038         return ret_conv;
26039 }
26040
26041 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ECDSASignatureCVec_1ECDSASignatureZZNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
26042         if (!ptr_is_owned(_res)) return;
26043         void* _res_ptr = untag_ptr(_res);
26044         CHECK_ACCESS(_res_ptr);
26045         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ _res_conv = *(LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ*)(_res_ptr);
26046         FREE(untag_ptr(_res));
26047         CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_free(_res_conv);
26048 }
26049
26050 static inline uint64_t CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_clone_ptr(LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ *NONNULL_PTR arg) {
26051         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ), "LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ");
26052         *ret_conv = CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_clone(arg);
26053         return tag_ptr(ret_conv, true);
26054 }
26055 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ECDSASignatureCVec_1ECDSASignatureZZNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
26056         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ* arg_conv = (LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ*)untag_ptr(arg);
26057         int64_t ret_conv = CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_clone_ptr(arg_conv);
26058         return ret_conv;
26059 }
26060
26061 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ECDSASignatureCVec_1ECDSASignatureZZNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26062         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ* orig_conv = (LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ*)untag_ptr(orig);
26063         LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ), "LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ");
26064         *ret_conv = CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_clone(orig_conv);
26065         return tag_ptr(ret_conv, true);
26066 }
26067
26068 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
26069         LDKInMemorySigner o_conv;
26070         o_conv.inner = untag_ptr(o);
26071         o_conv.is_owned = ptr_is_owned(o);
26072         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
26073         o_conv = InMemorySigner_clone(&o_conv);
26074         LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
26075         *ret_conv = CResult_InMemorySignerDecodeErrorZ_ok(o_conv);
26076         return tag_ptr(ret_conv, true);
26077 }
26078
26079 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
26080         void* e_ptr = untag_ptr(e);
26081         CHECK_ACCESS(e_ptr);
26082         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
26083         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
26084         LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
26085         *ret_conv = CResult_InMemorySignerDecodeErrorZ_err(e_conv);
26086         return tag_ptr(ret_conv, true);
26087 }
26088
26089 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
26090         LDKCResult_InMemorySignerDecodeErrorZ* o_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)untag_ptr(o);
26091         jboolean ret_conv = CResult_InMemorySignerDecodeErrorZ_is_ok(o_conv);
26092         return ret_conv;
26093 }
26094
26095 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
26096         if (!ptr_is_owned(_res)) return;
26097         void* _res_ptr = untag_ptr(_res);
26098         CHECK_ACCESS(_res_ptr);
26099         LDKCResult_InMemorySignerDecodeErrorZ _res_conv = *(LDKCResult_InMemorySignerDecodeErrorZ*)(_res_ptr);
26100         FREE(untag_ptr(_res));
26101         CResult_InMemorySignerDecodeErrorZ_free(_res_conv);
26102 }
26103
26104 static inline uint64_t CResult_InMemorySignerDecodeErrorZ_clone_ptr(LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR arg) {
26105         LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
26106         *ret_conv = CResult_InMemorySignerDecodeErrorZ_clone(arg);
26107         return tag_ptr(ret_conv, true);
26108 }
26109 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
26110         LDKCResult_InMemorySignerDecodeErrorZ* arg_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)untag_ptr(arg);
26111         int64_t ret_conv = CResult_InMemorySignerDecodeErrorZ_clone_ptr(arg_conv);
26112         return ret_conv;
26113 }
26114
26115 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26116         LDKCResult_InMemorySignerDecodeErrorZ* orig_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)untag_ptr(orig);
26117         LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
26118         *ret_conv = CResult_InMemorySignerDecodeErrorZ_clone(orig_conv);
26119         return tag_ptr(ret_conv, true);
26120 }
26121
26122 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1WriteableScoreZ_1some(JNIEnv *env, jclass clz, int64_t o) {
26123         void* o_ptr = untag_ptr(o);
26124         CHECK_ACCESS(o_ptr);
26125         LDKWriteableScore o_conv = *(LDKWriteableScore*)(o_ptr);
26126         if (o_conv.free == LDKWriteableScore_JCalls_free) {
26127                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
26128                 LDKWriteableScore_JCalls_cloned(&o_conv);
26129         }
26130         LDKCOption_WriteableScoreZ *ret_copy = MALLOC(sizeof(LDKCOption_WriteableScoreZ), "LDKCOption_WriteableScoreZ");
26131         *ret_copy = COption_WriteableScoreZ_some(o_conv);
26132         int64_t ret_ref = tag_ptr(ret_copy, true);
26133         return ret_ref;
26134 }
26135
26136 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1WriteableScoreZ_1none(JNIEnv *env, jclass clz) {
26137         LDKCOption_WriteableScoreZ *ret_copy = MALLOC(sizeof(LDKCOption_WriteableScoreZ), "LDKCOption_WriteableScoreZ");
26138         *ret_copy = COption_WriteableScoreZ_none();
26139         int64_t ret_ref = tag_ptr(ret_copy, true);
26140         return ret_ref;
26141 }
26142
26143 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1WriteableScoreZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
26144         if (!ptr_is_owned(_res)) return;
26145         void* _res_ptr = untag_ptr(_res);
26146         CHECK_ACCESS(_res_ptr);
26147         LDKCOption_WriteableScoreZ _res_conv = *(LDKCOption_WriteableScoreZ*)(_res_ptr);
26148         FREE(untag_ptr(_res));
26149         COption_WriteableScoreZ_free(_res_conv);
26150 }
26151
26152 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneIOErrorZ_1ok(JNIEnv *env, jclass clz) {
26153         LDKCResult_NoneIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneIOErrorZ), "LDKCResult_NoneIOErrorZ");
26154         *ret_conv = CResult_NoneIOErrorZ_ok();
26155         return tag_ptr(ret_conv, true);
26156 }
26157
26158 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneIOErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
26159         LDKIOError e_conv = LDKIOError_from_java(env, e);
26160         LDKCResult_NoneIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneIOErrorZ), "LDKCResult_NoneIOErrorZ");
26161         *ret_conv = CResult_NoneIOErrorZ_err(e_conv);
26162         return tag_ptr(ret_conv, true);
26163 }
26164
26165 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NoneIOErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
26166         LDKCResult_NoneIOErrorZ* o_conv = (LDKCResult_NoneIOErrorZ*)untag_ptr(o);
26167         jboolean ret_conv = CResult_NoneIOErrorZ_is_ok(o_conv);
26168         return ret_conv;
26169 }
26170
26171 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneIOErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
26172         if (!ptr_is_owned(_res)) return;
26173         void* _res_ptr = untag_ptr(_res);
26174         CHECK_ACCESS(_res_ptr);
26175         LDKCResult_NoneIOErrorZ _res_conv = *(LDKCResult_NoneIOErrorZ*)(_res_ptr);
26176         FREE(untag_ptr(_res));
26177         CResult_NoneIOErrorZ_free(_res_conv);
26178 }
26179
26180 static inline uint64_t CResult_NoneIOErrorZ_clone_ptr(LDKCResult_NoneIOErrorZ *NONNULL_PTR arg) {
26181         LDKCResult_NoneIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneIOErrorZ), "LDKCResult_NoneIOErrorZ");
26182         *ret_conv = CResult_NoneIOErrorZ_clone(arg);
26183         return tag_ptr(ret_conv, true);
26184 }
26185 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneIOErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
26186         LDKCResult_NoneIOErrorZ* arg_conv = (LDKCResult_NoneIOErrorZ*)untag_ptr(arg);
26187         int64_t ret_conv = CResult_NoneIOErrorZ_clone_ptr(arg_conv);
26188         return ret_conv;
26189 }
26190
26191 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneIOErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26192         LDKCResult_NoneIOErrorZ* orig_conv = (LDKCResult_NoneIOErrorZ*)untag_ptr(orig);
26193         LDKCResult_NoneIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneIOErrorZ), "LDKCResult_NoneIOErrorZ");
26194         *ret_conv = CResult_NoneIOErrorZ_clone(orig_conv);
26195         return tag_ptr(ret_conv, true);
26196 }
26197
26198 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1ChannelDetailsZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
26199         LDKCVec_ChannelDetailsZ _res_constr;
26200         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
26201         if (_res_constr.datalen > 0)
26202                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
26203         else
26204                 _res_constr.data = NULL;
26205         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
26206         for (size_t q = 0; q < _res_constr.datalen; q++) {
26207                 int64_t _res_conv_16 = _res_vals[q];
26208                 LDKChannelDetails _res_conv_16_conv;
26209                 _res_conv_16_conv.inner = untag_ptr(_res_conv_16);
26210                 _res_conv_16_conv.is_owned = ptr_is_owned(_res_conv_16);
26211                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_16_conv);
26212                 _res_constr.data[q] = _res_conv_16_conv;
26213         }
26214         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
26215         CVec_ChannelDetailsZ_free(_res_constr);
26216 }
26217
26218 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
26219         LDKRoute o_conv;
26220         o_conv.inner = untag_ptr(o);
26221         o_conv.is_owned = ptr_is_owned(o);
26222         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
26223         o_conv = Route_clone(&o_conv);
26224         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
26225         *ret_conv = CResult_RouteLightningErrorZ_ok(o_conv);
26226         return tag_ptr(ret_conv, true);
26227 }
26228
26229 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
26230         LDKLightningError e_conv;
26231         e_conv.inner = untag_ptr(e);
26232         e_conv.is_owned = ptr_is_owned(e);
26233         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
26234         e_conv = LightningError_clone(&e_conv);
26235         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
26236         *ret_conv = CResult_RouteLightningErrorZ_err(e_conv);
26237         return tag_ptr(ret_conv, true);
26238 }
26239
26240 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
26241         LDKCResult_RouteLightningErrorZ* o_conv = (LDKCResult_RouteLightningErrorZ*)untag_ptr(o);
26242         jboolean ret_conv = CResult_RouteLightningErrorZ_is_ok(o_conv);
26243         return ret_conv;
26244 }
26245
26246 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
26247         if (!ptr_is_owned(_res)) return;
26248         void* _res_ptr = untag_ptr(_res);
26249         CHECK_ACCESS(_res_ptr);
26250         LDKCResult_RouteLightningErrorZ _res_conv = *(LDKCResult_RouteLightningErrorZ*)(_res_ptr);
26251         FREE(untag_ptr(_res));
26252         CResult_RouteLightningErrorZ_free(_res_conv);
26253 }
26254
26255 static inline uint64_t CResult_RouteLightningErrorZ_clone_ptr(LDKCResult_RouteLightningErrorZ *NONNULL_PTR arg) {
26256         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
26257         *ret_conv = CResult_RouteLightningErrorZ_clone(arg);
26258         return tag_ptr(ret_conv, true);
26259 }
26260 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
26261         LDKCResult_RouteLightningErrorZ* arg_conv = (LDKCResult_RouteLightningErrorZ*)untag_ptr(arg);
26262         int64_t ret_conv = CResult_RouteLightningErrorZ_clone_ptr(arg_conv);
26263         return ret_conv;
26264 }
26265
26266 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26267         LDKCResult_RouteLightningErrorZ* orig_conv = (LDKCResult_RouteLightningErrorZ*)untag_ptr(orig);
26268         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
26269         *ret_conv = CResult_RouteLightningErrorZ_clone(orig_conv);
26270         return tag_ptr(ret_conv, true);
26271 }
26272
26273 static inline uint64_t C2Tuple_BlindedPayInfoBlindedPathZ_clone_ptr(LDKC2Tuple_BlindedPayInfoBlindedPathZ *NONNULL_PTR arg) {
26274         LDKC2Tuple_BlindedPayInfoBlindedPathZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKC2Tuple_BlindedPayInfoBlindedPathZ");
26275         *ret_conv = C2Tuple_BlindedPayInfoBlindedPathZ_clone(arg);
26276         return tag_ptr(ret_conv, true);
26277 }
26278 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlindedPayInfoBlindedPathZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
26279         LDKC2Tuple_BlindedPayInfoBlindedPathZ* arg_conv = (LDKC2Tuple_BlindedPayInfoBlindedPathZ*)untag_ptr(arg);
26280         int64_t ret_conv = C2Tuple_BlindedPayInfoBlindedPathZ_clone_ptr(arg_conv);
26281         return ret_conv;
26282 }
26283
26284 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlindedPayInfoBlindedPathZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26285         LDKC2Tuple_BlindedPayInfoBlindedPathZ* orig_conv = (LDKC2Tuple_BlindedPayInfoBlindedPathZ*)untag_ptr(orig);
26286         LDKC2Tuple_BlindedPayInfoBlindedPathZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKC2Tuple_BlindedPayInfoBlindedPathZ");
26287         *ret_conv = C2Tuple_BlindedPayInfoBlindedPathZ_clone(orig_conv);
26288         return tag_ptr(ret_conv, true);
26289 }
26290
26291 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlindedPayInfoBlindedPathZ_1new(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
26292         LDKBlindedPayInfo a_conv;
26293         a_conv.inner = untag_ptr(a);
26294         a_conv.is_owned = ptr_is_owned(a);
26295         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
26296         a_conv = BlindedPayInfo_clone(&a_conv);
26297         LDKBlindedPath b_conv;
26298         b_conv.inner = untag_ptr(b);
26299         b_conv.is_owned = ptr_is_owned(b);
26300         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
26301         b_conv = BlindedPath_clone(&b_conv);
26302         LDKC2Tuple_BlindedPayInfoBlindedPathZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKC2Tuple_BlindedPayInfoBlindedPathZ");
26303         *ret_conv = C2Tuple_BlindedPayInfoBlindedPathZ_new(a_conv, b_conv);
26304         return tag_ptr(ret_conv, true);
26305 }
26306
26307 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlindedPayInfoBlindedPathZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
26308         if (!ptr_is_owned(_res)) return;
26309         void* _res_ptr = untag_ptr(_res);
26310         CHECK_ACCESS(_res_ptr);
26311         LDKC2Tuple_BlindedPayInfoBlindedPathZ _res_conv = *(LDKC2Tuple_BlindedPayInfoBlindedPathZ*)(_res_ptr);
26312         FREE(untag_ptr(_res));
26313         C2Tuple_BlindedPayInfoBlindedPathZ_free(_res_conv);
26314 }
26315
26316 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1BlindedPayInfoBlindedPathZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
26317         LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ _res_constr;
26318         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
26319         if (_res_constr.datalen > 0)
26320                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ Elements");
26321         else
26322                 _res_constr.data = NULL;
26323         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
26324         for (size_t l = 0; l < _res_constr.datalen; l++) {
26325                 int64_t _res_conv_37 = _res_vals[l];
26326                 void* _res_conv_37_ptr = untag_ptr(_res_conv_37);
26327                 CHECK_ACCESS(_res_conv_37_ptr);
26328                 LDKC2Tuple_BlindedPayInfoBlindedPathZ _res_conv_37_conv = *(LDKC2Tuple_BlindedPayInfoBlindedPathZ*)(_res_conv_37_ptr);
26329                 FREE(untag_ptr(_res_conv_37));
26330                 _res_constr.data[l] = _res_conv_37_conv;
26331         }
26332         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
26333         CVec_C2Tuple_BlindedPayInfoBlindedPathZZ_free(_res_constr);
26334 }
26335
26336 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1BlindedPayInfoBlindedPathZZNoneZ_1ok(JNIEnv *env, jclass clz, int64_tArray o) {
26337         LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ o_constr;
26338         o_constr.datalen = (*env)->GetArrayLength(env, o);
26339         if (o_constr.datalen > 0)
26340                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ Elements");
26341         else
26342                 o_constr.data = NULL;
26343         int64_t* o_vals = (*env)->GetLongArrayElements (env, o, NULL);
26344         for (size_t l = 0; l < o_constr.datalen; l++) {
26345                 int64_t o_conv_37 = o_vals[l];
26346                 void* o_conv_37_ptr = untag_ptr(o_conv_37);
26347                 CHECK_ACCESS(o_conv_37_ptr);
26348                 LDKC2Tuple_BlindedPayInfoBlindedPathZ o_conv_37_conv = *(LDKC2Tuple_BlindedPayInfoBlindedPathZ*)(o_conv_37_ptr);
26349                 o_conv_37_conv = C2Tuple_BlindedPayInfoBlindedPathZ_clone((LDKC2Tuple_BlindedPayInfoBlindedPathZ*)untag_ptr(o_conv_37));
26350                 o_constr.data[l] = o_conv_37_conv;
26351         }
26352         (*env)->ReleaseLongArrayElements(env, o, o_vals, 0);
26353         LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ), "LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ");
26354         *ret_conv = CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_ok(o_constr);
26355         return tag_ptr(ret_conv, true);
26356 }
26357
26358 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1BlindedPayInfoBlindedPathZZNoneZ_1err(JNIEnv *env, jclass clz) {
26359         LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ), "LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ");
26360         *ret_conv = CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_err();
26361         return tag_ptr(ret_conv, true);
26362 }
26363
26364 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1BlindedPayInfoBlindedPathZZNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
26365         LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ* o_conv = (LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ*)untag_ptr(o);
26366         jboolean ret_conv = CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_is_ok(o_conv);
26367         return ret_conv;
26368 }
26369
26370 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1BlindedPayInfoBlindedPathZZNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
26371         if (!ptr_is_owned(_res)) return;
26372         void* _res_ptr = untag_ptr(_res);
26373         CHECK_ACCESS(_res_ptr);
26374         LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ _res_conv = *(LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ*)(_res_ptr);
26375         FREE(untag_ptr(_res));
26376         CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_free(_res_conv);
26377 }
26378
26379 static inline uint64_t CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_clone_ptr(LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ *NONNULL_PTR arg) {
26380         LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ), "LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ");
26381         *ret_conv = CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_clone(arg);
26382         return tag_ptr(ret_conv, true);
26383 }
26384 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1BlindedPayInfoBlindedPathZZNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
26385         LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ* arg_conv = (LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ*)untag_ptr(arg);
26386         int64_t ret_conv = CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_clone_ptr(arg_conv);
26387         return ret_conv;
26388 }
26389
26390 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1BlindedPayInfoBlindedPathZZNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26391         LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ* orig_conv = (LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ*)untag_ptr(orig);
26392         LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ), "LDKCResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ");
26393         *ret_conv = CResult_CVec_C2Tuple_BlindedPayInfoBlindedPathZZNoneZ_clone(orig_conv);
26394         return tag_ptr(ret_conv, true);
26395 }
26396
26397 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1PublicKeyZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
26398         LDKCVec_PublicKeyZ _res_constr;
26399         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
26400         if (_res_constr.datalen > 0)
26401                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
26402         else
26403                 _res_constr.data = NULL;
26404         for (size_t i = 0; i < _res_constr.datalen; i++) {
26405                 int8_tArray _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
26406                 LDKPublicKey _res_conv_8_ref;
26407                 CHECK((*env)->GetArrayLength(env, _res_conv_8) == 33);
26408                 (*env)->GetByteArrayRegion(env, _res_conv_8, 0, 33, _res_conv_8_ref.compressed_form);
26409                 _res_constr.data[i] = _res_conv_8_ref;
26410         }
26411         CVec_PublicKeyZ_free(_res_constr);
26412 }
26413
26414 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OnionMessagePathNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
26415         LDKOnionMessagePath o_conv;
26416         o_conv.inner = untag_ptr(o);
26417         o_conv.is_owned = ptr_is_owned(o);
26418         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
26419         o_conv = OnionMessagePath_clone(&o_conv);
26420         LDKCResult_OnionMessagePathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessagePathNoneZ), "LDKCResult_OnionMessagePathNoneZ");
26421         *ret_conv = CResult_OnionMessagePathNoneZ_ok(o_conv);
26422         return tag_ptr(ret_conv, true);
26423 }
26424
26425 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OnionMessagePathNoneZ_1err(JNIEnv *env, jclass clz) {
26426         LDKCResult_OnionMessagePathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessagePathNoneZ), "LDKCResult_OnionMessagePathNoneZ");
26427         *ret_conv = CResult_OnionMessagePathNoneZ_err();
26428         return tag_ptr(ret_conv, true);
26429 }
26430
26431 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1OnionMessagePathNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
26432         LDKCResult_OnionMessagePathNoneZ* o_conv = (LDKCResult_OnionMessagePathNoneZ*)untag_ptr(o);
26433         jboolean ret_conv = CResult_OnionMessagePathNoneZ_is_ok(o_conv);
26434         return ret_conv;
26435 }
26436
26437 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1OnionMessagePathNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
26438         if (!ptr_is_owned(_res)) return;
26439         void* _res_ptr = untag_ptr(_res);
26440         CHECK_ACCESS(_res_ptr);
26441         LDKCResult_OnionMessagePathNoneZ _res_conv = *(LDKCResult_OnionMessagePathNoneZ*)(_res_ptr);
26442         FREE(untag_ptr(_res));
26443         CResult_OnionMessagePathNoneZ_free(_res_conv);
26444 }
26445
26446 static inline uint64_t CResult_OnionMessagePathNoneZ_clone_ptr(LDKCResult_OnionMessagePathNoneZ *NONNULL_PTR arg) {
26447         LDKCResult_OnionMessagePathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessagePathNoneZ), "LDKCResult_OnionMessagePathNoneZ");
26448         *ret_conv = CResult_OnionMessagePathNoneZ_clone(arg);
26449         return tag_ptr(ret_conv, true);
26450 }
26451 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OnionMessagePathNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
26452         LDKCResult_OnionMessagePathNoneZ* arg_conv = (LDKCResult_OnionMessagePathNoneZ*)untag_ptr(arg);
26453         int64_t ret_conv = CResult_OnionMessagePathNoneZ_clone_ptr(arg_conv);
26454         return ret_conv;
26455 }
26456
26457 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OnionMessagePathNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26458         LDKCResult_OnionMessagePathNoneZ* orig_conv = (LDKCResult_OnionMessagePathNoneZ*)untag_ptr(orig);
26459         LDKCResult_OnionMessagePathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessagePathNoneZ), "LDKCResult_OnionMessagePathNoneZ");
26460         *ret_conv = CResult_OnionMessagePathNoneZ_clone(orig_conv);
26461         return tag_ptr(ret_conv, true);
26462 }
26463
26464 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1BlindedPathZNoneZ_1ok(JNIEnv *env, jclass clz, int64_tArray o) {
26465         LDKCVec_BlindedPathZ o_constr;
26466         o_constr.datalen = (*env)->GetArrayLength(env, o);
26467         if (o_constr.datalen > 0)
26468                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKBlindedPath), "LDKCVec_BlindedPathZ Elements");
26469         else
26470                 o_constr.data = NULL;
26471         int64_t* o_vals = (*env)->GetLongArrayElements (env, o, NULL);
26472         for (size_t n = 0; n < o_constr.datalen; n++) {
26473                 int64_t o_conv_13 = o_vals[n];
26474                 LDKBlindedPath o_conv_13_conv;
26475                 o_conv_13_conv.inner = untag_ptr(o_conv_13);
26476                 o_conv_13_conv.is_owned = ptr_is_owned(o_conv_13);
26477                 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv_13_conv);
26478                 o_conv_13_conv = BlindedPath_clone(&o_conv_13_conv);
26479                 o_constr.data[n] = o_conv_13_conv;
26480         }
26481         (*env)->ReleaseLongArrayElements(env, o, o_vals, 0);
26482         LDKCResult_CVec_BlindedPathZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_BlindedPathZNoneZ), "LDKCResult_CVec_BlindedPathZNoneZ");
26483         *ret_conv = CResult_CVec_BlindedPathZNoneZ_ok(o_constr);
26484         return tag_ptr(ret_conv, true);
26485 }
26486
26487 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1BlindedPathZNoneZ_1err(JNIEnv *env, jclass clz) {
26488         LDKCResult_CVec_BlindedPathZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_BlindedPathZNoneZ), "LDKCResult_CVec_BlindedPathZNoneZ");
26489         *ret_conv = CResult_CVec_BlindedPathZNoneZ_err();
26490         return tag_ptr(ret_conv, true);
26491 }
26492
26493 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1BlindedPathZNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
26494         LDKCResult_CVec_BlindedPathZNoneZ* o_conv = (LDKCResult_CVec_BlindedPathZNoneZ*)untag_ptr(o);
26495         jboolean ret_conv = CResult_CVec_BlindedPathZNoneZ_is_ok(o_conv);
26496         return ret_conv;
26497 }
26498
26499 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1BlindedPathZNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
26500         if (!ptr_is_owned(_res)) return;
26501         void* _res_ptr = untag_ptr(_res);
26502         CHECK_ACCESS(_res_ptr);
26503         LDKCResult_CVec_BlindedPathZNoneZ _res_conv = *(LDKCResult_CVec_BlindedPathZNoneZ*)(_res_ptr);
26504         FREE(untag_ptr(_res));
26505         CResult_CVec_BlindedPathZNoneZ_free(_res_conv);
26506 }
26507
26508 static inline uint64_t CResult_CVec_BlindedPathZNoneZ_clone_ptr(LDKCResult_CVec_BlindedPathZNoneZ *NONNULL_PTR arg) {
26509         LDKCResult_CVec_BlindedPathZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_BlindedPathZNoneZ), "LDKCResult_CVec_BlindedPathZNoneZ");
26510         *ret_conv = CResult_CVec_BlindedPathZNoneZ_clone(arg);
26511         return tag_ptr(ret_conv, true);
26512 }
26513 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1BlindedPathZNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
26514         LDKCResult_CVec_BlindedPathZNoneZ* arg_conv = (LDKCResult_CVec_BlindedPathZNoneZ*)untag_ptr(arg);
26515         int64_t ret_conv = CResult_CVec_BlindedPathZNoneZ_clone_ptr(arg_conv);
26516         return ret_conv;
26517 }
26518
26519 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1BlindedPathZNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26520         LDKCResult_CVec_BlindedPathZNoneZ* orig_conv = (LDKCResult_CVec_BlindedPathZNoneZ*)untag_ptr(orig);
26521         LDKCResult_CVec_BlindedPathZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_BlindedPathZNoneZ), "LDKCResult_CVec_BlindedPathZNoneZ");
26522         *ret_conv = CResult_CVec_BlindedPathZNoneZ_clone(orig_conv);
26523         return tag_ptr(ret_conv, true);
26524 }
26525
26526 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InFlightHtlcsDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
26527         LDKInFlightHtlcs o_conv;
26528         o_conv.inner = untag_ptr(o);
26529         o_conv.is_owned = ptr_is_owned(o);
26530         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
26531         o_conv = InFlightHtlcs_clone(&o_conv);
26532         LDKCResult_InFlightHtlcsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InFlightHtlcsDecodeErrorZ), "LDKCResult_InFlightHtlcsDecodeErrorZ");
26533         *ret_conv = CResult_InFlightHtlcsDecodeErrorZ_ok(o_conv);
26534         return tag_ptr(ret_conv, true);
26535 }
26536
26537 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InFlightHtlcsDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
26538         void* e_ptr = untag_ptr(e);
26539         CHECK_ACCESS(e_ptr);
26540         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
26541         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
26542         LDKCResult_InFlightHtlcsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InFlightHtlcsDecodeErrorZ), "LDKCResult_InFlightHtlcsDecodeErrorZ");
26543         *ret_conv = CResult_InFlightHtlcsDecodeErrorZ_err(e_conv);
26544         return tag_ptr(ret_conv, true);
26545 }
26546
26547 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1InFlightHtlcsDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
26548         LDKCResult_InFlightHtlcsDecodeErrorZ* o_conv = (LDKCResult_InFlightHtlcsDecodeErrorZ*)untag_ptr(o);
26549         jboolean ret_conv = CResult_InFlightHtlcsDecodeErrorZ_is_ok(o_conv);
26550         return ret_conv;
26551 }
26552
26553 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InFlightHtlcsDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
26554         if (!ptr_is_owned(_res)) return;
26555         void* _res_ptr = untag_ptr(_res);
26556         CHECK_ACCESS(_res_ptr);
26557         LDKCResult_InFlightHtlcsDecodeErrorZ _res_conv = *(LDKCResult_InFlightHtlcsDecodeErrorZ*)(_res_ptr);
26558         FREE(untag_ptr(_res));
26559         CResult_InFlightHtlcsDecodeErrorZ_free(_res_conv);
26560 }
26561
26562 static inline uint64_t CResult_InFlightHtlcsDecodeErrorZ_clone_ptr(LDKCResult_InFlightHtlcsDecodeErrorZ *NONNULL_PTR arg) {
26563         LDKCResult_InFlightHtlcsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InFlightHtlcsDecodeErrorZ), "LDKCResult_InFlightHtlcsDecodeErrorZ");
26564         *ret_conv = CResult_InFlightHtlcsDecodeErrorZ_clone(arg);
26565         return tag_ptr(ret_conv, true);
26566 }
26567 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InFlightHtlcsDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
26568         LDKCResult_InFlightHtlcsDecodeErrorZ* arg_conv = (LDKCResult_InFlightHtlcsDecodeErrorZ*)untag_ptr(arg);
26569         int64_t ret_conv = CResult_InFlightHtlcsDecodeErrorZ_clone_ptr(arg_conv);
26570         return ret_conv;
26571 }
26572
26573 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InFlightHtlcsDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26574         LDKCResult_InFlightHtlcsDecodeErrorZ* orig_conv = (LDKCResult_InFlightHtlcsDecodeErrorZ*)untag_ptr(orig);
26575         LDKCResult_InFlightHtlcsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InFlightHtlcsDecodeErrorZ), "LDKCResult_InFlightHtlcsDecodeErrorZ");
26576         *ret_conv = CResult_InFlightHtlcsDecodeErrorZ_clone(orig_conv);
26577         return tag_ptr(ret_conv, true);
26578 }
26579
26580 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
26581         LDKRouteHop o_conv;
26582         o_conv.inner = untag_ptr(o);
26583         o_conv.is_owned = ptr_is_owned(o);
26584         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
26585         o_conv = RouteHop_clone(&o_conv);
26586         LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
26587         *ret_conv = CResult_RouteHopDecodeErrorZ_ok(o_conv);
26588         return tag_ptr(ret_conv, true);
26589 }
26590
26591 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
26592         void* e_ptr = untag_ptr(e);
26593         CHECK_ACCESS(e_ptr);
26594         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
26595         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
26596         LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
26597         *ret_conv = CResult_RouteHopDecodeErrorZ_err(e_conv);
26598         return tag_ptr(ret_conv, true);
26599 }
26600
26601 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
26602         LDKCResult_RouteHopDecodeErrorZ* o_conv = (LDKCResult_RouteHopDecodeErrorZ*)untag_ptr(o);
26603         jboolean ret_conv = CResult_RouteHopDecodeErrorZ_is_ok(o_conv);
26604         return ret_conv;
26605 }
26606
26607 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
26608         if (!ptr_is_owned(_res)) return;
26609         void* _res_ptr = untag_ptr(_res);
26610         CHECK_ACCESS(_res_ptr);
26611         LDKCResult_RouteHopDecodeErrorZ _res_conv = *(LDKCResult_RouteHopDecodeErrorZ*)(_res_ptr);
26612         FREE(untag_ptr(_res));
26613         CResult_RouteHopDecodeErrorZ_free(_res_conv);
26614 }
26615
26616 static inline uint64_t CResult_RouteHopDecodeErrorZ_clone_ptr(LDKCResult_RouteHopDecodeErrorZ *NONNULL_PTR arg) {
26617         LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
26618         *ret_conv = CResult_RouteHopDecodeErrorZ_clone(arg);
26619         return tag_ptr(ret_conv, true);
26620 }
26621 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
26622         LDKCResult_RouteHopDecodeErrorZ* arg_conv = (LDKCResult_RouteHopDecodeErrorZ*)untag_ptr(arg);
26623         int64_t ret_conv = CResult_RouteHopDecodeErrorZ_clone_ptr(arg_conv);
26624         return ret_conv;
26625 }
26626
26627 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26628         LDKCResult_RouteHopDecodeErrorZ* orig_conv = (LDKCResult_RouteHopDecodeErrorZ*)untag_ptr(orig);
26629         LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
26630         *ret_conv = CResult_RouteHopDecodeErrorZ_clone(orig_conv);
26631         return tag_ptr(ret_conv, true);
26632 }
26633
26634 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1BlindedHopZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
26635         LDKCVec_BlindedHopZ _res_constr;
26636         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
26637         if (_res_constr.datalen > 0)
26638                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKBlindedHop), "LDKCVec_BlindedHopZ Elements");
26639         else
26640                 _res_constr.data = NULL;
26641         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
26642         for (size_t m = 0; m < _res_constr.datalen; m++) {
26643                 int64_t _res_conv_12 = _res_vals[m];
26644                 LDKBlindedHop _res_conv_12_conv;
26645                 _res_conv_12_conv.inner = untag_ptr(_res_conv_12);
26646                 _res_conv_12_conv.is_owned = ptr_is_owned(_res_conv_12);
26647                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_12_conv);
26648                 _res_constr.data[m] = _res_conv_12_conv;
26649         }
26650         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
26651         CVec_BlindedHopZ_free(_res_constr);
26652 }
26653
26654 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedTailDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
26655         LDKBlindedTail o_conv;
26656         o_conv.inner = untag_ptr(o);
26657         o_conv.is_owned = ptr_is_owned(o);
26658         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
26659         o_conv = BlindedTail_clone(&o_conv);
26660         LDKCResult_BlindedTailDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedTailDecodeErrorZ), "LDKCResult_BlindedTailDecodeErrorZ");
26661         *ret_conv = CResult_BlindedTailDecodeErrorZ_ok(o_conv);
26662         return tag_ptr(ret_conv, true);
26663 }
26664
26665 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedTailDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
26666         void* e_ptr = untag_ptr(e);
26667         CHECK_ACCESS(e_ptr);
26668         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
26669         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
26670         LDKCResult_BlindedTailDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedTailDecodeErrorZ), "LDKCResult_BlindedTailDecodeErrorZ");
26671         *ret_conv = CResult_BlindedTailDecodeErrorZ_err(e_conv);
26672         return tag_ptr(ret_conv, true);
26673 }
26674
26675 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedTailDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
26676         LDKCResult_BlindedTailDecodeErrorZ* o_conv = (LDKCResult_BlindedTailDecodeErrorZ*)untag_ptr(o);
26677         jboolean ret_conv = CResult_BlindedTailDecodeErrorZ_is_ok(o_conv);
26678         return ret_conv;
26679 }
26680
26681 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedTailDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
26682         if (!ptr_is_owned(_res)) return;
26683         void* _res_ptr = untag_ptr(_res);
26684         CHECK_ACCESS(_res_ptr);
26685         LDKCResult_BlindedTailDecodeErrorZ _res_conv = *(LDKCResult_BlindedTailDecodeErrorZ*)(_res_ptr);
26686         FREE(untag_ptr(_res));
26687         CResult_BlindedTailDecodeErrorZ_free(_res_conv);
26688 }
26689
26690 static inline uint64_t CResult_BlindedTailDecodeErrorZ_clone_ptr(LDKCResult_BlindedTailDecodeErrorZ *NONNULL_PTR arg) {
26691         LDKCResult_BlindedTailDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedTailDecodeErrorZ), "LDKCResult_BlindedTailDecodeErrorZ");
26692         *ret_conv = CResult_BlindedTailDecodeErrorZ_clone(arg);
26693         return tag_ptr(ret_conv, true);
26694 }
26695 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedTailDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
26696         LDKCResult_BlindedTailDecodeErrorZ* arg_conv = (LDKCResult_BlindedTailDecodeErrorZ*)untag_ptr(arg);
26697         int64_t ret_conv = CResult_BlindedTailDecodeErrorZ_clone_ptr(arg_conv);
26698         return ret_conv;
26699 }
26700
26701 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedTailDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26702         LDKCResult_BlindedTailDecodeErrorZ* orig_conv = (LDKCResult_BlindedTailDecodeErrorZ*)untag_ptr(orig);
26703         LDKCResult_BlindedTailDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedTailDecodeErrorZ), "LDKCResult_BlindedTailDecodeErrorZ");
26704         *ret_conv = CResult_BlindedTailDecodeErrorZ_clone(orig_conv);
26705         return tag_ptr(ret_conv, true);
26706 }
26707
26708 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1RouteHopZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
26709         LDKCVec_RouteHopZ _res_constr;
26710         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
26711         if (_res_constr.datalen > 0)
26712                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
26713         else
26714                 _res_constr.data = NULL;
26715         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
26716         for (size_t k = 0; k < _res_constr.datalen; k++) {
26717                 int64_t _res_conv_10 = _res_vals[k];
26718                 LDKRouteHop _res_conv_10_conv;
26719                 _res_conv_10_conv.inner = untag_ptr(_res_conv_10);
26720                 _res_conv_10_conv.is_owned = ptr_is_owned(_res_conv_10);
26721                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_10_conv);
26722                 _res_constr.data[k] = _res_conv_10_conv;
26723         }
26724         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
26725         CVec_RouteHopZ_free(_res_constr);
26726 }
26727
26728 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1PathZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
26729         LDKCVec_PathZ _res_constr;
26730         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
26731         if (_res_constr.datalen > 0)
26732                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPath), "LDKCVec_PathZ Elements");
26733         else
26734                 _res_constr.data = NULL;
26735         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
26736         for (size_t g = 0; g < _res_constr.datalen; g++) {
26737                 int64_t _res_conv_6 = _res_vals[g];
26738                 LDKPath _res_conv_6_conv;
26739                 _res_conv_6_conv.inner = untag_ptr(_res_conv_6);
26740                 _res_conv_6_conv.is_owned = ptr_is_owned(_res_conv_6);
26741                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_6_conv);
26742                 _res_constr.data[g] = _res_conv_6_conv;
26743         }
26744         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
26745         CVec_PathZ_free(_res_constr);
26746 }
26747
26748 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
26749         LDKRoute o_conv;
26750         o_conv.inner = untag_ptr(o);
26751         o_conv.is_owned = ptr_is_owned(o);
26752         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
26753         o_conv = Route_clone(&o_conv);
26754         LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
26755         *ret_conv = CResult_RouteDecodeErrorZ_ok(o_conv);
26756         return tag_ptr(ret_conv, true);
26757 }
26758
26759 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
26760         void* e_ptr = untag_ptr(e);
26761         CHECK_ACCESS(e_ptr);
26762         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
26763         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
26764         LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
26765         *ret_conv = CResult_RouteDecodeErrorZ_err(e_conv);
26766         return tag_ptr(ret_conv, true);
26767 }
26768
26769 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
26770         LDKCResult_RouteDecodeErrorZ* o_conv = (LDKCResult_RouteDecodeErrorZ*)untag_ptr(o);
26771         jboolean ret_conv = CResult_RouteDecodeErrorZ_is_ok(o_conv);
26772         return ret_conv;
26773 }
26774
26775 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
26776         if (!ptr_is_owned(_res)) return;
26777         void* _res_ptr = untag_ptr(_res);
26778         CHECK_ACCESS(_res_ptr);
26779         LDKCResult_RouteDecodeErrorZ _res_conv = *(LDKCResult_RouteDecodeErrorZ*)(_res_ptr);
26780         FREE(untag_ptr(_res));
26781         CResult_RouteDecodeErrorZ_free(_res_conv);
26782 }
26783
26784 static inline uint64_t CResult_RouteDecodeErrorZ_clone_ptr(LDKCResult_RouteDecodeErrorZ *NONNULL_PTR arg) {
26785         LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
26786         *ret_conv = CResult_RouteDecodeErrorZ_clone(arg);
26787         return tag_ptr(ret_conv, true);
26788 }
26789 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
26790         LDKCResult_RouteDecodeErrorZ* arg_conv = (LDKCResult_RouteDecodeErrorZ*)untag_ptr(arg);
26791         int64_t ret_conv = CResult_RouteDecodeErrorZ_clone_ptr(arg_conv);
26792         return ret_conv;
26793 }
26794
26795 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26796         LDKCResult_RouteDecodeErrorZ* orig_conv = (LDKCResult_RouteDecodeErrorZ*)untag_ptr(orig);
26797         LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
26798         *ret_conv = CResult_RouteDecodeErrorZ_clone(orig_conv);
26799         return tag_ptr(ret_conv, true);
26800 }
26801
26802 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteParametersDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
26803         LDKRouteParameters o_conv;
26804         o_conv.inner = untag_ptr(o);
26805         o_conv.is_owned = ptr_is_owned(o);
26806         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
26807         o_conv = RouteParameters_clone(&o_conv);
26808         LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
26809         *ret_conv = CResult_RouteParametersDecodeErrorZ_ok(o_conv);
26810         return tag_ptr(ret_conv, true);
26811 }
26812
26813 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteParametersDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
26814         void* e_ptr = untag_ptr(e);
26815         CHECK_ACCESS(e_ptr);
26816         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
26817         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
26818         LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
26819         *ret_conv = CResult_RouteParametersDecodeErrorZ_err(e_conv);
26820         return tag_ptr(ret_conv, true);
26821 }
26822
26823 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RouteParametersDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
26824         LDKCResult_RouteParametersDecodeErrorZ* o_conv = (LDKCResult_RouteParametersDecodeErrorZ*)untag_ptr(o);
26825         jboolean ret_conv = CResult_RouteParametersDecodeErrorZ_is_ok(o_conv);
26826         return ret_conv;
26827 }
26828
26829 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RouteParametersDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
26830         if (!ptr_is_owned(_res)) return;
26831         void* _res_ptr = untag_ptr(_res);
26832         CHECK_ACCESS(_res_ptr);
26833         LDKCResult_RouteParametersDecodeErrorZ _res_conv = *(LDKCResult_RouteParametersDecodeErrorZ*)(_res_ptr);
26834         FREE(untag_ptr(_res));
26835         CResult_RouteParametersDecodeErrorZ_free(_res_conv);
26836 }
26837
26838 static inline uint64_t CResult_RouteParametersDecodeErrorZ_clone_ptr(LDKCResult_RouteParametersDecodeErrorZ *NONNULL_PTR arg) {
26839         LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
26840         *ret_conv = CResult_RouteParametersDecodeErrorZ_clone(arg);
26841         return tag_ptr(ret_conv, true);
26842 }
26843 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteParametersDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
26844         LDKCResult_RouteParametersDecodeErrorZ* arg_conv = (LDKCResult_RouteParametersDecodeErrorZ*)untag_ptr(arg);
26845         int64_t ret_conv = CResult_RouteParametersDecodeErrorZ_clone_ptr(arg_conv);
26846         return ret_conv;
26847 }
26848
26849 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteParametersDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26850         LDKCResult_RouteParametersDecodeErrorZ* orig_conv = (LDKCResult_RouteParametersDecodeErrorZ*)untag_ptr(orig);
26851         LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
26852         *ret_conv = CResult_RouteParametersDecodeErrorZ_clone(orig_conv);
26853         return tag_ptr(ret_conv, true);
26854 }
26855
26856 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1u64Z_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
26857         LDKCVec_u64Z _res_constr;
26858         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
26859         if (_res_constr.datalen > 0)
26860                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
26861         else
26862                 _res_constr.data = NULL;
26863         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
26864         for (size_t g = 0; g < _res_constr.datalen; g++) {
26865                 int64_t _res_conv_6 = _res_vals[g];
26866                 _res_constr.data[g] = _res_conv_6;
26867         }
26868         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
26869         CVec_u64Z_free(_res_constr);
26870 }
26871
26872 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentParametersDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
26873         LDKPaymentParameters o_conv;
26874         o_conv.inner = untag_ptr(o);
26875         o_conv.is_owned = ptr_is_owned(o);
26876         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
26877         o_conv = PaymentParameters_clone(&o_conv);
26878         LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
26879         *ret_conv = CResult_PaymentParametersDecodeErrorZ_ok(o_conv);
26880         return tag_ptr(ret_conv, true);
26881 }
26882
26883 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentParametersDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
26884         void* e_ptr = untag_ptr(e);
26885         CHECK_ACCESS(e_ptr);
26886         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
26887         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
26888         LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
26889         *ret_conv = CResult_PaymentParametersDecodeErrorZ_err(e_conv);
26890         return tag_ptr(ret_conv, true);
26891 }
26892
26893 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentParametersDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
26894         LDKCResult_PaymentParametersDecodeErrorZ* o_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)untag_ptr(o);
26895         jboolean ret_conv = CResult_PaymentParametersDecodeErrorZ_is_ok(o_conv);
26896         return ret_conv;
26897 }
26898
26899 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentParametersDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
26900         if (!ptr_is_owned(_res)) return;
26901         void* _res_ptr = untag_ptr(_res);
26902         CHECK_ACCESS(_res_ptr);
26903         LDKCResult_PaymentParametersDecodeErrorZ _res_conv = *(LDKCResult_PaymentParametersDecodeErrorZ*)(_res_ptr);
26904         FREE(untag_ptr(_res));
26905         CResult_PaymentParametersDecodeErrorZ_free(_res_conv);
26906 }
26907
26908 static inline uint64_t CResult_PaymentParametersDecodeErrorZ_clone_ptr(LDKCResult_PaymentParametersDecodeErrorZ *NONNULL_PTR arg) {
26909         LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
26910         *ret_conv = CResult_PaymentParametersDecodeErrorZ_clone(arg);
26911         return tag_ptr(ret_conv, true);
26912 }
26913 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentParametersDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
26914         LDKCResult_PaymentParametersDecodeErrorZ* arg_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)untag_ptr(arg);
26915         int64_t ret_conv = CResult_PaymentParametersDecodeErrorZ_clone_ptr(arg_conv);
26916         return ret_conv;
26917 }
26918
26919 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentParametersDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26920         LDKCResult_PaymentParametersDecodeErrorZ* orig_conv = (LDKCResult_PaymentParametersDecodeErrorZ*)untag_ptr(orig);
26921         LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
26922         *ret_conv = CResult_PaymentParametersDecodeErrorZ_clone(orig_conv);
26923         return tag_ptr(ret_conv, true);
26924 }
26925
26926 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1RouteHintZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
26927         LDKCVec_RouteHintZ _res_constr;
26928         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
26929         if (_res_constr.datalen > 0)
26930                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
26931         else
26932                 _res_constr.data = NULL;
26933         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
26934         for (size_t l = 0; l < _res_constr.datalen; l++) {
26935                 int64_t _res_conv_11 = _res_vals[l];
26936                 LDKRouteHint _res_conv_11_conv;
26937                 _res_conv_11_conv.inner = untag_ptr(_res_conv_11);
26938                 _res_conv_11_conv.is_owned = ptr_is_owned(_res_conv_11);
26939                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_11_conv);
26940                 _res_constr.data[l] = _res_conv_11_conv;
26941         }
26942         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
26943         CVec_RouteHintZ_free(_res_constr);
26944 }
26945
26946 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1RouteHintHopZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
26947         LDKCVec_RouteHintHopZ _res_constr;
26948         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
26949         if (_res_constr.datalen > 0)
26950                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHintHop), "LDKCVec_RouteHintHopZ Elements");
26951         else
26952                 _res_constr.data = NULL;
26953         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
26954         for (size_t o = 0; o < _res_constr.datalen; o++) {
26955                 int64_t _res_conv_14 = _res_vals[o];
26956                 LDKRouteHintHop _res_conv_14_conv;
26957                 _res_conv_14_conv.inner = untag_ptr(_res_conv_14);
26958                 _res_conv_14_conv.is_owned = ptr_is_owned(_res_conv_14);
26959                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_14_conv);
26960                 _res_constr.data[o] = _res_conv_14_conv;
26961         }
26962         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
26963         CVec_RouteHintHopZ_free(_res_constr);
26964 }
26965
26966 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
26967         LDKRouteHint o_conv;
26968         o_conv.inner = untag_ptr(o);
26969         o_conv.is_owned = ptr_is_owned(o);
26970         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
26971         o_conv = RouteHint_clone(&o_conv);
26972         LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
26973         *ret_conv = CResult_RouteHintDecodeErrorZ_ok(o_conv);
26974         return tag_ptr(ret_conv, true);
26975 }
26976
26977 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
26978         void* e_ptr = untag_ptr(e);
26979         CHECK_ACCESS(e_ptr);
26980         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
26981         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
26982         LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
26983         *ret_conv = CResult_RouteHintDecodeErrorZ_err(e_conv);
26984         return tag_ptr(ret_conv, true);
26985 }
26986
26987 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
26988         LDKCResult_RouteHintDecodeErrorZ* o_conv = (LDKCResult_RouteHintDecodeErrorZ*)untag_ptr(o);
26989         jboolean ret_conv = CResult_RouteHintDecodeErrorZ_is_ok(o_conv);
26990         return ret_conv;
26991 }
26992
26993 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
26994         if (!ptr_is_owned(_res)) return;
26995         void* _res_ptr = untag_ptr(_res);
26996         CHECK_ACCESS(_res_ptr);
26997         LDKCResult_RouteHintDecodeErrorZ _res_conv = *(LDKCResult_RouteHintDecodeErrorZ*)(_res_ptr);
26998         FREE(untag_ptr(_res));
26999         CResult_RouteHintDecodeErrorZ_free(_res_conv);
27000 }
27001
27002 static inline uint64_t CResult_RouteHintDecodeErrorZ_clone_ptr(LDKCResult_RouteHintDecodeErrorZ *NONNULL_PTR arg) {
27003         LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
27004         *ret_conv = CResult_RouteHintDecodeErrorZ_clone(arg);
27005         return tag_ptr(ret_conv, true);
27006 }
27007 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27008         LDKCResult_RouteHintDecodeErrorZ* arg_conv = (LDKCResult_RouteHintDecodeErrorZ*)untag_ptr(arg);
27009         int64_t ret_conv = CResult_RouteHintDecodeErrorZ_clone_ptr(arg_conv);
27010         return ret_conv;
27011 }
27012
27013 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27014         LDKCResult_RouteHintDecodeErrorZ* orig_conv = (LDKCResult_RouteHintDecodeErrorZ*)untag_ptr(orig);
27015         LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
27016         *ret_conv = CResult_RouteHintDecodeErrorZ_clone(orig_conv);
27017         return tag_ptr(ret_conv, true);
27018 }
27019
27020 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintHopDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
27021         LDKRouteHintHop o_conv;
27022         o_conv.inner = untag_ptr(o);
27023         o_conv.is_owned = ptr_is_owned(o);
27024         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
27025         o_conv = RouteHintHop_clone(&o_conv);
27026         LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
27027         *ret_conv = CResult_RouteHintHopDecodeErrorZ_ok(o_conv);
27028         return tag_ptr(ret_conv, true);
27029 }
27030
27031 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintHopDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
27032         void* e_ptr = untag_ptr(e);
27033         CHECK_ACCESS(e_ptr);
27034         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
27035         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
27036         LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
27037         *ret_conv = CResult_RouteHintHopDecodeErrorZ_err(e_conv);
27038         return tag_ptr(ret_conv, true);
27039 }
27040
27041 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintHopDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
27042         LDKCResult_RouteHintHopDecodeErrorZ* o_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)untag_ptr(o);
27043         jboolean ret_conv = CResult_RouteHintHopDecodeErrorZ_is_ok(o_conv);
27044         return ret_conv;
27045 }
27046
27047 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintHopDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
27048         if (!ptr_is_owned(_res)) return;
27049         void* _res_ptr = untag_ptr(_res);
27050         CHECK_ACCESS(_res_ptr);
27051         LDKCResult_RouteHintHopDecodeErrorZ _res_conv = *(LDKCResult_RouteHintHopDecodeErrorZ*)(_res_ptr);
27052         FREE(untag_ptr(_res));
27053         CResult_RouteHintHopDecodeErrorZ_free(_res_conv);
27054 }
27055
27056 static inline uint64_t CResult_RouteHintHopDecodeErrorZ_clone_ptr(LDKCResult_RouteHintHopDecodeErrorZ *NONNULL_PTR arg) {
27057         LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
27058         *ret_conv = CResult_RouteHintHopDecodeErrorZ_clone(arg);
27059         return tag_ptr(ret_conv, true);
27060 }
27061 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintHopDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27062         LDKCResult_RouteHintHopDecodeErrorZ* arg_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)untag_ptr(arg);
27063         int64_t ret_conv = CResult_RouteHintHopDecodeErrorZ_clone_ptr(arg_conv);
27064         return ret_conv;
27065 }
27066
27067 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHintHopDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27068         LDKCResult_RouteHintHopDecodeErrorZ* orig_conv = (LDKCResult_RouteHintHopDecodeErrorZ*)untag_ptr(orig);
27069         LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
27070         *ret_conv = CResult_RouteHintHopDecodeErrorZ_clone(orig_conv);
27071         return tag_ptr(ret_conv, true);
27072 }
27073
27074 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FixedPenaltyScorerDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
27075         LDKFixedPenaltyScorer o_conv;
27076         o_conv.inner = untag_ptr(o);
27077         o_conv.is_owned = ptr_is_owned(o);
27078         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
27079         o_conv = FixedPenaltyScorer_clone(&o_conv);
27080         LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
27081         *ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_ok(o_conv);
27082         return tag_ptr(ret_conv, true);
27083 }
27084
27085 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FixedPenaltyScorerDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
27086         void* e_ptr = untag_ptr(e);
27087         CHECK_ACCESS(e_ptr);
27088         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
27089         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
27090         LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
27091         *ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_err(e_conv);
27092         return tag_ptr(ret_conv, true);
27093 }
27094
27095 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1FixedPenaltyScorerDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
27096         LDKCResult_FixedPenaltyScorerDecodeErrorZ* o_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)untag_ptr(o);
27097         jboolean ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_is_ok(o_conv);
27098         return ret_conv;
27099 }
27100
27101 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1FixedPenaltyScorerDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
27102         if (!ptr_is_owned(_res)) return;
27103         void* _res_ptr = untag_ptr(_res);
27104         CHECK_ACCESS(_res_ptr);
27105         LDKCResult_FixedPenaltyScorerDecodeErrorZ _res_conv = *(LDKCResult_FixedPenaltyScorerDecodeErrorZ*)(_res_ptr);
27106         FREE(untag_ptr(_res));
27107         CResult_FixedPenaltyScorerDecodeErrorZ_free(_res_conv);
27108 }
27109
27110 static inline uint64_t CResult_FixedPenaltyScorerDecodeErrorZ_clone_ptr(LDKCResult_FixedPenaltyScorerDecodeErrorZ *NONNULL_PTR arg) {
27111         LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
27112         *ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_clone(arg);
27113         return tag_ptr(ret_conv, true);
27114 }
27115 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FixedPenaltyScorerDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27116         LDKCResult_FixedPenaltyScorerDecodeErrorZ* arg_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)untag_ptr(arg);
27117         int64_t ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_clone_ptr(arg_conv);
27118         return ret_conv;
27119 }
27120
27121 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FixedPenaltyScorerDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27122         LDKCResult_FixedPenaltyScorerDecodeErrorZ* orig_conv = (LDKCResult_FixedPenaltyScorerDecodeErrorZ*)untag_ptr(orig);
27123         LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
27124         *ret_conv = CResult_FixedPenaltyScorerDecodeErrorZ_clone(orig_conv);
27125         return tag_ptr(ret_conv, true);
27126 }
27127
27128 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1NodeIdZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
27129         LDKCVec_NodeIdZ _res_constr;
27130         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
27131         if (_res_constr.datalen > 0)
27132                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKNodeId), "LDKCVec_NodeIdZ Elements");
27133         else
27134                 _res_constr.data = NULL;
27135         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
27136         for (size_t i = 0; i < _res_constr.datalen; i++) {
27137                 int64_t _res_conv_8 = _res_vals[i];
27138                 LDKNodeId _res_conv_8_conv;
27139                 _res_conv_8_conv.inner = untag_ptr(_res_conv_8);
27140                 _res_conv_8_conv.is_owned = ptr_is_owned(_res_conv_8);
27141                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_8_conv);
27142                 _res_constr.data[i] = _res_conv_8_conv;
27143         }
27144         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
27145         CVec_NodeIdZ_free(_res_constr);
27146 }
27147
27148 static inline uint64_t C2Tuple_u64u64Z_clone_ptr(LDKC2Tuple_u64u64Z *NONNULL_PTR arg) {
27149         LDKC2Tuple_u64u64Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
27150         *ret_conv = C2Tuple_u64u64Z_clone(arg);
27151         return tag_ptr(ret_conv, true);
27152 }
27153 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64u64Z_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27154         LDKC2Tuple_u64u64Z* arg_conv = (LDKC2Tuple_u64u64Z*)untag_ptr(arg);
27155         int64_t ret_conv = C2Tuple_u64u64Z_clone_ptr(arg_conv);
27156         return ret_conv;
27157 }
27158
27159 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64u64Z_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27160         LDKC2Tuple_u64u64Z* orig_conv = (LDKC2Tuple_u64u64Z*)untag_ptr(orig);
27161         LDKC2Tuple_u64u64Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
27162         *ret_conv = C2Tuple_u64u64Z_clone(orig_conv);
27163         return tag_ptr(ret_conv, true);
27164 }
27165
27166 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64u64Z_1new(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
27167         LDKC2Tuple_u64u64Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
27168         *ret_conv = C2Tuple_u64u64Z_new(a, b);
27169         return tag_ptr(ret_conv, true);
27170 }
27171
27172 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64u64Z_1free(JNIEnv *env, jclass clz, int64_t _res) {
27173         if (!ptr_is_owned(_res)) return;
27174         void* _res_ptr = untag_ptr(_res);
27175         CHECK_ACCESS(_res_ptr);
27176         LDKC2Tuple_u64u64Z _res_conv = *(LDKC2Tuple_u64u64Z*)(_res_ptr);
27177         FREE(untag_ptr(_res));
27178         C2Tuple_u64u64Z_free(_res_conv);
27179 }
27180
27181 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1u64u64ZZ_1some(JNIEnv *env, jclass clz, int64_t o) {
27182         void* o_ptr = untag_ptr(o);
27183         CHECK_ACCESS(o_ptr);
27184         LDKC2Tuple_u64u64Z o_conv = *(LDKC2Tuple_u64u64Z*)(o_ptr);
27185         o_conv = C2Tuple_u64u64Z_clone((LDKC2Tuple_u64u64Z*)untag_ptr(o));
27186         LDKCOption_C2Tuple_u64u64ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u64ZZ), "LDKCOption_C2Tuple_u64u64ZZ");
27187         *ret_copy = COption_C2Tuple_u64u64ZZ_some(o_conv);
27188         int64_t ret_ref = tag_ptr(ret_copy, true);
27189         return ret_ref;
27190 }
27191
27192 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1u64u64ZZ_1none(JNIEnv *env, jclass clz) {
27193         LDKCOption_C2Tuple_u64u64ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u64ZZ), "LDKCOption_C2Tuple_u64u64ZZ");
27194         *ret_copy = COption_C2Tuple_u64u64ZZ_none();
27195         int64_t ret_ref = tag_ptr(ret_copy, true);
27196         return ret_ref;
27197 }
27198
27199 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1u64u64ZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
27200         if (!ptr_is_owned(_res)) return;
27201         void* _res_ptr = untag_ptr(_res);
27202         CHECK_ACCESS(_res_ptr);
27203         LDKCOption_C2Tuple_u64u64ZZ _res_conv = *(LDKCOption_C2Tuple_u64u64ZZ*)(_res_ptr);
27204         FREE(untag_ptr(_res));
27205         COption_C2Tuple_u64u64ZZ_free(_res_conv);
27206 }
27207
27208 static inline uint64_t COption_C2Tuple_u64u64ZZ_clone_ptr(LDKCOption_C2Tuple_u64u64ZZ *NONNULL_PTR arg) {
27209         LDKCOption_C2Tuple_u64u64ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u64ZZ), "LDKCOption_C2Tuple_u64u64ZZ");
27210         *ret_copy = COption_C2Tuple_u64u64ZZ_clone(arg);
27211         int64_t ret_ref = tag_ptr(ret_copy, true);
27212         return ret_ref;
27213 }
27214 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1u64u64ZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27215         LDKCOption_C2Tuple_u64u64ZZ* arg_conv = (LDKCOption_C2Tuple_u64u64ZZ*)untag_ptr(arg);
27216         int64_t ret_conv = COption_C2Tuple_u64u64ZZ_clone_ptr(arg_conv);
27217         return ret_conv;
27218 }
27219
27220 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1u64u64ZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27221         LDKCOption_C2Tuple_u64u64ZZ* orig_conv = (LDKCOption_C2Tuple_u64u64ZZ*)untag_ptr(orig);
27222         LDKCOption_C2Tuple_u64u64ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u64ZZ), "LDKCOption_C2Tuple_u64u64ZZ");
27223         *ret_copy = COption_C2Tuple_u64u64ZZ_clone(orig_conv);
27224         int64_t ret_ref = tag_ptr(ret_copy, true);
27225         return ret_ref;
27226 }
27227
27228 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1Z_1new(JNIEnv *env, jclass clz, int16_tArray a, int16_tArray b) {
27229         LDKThirtyTwoU16s a_ref;
27230         CHECK((*env)->GetArrayLength(env, a) == 32);
27231         (*env)->GetShortArrayRegion(env, a, 0, 32, a_ref.data);
27232         LDKThirtyTwoU16s b_ref;
27233         CHECK((*env)->GetArrayLength(env, b) == 32);
27234         (*env)->GetShortArrayRegion(env, b, 0, 32, b_ref.data);
27235         LDKC2Tuple_Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_Z), "LDKC2Tuple_Z");
27236         *ret_conv = C2Tuple_Z_new(a_ref, b_ref);
27237         return tag_ptr(ret_conv, true);
27238 }
27239
27240 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1Z_1free(JNIEnv *env, jclass clz, int64_t _res) {
27241         if (!ptr_is_owned(_res)) return;
27242         void* _res_ptr = untag_ptr(_res);
27243         CHECK_ACCESS(_res_ptr);
27244         LDKC2Tuple_Z _res_conv = *(LDKC2Tuple_Z*)(_res_ptr);
27245         FREE(untag_ptr(_res));
27246         C2Tuple_Z_free(_res_conv);
27247 }
27248
27249 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1_1u1632_1u1632Z_1new(JNIEnv *env, jclass clz, int16_tArray a, int16_tArray b) {
27250         LDKThirtyTwoU16s a_ref;
27251         CHECK((*env)->GetArrayLength(env, a) == 32);
27252         (*env)->GetShortArrayRegion(env, a, 0, 32, a_ref.data);
27253         LDKThirtyTwoU16s b_ref;
27254         CHECK((*env)->GetArrayLength(env, b) == 32);
27255         (*env)->GetShortArrayRegion(env, b, 0, 32, b_ref.data);
27256         LDKC2Tuple__u1632_u1632Z* ret_conv = MALLOC(sizeof(LDKC2Tuple__u1632_u1632Z), "LDKC2Tuple__u1632_u1632Z");
27257         *ret_conv = C2Tuple__u1632_u1632Z_new(a_ref, b_ref);
27258         return tag_ptr(ret_conv, true);
27259 }
27260
27261 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1_1u1632_1u1632Z_1free(JNIEnv *env, jclass clz, int64_t _res) {
27262         if (!ptr_is_owned(_res)) return;
27263         void* _res_ptr = untag_ptr(_res);
27264         CHECK_ACCESS(_res_ptr);
27265         LDKC2Tuple__u1632_u1632Z _res_conv = *(LDKC2Tuple__u1632_u1632Z*)(_res_ptr);
27266         FREE(untag_ptr(_res));
27267         C2Tuple__u1632_u1632Z_free(_res_conv);
27268 }
27269
27270 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1ThirtyTwoU16sThirtyTwoU16sZZ_1some(JNIEnv *env, jclass clz, int64_t o) {
27271         void* o_ptr = untag_ptr(o);
27272         CHECK_ACCESS(o_ptr);
27273         LDKC2Tuple__u1632_u1632Z o_conv = *(LDKC2Tuple__u1632_u1632Z*)(o_ptr);
27274         // WARNING: we may need a move here but no clone is available for LDKC2Tuple__u1632_u1632Z
27275         LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ), "LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ");
27276         *ret_copy = COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_some(o_conv);
27277         int64_t ret_ref = tag_ptr(ret_copy, true);
27278         return ret_ref;
27279 }
27280
27281 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1ThirtyTwoU16sThirtyTwoU16sZZ_1none(JNIEnv *env, jclass clz) {
27282         LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ), "LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ");
27283         *ret_copy = COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_none();
27284         int64_t ret_ref = tag_ptr(ret_copy, true);
27285         return ret_ref;
27286 }
27287
27288 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1ThirtyTwoU16sThirtyTwoU16sZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
27289         if (!ptr_is_owned(_res)) return;
27290         void* _res_ptr = untag_ptr(_res);
27291         CHECK_ACCESS(_res_ptr);
27292         LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ _res_conv = *(LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ*)(_res_ptr);
27293         FREE(untag_ptr(_res));
27294         COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_free(_res_conv);
27295 }
27296
27297 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1f64Z_1some(JNIEnv *env, jclass clz, double o) {
27298         LDKCOption_f64Z *ret_copy = MALLOC(sizeof(LDKCOption_f64Z), "LDKCOption_f64Z");
27299         *ret_copy = COption_f64Z_some(o);
27300         int64_t ret_ref = tag_ptr(ret_copy, true);
27301         return ret_ref;
27302 }
27303
27304 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1f64Z_1none(JNIEnv *env, jclass clz) {
27305         LDKCOption_f64Z *ret_copy = MALLOC(sizeof(LDKCOption_f64Z), "LDKCOption_f64Z");
27306         *ret_copy = COption_f64Z_none();
27307         int64_t ret_ref = tag_ptr(ret_copy, true);
27308         return ret_ref;
27309 }
27310
27311 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1f64Z_1free(JNIEnv *env, jclass clz, int64_t _res) {
27312         if (!ptr_is_owned(_res)) return;
27313         void* _res_ptr = untag_ptr(_res);
27314         CHECK_ACCESS(_res_ptr);
27315         LDKCOption_f64Z _res_conv = *(LDKCOption_f64Z*)(_res_ptr);
27316         FREE(untag_ptr(_res));
27317         COption_f64Z_free(_res_conv);
27318 }
27319
27320 static inline uint64_t COption_f64Z_clone_ptr(LDKCOption_f64Z *NONNULL_PTR arg) {
27321         LDKCOption_f64Z *ret_copy = MALLOC(sizeof(LDKCOption_f64Z), "LDKCOption_f64Z");
27322         *ret_copy = COption_f64Z_clone(arg);
27323         int64_t ret_ref = tag_ptr(ret_copy, true);
27324         return ret_ref;
27325 }
27326 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1f64Z_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27327         LDKCOption_f64Z* arg_conv = (LDKCOption_f64Z*)untag_ptr(arg);
27328         int64_t ret_conv = COption_f64Z_clone_ptr(arg_conv);
27329         return ret_conv;
27330 }
27331
27332 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1f64Z_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27333         LDKCOption_f64Z* orig_conv = (LDKCOption_f64Z*)untag_ptr(orig);
27334         LDKCOption_f64Z *ret_copy = MALLOC(sizeof(LDKCOption_f64Z), "LDKCOption_f64Z");
27335         *ret_copy = COption_f64Z_clone(orig_conv);
27336         int64_t ret_ref = tag_ptr(ret_copy, true);
27337         return ret_ref;
27338 }
27339
27340 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ProbabilisticScorerDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
27341         LDKProbabilisticScorer o_conv;
27342         o_conv.inner = untag_ptr(o);
27343         o_conv.is_owned = ptr_is_owned(o);
27344         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
27345         // WARNING: we need a move here but no clone is available for LDKProbabilisticScorer
27346         
27347         LDKCResult_ProbabilisticScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ProbabilisticScorerDecodeErrorZ), "LDKCResult_ProbabilisticScorerDecodeErrorZ");
27348         *ret_conv = CResult_ProbabilisticScorerDecodeErrorZ_ok(o_conv);
27349         return tag_ptr(ret_conv, true);
27350 }
27351
27352 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ProbabilisticScorerDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
27353         void* e_ptr = untag_ptr(e);
27354         CHECK_ACCESS(e_ptr);
27355         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
27356         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
27357         LDKCResult_ProbabilisticScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ProbabilisticScorerDecodeErrorZ), "LDKCResult_ProbabilisticScorerDecodeErrorZ");
27358         *ret_conv = CResult_ProbabilisticScorerDecodeErrorZ_err(e_conv);
27359         return tag_ptr(ret_conv, true);
27360 }
27361
27362 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ProbabilisticScorerDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
27363         LDKCResult_ProbabilisticScorerDecodeErrorZ* o_conv = (LDKCResult_ProbabilisticScorerDecodeErrorZ*)untag_ptr(o);
27364         jboolean ret_conv = CResult_ProbabilisticScorerDecodeErrorZ_is_ok(o_conv);
27365         return ret_conv;
27366 }
27367
27368 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ProbabilisticScorerDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
27369         if (!ptr_is_owned(_res)) return;
27370         void* _res_ptr = untag_ptr(_res);
27371         CHECK_ACCESS(_res_ptr);
27372         LDKCResult_ProbabilisticScorerDecodeErrorZ _res_conv = *(LDKCResult_ProbabilisticScorerDecodeErrorZ*)(_res_ptr);
27373         FREE(untag_ptr(_res));
27374         CResult_ProbabilisticScorerDecodeErrorZ_free(_res_conv);
27375 }
27376
27377 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BestBlockDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
27378         LDKBestBlock o_conv;
27379         o_conv.inner = untag_ptr(o);
27380         o_conv.is_owned = ptr_is_owned(o);
27381         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
27382         o_conv = BestBlock_clone(&o_conv);
27383         LDKCResult_BestBlockDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BestBlockDecodeErrorZ), "LDKCResult_BestBlockDecodeErrorZ");
27384         *ret_conv = CResult_BestBlockDecodeErrorZ_ok(o_conv);
27385         return tag_ptr(ret_conv, true);
27386 }
27387
27388 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BestBlockDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
27389         void* e_ptr = untag_ptr(e);
27390         CHECK_ACCESS(e_ptr);
27391         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
27392         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
27393         LDKCResult_BestBlockDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BestBlockDecodeErrorZ), "LDKCResult_BestBlockDecodeErrorZ");
27394         *ret_conv = CResult_BestBlockDecodeErrorZ_err(e_conv);
27395         return tag_ptr(ret_conv, true);
27396 }
27397
27398 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1BestBlockDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
27399         LDKCResult_BestBlockDecodeErrorZ* o_conv = (LDKCResult_BestBlockDecodeErrorZ*)untag_ptr(o);
27400         jboolean ret_conv = CResult_BestBlockDecodeErrorZ_is_ok(o_conv);
27401         return ret_conv;
27402 }
27403
27404 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1BestBlockDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
27405         if (!ptr_is_owned(_res)) return;
27406         void* _res_ptr = untag_ptr(_res);
27407         CHECK_ACCESS(_res_ptr);
27408         LDKCResult_BestBlockDecodeErrorZ _res_conv = *(LDKCResult_BestBlockDecodeErrorZ*)(_res_ptr);
27409         FREE(untag_ptr(_res));
27410         CResult_BestBlockDecodeErrorZ_free(_res_conv);
27411 }
27412
27413 static inline uint64_t CResult_BestBlockDecodeErrorZ_clone_ptr(LDKCResult_BestBlockDecodeErrorZ *NONNULL_PTR arg) {
27414         LDKCResult_BestBlockDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BestBlockDecodeErrorZ), "LDKCResult_BestBlockDecodeErrorZ");
27415         *ret_conv = CResult_BestBlockDecodeErrorZ_clone(arg);
27416         return tag_ptr(ret_conv, true);
27417 }
27418 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BestBlockDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27419         LDKCResult_BestBlockDecodeErrorZ* arg_conv = (LDKCResult_BestBlockDecodeErrorZ*)untag_ptr(arg);
27420         int64_t ret_conv = CResult_BestBlockDecodeErrorZ_clone_ptr(arg_conv);
27421         return ret_conv;
27422 }
27423
27424 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BestBlockDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27425         LDKCResult_BestBlockDecodeErrorZ* orig_conv = (LDKCResult_BestBlockDecodeErrorZ*)untag_ptr(orig);
27426         LDKCResult_BestBlockDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BestBlockDecodeErrorZ), "LDKCResult_BestBlockDecodeErrorZ");
27427         *ret_conv = CResult_BestBlockDecodeErrorZ_clone(orig_conv);
27428         return tag_ptr(ret_conv, true);
27429 }
27430
27431 static inline uint64_t C2Tuple_usizeTransactionZ_clone_ptr(LDKC2Tuple_usizeTransactionZ *NONNULL_PTR arg) {
27432         LDKC2Tuple_usizeTransactionZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
27433         *ret_conv = C2Tuple_usizeTransactionZ_clone(arg);
27434         return tag_ptr(ret_conv, true);
27435 }
27436 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27437         LDKC2Tuple_usizeTransactionZ* arg_conv = (LDKC2Tuple_usizeTransactionZ*)untag_ptr(arg);
27438         int64_t ret_conv = C2Tuple_usizeTransactionZ_clone_ptr(arg_conv);
27439         return ret_conv;
27440 }
27441
27442 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27443         LDKC2Tuple_usizeTransactionZ* orig_conv = (LDKC2Tuple_usizeTransactionZ*)untag_ptr(orig);
27444         LDKC2Tuple_usizeTransactionZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
27445         *ret_conv = C2Tuple_usizeTransactionZ_clone(orig_conv);
27446         return tag_ptr(ret_conv, true);
27447 }
27448
27449 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1new(JNIEnv *env, jclass clz, int64_t a, int8_tArray b) {
27450         LDKTransaction b_ref;
27451         b_ref.datalen = (*env)->GetArrayLength(env, b);
27452         b_ref.data = MALLOC(b_ref.datalen, "LDKTransaction Bytes");
27453         (*env)->GetByteArrayRegion(env, b, 0, b_ref.datalen, b_ref.data);
27454         b_ref.data_is_owned = true;
27455         LDKC2Tuple_usizeTransactionZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
27456         *ret_conv = C2Tuple_usizeTransactionZ_new(a, b_ref);
27457         return tag_ptr(ret_conv, true);
27458 }
27459
27460 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
27461         if (!ptr_is_owned(_res)) return;
27462         void* _res_ptr = untag_ptr(_res);
27463         CHECK_ACCESS(_res_ptr);
27464         LDKC2Tuple_usizeTransactionZ _res_conv = *(LDKC2Tuple_usizeTransactionZ*)(_res_ptr);
27465         FREE(untag_ptr(_res));
27466         C2Tuple_usizeTransactionZ_free(_res_conv);
27467 }
27468
27469 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1usizeTransactionZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
27470         LDKCVec_C2Tuple_usizeTransactionZZ _res_constr;
27471         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
27472         if (_res_constr.datalen > 0)
27473                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
27474         else
27475                 _res_constr.data = NULL;
27476         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
27477         for (size_t c = 0; c < _res_constr.datalen; c++) {
27478                 int64_t _res_conv_28 = _res_vals[c];
27479                 void* _res_conv_28_ptr = untag_ptr(_res_conv_28);
27480                 CHECK_ACCESS(_res_conv_28_ptr);
27481                 LDKC2Tuple_usizeTransactionZ _res_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(_res_conv_28_ptr);
27482                 FREE(untag_ptr(_res_conv_28));
27483                 _res_constr.data[c] = _res_conv_28_conv;
27484         }
27485         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
27486         CVec_C2Tuple_usizeTransactionZZ_free(_res_constr);
27487 }
27488
27489 static inline uint64_t C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_clone_ptr(LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ *NONNULL_PTR arg) {
27490         LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ), "LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ");
27491         *ret_conv = C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_clone(arg);
27492         return tag_ptr(ret_conv, true);
27493 }
27494 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ThirtyTwoBytesu32COption_1ThirtyTwoBytesZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27495         LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ* arg_conv = (LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ*)untag_ptr(arg);
27496         int64_t ret_conv = C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_clone_ptr(arg_conv);
27497         return ret_conv;
27498 }
27499
27500 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ThirtyTwoBytesu32COption_1ThirtyTwoBytesZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27501         LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ* orig_conv = (LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ*)untag_ptr(orig);
27502         LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ), "LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ");
27503         *ret_conv = C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_clone(orig_conv);
27504         return tag_ptr(ret_conv, true);
27505 }
27506
27507 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) {
27508         LDKThirtyTwoBytes a_ref;
27509         CHECK((*env)->GetArrayLength(env, a) == 32);
27510         (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
27511         void* c_ptr = untag_ptr(c);
27512         CHECK_ACCESS(c_ptr);
27513         LDKCOption_ThirtyTwoBytesZ c_conv = *(LDKCOption_ThirtyTwoBytesZ*)(c_ptr);
27514         c_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(c));
27515         LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ), "LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ");
27516         *ret_conv = C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_new(a_ref, b, c_conv);
27517         return tag_ptr(ret_conv, true);
27518 }
27519
27520 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ThirtyTwoBytesu32COption_1ThirtyTwoBytesZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
27521         if (!ptr_is_owned(_res)) return;
27522         void* _res_ptr = untag_ptr(_res);
27523         CHECK_ACCESS(_res_ptr);
27524         LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ _res_conv = *(LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ*)(_res_ptr);
27525         FREE(untag_ptr(_res));
27526         C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_free(_res_conv);
27527 }
27528
27529 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C3Tuple_1ThirtyTwoBytesu32COption_1ThirtyTwoBytesZZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
27530         LDKCVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ _res_constr;
27531         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
27532         if (_res_constr.datalen > 0)
27533                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ), "LDKCVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ Elements");
27534         else
27535                 _res_constr.data = NULL;
27536         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
27537         for (size_t c = 0; c < _res_constr.datalen; c++) {
27538                 int64_t _res_conv_54 = _res_vals[c];
27539                 void* _res_conv_54_ptr = untag_ptr(_res_conv_54);
27540                 CHECK_ACCESS(_res_conv_54_ptr);
27541                 LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ _res_conv_54_conv = *(LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ*)(_res_conv_54_ptr);
27542                 FREE(untag_ptr(_res_conv_54));
27543                 _res_constr.data[c] = _res_conv_54_conv;
27544         }
27545         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
27546         CVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ_free(_res_constr);
27547 }
27548
27549 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateStatusNoneZ_1ok(JNIEnv *env, jclass clz, jclass o) {
27550         LDKChannelMonitorUpdateStatus o_conv = LDKChannelMonitorUpdateStatus_from_java(env, o);
27551         LDKCResult_ChannelMonitorUpdateStatusNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateStatusNoneZ), "LDKCResult_ChannelMonitorUpdateStatusNoneZ");
27552         *ret_conv = CResult_ChannelMonitorUpdateStatusNoneZ_ok(o_conv);
27553         return tag_ptr(ret_conv, true);
27554 }
27555
27556 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateStatusNoneZ_1err(JNIEnv *env, jclass clz) {
27557         LDKCResult_ChannelMonitorUpdateStatusNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateStatusNoneZ), "LDKCResult_ChannelMonitorUpdateStatusNoneZ");
27558         *ret_conv = CResult_ChannelMonitorUpdateStatusNoneZ_err();
27559         return tag_ptr(ret_conv, true);
27560 }
27561
27562 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateStatusNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
27563         LDKCResult_ChannelMonitorUpdateStatusNoneZ* o_conv = (LDKCResult_ChannelMonitorUpdateStatusNoneZ*)untag_ptr(o);
27564         jboolean ret_conv = CResult_ChannelMonitorUpdateStatusNoneZ_is_ok(o_conv);
27565         return ret_conv;
27566 }
27567
27568 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateStatusNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
27569         if (!ptr_is_owned(_res)) return;
27570         void* _res_ptr = untag_ptr(_res);
27571         CHECK_ACCESS(_res_ptr);
27572         LDKCResult_ChannelMonitorUpdateStatusNoneZ _res_conv = *(LDKCResult_ChannelMonitorUpdateStatusNoneZ*)(_res_ptr);
27573         FREE(untag_ptr(_res));
27574         CResult_ChannelMonitorUpdateStatusNoneZ_free(_res_conv);
27575 }
27576
27577 static inline uint64_t CResult_ChannelMonitorUpdateStatusNoneZ_clone_ptr(LDKCResult_ChannelMonitorUpdateStatusNoneZ *NONNULL_PTR arg) {
27578         LDKCResult_ChannelMonitorUpdateStatusNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateStatusNoneZ), "LDKCResult_ChannelMonitorUpdateStatusNoneZ");
27579         *ret_conv = CResult_ChannelMonitorUpdateStatusNoneZ_clone(arg);
27580         return tag_ptr(ret_conv, true);
27581 }
27582 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateStatusNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27583         LDKCResult_ChannelMonitorUpdateStatusNoneZ* arg_conv = (LDKCResult_ChannelMonitorUpdateStatusNoneZ*)untag_ptr(arg);
27584         int64_t ret_conv = CResult_ChannelMonitorUpdateStatusNoneZ_clone_ptr(arg_conv);
27585         return ret_conv;
27586 }
27587
27588 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateStatusNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27589         LDKCResult_ChannelMonitorUpdateStatusNoneZ* orig_conv = (LDKCResult_ChannelMonitorUpdateStatusNoneZ*)untag_ptr(orig);
27590         LDKCResult_ChannelMonitorUpdateStatusNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateStatusNoneZ), "LDKCResult_ChannelMonitorUpdateStatusNoneZ");
27591         *ret_conv = CResult_ChannelMonitorUpdateStatusNoneZ_clone(orig_conv);
27592         return tag_ptr(ret_conv, true);
27593 }
27594
27595 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1MonitorEventZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
27596         LDKCVec_MonitorEventZ _res_constr;
27597         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
27598         if (_res_constr.datalen > 0)
27599                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKMonitorEvent), "LDKCVec_MonitorEventZ Elements");
27600         else
27601                 _res_constr.data = NULL;
27602         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
27603         for (size_t o = 0; o < _res_constr.datalen; o++) {
27604                 int64_t _res_conv_14 = _res_vals[o];
27605                 void* _res_conv_14_ptr = untag_ptr(_res_conv_14);
27606                 CHECK_ACCESS(_res_conv_14_ptr);
27607                 LDKMonitorEvent _res_conv_14_conv = *(LDKMonitorEvent*)(_res_conv_14_ptr);
27608                 FREE(untag_ptr(_res_conv_14));
27609                 _res_constr.data[o] = _res_conv_14_conv;
27610         }
27611         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
27612         CVec_MonitorEventZ_free(_res_constr);
27613 }
27614
27615 static inline uint64_t C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ_clone_ptr(LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ *NONNULL_PTR arg) {
27616         LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ* ret_conv = MALLOC(sizeof(LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ), "LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ");
27617         *ret_conv = C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ_clone(arg);
27618         return tag_ptr(ret_conv, true);
27619 }
27620 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C4Tuple_1OutPointChannelIdCVec_1MonitorEventZPublicKeyZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27621         LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ* arg_conv = (LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ*)untag_ptr(arg);
27622         int64_t ret_conv = C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ_clone_ptr(arg_conv);
27623         return ret_conv;
27624 }
27625
27626 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C4Tuple_1OutPointChannelIdCVec_1MonitorEventZPublicKeyZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27627         LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ* orig_conv = (LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ*)untag_ptr(orig);
27628         LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ* ret_conv = MALLOC(sizeof(LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ), "LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ");
27629         *ret_conv = C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ_clone(orig_conv);
27630         return tag_ptr(ret_conv, true);
27631 }
27632
27633 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C4Tuple_1OutPointChannelIdCVec_1MonitorEventZPublicKeyZ_1new(JNIEnv *env, jclass clz, int64_t a, int64_t b, int64_tArray c, int8_tArray d) {
27634         LDKOutPoint a_conv;
27635         a_conv.inner = untag_ptr(a);
27636         a_conv.is_owned = ptr_is_owned(a);
27637         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
27638         a_conv = OutPoint_clone(&a_conv);
27639         LDKChannelId b_conv;
27640         b_conv.inner = untag_ptr(b);
27641         b_conv.is_owned = ptr_is_owned(b);
27642         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
27643         b_conv = ChannelId_clone(&b_conv);
27644         LDKCVec_MonitorEventZ c_constr;
27645         c_constr.datalen = (*env)->GetArrayLength(env, c);
27646         if (c_constr.datalen > 0)
27647                 c_constr.data = MALLOC(c_constr.datalen * sizeof(LDKMonitorEvent), "LDKCVec_MonitorEventZ Elements");
27648         else
27649                 c_constr.data = NULL;
27650         int64_t* c_vals = (*env)->GetLongArrayElements (env, c, NULL);
27651         for (size_t o = 0; o < c_constr.datalen; o++) {
27652                 int64_t c_conv_14 = c_vals[o];
27653                 void* c_conv_14_ptr = untag_ptr(c_conv_14);
27654                 CHECK_ACCESS(c_conv_14_ptr);
27655                 LDKMonitorEvent c_conv_14_conv = *(LDKMonitorEvent*)(c_conv_14_ptr);
27656                 c_conv_14_conv = MonitorEvent_clone((LDKMonitorEvent*)untag_ptr(c_conv_14));
27657                 c_constr.data[o] = c_conv_14_conv;
27658         }
27659         (*env)->ReleaseLongArrayElements(env, c, c_vals, 0);
27660         LDKPublicKey d_ref;
27661         CHECK((*env)->GetArrayLength(env, d) == 33);
27662         (*env)->GetByteArrayRegion(env, d, 0, 33, d_ref.compressed_form);
27663         LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ* ret_conv = MALLOC(sizeof(LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ), "LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ");
27664         *ret_conv = C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ_new(a_conv, b_conv, c_constr, d_ref);
27665         return tag_ptr(ret_conv, true);
27666 }
27667
27668 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C4Tuple_1OutPointChannelIdCVec_1MonitorEventZPublicKeyZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
27669         if (!ptr_is_owned(_res)) return;
27670         void* _res_ptr = untag_ptr(_res);
27671         CHECK_ACCESS(_res_ptr);
27672         LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ _res_conv = *(LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ*)(_res_ptr);
27673         FREE(untag_ptr(_res));
27674         C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ_free(_res_conv);
27675 }
27676
27677 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C4Tuple_1OutPointChannelIdCVec_1MonitorEventZPublicKeyZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
27678         LDKCVec_C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZZ _res_constr;
27679         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
27680         if (_res_constr.datalen > 0)
27681                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ), "LDKCVec_C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZZ Elements");
27682         else
27683                 _res_constr.data = NULL;
27684         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
27685         for (size_t f = 0; f < _res_constr.datalen; f++) {
27686                 int64_t _res_conv_57 = _res_vals[f];
27687                 void* _res_conv_57_ptr = untag_ptr(_res_conv_57);
27688                 CHECK_ACCESS(_res_conv_57_ptr);
27689                 LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ _res_conv_57_conv = *(LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ*)(_res_conv_57_ptr);
27690                 FREE(untag_ptr(_res_conv_57));
27691                 _res_constr.data[f] = _res_conv_57_conv;
27692         }
27693         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
27694         CVec_C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZZ_free(_res_constr);
27695 }
27696
27697 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
27698         LDKInitFeatures o_conv;
27699         o_conv.inner = untag_ptr(o);
27700         o_conv.is_owned = ptr_is_owned(o);
27701         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
27702         o_conv = InitFeatures_clone(&o_conv);
27703         LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
27704         *ret_conv = CResult_InitFeaturesDecodeErrorZ_ok(o_conv);
27705         return tag_ptr(ret_conv, true);
27706 }
27707
27708 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
27709         void* e_ptr = untag_ptr(e);
27710         CHECK_ACCESS(e_ptr);
27711         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
27712         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
27713         LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
27714         *ret_conv = CResult_InitFeaturesDecodeErrorZ_err(e_conv);
27715         return tag_ptr(ret_conv, true);
27716 }
27717
27718 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
27719         LDKCResult_InitFeaturesDecodeErrorZ* o_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)untag_ptr(o);
27720         jboolean ret_conv = CResult_InitFeaturesDecodeErrorZ_is_ok(o_conv);
27721         return ret_conv;
27722 }
27723
27724 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
27725         if (!ptr_is_owned(_res)) return;
27726         void* _res_ptr = untag_ptr(_res);
27727         CHECK_ACCESS(_res_ptr);
27728         LDKCResult_InitFeaturesDecodeErrorZ _res_conv = *(LDKCResult_InitFeaturesDecodeErrorZ*)(_res_ptr);
27729         FREE(untag_ptr(_res));
27730         CResult_InitFeaturesDecodeErrorZ_free(_res_conv);
27731 }
27732
27733 static inline uint64_t CResult_InitFeaturesDecodeErrorZ_clone_ptr(LDKCResult_InitFeaturesDecodeErrorZ *NONNULL_PTR arg) {
27734         LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
27735         *ret_conv = CResult_InitFeaturesDecodeErrorZ_clone(arg);
27736         return tag_ptr(ret_conv, true);
27737 }
27738 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27739         LDKCResult_InitFeaturesDecodeErrorZ* arg_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)untag_ptr(arg);
27740         int64_t ret_conv = CResult_InitFeaturesDecodeErrorZ_clone_ptr(arg_conv);
27741         return ret_conv;
27742 }
27743
27744 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27745         LDKCResult_InitFeaturesDecodeErrorZ* orig_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)untag_ptr(orig);
27746         LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
27747         *ret_conv = CResult_InitFeaturesDecodeErrorZ_clone(orig_conv);
27748         return tag_ptr(ret_conv, true);
27749 }
27750
27751 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
27752         LDKChannelFeatures o_conv;
27753         o_conv.inner = untag_ptr(o);
27754         o_conv.is_owned = ptr_is_owned(o);
27755         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
27756         o_conv = ChannelFeatures_clone(&o_conv);
27757         LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
27758         *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_ok(o_conv);
27759         return tag_ptr(ret_conv, true);
27760 }
27761
27762 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
27763         void* e_ptr = untag_ptr(e);
27764         CHECK_ACCESS(e_ptr);
27765         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
27766         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
27767         LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
27768         *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_err(e_conv);
27769         return tag_ptr(ret_conv, true);
27770 }
27771
27772 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
27773         LDKCResult_ChannelFeaturesDecodeErrorZ* o_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)untag_ptr(o);
27774         jboolean ret_conv = CResult_ChannelFeaturesDecodeErrorZ_is_ok(o_conv);
27775         return ret_conv;
27776 }
27777
27778 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
27779         if (!ptr_is_owned(_res)) return;
27780         void* _res_ptr = untag_ptr(_res);
27781         CHECK_ACCESS(_res_ptr);
27782         LDKCResult_ChannelFeaturesDecodeErrorZ _res_conv = *(LDKCResult_ChannelFeaturesDecodeErrorZ*)(_res_ptr);
27783         FREE(untag_ptr(_res));
27784         CResult_ChannelFeaturesDecodeErrorZ_free(_res_conv);
27785 }
27786
27787 static inline uint64_t CResult_ChannelFeaturesDecodeErrorZ_clone_ptr(LDKCResult_ChannelFeaturesDecodeErrorZ *NONNULL_PTR arg) {
27788         LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
27789         *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_clone(arg);
27790         return tag_ptr(ret_conv, true);
27791 }
27792 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27793         LDKCResult_ChannelFeaturesDecodeErrorZ* arg_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)untag_ptr(arg);
27794         int64_t ret_conv = CResult_ChannelFeaturesDecodeErrorZ_clone_ptr(arg_conv);
27795         return ret_conv;
27796 }
27797
27798 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27799         LDKCResult_ChannelFeaturesDecodeErrorZ* orig_conv = (LDKCResult_ChannelFeaturesDecodeErrorZ*)untag_ptr(orig);
27800         LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
27801         *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_clone(orig_conv);
27802         return tag_ptr(ret_conv, true);
27803 }
27804
27805 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
27806         LDKNodeFeatures o_conv;
27807         o_conv.inner = untag_ptr(o);
27808         o_conv.is_owned = ptr_is_owned(o);
27809         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
27810         o_conv = NodeFeatures_clone(&o_conv);
27811         LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
27812         *ret_conv = CResult_NodeFeaturesDecodeErrorZ_ok(o_conv);
27813         return tag_ptr(ret_conv, true);
27814 }
27815
27816 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
27817         void* e_ptr = untag_ptr(e);
27818         CHECK_ACCESS(e_ptr);
27819         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
27820         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
27821         LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
27822         *ret_conv = CResult_NodeFeaturesDecodeErrorZ_err(e_conv);
27823         return tag_ptr(ret_conv, true);
27824 }
27825
27826 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
27827         LDKCResult_NodeFeaturesDecodeErrorZ* o_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)untag_ptr(o);
27828         jboolean ret_conv = CResult_NodeFeaturesDecodeErrorZ_is_ok(o_conv);
27829         return ret_conv;
27830 }
27831
27832 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
27833         if (!ptr_is_owned(_res)) return;
27834         void* _res_ptr = untag_ptr(_res);
27835         CHECK_ACCESS(_res_ptr);
27836         LDKCResult_NodeFeaturesDecodeErrorZ _res_conv = *(LDKCResult_NodeFeaturesDecodeErrorZ*)(_res_ptr);
27837         FREE(untag_ptr(_res));
27838         CResult_NodeFeaturesDecodeErrorZ_free(_res_conv);
27839 }
27840
27841 static inline uint64_t CResult_NodeFeaturesDecodeErrorZ_clone_ptr(LDKCResult_NodeFeaturesDecodeErrorZ *NONNULL_PTR arg) {
27842         LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
27843         *ret_conv = CResult_NodeFeaturesDecodeErrorZ_clone(arg);
27844         return tag_ptr(ret_conv, true);
27845 }
27846 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27847         LDKCResult_NodeFeaturesDecodeErrorZ* arg_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)untag_ptr(arg);
27848         int64_t ret_conv = CResult_NodeFeaturesDecodeErrorZ_clone_ptr(arg_conv);
27849         return ret_conv;
27850 }
27851
27852 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27853         LDKCResult_NodeFeaturesDecodeErrorZ* orig_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)untag_ptr(orig);
27854         LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
27855         *ret_conv = CResult_NodeFeaturesDecodeErrorZ_clone(orig_conv);
27856         return tag_ptr(ret_conv, true);
27857 }
27858
27859 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
27860         LDKBolt11InvoiceFeatures o_conv;
27861         o_conv.inner = untag_ptr(o);
27862         o_conv.is_owned = ptr_is_owned(o);
27863         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
27864         o_conv = Bolt11InvoiceFeatures_clone(&o_conv);
27865         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ");
27866         *ret_conv = CResult_Bolt11InvoiceFeaturesDecodeErrorZ_ok(o_conv);
27867         return tag_ptr(ret_conv, true);
27868 }
27869
27870 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceFeaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
27871         void* e_ptr = untag_ptr(e);
27872         CHECK_ACCESS(e_ptr);
27873         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
27874         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
27875         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ");
27876         *ret_conv = CResult_Bolt11InvoiceFeaturesDecodeErrorZ_err(e_conv);
27877         return tag_ptr(ret_conv, true);
27878 }
27879
27880 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceFeaturesDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
27881         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* o_conv = (LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ*)untag_ptr(o);
27882         jboolean ret_conv = CResult_Bolt11InvoiceFeaturesDecodeErrorZ_is_ok(o_conv);
27883         return ret_conv;
27884 }
27885
27886 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceFeaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
27887         if (!ptr_is_owned(_res)) return;
27888         void* _res_ptr = untag_ptr(_res);
27889         CHECK_ACCESS(_res_ptr);
27890         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ _res_conv = *(LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ*)(_res_ptr);
27891         FREE(untag_ptr(_res));
27892         CResult_Bolt11InvoiceFeaturesDecodeErrorZ_free(_res_conv);
27893 }
27894
27895 static inline uint64_t CResult_Bolt11InvoiceFeaturesDecodeErrorZ_clone_ptr(LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ *NONNULL_PTR arg) {
27896         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ");
27897         *ret_conv = CResult_Bolt11InvoiceFeaturesDecodeErrorZ_clone(arg);
27898         return tag_ptr(ret_conv, true);
27899 }
27900 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceFeaturesDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27901         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* arg_conv = (LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ*)untag_ptr(arg);
27902         int64_t ret_conv = CResult_Bolt11InvoiceFeaturesDecodeErrorZ_clone_ptr(arg_conv);
27903         return ret_conv;
27904 }
27905
27906 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceFeaturesDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27907         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* orig_conv = (LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ*)untag_ptr(orig);
27908         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ");
27909         *ret_conv = CResult_Bolt11InvoiceFeaturesDecodeErrorZ_clone(orig_conv);
27910         return tag_ptr(ret_conv, true);
27911 }
27912
27913 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt12InvoiceFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
27914         LDKBolt12InvoiceFeatures o_conv;
27915         o_conv.inner = untag_ptr(o);
27916         o_conv.is_owned = ptr_is_owned(o);
27917         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
27918         o_conv = Bolt12InvoiceFeatures_clone(&o_conv);
27919         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ");
27920         *ret_conv = CResult_Bolt12InvoiceFeaturesDecodeErrorZ_ok(o_conv);
27921         return tag_ptr(ret_conv, true);
27922 }
27923
27924 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt12InvoiceFeaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
27925         void* e_ptr = untag_ptr(e);
27926         CHECK_ACCESS(e_ptr);
27927         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
27928         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
27929         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ");
27930         *ret_conv = CResult_Bolt12InvoiceFeaturesDecodeErrorZ_err(e_conv);
27931         return tag_ptr(ret_conv, true);
27932 }
27933
27934 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt12InvoiceFeaturesDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
27935         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* o_conv = (LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ*)untag_ptr(o);
27936         jboolean ret_conv = CResult_Bolt12InvoiceFeaturesDecodeErrorZ_is_ok(o_conv);
27937         return ret_conv;
27938 }
27939
27940 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt12InvoiceFeaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
27941         if (!ptr_is_owned(_res)) return;
27942         void* _res_ptr = untag_ptr(_res);
27943         CHECK_ACCESS(_res_ptr);
27944         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ _res_conv = *(LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ*)(_res_ptr);
27945         FREE(untag_ptr(_res));
27946         CResult_Bolt12InvoiceFeaturesDecodeErrorZ_free(_res_conv);
27947 }
27948
27949 static inline uint64_t CResult_Bolt12InvoiceFeaturesDecodeErrorZ_clone_ptr(LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ *NONNULL_PTR arg) {
27950         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ");
27951         *ret_conv = CResult_Bolt12InvoiceFeaturesDecodeErrorZ_clone(arg);
27952         return tag_ptr(ret_conv, true);
27953 }
27954 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt12InvoiceFeaturesDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
27955         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* arg_conv = (LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ*)untag_ptr(arg);
27956         int64_t ret_conv = CResult_Bolt12InvoiceFeaturesDecodeErrorZ_clone_ptr(arg_conv);
27957         return ret_conv;
27958 }
27959
27960 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt12InvoiceFeaturesDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
27961         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* orig_conv = (LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ*)untag_ptr(orig);
27962         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ");
27963         *ret_conv = CResult_Bolt12InvoiceFeaturesDecodeErrorZ_clone(orig_conv);
27964         return tag_ptr(ret_conv, true);
27965 }
27966
27967 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedHopFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
27968         LDKBlindedHopFeatures o_conv;
27969         o_conv.inner = untag_ptr(o);
27970         o_conv.is_owned = ptr_is_owned(o);
27971         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
27972         o_conv = BlindedHopFeatures_clone(&o_conv);
27973         LDKCResult_BlindedHopFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopFeaturesDecodeErrorZ), "LDKCResult_BlindedHopFeaturesDecodeErrorZ");
27974         *ret_conv = CResult_BlindedHopFeaturesDecodeErrorZ_ok(o_conv);
27975         return tag_ptr(ret_conv, true);
27976 }
27977
27978 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedHopFeaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
27979         void* e_ptr = untag_ptr(e);
27980         CHECK_ACCESS(e_ptr);
27981         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
27982         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
27983         LDKCResult_BlindedHopFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopFeaturesDecodeErrorZ), "LDKCResult_BlindedHopFeaturesDecodeErrorZ");
27984         *ret_conv = CResult_BlindedHopFeaturesDecodeErrorZ_err(e_conv);
27985         return tag_ptr(ret_conv, true);
27986 }
27987
27988 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedHopFeaturesDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
27989         LDKCResult_BlindedHopFeaturesDecodeErrorZ* o_conv = (LDKCResult_BlindedHopFeaturesDecodeErrorZ*)untag_ptr(o);
27990         jboolean ret_conv = CResult_BlindedHopFeaturesDecodeErrorZ_is_ok(o_conv);
27991         return ret_conv;
27992 }
27993
27994 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedHopFeaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
27995         if (!ptr_is_owned(_res)) return;
27996         void* _res_ptr = untag_ptr(_res);
27997         CHECK_ACCESS(_res_ptr);
27998         LDKCResult_BlindedHopFeaturesDecodeErrorZ _res_conv = *(LDKCResult_BlindedHopFeaturesDecodeErrorZ*)(_res_ptr);
27999         FREE(untag_ptr(_res));
28000         CResult_BlindedHopFeaturesDecodeErrorZ_free(_res_conv);
28001 }
28002
28003 static inline uint64_t CResult_BlindedHopFeaturesDecodeErrorZ_clone_ptr(LDKCResult_BlindedHopFeaturesDecodeErrorZ *NONNULL_PTR arg) {
28004         LDKCResult_BlindedHopFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopFeaturesDecodeErrorZ), "LDKCResult_BlindedHopFeaturesDecodeErrorZ");
28005         *ret_conv = CResult_BlindedHopFeaturesDecodeErrorZ_clone(arg);
28006         return tag_ptr(ret_conv, true);
28007 }
28008 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedHopFeaturesDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
28009         LDKCResult_BlindedHopFeaturesDecodeErrorZ* arg_conv = (LDKCResult_BlindedHopFeaturesDecodeErrorZ*)untag_ptr(arg);
28010         int64_t ret_conv = CResult_BlindedHopFeaturesDecodeErrorZ_clone_ptr(arg_conv);
28011         return ret_conv;
28012 }
28013
28014 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedHopFeaturesDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28015         LDKCResult_BlindedHopFeaturesDecodeErrorZ* orig_conv = (LDKCResult_BlindedHopFeaturesDecodeErrorZ*)untag_ptr(orig);
28016         LDKCResult_BlindedHopFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopFeaturesDecodeErrorZ), "LDKCResult_BlindedHopFeaturesDecodeErrorZ");
28017         *ret_conv = CResult_BlindedHopFeaturesDecodeErrorZ_clone(orig_conv);
28018         return tag_ptr(ret_conv, true);
28019 }
28020
28021 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTypeFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
28022         LDKChannelTypeFeatures o_conv;
28023         o_conv.inner = untag_ptr(o);
28024         o_conv.is_owned = ptr_is_owned(o);
28025         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28026         o_conv = ChannelTypeFeatures_clone(&o_conv);
28027         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
28028         *ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_ok(o_conv);
28029         return tag_ptr(ret_conv, true);
28030 }
28031
28032 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTypeFeaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
28033         void* e_ptr = untag_ptr(e);
28034         CHECK_ACCESS(e_ptr);
28035         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28036         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28037         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
28038         *ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_err(e_conv);
28039         return tag_ptr(ret_conv, true);
28040 }
28041
28042 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTypeFeaturesDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
28043         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* o_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)untag_ptr(o);
28044         jboolean ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_is_ok(o_conv);
28045         return ret_conv;
28046 }
28047
28048 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTypeFeaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
28049         if (!ptr_is_owned(_res)) return;
28050         void* _res_ptr = untag_ptr(_res);
28051         CHECK_ACCESS(_res_ptr);
28052         LDKCResult_ChannelTypeFeaturesDecodeErrorZ _res_conv = *(LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)(_res_ptr);
28053         FREE(untag_ptr(_res));
28054         CResult_ChannelTypeFeaturesDecodeErrorZ_free(_res_conv);
28055 }
28056
28057 static inline uint64_t CResult_ChannelTypeFeaturesDecodeErrorZ_clone_ptr(LDKCResult_ChannelTypeFeaturesDecodeErrorZ *NONNULL_PTR arg) {
28058         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
28059         *ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_clone(arg);
28060         return tag_ptr(ret_conv, true);
28061 }
28062 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTypeFeaturesDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
28063         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* arg_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)untag_ptr(arg);
28064         int64_t ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_clone_ptr(arg_conv);
28065         return ret_conv;
28066 }
28067
28068 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTypeFeaturesDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28069         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* orig_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)untag_ptr(orig);
28070         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
28071         *ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_clone(orig_conv);
28072         return tag_ptr(ret_conv, true);
28073 }
28074
28075 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OfferIdDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
28076         LDKOfferId o_conv;
28077         o_conv.inner = untag_ptr(o);
28078         o_conv.is_owned = ptr_is_owned(o);
28079         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28080         o_conv = OfferId_clone(&o_conv);
28081         LDKCResult_OfferIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferIdDecodeErrorZ), "LDKCResult_OfferIdDecodeErrorZ");
28082         *ret_conv = CResult_OfferIdDecodeErrorZ_ok(o_conv);
28083         return tag_ptr(ret_conv, true);
28084 }
28085
28086 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OfferIdDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
28087         void* e_ptr = untag_ptr(e);
28088         CHECK_ACCESS(e_ptr);
28089         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28090         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28091         LDKCResult_OfferIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferIdDecodeErrorZ), "LDKCResult_OfferIdDecodeErrorZ");
28092         *ret_conv = CResult_OfferIdDecodeErrorZ_err(e_conv);
28093         return tag_ptr(ret_conv, true);
28094 }
28095
28096 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1OfferIdDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
28097         LDKCResult_OfferIdDecodeErrorZ* o_conv = (LDKCResult_OfferIdDecodeErrorZ*)untag_ptr(o);
28098         jboolean ret_conv = CResult_OfferIdDecodeErrorZ_is_ok(o_conv);
28099         return ret_conv;
28100 }
28101
28102 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1OfferIdDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
28103         if (!ptr_is_owned(_res)) return;
28104         void* _res_ptr = untag_ptr(_res);
28105         CHECK_ACCESS(_res_ptr);
28106         LDKCResult_OfferIdDecodeErrorZ _res_conv = *(LDKCResult_OfferIdDecodeErrorZ*)(_res_ptr);
28107         FREE(untag_ptr(_res));
28108         CResult_OfferIdDecodeErrorZ_free(_res_conv);
28109 }
28110
28111 static inline uint64_t CResult_OfferIdDecodeErrorZ_clone_ptr(LDKCResult_OfferIdDecodeErrorZ *NONNULL_PTR arg) {
28112         LDKCResult_OfferIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferIdDecodeErrorZ), "LDKCResult_OfferIdDecodeErrorZ");
28113         *ret_conv = CResult_OfferIdDecodeErrorZ_clone(arg);
28114         return tag_ptr(ret_conv, true);
28115 }
28116 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OfferIdDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
28117         LDKCResult_OfferIdDecodeErrorZ* arg_conv = (LDKCResult_OfferIdDecodeErrorZ*)untag_ptr(arg);
28118         int64_t ret_conv = CResult_OfferIdDecodeErrorZ_clone_ptr(arg_conv);
28119         return ret_conv;
28120 }
28121
28122 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OfferIdDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28123         LDKCResult_OfferIdDecodeErrorZ* orig_conv = (LDKCResult_OfferIdDecodeErrorZ*)untag_ptr(orig);
28124         LDKCResult_OfferIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferIdDecodeErrorZ), "LDKCResult_OfferIdDecodeErrorZ");
28125         *ret_conv = CResult_OfferIdDecodeErrorZ_clone(orig_conv);
28126         return tag_ptr(ret_conv, true);
28127 }
28128
28129 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneBolt12SemanticErrorZ_1ok(JNIEnv *env, jclass clz) {
28130         LDKCResult_NoneBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt12SemanticErrorZ), "LDKCResult_NoneBolt12SemanticErrorZ");
28131         *ret_conv = CResult_NoneBolt12SemanticErrorZ_ok();
28132         return tag_ptr(ret_conv, true);
28133 }
28134
28135 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneBolt12SemanticErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
28136         LDKBolt12SemanticError e_conv = LDKBolt12SemanticError_from_java(env, e);
28137         LDKCResult_NoneBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt12SemanticErrorZ), "LDKCResult_NoneBolt12SemanticErrorZ");
28138         *ret_conv = CResult_NoneBolt12SemanticErrorZ_err(e_conv);
28139         return tag_ptr(ret_conv, true);
28140 }
28141
28142 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NoneBolt12SemanticErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
28143         LDKCResult_NoneBolt12SemanticErrorZ* o_conv = (LDKCResult_NoneBolt12SemanticErrorZ*)untag_ptr(o);
28144         jboolean ret_conv = CResult_NoneBolt12SemanticErrorZ_is_ok(o_conv);
28145         return ret_conv;
28146 }
28147
28148 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneBolt12SemanticErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
28149         if (!ptr_is_owned(_res)) return;
28150         void* _res_ptr = untag_ptr(_res);
28151         CHECK_ACCESS(_res_ptr);
28152         LDKCResult_NoneBolt12SemanticErrorZ _res_conv = *(LDKCResult_NoneBolt12SemanticErrorZ*)(_res_ptr);
28153         FREE(untag_ptr(_res));
28154         CResult_NoneBolt12SemanticErrorZ_free(_res_conv);
28155 }
28156
28157 static inline uint64_t CResult_NoneBolt12SemanticErrorZ_clone_ptr(LDKCResult_NoneBolt12SemanticErrorZ *NONNULL_PTR arg) {
28158         LDKCResult_NoneBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt12SemanticErrorZ), "LDKCResult_NoneBolt12SemanticErrorZ");
28159         *ret_conv = CResult_NoneBolt12SemanticErrorZ_clone(arg);
28160         return tag_ptr(ret_conv, true);
28161 }
28162 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneBolt12SemanticErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
28163         LDKCResult_NoneBolt12SemanticErrorZ* arg_conv = (LDKCResult_NoneBolt12SemanticErrorZ*)untag_ptr(arg);
28164         int64_t ret_conv = CResult_NoneBolt12SemanticErrorZ_clone_ptr(arg_conv);
28165         return ret_conv;
28166 }
28167
28168 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneBolt12SemanticErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28169         LDKCResult_NoneBolt12SemanticErrorZ* orig_conv = (LDKCResult_NoneBolt12SemanticErrorZ*)untag_ptr(orig);
28170         LDKCResult_NoneBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt12SemanticErrorZ), "LDKCResult_NoneBolt12SemanticErrorZ");
28171         *ret_conv = CResult_NoneBolt12SemanticErrorZ_clone(orig_conv);
28172         return tag_ptr(ret_conv, true);
28173 }
28174
28175 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OfferBolt12SemanticErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
28176         LDKOffer o_conv;
28177         o_conv.inner = untag_ptr(o);
28178         o_conv.is_owned = ptr_is_owned(o);
28179         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28180         o_conv = Offer_clone(&o_conv);
28181         LDKCResult_OfferBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferBolt12SemanticErrorZ), "LDKCResult_OfferBolt12SemanticErrorZ");
28182         *ret_conv = CResult_OfferBolt12SemanticErrorZ_ok(o_conv);
28183         return tag_ptr(ret_conv, true);
28184 }
28185
28186 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OfferBolt12SemanticErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
28187         LDKBolt12SemanticError e_conv = LDKBolt12SemanticError_from_java(env, e);
28188         LDKCResult_OfferBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferBolt12SemanticErrorZ), "LDKCResult_OfferBolt12SemanticErrorZ");
28189         *ret_conv = CResult_OfferBolt12SemanticErrorZ_err(e_conv);
28190         return tag_ptr(ret_conv, true);
28191 }
28192
28193 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1OfferBolt12SemanticErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
28194         LDKCResult_OfferBolt12SemanticErrorZ* o_conv = (LDKCResult_OfferBolt12SemanticErrorZ*)untag_ptr(o);
28195         jboolean ret_conv = CResult_OfferBolt12SemanticErrorZ_is_ok(o_conv);
28196         return ret_conv;
28197 }
28198
28199 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1OfferBolt12SemanticErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
28200         if (!ptr_is_owned(_res)) return;
28201         void* _res_ptr = untag_ptr(_res);
28202         CHECK_ACCESS(_res_ptr);
28203         LDKCResult_OfferBolt12SemanticErrorZ _res_conv = *(LDKCResult_OfferBolt12SemanticErrorZ*)(_res_ptr);
28204         FREE(untag_ptr(_res));
28205         CResult_OfferBolt12SemanticErrorZ_free(_res_conv);
28206 }
28207
28208 static inline uint64_t CResult_OfferBolt12SemanticErrorZ_clone_ptr(LDKCResult_OfferBolt12SemanticErrorZ *NONNULL_PTR arg) {
28209         LDKCResult_OfferBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferBolt12SemanticErrorZ), "LDKCResult_OfferBolt12SemanticErrorZ");
28210         *ret_conv = CResult_OfferBolt12SemanticErrorZ_clone(arg);
28211         return tag_ptr(ret_conv, true);
28212 }
28213 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OfferBolt12SemanticErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
28214         LDKCResult_OfferBolt12SemanticErrorZ* arg_conv = (LDKCResult_OfferBolt12SemanticErrorZ*)untag_ptr(arg);
28215         int64_t ret_conv = CResult_OfferBolt12SemanticErrorZ_clone_ptr(arg_conv);
28216         return ret_conv;
28217 }
28218
28219 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OfferBolt12SemanticErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28220         LDKCResult_OfferBolt12SemanticErrorZ* orig_conv = (LDKCResult_OfferBolt12SemanticErrorZ*)untag_ptr(orig);
28221         LDKCResult_OfferBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferBolt12SemanticErrorZ), "LDKCResult_OfferBolt12SemanticErrorZ");
28222         *ret_conv = CResult_OfferBolt12SemanticErrorZ_clone(orig_conv);
28223         return tag_ptr(ret_conv, true);
28224 }
28225
28226 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
28227         LDKInvoiceRequestWithDerivedPayerIdBuilder o_conv;
28228         o_conv.inner = untag_ptr(o);
28229         o_conv.is_owned = ptr_is_owned(o);
28230         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28231         // WARNING: we need a move here but no clone is available for LDKInvoiceRequestWithDerivedPayerIdBuilder
28232         
28233         LDKCResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ), "LDKCResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ");
28234         *ret_conv = CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ_ok(o_conv);
28235         return tag_ptr(ret_conv, true);
28236 }
28237
28238 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
28239         LDKBolt12SemanticError e_conv = LDKBolt12SemanticError_from_java(env, e);
28240         LDKCResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ), "LDKCResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ");
28241         *ret_conv = CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ_err(e_conv);
28242         return tag_ptr(ret_conv, true);
28243 }
28244
28245 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
28246         LDKCResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ* o_conv = (LDKCResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ*)untag_ptr(o);
28247         jboolean ret_conv = CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ_is_ok(o_conv);
28248         return ret_conv;
28249 }
28250
28251 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
28252         if (!ptr_is_owned(_res)) return;
28253         void* _res_ptr = untag_ptr(_res);
28254         CHECK_ACCESS(_res_ptr);
28255         LDKCResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ _res_conv = *(LDKCResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ*)(_res_ptr);
28256         FREE(untag_ptr(_res));
28257         CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ_free(_res_conv);
28258 }
28259
28260 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
28261         LDKInvoiceRequestWithExplicitPayerIdBuilder o_conv;
28262         o_conv.inner = untag_ptr(o);
28263         o_conv.is_owned = ptr_is_owned(o);
28264         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28265         // WARNING: we need a move here but no clone is available for LDKInvoiceRequestWithExplicitPayerIdBuilder
28266         
28267         LDKCResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ), "LDKCResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ");
28268         *ret_conv = CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ_ok(o_conv);
28269         return tag_ptr(ret_conv, true);
28270 }
28271
28272 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
28273         LDKBolt12SemanticError e_conv = LDKBolt12SemanticError_from_java(env, e);
28274         LDKCResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ), "LDKCResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ");
28275         *ret_conv = CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ_err(e_conv);
28276         return tag_ptr(ret_conv, true);
28277 }
28278
28279 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
28280         LDKCResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ* o_conv = (LDKCResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ*)untag_ptr(o);
28281         jboolean ret_conv = CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ_is_ok(o_conv);
28282         return ret_conv;
28283 }
28284
28285 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
28286         if (!ptr_is_owned(_res)) return;
28287         void* _res_ptr = untag_ptr(_res);
28288         CHECK_ACCESS(_res_ptr);
28289         LDKCResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ _res_conv = *(LDKCResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ*)(_res_ptr);
28290         FREE(untag_ptr(_res));
28291         CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ_free(_res_conv);
28292 }
28293
28294 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OfferBolt12ParseErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
28295         LDKOffer o_conv;
28296         o_conv.inner = untag_ptr(o);
28297         o_conv.is_owned = ptr_is_owned(o);
28298         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28299         o_conv = Offer_clone(&o_conv);
28300         LDKCResult_OfferBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferBolt12ParseErrorZ), "LDKCResult_OfferBolt12ParseErrorZ");
28301         *ret_conv = CResult_OfferBolt12ParseErrorZ_ok(o_conv);
28302         return tag_ptr(ret_conv, true);
28303 }
28304
28305 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OfferBolt12ParseErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
28306         LDKBolt12ParseError e_conv;
28307         e_conv.inner = untag_ptr(e);
28308         e_conv.is_owned = ptr_is_owned(e);
28309         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
28310         e_conv = Bolt12ParseError_clone(&e_conv);
28311         LDKCResult_OfferBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferBolt12ParseErrorZ), "LDKCResult_OfferBolt12ParseErrorZ");
28312         *ret_conv = CResult_OfferBolt12ParseErrorZ_err(e_conv);
28313         return tag_ptr(ret_conv, true);
28314 }
28315
28316 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1OfferBolt12ParseErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
28317         LDKCResult_OfferBolt12ParseErrorZ* o_conv = (LDKCResult_OfferBolt12ParseErrorZ*)untag_ptr(o);
28318         jboolean ret_conv = CResult_OfferBolt12ParseErrorZ_is_ok(o_conv);
28319         return ret_conv;
28320 }
28321
28322 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1OfferBolt12ParseErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
28323         if (!ptr_is_owned(_res)) return;
28324         void* _res_ptr = untag_ptr(_res);
28325         CHECK_ACCESS(_res_ptr);
28326         LDKCResult_OfferBolt12ParseErrorZ _res_conv = *(LDKCResult_OfferBolt12ParseErrorZ*)(_res_ptr);
28327         FREE(untag_ptr(_res));
28328         CResult_OfferBolt12ParseErrorZ_free(_res_conv);
28329 }
28330
28331 static inline uint64_t CResult_OfferBolt12ParseErrorZ_clone_ptr(LDKCResult_OfferBolt12ParseErrorZ *NONNULL_PTR arg) {
28332         LDKCResult_OfferBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferBolt12ParseErrorZ), "LDKCResult_OfferBolt12ParseErrorZ");
28333         *ret_conv = CResult_OfferBolt12ParseErrorZ_clone(arg);
28334         return tag_ptr(ret_conv, true);
28335 }
28336 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OfferBolt12ParseErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
28337         LDKCResult_OfferBolt12ParseErrorZ* arg_conv = (LDKCResult_OfferBolt12ParseErrorZ*)untag_ptr(arg);
28338         int64_t ret_conv = CResult_OfferBolt12ParseErrorZ_clone_ptr(arg_conv);
28339         return ret_conv;
28340 }
28341
28342 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OfferBolt12ParseErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28343         LDKCResult_OfferBolt12ParseErrorZ* orig_conv = (LDKCResult_OfferBolt12ParseErrorZ*)untag_ptr(orig);
28344         LDKCResult_OfferBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferBolt12ParseErrorZ), "LDKCResult_OfferBolt12ParseErrorZ");
28345         *ret_conv = CResult_OfferBolt12ParseErrorZ_clone(orig_conv);
28346         return tag_ptr(ret_conv, true);
28347 }
28348
28349 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeIdDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
28350         LDKNodeId o_conv;
28351         o_conv.inner = untag_ptr(o);
28352         o_conv.is_owned = ptr_is_owned(o);
28353         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28354         o_conv = NodeId_clone(&o_conv);
28355         LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
28356         *ret_conv = CResult_NodeIdDecodeErrorZ_ok(o_conv);
28357         return tag_ptr(ret_conv, true);
28358 }
28359
28360 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeIdDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
28361         void* e_ptr = untag_ptr(e);
28362         CHECK_ACCESS(e_ptr);
28363         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28364         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28365         LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
28366         *ret_conv = CResult_NodeIdDecodeErrorZ_err(e_conv);
28367         return tag_ptr(ret_conv, true);
28368 }
28369
28370 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NodeIdDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
28371         LDKCResult_NodeIdDecodeErrorZ* o_conv = (LDKCResult_NodeIdDecodeErrorZ*)untag_ptr(o);
28372         jboolean ret_conv = CResult_NodeIdDecodeErrorZ_is_ok(o_conv);
28373         return ret_conv;
28374 }
28375
28376 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NodeIdDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
28377         if (!ptr_is_owned(_res)) return;
28378         void* _res_ptr = untag_ptr(_res);
28379         CHECK_ACCESS(_res_ptr);
28380         LDKCResult_NodeIdDecodeErrorZ _res_conv = *(LDKCResult_NodeIdDecodeErrorZ*)(_res_ptr);
28381         FREE(untag_ptr(_res));
28382         CResult_NodeIdDecodeErrorZ_free(_res_conv);
28383 }
28384
28385 static inline uint64_t CResult_NodeIdDecodeErrorZ_clone_ptr(LDKCResult_NodeIdDecodeErrorZ *NONNULL_PTR arg) {
28386         LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
28387         *ret_conv = CResult_NodeIdDecodeErrorZ_clone(arg);
28388         return tag_ptr(ret_conv, true);
28389 }
28390 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeIdDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
28391         LDKCResult_NodeIdDecodeErrorZ* arg_conv = (LDKCResult_NodeIdDecodeErrorZ*)untag_ptr(arg);
28392         int64_t ret_conv = CResult_NodeIdDecodeErrorZ_clone_ptr(arg_conv);
28393         return ret_conv;
28394 }
28395
28396 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeIdDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28397         LDKCResult_NodeIdDecodeErrorZ* orig_conv = (LDKCResult_NodeIdDecodeErrorZ*)untag_ptr(orig);
28398         LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
28399         *ret_conv = CResult_NodeIdDecodeErrorZ_clone(orig_conv);
28400         return tag_ptr(ret_conv, true);
28401 }
28402
28403 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeySecp256k1ErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
28404         LDKPublicKey o_ref;
28405         CHECK((*env)->GetArrayLength(env, o) == 33);
28406         (*env)->GetByteArrayRegion(env, o, 0, 33, o_ref.compressed_form);
28407         LDKCResult_PublicKeySecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeySecp256k1ErrorZ), "LDKCResult_PublicKeySecp256k1ErrorZ");
28408         *ret_conv = CResult_PublicKeySecp256k1ErrorZ_ok(o_ref);
28409         return tag_ptr(ret_conv, true);
28410 }
28411
28412 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeySecp256k1ErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
28413         LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_java(env, e);
28414         LDKCResult_PublicKeySecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeySecp256k1ErrorZ), "LDKCResult_PublicKeySecp256k1ErrorZ");
28415         *ret_conv = CResult_PublicKeySecp256k1ErrorZ_err(e_conv);
28416         return tag_ptr(ret_conv, true);
28417 }
28418
28419 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeySecp256k1ErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
28420         LDKCResult_PublicKeySecp256k1ErrorZ* o_conv = (LDKCResult_PublicKeySecp256k1ErrorZ*)untag_ptr(o);
28421         jboolean ret_conv = CResult_PublicKeySecp256k1ErrorZ_is_ok(o_conv);
28422         return ret_conv;
28423 }
28424
28425 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeySecp256k1ErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
28426         if (!ptr_is_owned(_res)) return;
28427         void* _res_ptr = untag_ptr(_res);
28428         CHECK_ACCESS(_res_ptr);
28429         LDKCResult_PublicKeySecp256k1ErrorZ _res_conv = *(LDKCResult_PublicKeySecp256k1ErrorZ*)(_res_ptr);
28430         FREE(untag_ptr(_res));
28431         CResult_PublicKeySecp256k1ErrorZ_free(_res_conv);
28432 }
28433
28434 static inline uint64_t CResult_PublicKeySecp256k1ErrorZ_clone_ptr(LDKCResult_PublicKeySecp256k1ErrorZ *NONNULL_PTR arg) {
28435         LDKCResult_PublicKeySecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeySecp256k1ErrorZ), "LDKCResult_PublicKeySecp256k1ErrorZ");
28436         *ret_conv = CResult_PublicKeySecp256k1ErrorZ_clone(arg);
28437         return tag_ptr(ret_conv, true);
28438 }
28439 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeySecp256k1ErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
28440         LDKCResult_PublicKeySecp256k1ErrorZ* arg_conv = (LDKCResult_PublicKeySecp256k1ErrorZ*)untag_ptr(arg);
28441         int64_t ret_conv = CResult_PublicKeySecp256k1ErrorZ_clone_ptr(arg_conv);
28442         return ret_conv;
28443 }
28444
28445 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeySecp256k1ErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28446         LDKCResult_PublicKeySecp256k1ErrorZ* orig_conv = (LDKCResult_PublicKeySecp256k1ErrorZ*)untag_ptr(orig);
28447         LDKCResult_PublicKeySecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeySecp256k1ErrorZ), "LDKCResult_PublicKeySecp256k1ErrorZ");
28448         *ret_conv = CResult_PublicKeySecp256k1ErrorZ_clone(orig_conv);
28449         return tag_ptr(ret_conv, true);
28450 }
28451
28452 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1NetworkUpdateZ_1some(JNIEnv *env, jclass clz, int64_t o) {
28453         void* o_ptr = untag_ptr(o);
28454         CHECK_ACCESS(o_ptr);
28455         LDKNetworkUpdate o_conv = *(LDKNetworkUpdate*)(o_ptr);
28456         o_conv = NetworkUpdate_clone((LDKNetworkUpdate*)untag_ptr(o));
28457         LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
28458         *ret_copy = COption_NetworkUpdateZ_some(o_conv);
28459         int64_t ret_ref = tag_ptr(ret_copy, true);
28460         return ret_ref;
28461 }
28462
28463 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1NetworkUpdateZ_1none(JNIEnv *env, jclass clz) {
28464         LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
28465         *ret_copy = COption_NetworkUpdateZ_none();
28466         int64_t ret_ref = tag_ptr(ret_copy, true);
28467         return ret_ref;
28468 }
28469
28470 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1NetworkUpdateZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
28471         if (!ptr_is_owned(_res)) return;
28472         void* _res_ptr = untag_ptr(_res);
28473         CHECK_ACCESS(_res_ptr);
28474         LDKCOption_NetworkUpdateZ _res_conv = *(LDKCOption_NetworkUpdateZ*)(_res_ptr);
28475         FREE(untag_ptr(_res));
28476         COption_NetworkUpdateZ_free(_res_conv);
28477 }
28478
28479 static inline uint64_t COption_NetworkUpdateZ_clone_ptr(LDKCOption_NetworkUpdateZ *NONNULL_PTR arg) {
28480         LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
28481         *ret_copy = COption_NetworkUpdateZ_clone(arg);
28482         int64_t ret_ref = tag_ptr(ret_copy, true);
28483         return ret_ref;
28484 }
28485 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1NetworkUpdateZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
28486         LDKCOption_NetworkUpdateZ* arg_conv = (LDKCOption_NetworkUpdateZ*)untag_ptr(arg);
28487         int64_t ret_conv = COption_NetworkUpdateZ_clone_ptr(arg_conv);
28488         return ret_conv;
28489 }
28490
28491 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1NetworkUpdateZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28492         LDKCOption_NetworkUpdateZ* orig_conv = (LDKCOption_NetworkUpdateZ*)untag_ptr(orig);
28493         LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
28494         *ret_copy = COption_NetworkUpdateZ_clone(orig_conv);
28495         int64_t ret_ref = tag_ptr(ret_copy, true);
28496         return ret_ref;
28497 }
28498
28499 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1NetworkUpdateZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
28500         void* o_ptr = untag_ptr(o);
28501         CHECK_ACCESS(o_ptr);
28502         LDKCOption_NetworkUpdateZ o_conv = *(LDKCOption_NetworkUpdateZ*)(o_ptr);
28503         o_conv = COption_NetworkUpdateZ_clone((LDKCOption_NetworkUpdateZ*)untag_ptr(o));
28504         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
28505         *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_ok(o_conv);
28506         return tag_ptr(ret_conv, true);
28507 }
28508
28509 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1NetworkUpdateZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
28510         void* e_ptr = untag_ptr(e);
28511         CHECK_ACCESS(e_ptr);
28512         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28513         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28514         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
28515         *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_err(e_conv);
28516         return tag_ptr(ret_conv, true);
28517 }
28518
28519 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1NetworkUpdateZDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
28520         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* o_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)untag_ptr(o);
28521         jboolean ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_is_ok(o_conv);
28522         return ret_conv;
28523 }
28524
28525 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1NetworkUpdateZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
28526         if (!ptr_is_owned(_res)) return;
28527         void* _res_ptr = untag_ptr(_res);
28528         CHECK_ACCESS(_res_ptr);
28529         LDKCResult_COption_NetworkUpdateZDecodeErrorZ _res_conv = *(LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)(_res_ptr);
28530         FREE(untag_ptr(_res));
28531         CResult_COption_NetworkUpdateZDecodeErrorZ_free(_res_conv);
28532 }
28533
28534 static inline uint64_t CResult_COption_NetworkUpdateZDecodeErrorZ_clone_ptr(LDKCResult_COption_NetworkUpdateZDecodeErrorZ *NONNULL_PTR arg) {
28535         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
28536         *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_clone(arg);
28537         return tag_ptr(ret_conv, true);
28538 }
28539 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1NetworkUpdateZDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
28540         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* arg_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)untag_ptr(arg);
28541         int64_t ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_clone_ptr(arg_conv);
28542         return ret_conv;
28543 }
28544
28545 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1NetworkUpdateZDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28546         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* orig_conv = (LDKCResult_COption_NetworkUpdateZDecodeErrorZ*)untag_ptr(orig);
28547         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
28548         *ret_conv = CResult_COption_NetworkUpdateZDecodeErrorZ_clone(orig_conv);
28549         return tag_ptr(ret_conv, true);
28550 }
28551
28552 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1UtxoLookupZ_1some(JNIEnv *env, jclass clz, int64_t o) {
28553         void* o_ptr = untag_ptr(o);
28554         CHECK_ACCESS(o_ptr);
28555         LDKUtxoLookup o_conv = *(LDKUtxoLookup*)(o_ptr);
28556         if (o_conv.free == LDKUtxoLookup_JCalls_free) {
28557                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
28558                 LDKUtxoLookup_JCalls_cloned(&o_conv);
28559         }
28560         LDKCOption_UtxoLookupZ *ret_copy = MALLOC(sizeof(LDKCOption_UtxoLookupZ), "LDKCOption_UtxoLookupZ");
28561         *ret_copy = COption_UtxoLookupZ_some(o_conv);
28562         int64_t ret_ref = tag_ptr(ret_copy, true);
28563         return ret_ref;
28564 }
28565
28566 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1UtxoLookupZ_1none(JNIEnv *env, jclass clz) {
28567         LDKCOption_UtxoLookupZ *ret_copy = MALLOC(sizeof(LDKCOption_UtxoLookupZ), "LDKCOption_UtxoLookupZ");
28568         *ret_copy = COption_UtxoLookupZ_none();
28569         int64_t ret_ref = tag_ptr(ret_copy, true);
28570         return ret_ref;
28571 }
28572
28573 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1UtxoLookupZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
28574         if (!ptr_is_owned(_res)) return;
28575         void* _res_ptr = untag_ptr(_res);
28576         CHECK_ACCESS(_res_ptr);
28577         LDKCOption_UtxoLookupZ _res_conv = *(LDKCOption_UtxoLookupZ*)(_res_ptr);
28578         FREE(untag_ptr(_res));
28579         COption_UtxoLookupZ_free(_res_conv);
28580 }
28581
28582 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1ok(JNIEnv *env, jclass clz) {
28583         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
28584         *ret_conv = CResult_NoneLightningErrorZ_ok();
28585         return tag_ptr(ret_conv, true);
28586 }
28587
28588 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
28589         LDKLightningError e_conv;
28590         e_conv.inner = untag_ptr(e);
28591         e_conv.is_owned = ptr_is_owned(e);
28592         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
28593         e_conv = LightningError_clone(&e_conv);
28594         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
28595         *ret_conv = CResult_NoneLightningErrorZ_err(e_conv);
28596         return tag_ptr(ret_conv, true);
28597 }
28598
28599 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
28600         LDKCResult_NoneLightningErrorZ* o_conv = (LDKCResult_NoneLightningErrorZ*)untag_ptr(o);
28601         jboolean ret_conv = CResult_NoneLightningErrorZ_is_ok(o_conv);
28602         return ret_conv;
28603 }
28604
28605 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
28606         if (!ptr_is_owned(_res)) return;
28607         void* _res_ptr = untag_ptr(_res);
28608         CHECK_ACCESS(_res_ptr);
28609         LDKCResult_NoneLightningErrorZ _res_conv = *(LDKCResult_NoneLightningErrorZ*)(_res_ptr);
28610         FREE(untag_ptr(_res));
28611         CResult_NoneLightningErrorZ_free(_res_conv);
28612 }
28613
28614 static inline uint64_t CResult_NoneLightningErrorZ_clone_ptr(LDKCResult_NoneLightningErrorZ *NONNULL_PTR arg) {
28615         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
28616         *ret_conv = CResult_NoneLightningErrorZ_clone(arg);
28617         return tag_ptr(ret_conv, true);
28618 }
28619 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
28620         LDKCResult_NoneLightningErrorZ* arg_conv = (LDKCResult_NoneLightningErrorZ*)untag_ptr(arg);
28621         int64_t ret_conv = CResult_NoneLightningErrorZ_clone_ptr(arg_conv);
28622         return ret_conv;
28623 }
28624
28625 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28626         LDKCResult_NoneLightningErrorZ* orig_conv = (LDKCResult_NoneLightningErrorZ*)untag_ptr(orig);
28627         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
28628         *ret_conv = CResult_NoneLightningErrorZ_clone(orig_conv);
28629         return tag_ptr(ret_conv, true);
28630 }
28631
28632 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1ok(JNIEnv *env, jclass clz, jboolean o) {
28633         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
28634         *ret_conv = CResult_boolLightningErrorZ_ok(o);
28635         return tag_ptr(ret_conv, true);
28636 }
28637
28638 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
28639         LDKLightningError e_conv;
28640         e_conv.inner = untag_ptr(e);
28641         e_conv.is_owned = ptr_is_owned(e);
28642         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
28643         e_conv = LightningError_clone(&e_conv);
28644         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
28645         *ret_conv = CResult_boolLightningErrorZ_err(e_conv);
28646         return tag_ptr(ret_conv, true);
28647 }
28648
28649 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
28650         LDKCResult_boolLightningErrorZ* o_conv = (LDKCResult_boolLightningErrorZ*)untag_ptr(o);
28651         jboolean ret_conv = CResult_boolLightningErrorZ_is_ok(o_conv);
28652         return ret_conv;
28653 }
28654
28655 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
28656         if (!ptr_is_owned(_res)) return;
28657         void* _res_ptr = untag_ptr(_res);
28658         CHECK_ACCESS(_res_ptr);
28659         LDKCResult_boolLightningErrorZ _res_conv = *(LDKCResult_boolLightningErrorZ*)(_res_ptr);
28660         FREE(untag_ptr(_res));
28661         CResult_boolLightningErrorZ_free(_res_conv);
28662 }
28663
28664 static inline uint64_t CResult_boolLightningErrorZ_clone_ptr(LDKCResult_boolLightningErrorZ *NONNULL_PTR arg) {
28665         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
28666         *ret_conv = CResult_boolLightningErrorZ_clone(arg);
28667         return tag_ptr(ret_conv, true);
28668 }
28669 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
28670         LDKCResult_boolLightningErrorZ* arg_conv = (LDKCResult_boolLightningErrorZ*)untag_ptr(arg);
28671         int64_t ret_conv = CResult_boolLightningErrorZ_clone_ptr(arg_conv);
28672         return ret_conv;
28673 }
28674
28675 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28676         LDKCResult_boolLightningErrorZ* orig_conv = (LDKCResult_boolLightningErrorZ*)untag_ptr(orig);
28677         LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
28678         *ret_conv = CResult_boolLightningErrorZ_clone(orig_conv);
28679         return tag_ptr(ret_conv, true);
28680 }
28681
28682 static inline uint64_t C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone_ptr(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR arg) {
28683         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
28684         *ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(arg);
28685         return tag_ptr(ret_conv, true);
28686 }
28687 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
28688         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* arg_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)untag_ptr(arg);
28689         int64_t ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone_ptr(arg_conv);
28690         return ret_conv;
28691 }
28692
28693 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28694         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* orig_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)untag_ptr(orig);
28695         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
28696         *ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(orig_conv);
28697         return tag_ptr(ret_conv, true);
28698 }
28699
28700 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) {
28701         LDKChannelAnnouncement a_conv;
28702         a_conv.inner = untag_ptr(a);
28703         a_conv.is_owned = ptr_is_owned(a);
28704         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
28705         a_conv = ChannelAnnouncement_clone(&a_conv);
28706         LDKChannelUpdate b_conv;
28707         b_conv.inner = untag_ptr(b);
28708         b_conv.is_owned = ptr_is_owned(b);
28709         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
28710         b_conv = ChannelUpdate_clone(&b_conv);
28711         LDKChannelUpdate c_conv;
28712         c_conv.inner = untag_ptr(c);
28713         c_conv.is_owned = ptr_is_owned(c);
28714         CHECK_INNER_FIELD_ACCESS_OR_NULL(c_conv);
28715         c_conv = ChannelUpdate_clone(&c_conv);
28716         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
28717         *ret_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(a_conv, b_conv, c_conv);
28718         return tag_ptr(ret_conv, true);
28719 }
28720
28721 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
28722         if (!ptr_is_owned(_res)) return;
28723         void* _res_ptr = untag_ptr(_res);
28724         CHECK_ACCESS(_res_ptr);
28725         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ _res_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(_res_ptr);
28726         FREE(untag_ptr(_res));
28727         C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(_res_conv);
28728 }
28729
28730 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZZ_1some(JNIEnv *env, jclass clz, int64_t o) {
28731         void* o_ptr = untag_ptr(o);
28732         CHECK_ACCESS(o_ptr);
28733         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ o_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(o_ptr);
28734         o_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone((LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)untag_ptr(o));
28735         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *ret_copy = MALLOC(sizeof(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ), "LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ");
28736         *ret_copy = COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_some(o_conv);
28737         int64_t ret_ref = tag_ptr(ret_copy, true);
28738         return ret_ref;
28739 }
28740
28741 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZZ_1none(JNIEnv *env, jclass clz) {
28742         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *ret_copy = MALLOC(sizeof(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ), "LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ");
28743         *ret_copy = COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_none();
28744         int64_t ret_ref = tag_ptr(ret_copy, true);
28745         return ret_ref;
28746 }
28747
28748 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
28749         if (!ptr_is_owned(_res)) return;
28750         void* _res_ptr = untag_ptr(_res);
28751         CHECK_ACCESS(_res_ptr);
28752         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ _res_conv = *(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ*)(_res_ptr);
28753         FREE(untag_ptr(_res));
28754         COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(_res_conv);
28755 }
28756
28757 static inline uint64_t COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone_ptr(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *NONNULL_PTR arg) {
28758         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *ret_copy = MALLOC(sizeof(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ), "LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ");
28759         *ret_copy = COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone(arg);
28760         int64_t ret_ref = tag_ptr(ret_copy, true);
28761         return ret_ref;
28762 }
28763 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
28764         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ* arg_conv = (LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ*)untag_ptr(arg);
28765         int64_t ret_conv = COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone_ptr(arg_conv);
28766         return ret_conv;
28767 }
28768
28769 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28770         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ* orig_conv = (LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ*)untag_ptr(orig);
28771         LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *ret_copy = MALLOC(sizeof(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ), "LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ");
28772         *ret_copy = COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone(orig_conv);
28773         int64_t ret_ref = tag_ptr(ret_copy, true);
28774         return ret_ref;
28775 }
28776
28777 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1MessageSendEventZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
28778         LDKCVec_MessageSendEventZ _res_constr;
28779         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
28780         if (_res_constr.datalen > 0)
28781                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKMessageSendEvent), "LDKCVec_MessageSendEventZ Elements");
28782         else
28783                 _res_constr.data = NULL;
28784         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
28785         for (size_t s = 0; s < _res_constr.datalen; s++) {
28786                 int64_t _res_conv_18 = _res_vals[s];
28787                 void* _res_conv_18_ptr = untag_ptr(_res_conv_18);
28788                 CHECK_ACCESS(_res_conv_18_ptr);
28789                 LDKMessageSendEvent _res_conv_18_conv = *(LDKMessageSendEvent*)(_res_conv_18_ptr);
28790                 FREE(untag_ptr(_res_conv_18));
28791                 _res_constr.data[s] = _res_conv_18_conv;
28792         }
28793         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
28794         CVec_MessageSendEventZ_free(_res_constr);
28795 }
28796
28797 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateInfoDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
28798         LDKChannelUpdateInfo o_conv;
28799         o_conv.inner = untag_ptr(o);
28800         o_conv.is_owned = ptr_is_owned(o);
28801         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28802         o_conv = ChannelUpdateInfo_clone(&o_conv);
28803         LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
28804         *ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_ok(o_conv);
28805         return tag_ptr(ret_conv, true);
28806 }
28807
28808 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateInfoDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
28809         void* e_ptr = untag_ptr(e);
28810         CHECK_ACCESS(e_ptr);
28811         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28812         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28813         LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
28814         *ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_err(e_conv);
28815         return tag_ptr(ret_conv, true);
28816 }
28817
28818 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateInfoDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
28819         LDKCResult_ChannelUpdateInfoDecodeErrorZ* o_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)untag_ptr(o);
28820         jboolean ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_is_ok(o_conv);
28821         return ret_conv;
28822 }
28823
28824 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateInfoDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
28825         if (!ptr_is_owned(_res)) return;
28826         void* _res_ptr = untag_ptr(_res);
28827         CHECK_ACCESS(_res_ptr);
28828         LDKCResult_ChannelUpdateInfoDecodeErrorZ _res_conv = *(LDKCResult_ChannelUpdateInfoDecodeErrorZ*)(_res_ptr);
28829         FREE(untag_ptr(_res));
28830         CResult_ChannelUpdateInfoDecodeErrorZ_free(_res_conv);
28831 }
28832
28833 static inline uint64_t CResult_ChannelUpdateInfoDecodeErrorZ_clone_ptr(LDKCResult_ChannelUpdateInfoDecodeErrorZ *NONNULL_PTR arg) {
28834         LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
28835         *ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_clone(arg);
28836         return tag_ptr(ret_conv, true);
28837 }
28838 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateInfoDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
28839         LDKCResult_ChannelUpdateInfoDecodeErrorZ* arg_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)untag_ptr(arg);
28840         int64_t ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_clone_ptr(arg_conv);
28841         return ret_conv;
28842 }
28843
28844 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateInfoDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28845         LDKCResult_ChannelUpdateInfoDecodeErrorZ* orig_conv = (LDKCResult_ChannelUpdateInfoDecodeErrorZ*)untag_ptr(orig);
28846         LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
28847         *ret_conv = CResult_ChannelUpdateInfoDecodeErrorZ_clone(orig_conv);
28848         return tag_ptr(ret_conv, true);
28849 }
28850
28851 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
28852         LDKChannelInfo o_conv;
28853         o_conv.inner = untag_ptr(o);
28854         o_conv.is_owned = ptr_is_owned(o);
28855         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28856         o_conv = ChannelInfo_clone(&o_conv);
28857         LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
28858         *ret_conv = CResult_ChannelInfoDecodeErrorZ_ok(o_conv);
28859         return tag_ptr(ret_conv, true);
28860 }
28861
28862 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
28863         void* e_ptr = untag_ptr(e);
28864         CHECK_ACCESS(e_ptr);
28865         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28866         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28867         LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
28868         *ret_conv = CResult_ChannelInfoDecodeErrorZ_err(e_conv);
28869         return tag_ptr(ret_conv, true);
28870 }
28871
28872 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
28873         LDKCResult_ChannelInfoDecodeErrorZ* o_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)untag_ptr(o);
28874         jboolean ret_conv = CResult_ChannelInfoDecodeErrorZ_is_ok(o_conv);
28875         return ret_conv;
28876 }
28877
28878 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
28879         if (!ptr_is_owned(_res)) return;
28880         void* _res_ptr = untag_ptr(_res);
28881         CHECK_ACCESS(_res_ptr);
28882         LDKCResult_ChannelInfoDecodeErrorZ _res_conv = *(LDKCResult_ChannelInfoDecodeErrorZ*)(_res_ptr);
28883         FREE(untag_ptr(_res));
28884         CResult_ChannelInfoDecodeErrorZ_free(_res_conv);
28885 }
28886
28887 static inline uint64_t CResult_ChannelInfoDecodeErrorZ_clone_ptr(LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR arg) {
28888         LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
28889         *ret_conv = CResult_ChannelInfoDecodeErrorZ_clone(arg);
28890         return tag_ptr(ret_conv, true);
28891 }
28892 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
28893         LDKCResult_ChannelInfoDecodeErrorZ* arg_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)untag_ptr(arg);
28894         int64_t ret_conv = CResult_ChannelInfoDecodeErrorZ_clone_ptr(arg_conv);
28895         return ret_conv;
28896 }
28897
28898 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28899         LDKCResult_ChannelInfoDecodeErrorZ* orig_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)untag_ptr(orig);
28900         LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
28901         *ret_conv = CResult_ChannelInfoDecodeErrorZ_clone(orig_conv);
28902         return tag_ptr(ret_conv, true);
28903 }
28904
28905 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
28906         LDKRoutingFees o_conv;
28907         o_conv.inner = untag_ptr(o);
28908         o_conv.is_owned = ptr_is_owned(o);
28909         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28910         o_conv = RoutingFees_clone(&o_conv);
28911         LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
28912         *ret_conv = CResult_RoutingFeesDecodeErrorZ_ok(o_conv);
28913         return tag_ptr(ret_conv, true);
28914 }
28915
28916 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
28917         void* e_ptr = untag_ptr(e);
28918         CHECK_ACCESS(e_ptr);
28919         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28920         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28921         LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
28922         *ret_conv = CResult_RoutingFeesDecodeErrorZ_err(e_conv);
28923         return tag_ptr(ret_conv, true);
28924 }
28925
28926 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
28927         LDKCResult_RoutingFeesDecodeErrorZ* o_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)untag_ptr(o);
28928         jboolean ret_conv = CResult_RoutingFeesDecodeErrorZ_is_ok(o_conv);
28929         return ret_conv;
28930 }
28931
28932 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
28933         if (!ptr_is_owned(_res)) return;
28934         void* _res_ptr = untag_ptr(_res);
28935         CHECK_ACCESS(_res_ptr);
28936         LDKCResult_RoutingFeesDecodeErrorZ _res_conv = *(LDKCResult_RoutingFeesDecodeErrorZ*)(_res_ptr);
28937         FREE(untag_ptr(_res));
28938         CResult_RoutingFeesDecodeErrorZ_free(_res_conv);
28939 }
28940
28941 static inline uint64_t CResult_RoutingFeesDecodeErrorZ_clone_ptr(LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR arg) {
28942         LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
28943         *ret_conv = CResult_RoutingFeesDecodeErrorZ_clone(arg);
28944         return tag_ptr(ret_conv, true);
28945 }
28946 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
28947         LDKCResult_RoutingFeesDecodeErrorZ* arg_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)untag_ptr(arg);
28948         int64_t ret_conv = CResult_RoutingFeesDecodeErrorZ_clone_ptr(arg_conv);
28949         return ret_conv;
28950 }
28951
28952 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
28953         LDKCResult_RoutingFeesDecodeErrorZ* orig_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)untag_ptr(orig);
28954         LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
28955         *ret_conv = CResult_RoutingFeesDecodeErrorZ_clone(orig_conv);
28956         return tag_ptr(ret_conv, true);
28957 }
28958
28959 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1SocketAddressZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
28960         LDKCVec_SocketAddressZ _res_constr;
28961         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
28962         if (_res_constr.datalen > 0)
28963                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKSocketAddress), "LDKCVec_SocketAddressZ Elements");
28964         else
28965                 _res_constr.data = NULL;
28966         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
28967         for (size_t p = 0; p < _res_constr.datalen; p++) {
28968                 int64_t _res_conv_15 = _res_vals[p];
28969                 void* _res_conv_15_ptr = untag_ptr(_res_conv_15);
28970                 CHECK_ACCESS(_res_conv_15_ptr);
28971                 LDKSocketAddress _res_conv_15_conv = *(LDKSocketAddress*)(_res_conv_15_ptr);
28972                 FREE(untag_ptr(_res_conv_15));
28973                 _res_constr.data[p] = _res_conv_15_conv;
28974         }
28975         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
28976         CVec_SocketAddressZ_free(_res_constr);
28977 }
28978
28979 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
28980         LDKNodeAnnouncementInfo o_conv;
28981         o_conv.inner = untag_ptr(o);
28982         o_conv.is_owned = ptr_is_owned(o);
28983         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
28984         o_conv = NodeAnnouncementInfo_clone(&o_conv);
28985         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
28986         *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_ok(o_conv);
28987         return tag_ptr(ret_conv, true);
28988 }
28989
28990 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
28991         void* e_ptr = untag_ptr(e);
28992         CHECK_ACCESS(e_ptr);
28993         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
28994         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
28995         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
28996         *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_err(e_conv);
28997         return tag_ptr(ret_conv, true);
28998 }
28999
29000 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
29001         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* o_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)untag_ptr(o);
29002         jboolean ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_is_ok(o_conv);
29003         return ret_conv;
29004 }
29005
29006 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
29007         if (!ptr_is_owned(_res)) return;
29008         void* _res_ptr = untag_ptr(_res);
29009         CHECK_ACCESS(_res_ptr);
29010         LDKCResult_NodeAnnouncementInfoDecodeErrorZ _res_conv = *(LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(_res_ptr);
29011         FREE(untag_ptr(_res));
29012         CResult_NodeAnnouncementInfoDecodeErrorZ_free(_res_conv);
29013 }
29014
29015 static inline uint64_t CResult_NodeAnnouncementInfoDecodeErrorZ_clone_ptr(LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR arg) {
29016         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
29017         *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_clone(arg);
29018         return tag_ptr(ret_conv, true);
29019 }
29020 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
29021         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* arg_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)untag_ptr(arg);
29022         int64_t ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_clone_ptr(arg_conv);
29023         return ret_conv;
29024 }
29025
29026 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29027         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* orig_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)untag_ptr(orig);
29028         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
29029         *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_clone(orig_conv);
29030         return tag_ptr(ret_conv, true);
29031 }
29032
29033 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAliasDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
29034         LDKNodeAlias o_conv;
29035         o_conv.inner = untag_ptr(o);
29036         o_conv.is_owned = ptr_is_owned(o);
29037         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29038         o_conv = NodeAlias_clone(&o_conv);
29039         LDKCResult_NodeAliasDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAliasDecodeErrorZ), "LDKCResult_NodeAliasDecodeErrorZ");
29040         *ret_conv = CResult_NodeAliasDecodeErrorZ_ok(o_conv);
29041         return tag_ptr(ret_conv, true);
29042 }
29043
29044 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAliasDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
29045         void* e_ptr = untag_ptr(e);
29046         CHECK_ACCESS(e_ptr);
29047         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
29048         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
29049         LDKCResult_NodeAliasDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAliasDecodeErrorZ), "LDKCResult_NodeAliasDecodeErrorZ");
29050         *ret_conv = CResult_NodeAliasDecodeErrorZ_err(e_conv);
29051         return tag_ptr(ret_conv, true);
29052 }
29053
29054 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAliasDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
29055         LDKCResult_NodeAliasDecodeErrorZ* o_conv = (LDKCResult_NodeAliasDecodeErrorZ*)untag_ptr(o);
29056         jboolean ret_conv = CResult_NodeAliasDecodeErrorZ_is_ok(o_conv);
29057         return ret_conv;
29058 }
29059
29060 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAliasDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
29061         if (!ptr_is_owned(_res)) return;
29062         void* _res_ptr = untag_ptr(_res);
29063         CHECK_ACCESS(_res_ptr);
29064         LDKCResult_NodeAliasDecodeErrorZ _res_conv = *(LDKCResult_NodeAliasDecodeErrorZ*)(_res_ptr);
29065         FREE(untag_ptr(_res));
29066         CResult_NodeAliasDecodeErrorZ_free(_res_conv);
29067 }
29068
29069 static inline uint64_t CResult_NodeAliasDecodeErrorZ_clone_ptr(LDKCResult_NodeAliasDecodeErrorZ *NONNULL_PTR arg) {
29070         LDKCResult_NodeAliasDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAliasDecodeErrorZ), "LDKCResult_NodeAliasDecodeErrorZ");
29071         *ret_conv = CResult_NodeAliasDecodeErrorZ_clone(arg);
29072         return tag_ptr(ret_conv, true);
29073 }
29074 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAliasDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
29075         LDKCResult_NodeAliasDecodeErrorZ* arg_conv = (LDKCResult_NodeAliasDecodeErrorZ*)untag_ptr(arg);
29076         int64_t ret_conv = CResult_NodeAliasDecodeErrorZ_clone_ptr(arg_conv);
29077         return ret_conv;
29078 }
29079
29080 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAliasDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29081         LDKCResult_NodeAliasDecodeErrorZ* orig_conv = (LDKCResult_NodeAliasDecodeErrorZ*)untag_ptr(orig);
29082         LDKCResult_NodeAliasDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAliasDecodeErrorZ), "LDKCResult_NodeAliasDecodeErrorZ");
29083         *ret_conv = CResult_NodeAliasDecodeErrorZ_clone(orig_conv);
29084         return tag_ptr(ret_conv, true);
29085 }
29086
29087 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
29088         LDKNodeInfo o_conv;
29089         o_conv.inner = untag_ptr(o);
29090         o_conv.is_owned = ptr_is_owned(o);
29091         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29092         o_conv = NodeInfo_clone(&o_conv);
29093         LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
29094         *ret_conv = CResult_NodeInfoDecodeErrorZ_ok(o_conv);
29095         return tag_ptr(ret_conv, true);
29096 }
29097
29098 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
29099         void* e_ptr = untag_ptr(e);
29100         CHECK_ACCESS(e_ptr);
29101         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
29102         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
29103         LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
29104         *ret_conv = CResult_NodeInfoDecodeErrorZ_err(e_conv);
29105         return tag_ptr(ret_conv, true);
29106 }
29107
29108 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
29109         LDKCResult_NodeInfoDecodeErrorZ* o_conv = (LDKCResult_NodeInfoDecodeErrorZ*)untag_ptr(o);
29110         jboolean ret_conv = CResult_NodeInfoDecodeErrorZ_is_ok(o_conv);
29111         return ret_conv;
29112 }
29113
29114 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
29115         if (!ptr_is_owned(_res)) return;
29116         void* _res_ptr = untag_ptr(_res);
29117         CHECK_ACCESS(_res_ptr);
29118         LDKCResult_NodeInfoDecodeErrorZ _res_conv = *(LDKCResult_NodeInfoDecodeErrorZ*)(_res_ptr);
29119         FREE(untag_ptr(_res));
29120         CResult_NodeInfoDecodeErrorZ_free(_res_conv);
29121 }
29122
29123 static inline uint64_t CResult_NodeInfoDecodeErrorZ_clone_ptr(LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR arg) {
29124         LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
29125         *ret_conv = CResult_NodeInfoDecodeErrorZ_clone(arg);
29126         return tag_ptr(ret_conv, true);
29127 }
29128 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
29129         LDKCResult_NodeInfoDecodeErrorZ* arg_conv = (LDKCResult_NodeInfoDecodeErrorZ*)untag_ptr(arg);
29130         int64_t ret_conv = CResult_NodeInfoDecodeErrorZ_clone_ptr(arg_conv);
29131         return ret_conv;
29132 }
29133
29134 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29135         LDKCResult_NodeInfoDecodeErrorZ* orig_conv = (LDKCResult_NodeInfoDecodeErrorZ*)untag_ptr(orig);
29136         LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
29137         *ret_conv = CResult_NodeInfoDecodeErrorZ_clone(orig_conv);
29138         return tag_ptr(ret_conv, true);
29139 }
29140
29141 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
29142         LDKNetworkGraph o_conv;
29143         o_conv.inner = untag_ptr(o);
29144         o_conv.is_owned = ptr_is_owned(o);
29145         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29146         // WARNING: we need a move here but no clone is available for LDKNetworkGraph
29147         
29148         LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
29149         *ret_conv = CResult_NetworkGraphDecodeErrorZ_ok(o_conv);
29150         return tag_ptr(ret_conv, true);
29151 }
29152
29153 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
29154         void* e_ptr = untag_ptr(e);
29155         CHECK_ACCESS(e_ptr);
29156         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
29157         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
29158         LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
29159         *ret_conv = CResult_NetworkGraphDecodeErrorZ_err(e_conv);
29160         return tag_ptr(ret_conv, true);
29161 }
29162
29163 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
29164         LDKCResult_NetworkGraphDecodeErrorZ* o_conv = (LDKCResult_NetworkGraphDecodeErrorZ*)untag_ptr(o);
29165         jboolean ret_conv = CResult_NetworkGraphDecodeErrorZ_is_ok(o_conv);
29166         return ret_conv;
29167 }
29168
29169 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
29170         if (!ptr_is_owned(_res)) return;
29171         void* _res_ptr = untag_ptr(_res);
29172         CHECK_ACCESS(_res_ptr);
29173         LDKCResult_NetworkGraphDecodeErrorZ _res_conv = *(LDKCResult_NetworkGraphDecodeErrorZ*)(_res_ptr);
29174         FREE(untag_ptr(_res));
29175         CResult_NetworkGraphDecodeErrorZ_free(_res_conv);
29176 }
29177
29178 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1SocketAddressZZ_1some(JNIEnv *env, jclass clz, int64_tArray o) {
29179         LDKCVec_SocketAddressZ o_constr;
29180         o_constr.datalen = (*env)->GetArrayLength(env, o);
29181         if (o_constr.datalen > 0)
29182                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKSocketAddress), "LDKCVec_SocketAddressZ Elements");
29183         else
29184                 o_constr.data = NULL;
29185         int64_t* o_vals = (*env)->GetLongArrayElements (env, o, NULL);
29186         for (size_t p = 0; p < o_constr.datalen; p++) {
29187                 int64_t o_conv_15 = o_vals[p];
29188                 void* o_conv_15_ptr = untag_ptr(o_conv_15);
29189                 CHECK_ACCESS(o_conv_15_ptr);
29190                 LDKSocketAddress o_conv_15_conv = *(LDKSocketAddress*)(o_conv_15_ptr);
29191                 o_conv_15_conv = SocketAddress_clone((LDKSocketAddress*)untag_ptr(o_conv_15));
29192                 o_constr.data[p] = o_conv_15_conv;
29193         }
29194         (*env)->ReleaseLongArrayElements(env, o, o_vals, 0);
29195         LDKCOption_CVec_SocketAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_SocketAddressZZ), "LDKCOption_CVec_SocketAddressZZ");
29196         *ret_copy = COption_CVec_SocketAddressZZ_some(o_constr);
29197         int64_t ret_ref = tag_ptr(ret_copy, true);
29198         return ret_ref;
29199 }
29200
29201 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1SocketAddressZZ_1none(JNIEnv *env, jclass clz) {
29202         LDKCOption_CVec_SocketAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_SocketAddressZZ), "LDKCOption_CVec_SocketAddressZZ");
29203         *ret_copy = COption_CVec_SocketAddressZZ_none();
29204         int64_t ret_ref = tag_ptr(ret_copy, true);
29205         return ret_ref;
29206 }
29207
29208 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1SocketAddressZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
29209         if (!ptr_is_owned(_res)) return;
29210         void* _res_ptr = untag_ptr(_res);
29211         CHECK_ACCESS(_res_ptr);
29212         LDKCOption_CVec_SocketAddressZZ _res_conv = *(LDKCOption_CVec_SocketAddressZZ*)(_res_ptr);
29213         FREE(untag_ptr(_res));
29214         COption_CVec_SocketAddressZZ_free(_res_conv);
29215 }
29216
29217 static inline uint64_t COption_CVec_SocketAddressZZ_clone_ptr(LDKCOption_CVec_SocketAddressZZ *NONNULL_PTR arg) {
29218         LDKCOption_CVec_SocketAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_SocketAddressZZ), "LDKCOption_CVec_SocketAddressZZ");
29219         *ret_copy = COption_CVec_SocketAddressZZ_clone(arg);
29220         int64_t ret_ref = tag_ptr(ret_copy, true);
29221         return ret_ref;
29222 }
29223 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1SocketAddressZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
29224         LDKCOption_CVec_SocketAddressZZ* arg_conv = (LDKCOption_CVec_SocketAddressZZ*)untag_ptr(arg);
29225         int64_t ret_conv = COption_CVec_SocketAddressZZ_clone_ptr(arg_conv);
29226         return ret_conv;
29227 }
29228
29229 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1SocketAddressZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29230         LDKCOption_CVec_SocketAddressZZ* orig_conv = (LDKCOption_CVec_SocketAddressZZ*)untag_ptr(orig);
29231         LDKCOption_CVec_SocketAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_SocketAddressZZ), "LDKCOption_CVec_SocketAddressZZ");
29232         *ret_copy = COption_CVec_SocketAddressZZ_clone(orig_conv);
29233         int64_t ret_ref = tag_ptr(ret_copy, true);
29234         return ret_ref;
29235 }
29236
29237 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1u64ShortChannelIdErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
29238         LDKCResult_u64ShortChannelIdErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_u64ShortChannelIdErrorZ), "LDKCResult_u64ShortChannelIdErrorZ");
29239         *ret_conv = CResult_u64ShortChannelIdErrorZ_ok(o);
29240         return tag_ptr(ret_conv, true);
29241 }
29242
29243 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1u64ShortChannelIdErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
29244         LDKShortChannelIdError e_conv = LDKShortChannelIdError_from_java(env, e);
29245         LDKCResult_u64ShortChannelIdErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_u64ShortChannelIdErrorZ), "LDKCResult_u64ShortChannelIdErrorZ");
29246         *ret_conv = CResult_u64ShortChannelIdErrorZ_err(e_conv);
29247         return tag_ptr(ret_conv, true);
29248 }
29249
29250 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1u64ShortChannelIdErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
29251         LDKCResult_u64ShortChannelIdErrorZ* o_conv = (LDKCResult_u64ShortChannelIdErrorZ*)untag_ptr(o);
29252         jboolean ret_conv = CResult_u64ShortChannelIdErrorZ_is_ok(o_conv);
29253         return ret_conv;
29254 }
29255
29256 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1u64ShortChannelIdErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
29257         if (!ptr_is_owned(_res)) return;
29258         void* _res_ptr = untag_ptr(_res);
29259         CHECK_ACCESS(_res_ptr);
29260         LDKCResult_u64ShortChannelIdErrorZ _res_conv = *(LDKCResult_u64ShortChannelIdErrorZ*)(_res_ptr);
29261         FREE(untag_ptr(_res));
29262         CResult_u64ShortChannelIdErrorZ_free(_res_conv);
29263 }
29264
29265 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PendingHTLCInfoInboundHTLCErrZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
29266         LDKPendingHTLCInfo o_conv;
29267         o_conv.inner = untag_ptr(o);
29268         o_conv.is_owned = ptr_is_owned(o);
29269         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29270         o_conv = PendingHTLCInfo_clone(&o_conv);
29271         LDKCResult_PendingHTLCInfoInboundHTLCErrZ* ret_conv = MALLOC(sizeof(LDKCResult_PendingHTLCInfoInboundHTLCErrZ), "LDKCResult_PendingHTLCInfoInboundHTLCErrZ");
29272         *ret_conv = CResult_PendingHTLCInfoInboundHTLCErrZ_ok(o_conv);
29273         return tag_ptr(ret_conv, true);
29274 }
29275
29276 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PendingHTLCInfoInboundHTLCErrZ_1err(JNIEnv *env, jclass clz, int64_t e) {
29277         LDKInboundHTLCErr e_conv;
29278         e_conv.inner = untag_ptr(e);
29279         e_conv.is_owned = ptr_is_owned(e);
29280         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
29281         e_conv = InboundHTLCErr_clone(&e_conv);
29282         LDKCResult_PendingHTLCInfoInboundHTLCErrZ* ret_conv = MALLOC(sizeof(LDKCResult_PendingHTLCInfoInboundHTLCErrZ), "LDKCResult_PendingHTLCInfoInboundHTLCErrZ");
29283         *ret_conv = CResult_PendingHTLCInfoInboundHTLCErrZ_err(e_conv);
29284         return tag_ptr(ret_conv, true);
29285 }
29286
29287 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PendingHTLCInfoInboundHTLCErrZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
29288         LDKCResult_PendingHTLCInfoInboundHTLCErrZ* o_conv = (LDKCResult_PendingHTLCInfoInboundHTLCErrZ*)untag_ptr(o);
29289         jboolean ret_conv = CResult_PendingHTLCInfoInboundHTLCErrZ_is_ok(o_conv);
29290         return ret_conv;
29291 }
29292
29293 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PendingHTLCInfoInboundHTLCErrZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
29294         if (!ptr_is_owned(_res)) return;
29295         void* _res_ptr = untag_ptr(_res);
29296         CHECK_ACCESS(_res_ptr);
29297         LDKCResult_PendingHTLCInfoInboundHTLCErrZ _res_conv = *(LDKCResult_PendingHTLCInfoInboundHTLCErrZ*)(_res_ptr);
29298         FREE(untag_ptr(_res));
29299         CResult_PendingHTLCInfoInboundHTLCErrZ_free(_res_conv);
29300 }
29301
29302 static inline uint64_t CResult_PendingHTLCInfoInboundHTLCErrZ_clone_ptr(LDKCResult_PendingHTLCInfoInboundHTLCErrZ *NONNULL_PTR arg) {
29303         LDKCResult_PendingHTLCInfoInboundHTLCErrZ* ret_conv = MALLOC(sizeof(LDKCResult_PendingHTLCInfoInboundHTLCErrZ), "LDKCResult_PendingHTLCInfoInboundHTLCErrZ");
29304         *ret_conv = CResult_PendingHTLCInfoInboundHTLCErrZ_clone(arg);
29305         return tag_ptr(ret_conv, true);
29306 }
29307 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PendingHTLCInfoInboundHTLCErrZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
29308         LDKCResult_PendingHTLCInfoInboundHTLCErrZ* arg_conv = (LDKCResult_PendingHTLCInfoInboundHTLCErrZ*)untag_ptr(arg);
29309         int64_t ret_conv = CResult_PendingHTLCInfoInboundHTLCErrZ_clone_ptr(arg_conv);
29310         return ret_conv;
29311 }
29312
29313 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PendingHTLCInfoInboundHTLCErrZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29314         LDKCResult_PendingHTLCInfoInboundHTLCErrZ* orig_conv = (LDKCResult_PendingHTLCInfoInboundHTLCErrZ*)untag_ptr(orig);
29315         LDKCResult_PendingHTLCInfoInboundHTLCErrZ* ret_conv = MALLOC(sizeof(LDKCResult_PendingHTLCInfoInboundHTLCErrZ), "LDKCResult_PendingHTLCInfoInboundHTLCErrZ");
29316         *ret_conv = CResult_PendingHTLCInfoInboundHTLCErrZ_clone(orig_conv);
29317         return tag_ptr(ret_conv, true);
29318 }
29319
29320 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1HTLCOutputInCommitmentZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
29321         LDKCVec_HTLCOutputInCommitmentZ _res_constr;
29322         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
29323         if (_res_constr.datalen > 0)
29324                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKHTLCOutputInCommitment), "LDKCVec_HTLCOutputInCommitmentZ Elements");
29325         else
29326                 _res_constr.data = NULL;
29327         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
29328         for (size_t y = 0; y < _res_constr.datalen; y++) {
29329                 int64_t _res_conv_24 = _res_vals[y];
29330                 LDKHTLCOutputInCommitment _res_conv_24_conv;
29331                 _res_conv_24_conv.inner = untag_ptr(_res_conv_24);
29332                 _res_conv_24_conv.is_owned = ptr_is_owned(_res_conv_24);
29333                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_24_conv);
29334                 _res_constr.data[y] = _res_conv_24_conv;
29335         }
29336         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
29337         CVec_HTLCOutputInCommitmentZ_free(_res_constr);
29338 }
29339
29340 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1HTLCDescriptorZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
29341         LDKCVec_HTLCDescriptorZ _res_constr;
29342         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
29343         if (_res_constr.datalen > 0)
29344                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKHTLCDescriptor), "LDKCVec_HTLCDescriptorZ Elements");
29345         else
29346                 _res_constr.data = NULL;
29347         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
29348         for (size_t q = 0; q < _res_constr.datalen; q++) {
29349                 int64_t _res_conv_16 = _res_vals[q];
29350                 LDKHTLCDescriptor _res_conv_16_conv;
29351                 _res_conv_16_conv.inner = untag_ptr(_res_conv_16);
29352                 _res_conv_16_conv.is_owned = ptr_is_owned(_res_conv_16);
29353                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_16_conv);
29354                 _res_constr.data[q] = _res_conv_16_conv;
29355         }
29356         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
29357         CVec_HTLCDescriptorZ_free(_res_constr);
29358 }
29359
29360 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UtxoZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
29361         LDKCVec_UtxoZ _res_constr;
29362         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
29363         if (_res_constr.datalen > 0)
29364                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUtxo), "LDKCVec_UtxoZ Elements");
29365         else
29366                 _res_constr.data = NULL;
29367         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
29368         for (size_t g = 0; g < _res_constr.datalen; g++) {
29369                 int64_t _res_conv_6 = _res_vals[g];
29370                 LDKUtxo _res_conv_6_conv;
29371                 _res_conv_6_conv.inner = untag_ptr(_res_conv_6);
29372                 _res_conv_6_conv.is_owned = ptr_is_owned(_res_conv_6);
29373                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_6_conv);
29374                 _res_constr.data[g] = _res_conv_6_conv;
29375         }
29376         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
29377         CVec_UtxoZ_free(_res_constr);
29378 }
29379
29380 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1TxOutZ_1some(JNIEnv *env, jclass clz, int64_t o) {
29381         void* o_ptr = untag_ptr(o);
29382         CHECK_ACCESS(o_ptr);
29383         LDKTxOut o_conv = *(LDKTxOut*)(o_ptr);
29384         o_conv = TxOut_clone((LDKTxOut*)untag_ptr(o));
29385         LDKCOption_TxOutZ *ret_copy = MALLOC(sizeof(LDKCOption_TxOutZ), "LDKCOption_TxOutZ");
29386         *ret_copy = COption_TxOutZ_some(o_conv);
29387         int64_t ret_ref = tag_ptr(ret_copy, true);
29388         return ret_ref;
29389 }
29390
29391 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1TxOutZ_1none(JNIEnv *env, jclass clz) {
29392         LDKCOption_TxOutZ *ret_copy = MALLOC(sizeof(LDKCOption_TxOutZ), "LDKCOption_TxOutZ");
29393         *ret_copy = COption_TxOutZ_none();
29394         int64_t ret_ref = tag_ptr(ret_copy, true);
29395         return ret_ref;
29396 }
29397
29398 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1TxOutZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
29399         if (!ptr_is_owned(_res)) return;
29400         void* _res_ptr = untag_ptr(_res);
29401         CHECK_ACCESS(_res_ptr);
29402         LDKCOption_TxOutZ _res_conv = *(LDKCOption_TxOutZ*)(_res_ptr);
29403         FREE(untag_ptr(_res));
29404         COption_TxOutZ_free(_res_conv);
29405 }
29406
29407 static inline uint64_t COption_TxOutZ_clone_ptr(LDKCOption_TxOutZ *NONNULL_PTR arg) {
29408         LDKCOption_TxOutZ *ret_copy = MALLOC(sizeof(LDKCOption_TxOutZ), "LDKCOption_TxOutZ");
29409         *ret_copy = COption_TxOutZ_clone(arg);
29410         int64_t ret_ref = tag_ptr(ret_copy, true);
29411         return ret_ref;
29412 }
29413 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1TxOutZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
29414         LDKCOption_TxOutZ* arg_conv = (LDKCOption_TxOutZ*)untag_ptr(arg);
29415         int64_t ret_conv = COption_TxOutZ_clone_ptr(arg_conv);
29416         return ret_conv;
29417 }
29418
29419 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1TxOutZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29420         LDKCOption_TxOutZ* orig_conv = (LDKCOption_TxOutZ*)untag_ptr(orig);
29421         LDKCOption_TxOutZ *ret_copy = MALLOC(sizeof(LDKCOption_TxOutZ), "LDKCOption_TxOutZ");
29422         *ret_copy = COption_TxOutZ_clone(orig_conv);
29423         int64_t ret_ref = tag_ptr(ret_copy, true);
29424         return ret_ref;
29425 }
29426
29427 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1InputZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
29428         LDKCVec_InputZ _res_constr;
29429         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
29430         if (_res_constr.datalen > 0)
29431                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKInput), "LDKCVec_InputZ Elements");
29432         else
29433                 _res_constr.data = NULL;
29434         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
29435         for (size_t h = 0; h < _res_constr.datalen; h++) {
29436                 int64_t _res_conv_7 = _res_vals[h];
29437                 LDKInput _res_conv_7_conv;
29438                 _res_conv_7_conv.inner = untag_ptr(_res_conv_7);
29439                 _res_conv_7_conv.is_owned = ptr_is_owned(_res_conv_7);
29440                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_7_conv);
29441                 _res_constr.data[h] = _res_conv_7_conv;
29442         }
29443         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
29444         CVec_InputZ_free(_res_constr);
29445 }
29446
29447 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CoinSelectionNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
29448         LDKCoinSelection o_conv;
29449         o_conv.inner = untag_ptr(o);
29450         o_conv.is_owned = ptr_is_owned(o);
29451         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29452         o_conv = CoinSelection_clone(&o_conv);
29453         LDKCResult_CoinSelectionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CoinSelectionNoneZ), "LDKCResult_CoinSelectionNoneZ");
29454         *ret_conv = CResult_CoinSelectionNoneZ_ok(o_conv);
29455         return tag_ptr(ret_conv, true);
29456 }
29457
29458 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CoinSelectionNoneZ_1err(JNIEnv *env, jclass clz) {
29459         LDKCResult_CoinSelectionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CoinSelectionNoneZ), "LDKCResult_CoinSelectionNoneZ");
29460         *ret_conv = CResult_CoinSelectionNoneZ_err();
29461         return tag_ptr(ret_conv, true);
29462 }
29463
29464 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CoinSelectionNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
29465         LDKCResult_CoinSelectionNoneZ* o_conv = (LDKCResult_CoinSelectionNoneZ*)untag_ptr(o);
29466         jboolean ret_conv = CResult_CoinSelectionNoneZ_is_ok(o_conv);
29467         return ret_conv;
29468 }
29469
29470 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CoinSelectionNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
29471         if (!ptr_is_owned(_res)) return;
29472         void* _res_ptr = untag_ptr(_res);
29473         CHECK_ACCESS(_res_ptr);
29474         LDKCResult_CoinSelectionNoneZ _res_conv = *(LDKCResult_CoinSelectionNoneZ*)(_res_ptr);
29475         FREE(untag_ptr(_res));
29476         CResult_CoinSelectionNoneZ_free(_res_conv);
29477 }
29478
29479 static inline uint64_t CResult_CoinSelectionNoneZ_clone_ptr(LDKCResult_CoinSelectionNoneZ *NONNULL_PTR arg) {
29480         LDKCResult_CoinSelectionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CoinSelectionNoneZ), "LDKCResult_CoinSelectionNoneZ");
29481         *ret_conv = CResult_CoinSelectionNoneZ_clone(arg);
29482         return tag_ptr(ret_conv, true);
29483 }
29484 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CoinSelectionNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
29485         LDKCResult_CoinSelectionNoneZ* arg_conv = (LDKCResult_CoinSelectionNoneZ*)untag_ptr(arg);
29486         int64_t ret_conv = CResult_CoinSelectionNoneZ_clone_ptr(arg_conv);
29487         return ret_conv;
29488 }
29489
29490 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CoinSelectionNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29491         LDKCResult_CoinSelectionNoneZ* orig_conv = (LDKCResult_CoinSelectionNoneZ*)untag_ptr(orig);
29492         LDKCResult_CoinSelectionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CoinSelectionNoneZ), "LDKCResult_CoinSelectionNoneZ");
29493         *ret_conv = CResult_CoinSelectionNoneZ_clone(orig_conv);
29494         return tag_ptr(ret_conv, true);
29495 }
29496
29497 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1UtxoZNoneZ_1ok(JNIEnv *env, jclass clz, int64_tArray o) {
29498         LDKCVec_UtxoZ o_constr;
29499         o_constr.datalen = (*env)->GetArrayLength(env, o);
29500         if (o_constr.datalen > 0)
29501                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKUtxo), "LDKCVec_UtxoZ Elements");
29502         else
29503                 o_constr.data = NULL;
29504         int64_t* o_vals = (*env)->GetLongArrayElements (env, o, NULL);
29505         for (size_t g = 0; g < o_constr.datalen; g++) {
29506                 int64_t o_conv_6 = o_vals[g];
29507                 LDKUtxo o_conv_6_conv;
29508                 o_conv_6_conv.inner = untag_ptr(o_conv_6);
29509                 o_conv_6_conv.is_owned = ptr_is_owned(o_conv_6);
29510                 CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv_6_conv);
29511                 o_conv_6_conv = Utxo_clone(&o_conv_6_conv);
29512                 o_constr.data[g] = o_conv_6_conv;
29513         }
29514         (*env)->ReleaseLongArrayElements(env, o, o_vals, 0);
29515         LDKCResult_CVec_UtxoZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_UtxoZNoneZ), "LDKCResult_CVec_UtxoZNoneZ");
29516         *ret_conv = CResult_CVec_UtxoZNoneZ_ok(o_constr);
29517         return tag_ptr(ret_conv, true);
29518 }
29519
29520 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1UtxoZNoneZ_1err(JNIEnv *env, jclass clz) {
29521         LDKCResult_CVec_UtxoZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_UtxoZNoneZ), "LDKCResult_CVec_UtxoZNoneZ");
29522         *ret_conv = CResult_CVec_UtxoZNoneZ_err();
29523         return tag_ptr(ret_conv, true);
29524 }
29525
29526 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1UtxoZNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
29527         LDKCResult_CVec_UtxoZNoneZ* o_conv = (LDKCResult_CVec_UtxoZNoneZ*)untag_ptr(o);
29528         jboolean ret_conv = CResult_CVec_UtxoZNoneZ_is_ok(o_conv);
29529         return ret_conv;
29530 }
29531
29532 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1UtxoZNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
29533         if (!ptr_is_owned(_res)) return;
29534         void* _res_ptr = untag_ptr(_res);
29535         CHECK_ACCESS(_res_ptr);
29536         LDKCResult_CVec_UtxoZNoneZ _res_conv = *(LDKCResult_CVec_UtxoZNoneZ*)(_res_ptr);
29537         FREE(untag_ptr(_res));
29538         CResult_CVec_UtxoZNoneZ_free(_res_conv);
29539 }
29540
29541 static inline uint64_t CResult_CVec_UtxoZNoneZ_clone_ptr(LDKCResult_CVec_UtxoZNoneZ *NONNULL_PTR arg) {
29542         LDKCResult_CVec_UtxoZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_UtxoZNoneZ), "LDKCResult_CVec_UtxoZNoneZ");
29543         *ret_conv = CResult_CVec_UtxoZNoneZ_clone(arg);
29544         return tag_ptr(ret_conv, true);
29545 }
29546 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1UtxoZNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
29547         LDKCResult_CVec_UtxoZNoneZ* arg_conv = (LDKCResult_CVec_UtxoZNoneZ*)untag_ptr(arg);
29548         int64_t ret_conv = CResult_CVec_UtxoZNoneZ_clone_ptr(arg_conv);
29549         return ret_conv;
29550 }
29551
29552 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1UtxoZNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29553         LDKCResult_CVec_UtxoZNoneZ* orig_conv = (LDKCResult_CVec_UtxoZNoneZ*)untag_ptr(orig);
29554         LDKCResult_CVec_UtxoZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_UtxoZNoneZ), "LDKCResult_CVec_UtxoZNoneZ");
29555         *ret_conv = CResult_CVec_UtxoZNoneZ_clone(orig_conv);
29556         return tag_ptr(ret_conv, true);
29557 }
29558
29559 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1PaymentContextZ_1some(JNIEnv *env, jclass clz, int64_t o) {
29560         void* o_ptr = untag_ptr(o);
29561         CHECK_ACCESS(o_ptr);
29562         LDKPaymentContext o_conv = *(LDKPaymentContext*)(o_ptr);
29563         o_conv = PaymentContext_clone((LDKPaymentContext*)untag_ptr(o));
29564         LDKCOption_PaymentContextZ *ret_copy = MALLOC(sizeof(LDKCOption_PaymentContextZ), "LDKCOption_PaymentContextZ");
29565         *ret_copy = COption_PaymentContextZ_some(o_conv);
29566         int64_t ret_ref = tag_ptr(ret_copy, true);
29567         return ret_ref;
29568 }
29569
29570 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1PaymentContextZ_1none(JNIEnv *env, jclass clz) {
29571         LDKCOption_PaymentContextZ *ret_copy = MALLOC(sizeof(LDKCOption_PaymentContextZ), "LDKCOption_PaymentContextZ");
29572         *ret_copy = COption_PaymentContextZ_none();
29573         int64_t ret_ref = tag_ptr(ret_copy, true);
29574         return ret_ref;
29575 }
29576
29577 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1PaymentContextZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
29578         if (!ptr_is_owned(_res)) return;
29579         void* _res_ptr = untag_ptr(_res);
29580         CHECK_ACCESS(_res_ptr);
29581         LDKCOption_PaymentContextZ _res_conv = *(LDKCOption_PaymentContextZ*)(_res_ptr);
29582         FREE(untag_ptr(_res));
29583         COption_PaymentContextZ_free(_res_conv);
29584 }
29585
29586 static inline uint64_t COption_PaymentContextZ_clone_ptr(LDKCOption_PaymentContextZ *NONNULL_PTR arg) {
29587         LDKCOption_PaymentContextZ *ret_copy = MALLOC(sizeof(LDKCOption_PaymentContextZ), "LDKCOption_PaymentContextZ");
29588         *ret_copy = COption_PaymentContextZ_clone(arg);
29589         int64_t ret_ref = tag_ptr(ret_copy, true);
29590         return ret_ref;
29591 }
29592 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1PaymentContextZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
29593         LDKCOption_PaymentContextZ* arg_conv = (LDKCOption_PaymentContextZ*)untag_ptr(arg);
29594         int64_t ret_conv = COption_PaymentContextZ_clone_ptr(arg_conv);
29595         return ret_conv;
29596 }
29597
29598 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1PaymentContextZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29599         LDKCOption_PaymentContextZ* orig_conv = (LDKCOption_PaymentContextZ*)untag_ptr(orig);
29600         LDKCOption_PaymentContextZ *ret_copy = MALLOC(sizeof(LDKCOption_PaymentContextZ), "LDKCOption_PaymentContextZ");
29601         *ret_copy = COption_PaymentContextZ_clone(orig_conv);
29602         int64_t ret_ref = tag_ptr(ret_copy, true);
29603         return ret_ref;
29604 }
29605
29606 static inline uint64_t C2Tuple_u64u16Z_clone_ptr(LDKC2Tuple_u64u16Z *NONNULL_PTR arg) {
29607         LDKC2Tuple_u64u16Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64u16Z), "LDKC2Tuple_u64u16Z");
29608         *ret_conv = C2Tuple_u64u16Z_clone(arg);
29609         return tag_ptr(ret_conv, true);
29610 }
29611 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64u16Z_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
29612         LDKC2Tuple_u64u16Z* arg_conv = (LDKC2Tuple_u64u16Z*)untag_ptr(arg);
29613         int64_t ret_conv = C2Tuple_u64u16Z_clone_ptr(arg_conv);
29614         return ret_conv;
29615 }
29616
29617 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64u16Z_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29618         LDKC2Tuple_u64u16Z* orig_conv = (LDKC2Tuple_u64u16Z*)untag_ptr(orig);
29619         LDKC2Tuple_u64u16Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64u16Z), "LDKC2Tuple_u64u16Z");
29620         *ret_conv = C2Tuple_u64u16Z_clone(orig_conv);
29621         return tag_ptr(ret_conv, true);
29622 }
29623
29624 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64u16Z_1new(JNIEnv *env, jclass clz, int64_t a, int16_t b) {
29625         LDKC2Tuple_u64u16Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_u64u16Z), "LDKC2Tuple_u64u16Z");
29626         *ret_conv = C2Tuple_u64u16Z_new(a, b);
29627         return tag_ptr(ret_conv, true);
29628 }
29629
29630 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64u16Z_1free(JNIEnv *env, jclass clz, int64_t _res) {
29631         if (!ptr_is_owned(_res)) return;
29632         void* _res_ptr = untag_ptr(_res);
29633         CHECK_ACCESS(_res_ptr);
29634         LDKC2Tuple_u64u16Z _res_conv = *(LDKC2Tuple_u64u16Z*)(_res_ptr);
29635         FREE(untag_ptr(_res));
29636         C2Tuple_u64u16Z_free(_res_conv);
29637 }
29638
29639 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1u64u16ZZ_1some(JNIEnv *env, jclass clz, int64_t o) {
29640         void* o_ptr = untag_ptr(o);
29641         CHECK_ACCESS(o_ptr);
29642         LDKC2Tuple_u64u16Z o_conv = *(LDKC2Tuple_u64u16Z*)(o_ptr);
29643         o_conv = C2Tuple_u64u16Z_clone((LDKC2Tuple_u64u16Z*)untag_ptr(o));
29644         LDKCOption_C2Tuple_u64u16ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u16ZZ), "LDKCOption_C2Tuple_u64u16ZZ");
29645         *ret_copy = COption_C2Tuple_u64u16ZZ_some(o_conv);
29646         int64_t ret_ref = tag_ptr(ret_copy, true);
29647         return ret_ref;
29648 }
29649
29650 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1u64u16ZZ_1none(JNIEnv *env, jclass clz) {
29651         LDKCOption_C2Tuple_u64u16ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u16ZZ), "LDKCOption_C2Tuple_u64u16ZZ");
29652         *ret_copy = COption_C2Tuple_u64u16ZZ_none();
29653         int64_t ret_ref = tag_ptr(ret_copy, true);
29654         return ret_ref;
29655 }
29656
29657 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1u64u16ZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
29658         if (!ptr_is_owned(_res)) return;
29659         void* _res_ptr = untag_ptr(_res);
29660         CHECK_ACCESS(_res_ptr);
29661         LDKCOption_C2Tuple_u64u16ZZ _res_conv = *(LDKCOption_C2Tuple_u64u16ZZ*)(_res_ptr);
29662         FREE(untag_ptr(_res));
29663         COption_C2Tuple_u64u16ZZ_free(_res_conv);
29664 }
29665
29666 static inline uint64_t COption_C2Tuple_u64u16ZZ_clone_ptr(LDKCOption_C2Tuple_u64u16ZZ *NONNULL_PTR arg) {
29667         LDKCOption_C2Tuple_u64u16ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u16ZZ), "LDKCOption_C2Tuple_u64u16ZZ");
29668         *ret_copy = COption_C2Tuple_u64u16ZZ_clone(arg);
29669         int64_t ret_ref = tag_ptr(ret_copy, true);
29670         return ret_ref;
29671 }
29672 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1u64u16ZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
29673         LDKCOption_C2Tuple_u64u16ZZ* arg_conv = (LDKCOption_C2Tuple_u64u16ZZ*)untag_ptr(arg);
29674         int64_t ret_conv = COption_C2Tuple_u64u16ZZ_clone_ptr(arg_conv);
29675         return ret_conv;
29676 }
29677
29678 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1u64u16ZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29679         LDKCOption_C2Tuple_u64u16ZZ* orig_conv = (LDKCOption_C2Tuple_u64u16ZZ*)untag_ptr(orig);
29680         LDKCOption_C2Tuple_u64u16ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u16ZZ), "LDKCOption_C2Tuple_u64u16ZZ");
29681         *ret_copy = COption_C2Tuple_u64u16ZZ_clone(orig_conv);
29682         int64_t ret_ref = tag_ptr(ret_copy, true);
29683         return ret_ref;
29684 }
29685
29686 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1ChannelShutdownStateZ_1some(JNIEnv *env, jclass clz, jclass o) {
29687         LDKChannelShutdownState o_conv = LDKChannelShutdownState_from_java(env, o);
29688         LDKCOption_ChannelShutdownStateZ *ret_copy = MALLOC(sizeof(LDKCOption_ChannelShutdownStateZ), "LDKCOption_ChannelShutdownStateZ");
29689         *ret_copy = COption_ChannelShutdownStateZ_some(o_conv);
29690         int64_t ret_ref = tag_ptr(ret_copy, true);
29691         return ret_ref;
29692 }
29693
29694 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1ChannelShutdownStateZ_1none(JNIEnv *env, jclass clz) {
29695         LDKCOption_ChannelShutdownStateZ *ret_copy = MALLOC(sizeof(LDKCOption_ChannelShutdownStateZ), "LDKCOption_ChannelShutdownStateZ");
29696         *ret_copy = COption_ChannelShutdownStateZ_none();
29697         int64_t ret_ref = tag_ptr(ret_copy, true);
29698         return ret_ref;
29699 }
29700
29701 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1ChannelShutdownStateZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
29702         if (!ptr_is_owned(_res)) return;
29703         void* _res_ptr = untag_ptr(_res);
29704         CHECK_ACCESS(_res_ptr);
29705         LDKCOption_ChannelShutdownStateZ _res_conv = *(LDKCOption_ChannelShutdownStateZ*)(_res_ptr);
29706         FREE(untag_ptr(_res));
29707         COption_ChannelShutdownStateZ_free(_res_conv);
29708 }
29709
29710 static inline uint64_t COption_ChannelShutdownStateZ_clone_ptr(LDKCOption_ChannelShutdownStateZ *NONNULL_PTR arg) {
29711         LDKCOption_ChannelShutdownStateZ *ret_copy = MALLOC(sizeof(LDKCOption_ChannelShutdownStateZ), "LDKCOption_ChannelShutdownStateZ");
29712         *ret_copy = COption_ChannelShutdownStateZ_clone(arg);
29713         int64_t ret_ref = tag_ptr(ret_copy, true);
29714         return ret_ref;
29715 }
29716 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1ChannelShutdownStateZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
29717         LDKCOption_ChannelShutdownStateZ* arg_conv = (LDKCOption_ChannelShutdownStateZ*)untag_ptr(arg);
29718         int64_t ret_conv = COption_ChannelShutdownStateZ_clone_ptr(arg_conv);
29719         return ret_conv;
29720 }
29721
29722 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1ChannelShutdownStateZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29723         LDKCOption_ChannelShutdownStateZ* orig_conv = (LDKCOption_ChannelShutdownStateZ*)untag_ptr(orig);
29724         LDKCOption_ChannelShutdownStateZ *ret_copy = MALLOC(sizeof(LDKCOption_ChannelShutdownStateZ), "LDKCOption_ChannelShutdownStateZ");
29725         *ret_copy = COption_ChannelShutdownStateZ_clone(orig_conv);
29726         int64_t ret_ref = tag_ptr(ret_copy, true);
29727         return ret_ref;
29728 }
29729
29730 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelIdAPIErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
29731         LDKChannelId o_conv;
29732         o_conv.inner = untag_ptr(o);
29733         o_conv.is_owned = ptr_is_owned(o);
29734         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
29735         o_conv = ChannelId_clone(&o_conv);
29736         LDKCResult_ChannelIdAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelIdAPIErrorZ), "LDKCResult_ChannelIdAPIErrorZ");
29737         *ret_conv = CResult_ChannelIdAPIErrorZ_ok(o_conv);
29738         return tag_ptr(ret_conv, true);
29739 }
29740
29741 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelIdAPIErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
29742         void* e_ptr = untag_ptr(e);
29743         CHECK_ACCESS(e_ptr);
29744         LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
29745         e_conv = APIError_clone((LDKAPIError*)untag_ptr(e));
29746         LDKCResult_ChannelIdAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelIdAPIErrorZ), "LDKCResult_ChannelIdAPIErrorZ");
29747         *ret_conv = CResult_ChannelIdAPIErrorZ_err(e_conv);
29748         return tag_ptr(ret_conv, true);
29749 }
29750
29751 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelIdAPIErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
29752         LDKCResult_ChannelIdAPIErrorZ* o_conv = (LDKCResult_ChannelIdAPIErrorZ*)untag_ptr(o);
29753         jboolean ret_conv = CResult_ChannelIdAPIErrorZ_is_ok(o_conv);
29754         return ret_conv;
29755 }
29756
29757 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelIdAPIErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
29758         if (!ptr_is_owned(_res)) return;
29759         void* _res_ptr = untag_ptr(_res);
29760         CHECK_ACCESS(_res_ptr);
29761         LDKCResult_ChannelIdAPIErrorZ _res_conv = *(LDKCResult_ChannelIdAPIErrorZ*)(_res_ptr);
29762         FREE(untag_ptr(_res));
29763         CResult_ChannelIdAPIErrorZ_free(_res_conv);
29764 }
29765
29766 static inline uint64_t CResult_ChannelIdAPIErrorZ_clone_ptr(LDKCResult_ChannelIdAPIErrorZ *NONNULL_PTR arg) {
29767         LDKCResult_ChannelIdAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelIdAPIErrorZ), "LDKCResult_ChannelIdAPIErrorZ");
29768         *ret_conv = CResult_ChannelIdAPIErrorZ_clone(arg);
29769         return tag_ptr(ret_conv, true);
29770 }
29771 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelIdAPIErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
29772         LDKCResult_ChannelIdAPIErrorZ* arg_conv = (LDKCResult_ChannelIdAPIErrorZ*)untag_ptr(arg);
29773         int64_t ret_conv = CResult_ChannelIdAPIErrorZ_clone_ptr(arg_conv);
29774         return ret_conv;
29775 }
29776
29777 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelIdAPIErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29778         LDKCResult_ChannelIdAPIErrorZ* orig_conv = (LDKCResult_ChannelIdAPIErrorZ*)untag_ptr(orig);
29779         LDKCResult_ChannelIdAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelIdAPIErrorZ), "LDKCResult_ChannelIdAPIErrorZ");
29780         *ret_conv = CResult_ChannelIdAPIErrorZ_clone(orig_conv);
29781         return tag_ptr(ret_conv, true);
29782 }
29783
29784 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1RecentPaymentDetailsZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
29785         LDKCVec_RecentPaymentDetailsZ _res_constr;
29786         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
29787         if (_res_constr.datalen > 0)
29788                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRecentPaymentDetails), "LDKCVec_RecentPaymentDetailsZ Elements");
29789         else
29790                 _res_constr.data = NULL;
29791         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
29792         for (size_t w = 0; w < _res_constr.datalen; w++) {
29793                 int64_t _res_conv_22 = _res_vals[w];
29794                 void* _res_conv_22_ptr = untag_ptr(_res_conv_22);
29795                 CHECK_ACCESS(_res_conv_22_ptr);
29796                 LDKRecentPaymentDetails _res_conv_22_conv = *(LDKRecentPaymentDetails*)(_res_conv_22_ptr);
29797                 FREE(untag_ptr(_res_conv_22));
29798                 _res_constr.data[w] = _res_conv_22_conv;
29799         }
29800         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
29801         CVec_RecentPaymentDetailsZ_free(_res_constr);
29802 }
29803
29804 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1ok(JNIEnv *env, jclass clz) {
29805         LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
29806         *ret_conv = CResult_NonePaymentSendFailureZ_ok();
29807         return tag_ptr(ret_conv, true);
29808 }
29809
29810 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1err(JNIEnv *env, jclass clz, int64_t e) {
29811         void* e_ptr = untag_ptr(e);
29812         CHECK_ACCESS(e_ptr);
29813         LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(e_ptr);
29814         e_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)untag_ptr(e));
29815         LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
29816         *ret_conv = CResult_NonePaymentSendFailureZ_err(e_conv);
29817         return tag_ptr(ret_conv, true);
29818 }
29819
29820 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
29821         LDKCResult_NonePaymentSendFailureZ* o_conv = (LDKCResult_NonePaymentSendFailureZ*)untag_ptr(o);
29822         jboolean ret_conv = CResult_NonePaymentSendFailureZ_is_ok(o_conv);
29823         return ret_conv;
29824 }
29825
29826 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
29827         if (!ptr_is_owned(_res)) return;
29828         void* _res_ptr = untag_ptr(_res);
29829         CHECK_ACCESS(_res_ptr);
29830         LDKCResult_NonePaymentSendFailureZ _res_conv = *(LDKCResult_NonePaymentSendFailureZ*)(_res_ptr);
29831         FREE(untag_ptr(_res));
29832         CResult_NonePaymentSendFailureZ_free(_res_conv);
29833 }
29834
29835 static inline uint64_t CResult_NonePaymentSendFailureZ_clone_ptr(LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR arg) {
29836         LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
29837         *ret_conv = CResult_NonePaymentSendFailureZ_clone(arg);
29838         return tag_ptr(ret_conv, true);
29839 }
29840 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
29841         LDKCResult_NonePaymentSendFailureZ* arg_conv = (LDKCResult_NonePaymentSendFailureZ*)untag_ptr(arg);
29842         int64_t ret_conv = CResult_NonePaymentSendFailureZ_clone_ptr(arg_conv);
29843         return ret_conv;
29844 }
29845
29846 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29847         LDKCResult_NonePaymentSendFailureZ* orig_conv = (LDKCResult_NonePaymentSendFailureZ*)untag_ptr(orig);
29848         LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
29849         *ret_conv = CResult_NonePaymentSendFailureZ_clone(orig_conv);
29850         return tag_ptr(ret_conv, true);
29851 }
29852
29853 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneRetryableSendFailureZ_1ok(JNIEnv *env, jclass clz) {
29854         LDKCResult_NoneRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneRetryableSendFailureZ), "LDKCResult_NoneRetryableSendFailureZ");
29855         *ret_conv = CResult_NoneRetryableSendFailureZ_ok();
29856         return tag_ptr(ret_conv, true);
29857 }
29858
29859 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneRetryableSendFailureZ_1err(JNIEnv *env, jclass clz, jclass e) {
29860         LDKRetryableSendFailure e_conv = LDKRetryableSendFailure_from_java(env, e);
29861         LDKCResult_NoneRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneRetryableSendFailureZ), "LDKCResult_NoneRetryableSendFailureZ");
29862         *ret_conv = CResult_NoneRetryableSendFailureZ_err(e_conv);
29863         return tag_ptr(ret_conv, true);
29864 }
29865
29866 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NoneRetryableSendFailureZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
29867         LDKCResult_NoneRetryableSendFailureZ* o_conv = (LDKCResult_NoneRetryableSendFailureZ*)untag_ptr(o);
29868         jboolean ret_conv = CResult_NoneRetryableSendFailureZ_is_ok(o_conv);
29869         return ret_conv;
29870 }
29871
29872 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneRetryableSendFailureZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
29873         if (!ptr_is_owned(_res)) return;
29874         void* _res_ptr = untag_ptr(_res);
29875         CHECK_ACCESS(_res_ptr);
29876         LDKCResult_NoneRetryableSendFailureZ _res_conv = *(LDKCResult_NoneRetryableSendFailureZ*)(_res_ptr);
29877         FREE(untag_ptr(_res));
29878         CResult_NoneRetryableSendFailureZ_free(_res_conv);
29879 }
29880
29881 static inline uint64_t CResult_NoneRetryableSendFailureZ_clone_ptr(LDKCResult_NoneRetryableSendFailureZ *NONNULL_PTR arg) {
29882         LDKCResult_NoneRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneRetryableSendFailureZ), "LDKCResult_NoneRetryableSendFailureZ");
29883         *ret_conv = CResult_NoneRetryableSendFailureZ_clone(arg);
29884         return tag_ptr(ret_conv, true);
29885 }
29886 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneRetryableSendFailureZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
29887         LDKCResult_NoneRetryableSendFailureZ* arg_conv = (LDKCResult_NoneRetryableSendFailureZ*)untag_ptr(arg);
29888         int64_t ret_conv = CResult_NoneRetryableSendFailureZ_clone_ptr(arg_conv);
29889         return ret_conv;
29890 }
29891
29892 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneRetryableSendFailureZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29893         LDKCResult_NoneRetryableSendFailureZ* orig_conv = (LDKCResult_NoneRetryableSendFailureZ*)untag_ptr(orig);
29894         LDKCResult_NoneRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneRetryableSendFailureZ), "LDKCResult_NoneRetryableSendFailureZ");
29895         *ret_conv = CResult_NoneRetryableSendFailureZ_clone(orig_conv);
29896         return tag_ptr(ret_conv, true);
29897 }
29898
29899 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesPaymentSendFailureZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
29900         LDKThirtyTwoBytes o_ref;
29901         CHECK((*env)->GetArrayLength(env, o) == 32);
29902         (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.data);
29903         LDKCResult_ThirtyTwoBytesPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesPaymentSendFailureZ), "LDKCResult_ThirtyTwoBytesPaymentSendFailureZ");
29904         *ret_conv = CResult_ThirtyTwoBytesPaymentSendFailureZ_ok(o_ref);
29905         return tag_ptr(ret_conv, true);
29906 }
29907
29908 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesPaymentSendFailureZ_1err(JNIEnv *env, jclass clz, int64_t e) {
29909         void* e_ptr = untag_ptr(e);
29910         CHECK_ACCESS(e_ptr);
29911         LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(e_ptr);
29912         e_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)untag_ptr(e));
29913         LDKCResult_ThirtyTwoBytesPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesPaymentSendFailureZ), "LDKCResult_ThirtyTwoBytesPaymentSendFailureZ");
29914         *ret_conv = CResult_ThirtyTwoBytesPaymentSendFailureZ_err(e_conv);
29915         return tag_ptr(ret_conv, true);
29916 }
29917
29918 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesPaymentSendFailureZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
29919         LDKCResult_ThirtyTwoBytesPaymentSendFailureZ* o_conv = (LDKCResult_ThirtyTwoBytesPaymentSendFailureZ*)untag_ptr(o);
29920         jboolean ret_conv = CResult_ThirtyTwoBytesPaymentSendFailureZ_is_ok(o_conv);
29921         return ret_conv;
29922 }
29923
29924 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesPaymentSendFailureZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
29925         if (!ptr_is_owned(_res)) return;
29926         void* _res_ptr = untag_ptr(_res);
29927         CHECK_ACCESS(_res_ptr);
29928         LDKCResult_ThirtyTwoBytesPaymentSendFailureZ _res_conv = *(LDKCResult_ThirtyTwoBytesPaymentSendFailureZ*)(_res_ptr);
29929         FREE(untag_ptr(_res));
29930         CResult_ThirtyTwoBytesPaymentSendFailureZ_free(_res_conv);
29931 }
29932
29933 static inline uint64_t CResult_ThirtyTwoBytesPaymentSendFailureZ_clone_ptr(LDKCResult_ThirtyTwoBytesPaymentSendFailureZ *NONNULL_PTR arg) {
29934         LDKCResult_ThirtyTwoBytesPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesPaymentSendFailureZ), "LDKCResult_ThirtyTwoBytesPaymentSendFailureZ");
29935         *ret_conv = CResult_ThirtyTwoBytesPaymentSendFailureZ_clone(arg);
29936         return tag_ptr(ret_conv, true);
29937 }
29938 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesPaymentSendFailureZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
29939         LDKCResult_ThirtyTwoBytesPaymentSendFailureZ* arg_conv = (LDKCResult_ThirtyTwoBytesPaymentSendFailureZ*)untag_ptr(arg);
29940         int64_t ret_conv = CResult_ThirtyTwoBytesPaymentSendFailureZ_clone_ptr(arg_conv);
29941         return ret_conv;
29942 }
29943
29944 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesPaymentSendFailureZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29945         LDKCResult_ThirtyTwoBytesPaymentSendFailureZ* orig_conv = (LDKCResult_ThirtyTwoBytesPaymentSendFailureZ*)untag_ptr(orig);
29946         LDKCResult_ThirtyTwoBytesPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesPaymentSendFailureZ), "LDKCResult_ThirtyTwoBytesPaymentSendFailureZ");
29947         *ret_conv = CResult_ThirtyTwoBytesPaymentSendFailureZ_clone(orig_conv);
29948         return tag_ptr(ret_conv, true);
29949 }
29950
29951 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesRetryableSendFailureZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
29952         LDKThirtyTwoBytes o_ref;
29953         CHECK((*env)->GetArrayLength(env, o) == 32);
29954         (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.data);
29955         LDKCResult_ThirtyTwoBytesRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesRetryableSendFailureZ), "LDKCResult_ThirtyTwoBytesRetryableSendFailureZ");
29956         *ret_conv = CResult_ThirtyTwoBytesRetryableSendFailureZ_ok(o_ref);
29957         return tag_ptr(ret_conv, true);
29958 }
29959
29960 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesRetryableSendFailureZ_1err(JNIEnv *env, jclass clz, jclass e) {
29961         LDKRetryableSendFailure e_conv = LDKRetryableSendFailure_from_java(env, e);
29962         LDKCResult_ThirtyTwoBytesRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesRetryableSendFailureZ), "LDKCResult_ThirtyTwoBytesRetryableSendFailureZ");
29963         *ret_conv = CResult_ThirtyTwoBytesRetryableSendFailureZ_err(e_conv);
29964         return tag_ptr(ret_conv, true);
29965 }
29966
29967 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesRetryableSendFailureZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
29968         LDKCResult_ThirtyTwoBytesRetryableSendFailureZ* o_conv = (LDKCResult_ThirtyTwoBytesRetryableSendFailureZ*)untag_ptr(o);
29969         jboolean ret_conv = CResult_ThirtyTwoBytesRetryableSendFailureZ_is_ok(o_conv);
29970         return ret_conv;
29971 }
29972
29973 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesRetryableSendFailureZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
29974         if (!ptr_is_owned(_res)) return;
29975         void* _res_ptr = untag_ptr(_res);
29976         CHECK_ACCESS(_res_ptr);
29977         LDKCResult_ThirtyTwoBytesRetryableSendFailureZ _res_conv = *(LDKCResult_ThirtyTwoBytesRetryableSendFailureZ*)(_res_ptr);
29978         FREE(untag_ptr(_res));
29979         CResult_ThirtyTwoBytesRetryableSendFailureZ_free(_res_conv);
29980 }
29981
29982 static inline uint64_t CResult_ThirtyTwoBytesRetryableSendFailureZ_clone_ptr(LDKCResult_ThirtyTwoBytesRetryableSendFailureZ *NONNULL_PTR arg) {
29983         LDKCResult_ThirtyTwoBytesRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesRetryableSendFailureZ), "LDKCResult_ThirtyTwoBytesRetryableSendFailureZ");
29984         *ret_conv = CResult_ThirtyTwoBytesRetryableSendFailureZ_clone(arg);
29985         return tag_ptr(ret_conv, true);
29986 }
29987 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesRetryableSendFailureZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
29988         LDKCResult_ThirtyTwoBytesRetryableSendFailureZ* arg_conv = (LDKCResult_ThirtyTwoBytesRetryableSendFailureZ*)untag_ptr(arg);
29989         int64_t ret_conv = CResult_ThirtyTwoBytesRetryableSendFailureZ_clone_ptr(arg_conv);
29990         return ret_conv;
29991 }
29992
29993 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesRetryableSendFailureZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
29994         LDKCResult_ThirtyTwoBytesRetryableSendFailureZ* orig_conv = (LDKCResult_ThirtyTwoBytesRetryableSendFailureZ*)untag_ptr(orig);
29995         LDKCResult_ThirtyTwoBytesRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesRetryableSendFailureZ), "LDKCResult_ThirtyTwoBytesRetryableSendFailureZ");
29996         *ret_conv = CResult_ThirtyTwoBytesRetryableSendFailureZ_clone(orig_conv);
29997         return tag_ptr(ret_conv, true);
29998 }
29999
30000 static inline uint64_t C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone_ptr(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ *NONNULL_PTR arg) {
30001         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ), "LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ");
30002         *ret_conv = C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone(arg);
30003         return tag_ptr(ret_conv, true);
30004 }
30005 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30006         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ* arg_conv = (LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)untag_ptr(arg);
30007         int64_t ret_conv = C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone_ptr(arg_conv);
30008         return ret_conv;
30009 }
30010
30011 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30012         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ* orig_conv = (LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)untag_ptr(orig);
30013         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ), "LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ");
30014         *ret_conv = C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone(orig_conv);
30015         return tag_ptr(ret_conv, true);
30016 }
30017
30018 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int8_tArray b) {
30019         LDKThirtyTwoBytes a_ref;
30020         CHECK((*env)->GetArrayLength(env, a) == 32);
30021         (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
30022         LDKThirtyTwoBytes b_ref;
30023         CHECK((*env)->GetArrayLength(env, b) == 32);
30024         (*env)->GetByteArrayRegion(env, b, 0, 32, b_ref.data);
30025         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ), "LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ");
30026         *ret_conv = C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_new(a_ref, b_ref);
30027         return tag_ptr(ret_conv, true);
30028 }
30029
30030 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
30031         if (!ptr_is_owned(_res)) return;
30032         void* _res_ptr = untag_ptr(_res);
30033         CHECK_ACCESS(_res_ptr);
30034         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ _res_conv = *(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)(_res_ptr);
30035         FREE(untag_ptr(_res));
30036         C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_free(_res_conv);
30037 }
30038
30039 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
30040         void* o_ptr = untag_ptr(o);
30041         CHECK_ACCESS(o_ptr);
30042         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ o_conv = *(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)(o_ptr);
30043         o_conv = C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone((LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)untag_ptr(o));
30044         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ), "LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ");
30045         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_ok(o_conv);
30046         return tag_ptr(ret_conv, true);
30047 }
30048
30049 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_1err(JNIEnv *env, jclass clz, int64_t e) {
30050         void* e_ptr = untag_ptr(e);
30051         CHECK_ACCESS(e_ptr);
30052         LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(e_ptr);
30053         e_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)untag_ptr(e));
30054         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ), "LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ");
30055         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_err(e_conv);
30056         return tag_ptr(ret_conv, true);
30057 }
30058
30059 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
30060         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ* o_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ*)untag_ptr(o);
30061         jboolean ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_is_ok(o_conv);
30062         return ret_conv;
30063 }
30064
30065 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
30066         if (!ptr_is_owned(_res)) return;
30067         void* _res_ptr = untag_ptr(_res);
30068         CHECK_ACCESS(_res_ptr);
30069         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ _res_conv = *(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ*)(_res_ptr);
30070         FREE(untag_ptr(_res));
30071         CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_free(_res_conv);
30072 }
30073
30074 static inline uint64_t CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_clone_ptr(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ *NONNULL_PTR arg) {
30075         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ), "LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ");
30076         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_clone(arg);
30077         return tag_ptr(ret_conv, true);
30078 }
30079 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30080         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ* arg_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ*)untag_ptr(arg);
30081         int64_t ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_clone_ptr(arg_conv);
30082         return ret_conv;
30083 }
30084
30085 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30086         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ* orig_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ*)untag_ptr(orig);
30087         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ), "LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ");
30088         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_clone(orig_conv);
30089         return tag_ptr(ret_conv, true);
30090 }
30091
30092 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
30093         LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ _res_constr;
30094         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
30095         if (_res_constr.datalen > 0)
30096                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ), "LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ Elements");
30097         else
30098                 _res_constr.data = NULL;
30099         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
30100         for (size_t o = 0; o < _res_constr.datalen; o++) {
30101                 int64_t _res_conv_40 = _res_vals[o];
30102                 void* _res_conv_40_ptr = untag_ptr(_res_conv_40);
30103                 CHECK_ACCESS(_res_conv_40_ptr);
30104                 LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ _res_conv_40_conv = *(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)(_res_conv_40_ptr);
30105                 FREE(untag_ptr(_res_conv_40));
30106                 _res_constr.data[o] = _res_conv_40_conv;
30107         }
30108         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
30109         CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ_free(_res_constr);
30110 }
30111
30112 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_1ok(JNIEnv *env, jclass clz, int64_tArray o) {
30113         LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ o_constr;
30114         o_constr.datalen = (*env)->GetArrayLength(env, o);
30115         if (o_constr.datalen > 0)
30116                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ), "LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ Elements");
30117         else
30118                 o_constr.data = NULL;
30119         int64_t* o_vals = (*env)->GetLongArrayElements (env, o, NULL);
30120         for (size_t o = 0; o < o_constr.datalen; o++) {
30121                 int64_t o_conv_40 = o_vals[o];
30122                 void* o_conv_40_ptr = untag_ptr(o_conv_40);
30123                 CHECK_ACCESS(o_conv_40_ptr);
30124                 LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ o_conv_40_conv = *(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)(o_conv_40_ptr);
30125                 o_conv_40_conv = C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone((LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)untag_ptr(o_conv_40));
30126                 o_constr.data[o] = o_conv_40_conv;
30127         }
30128         (*env)->ReleaseLongArrayElements(env, o, o_vals, 0);
30129         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ");
30130         *ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_ok(o_constr);
30131         return tag_ptr(ret_conv, true);
30132 }
30133
30134 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_1err(JNIEnv *env, jclass clz, int64_t e) {
30135         void* e_ptr = untag_ptr(e);
30136         CHECK_ACCESS(e_ptr);
30137         LDKProbeSendFailure e_conv = *(LDKProbeSendFailure*)(e_ptr);
30138         e_conv = ProbeSendFailure_clone((LDKProbeSendFailure*)untag_ptr(e));
30139         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ");
30140         *ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_err(e_conv);
30141         return tag_ptr(ret_conv, true);
30142 }
30143
30144 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
30145         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ* o_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ*)untag_ptr(o);
30146         jboolean ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_is_ok(o_conv);
30147         return ret_conv;
30148 }
30149
30150 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
30151         if (!ptr_is_owned(_res)) return;
30152         void* _res_ptr = untag_ptr(_res);
30153         CHECK_ACCESS(_res_ptr);
30154         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ _res_conv = *(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ*)(_res_ptr);
30155         FREE(untag_ptr(_res));
30156         CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_free(_res_conv);
30157 }
30158
30159 static inline uint64_t CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_clone_ptr(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ *NONNULL_PTR arg) {
30160         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ");
30161         *ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_clone(arg);
30162         return tag_ptr(ret_conv, true);
30163 }
30164 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30165         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ* arg_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ*)untag_ptr(arg);
30166         int64_t ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_clone_ptr(arg_conv);
30167         return ret_conv;
30168 }
30169
30170 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30171         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ* orig_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ*)untag_ptr(orig);
30172         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ");
30173         *ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_clone(orig_conv);
30174         return tag_ptr(ret_conv, true);
30175 }
30176
30177 static inline uint64_t C2Tuple_ChannelIdPublicKeyZ_clone_ptr(LDKC2Tuple_ChannelIdPublicKeyZ *NONNULL_PTR arg) {
30178         LDKC2Tuple_ChannelIdPublicKeyZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ChannelIdPublicKeyZ), "LDKC2Tuple_ChannelIdPublicKeyZ");
30179         *ret_conv = C2Tuple_ChannelIdPublicKeyZ_clone(arg);
30180         return tag_ptr(ret_conv, true);
30181 }
30182 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ChannelIdPublicKeyZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30183         LDKC2Tuple_ChannelIdPublicKeyZ* arg_conv = (LDKC2Tuple_ChannelIdPublicKeyZ*)untag_ptr(arg);
30184         int64_t ret_conv = C2Tuple_ChannelIdPublicKeyZ_clone_ptr(arg_conv);
30185         return ret_conv;
30186 }
30187
30188 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ChannelIdPublicKeyZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30189         LDKC2Tuple_ChannelIdPublicKeyZ* orig_conv = (LDKC2Tuple_ChannelIdPublicKeyZ*)untag_ptr(orig);
30190         LDKC2Tuple_ChannelIdPublicKeyZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ChannelIdPublicKeyZ), "LDKC2Tuple_ChannelIdPublicKeyZ");
30191         *ret_conv = C2Tuple_ChannelIdPublicKeyZ_clone(orig_conv);
30192         return tag_ptr(ret_conv, true);
30193 }
30194
30195 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ChannelIdPublicKeyZ_1new(JNIEnv *env, jclass clz, int64_t a, int8_tArray b) {
30196         LDKChannelId a_conv;
30197         a_conv.inner = untag_ptr(a);
30198         a_conv.is_owned = ptr_is_owned(a);
30199         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
30200         a_conv = ChannelId_clone(&a_conv);
30201         LDKPublicKey b_ref;
30202         CHECK((*env)->GetArrayLength(env, b) == 33);
30203         (*env)->GetByteArrayRegion(env, b, 0, 33, b_ref.compressed_form);
30204         LDKC2Tuple_ChannelIdPublicKeyZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ChannelIdPublicKeyZ), "LDKC2Tuple_ChannelIdPublicKeyZ");
30205         *ret_conv = C2Tuple_ChannelIdPublicKeyZ_new(a_conv, b_ref);
30206         return tag_ptr(ret_conv, true);
30207 }
30208
30209 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ChannelIdPublicKeyZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
30210         if (!ptr_is_owned(_res)) return;
30211         void* _res_ptr = untag_ptr(_res);
30212         CHECK_ACCESS(_res_ptr);
30213         LDKC2Tuple_ChannelIdPublicKeyZ _res_conv = *(LDKC2Tuple_ChannelIdPublicKeyZ*)(_res_ptr);
30214         FREE(untag_ptr(_res));
30215         C2Tuple_ChannelIdPublicKeyZ_free(_res_conv);
30216 }
30217
30218 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1ChannelIdPublicKeyZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
30219         LDKCVec_C2Tuple_ChannelIdPublicKeyZZ _res_constr;
30220         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
30221         if (_res_constr.datalen > 0)
30222                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_ChannelIdPublicKeyZ), "LDKCVec_C2Tuple_ChannelIdPublicKeyZZ Elements");
30223         else
30224                 _res_constr.data = NULL;
30225         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
30226         for (size_t e = 0; e < _res_constr.datalen; e++) {
30227                 int64_t _res_conv_30 = _res_vals[e];
30228                 void* _res_conv_30_ptr = untag_ptr(_res_conv_30);
30229                 CHECK_ACCESS(_res_conv_30_ptr);
30230                 LDKC2Tuple_ChannelIdPublicKeyZ _res_conv_30_conv = *(LDKC2Tuple_ChannelIdPublicKeyZ*)(_res_conv_30_ptr);
30231                 FREE(untag_ptr(_res_conv_30));
30232                 _res_constr.data[e] = _res_conv_30_conv;
30233         }
30234         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
30235         CVec_C2Tuple_ChannelIdPublicKeyZZ_free(_res_constr);
30236 }
30237
30238 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1ChannelIdZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
30239         LDKCVec_ChannelIdZ _res_constr;
30240         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
30241         if (_res_constr.datalen > 0)
30242                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKChannelId), "LDKCVec_ChannelIdZ Elements");
30243         else
30244                 _res_constr.data = NULL;
30245         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
30246         for (size_t l = 0; l < _res_constr.datalen; l++) {
30247                 int64_t _res_conv_11 = _res_vals[l];
30248                 LDKChannelId _res_conv_11_conv;
30249                 _res_conv_11_conv.inner = untag_ptr(_res_conv_11);
30250                 _res_conv_11_conv.is_owned = ptr_is_owned(_res_conv_11);
30251                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_11_conv);
30252                 _res_constr.data[l] = _res_conv_11_conv;
30253         }
30254         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
30255         CVec_ChannelIdZ_free(_res_constr);
30256 }
30257
30258 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
30259         LDKOfferWithDerivedMetadataBuilder o_conv;
30260         o_conv.inner = untag_ptr(o);
30261         o_conv.is_owned = ptr_is_owned(o);
30262         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
30263         o_conv = OfferWithDerivedMetadataBuilder_clone(&o_conv);
30264         LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ), "LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ");
30265         *ret_conv = CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ_ok(o_conv);
30266         return tag_ptr(ret_conv, true);
30267 }
30268
30269 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
30270         LDKBolt12SemanticError e_conv = LDKBolt12SemanticError_from_java(env, e);
30271         LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ), "LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ");
30272         *ret_conv = CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ_err(e_conv);
30273         return tag_ptr(ret_conv, true);
30274 }
30275
30276 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
30277         LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ* o_conv = (LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ*)untag_ptr(o);
30278         jboolean ret_conv = CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ_is_ok(o_conv);
30279         return ret_conv;
30280 }
30281
30282 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
30283         if (!ptr_is_owned(_res)) return;
30284         void* _res_ptr = untag_ptr(_res);
30285         CHECK_ACCESS(_res_ptr);
30286         LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ _res_conv = *(LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ*)(_res_ptr);
30287         FREE(untag_ptr(_res));
30288         CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ_free(_res_conv);
30289 }
30290
30291 static inline uint64_t CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ_clone_ptr(LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ *NONNULL_PTR arg) {
30292         LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ), "LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ");
30293         *ret_conv = CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ_clone(arg);
30294         return tag_ptr(ret_conv, true);
30295 }
30296 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30297         LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ* arg_conv = (LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ*)untag_ptr(arg);
30298         int64_t ret_conv = CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ_clone_ptr(arg_conv);
30299         return ret_conv;
30300 }
30301
30302 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30303         LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ* orig_conv = (LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ*)untag_ptr(orig);
30304         LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ), "LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ");
30305         *ret_conv = CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ_clone(orig_conv);
30306         return tag_ptr(ret_conv, true);
30307 }
30308
30309 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1StrZ_1some(JNIEnv *env, jclass clz, jstring o) {
30310         LDKStr o_conv = java_to_owned_str(env, o);
30311         LDKCOption_StrZ *ret_copy = MALLOC(sizeof(LDKCOption_StrZ), "LDKCOption_StrZ");
30312         *ret_copy = COption_StrZ_some(o_conv);
30313         int64_t ret_ref = tag_ptr(ret_copy, true);
30314         return ret_ref;
30315 }
30316
30317 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1StrZ_1none(JNIEnv *env, jclass clz) {
30318         LDKCOption_StrZ *ret_copy = MALLOC(sizeof(LDKCOption_StrZ), "LDKCOption_StrZ");
30319         *ret_copy = COption_StrZ_none();
30320         int64_t ret_ref = tag_ptr(ret_copy, true);
30321         return ret_ref;
30322 }
30323
30324 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1StrZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
30325         if (!ptr_is_owned(_res)) return;
30326         void* _res_ptr = untag_ptr(_res);
30327         CHECK_ACCESS(_res_ptr);
30328         LDKCOption_StrZ _res_conv = *(LDKCOption_StrZ*)(_res_ptr);
30329         FREE(untag_ptr(_res));
30330         COption_StrZ_free(_res_conv);
30331 }
30332
30333 static inline uint64_t COption_StrZ_clone_ptr(LDKCOption_StrZ *NONNULL_PTR arg) {
30334         LDKCOption_StrZ *ret_copy = MALLOC(sizeof(LDKCOption_StrZ), "LDKCOption_StrZ");
30335         *ret_copy = COption_StrZ_clone(arg);
30336         int64_t ret_ref = tag_ptr(ret_copy, true);
30337         return ret_ref;
30338 }
30339 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1StrZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30340         LDKCOption_StrZ* arg_conv = (LDKCOption_StrZ*)untag_ptr(arg);
30341         int64_t ret_conv = COption_StrZ_clone_ptr(arg_conv);
30342         return ret_conv;
30343 }
30344
30345 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1StrZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30346         LDKCOption_StrZ* orig_conv = (LDKCOption_StrZ*)untag_ptr(orig);
30347         LDKCOption_StrZ *ret_copy = MALLOC(sizeof(LDKCOption_StrZ), "LDKCOption_StrZ");
30348         *ret_copy = COption_StrZ_clone(orig_conv);
30349         int64_t ret_ref = tag_ptr(ret_copy, true);
30350         return ret_ref;
30351 }
30352
30353 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
30354         void* o_ptr = untag_ptr(o);
30355         CHECK_ACCESS(o_ptr);
30356         LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ o_conv = *(LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)(o_ptr);
30357         o_conv = C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone((LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ*)untag_ptr(o));
30358         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ), "LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ");
30359         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_ok(o_conv);
30360         return tag_ptr(ret_conv, true);
30361 }
30362
30363 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZNoneZ_1err(JNIEnv *env, jclass clz) {
30364         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ), "LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ");
30365         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_err();
30366         return tag_ptr(ret_conv, true);
30367 }
30368
30369 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
30370         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ* o_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ*)untag_ptr(o);
30371         jboolean ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_is_ok(o_conv);
30372         return ret_conv;
30373 }
30374
30375 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
30376         if (!ptr_is_owned(_res)) return;
30377         void* _res_ptr = untag_ptr(_res);
30378         CHECK_ACCESS(_res_ptr);
30379         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ _res_conv = *(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ*)(_res_ptr);
30380         FREE(untag_ptr(_res));
30381         CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_free(_res_conv);
30382 }
30383
30384 static inline uint64_t CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_clone_ptr(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ *NONNULL_PTR arg) {
30385         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ), "LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ");
30386         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_clone(arg);
30387         return tag_ptr(ret_conv, true);
30388 }
30389 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30390         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ* arg_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ*)untag_ptr(arg);
30391         int64_t ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_clone_ptr(arg_conv);
30392         return ret_conv;
30393 }
30394
30395 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30396         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ* orig_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ*)untag_ptr(orig);
30397         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ), "LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ");
30398         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_clone(orig_conv);
30399         return tag_ptr(ret_conv, true);
30400 }
30401
30402 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesAPIErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
30403         LDKThirtyTwoBytes o_ref;
30404         CHECK((*env)->GetArrayLength(env, o) == 32);
30405         (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.data);
30406         LDKCResult_ThirtyTwoBytesAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesAPIErrorZ), "LDKCResult_ThirtyTwoBytesAPIErrorZ");
30407         *ret_conv = CResult_ThirtyTwoBytesAPIErrorZ_ok(o_ref);
30408         return tag_ptr(ret_conv, true);
30409 }
30410
30411 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesAPIErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
30412         void* e_ptr = untag_ptr(e);
30413         CHECK_ACCESS(e_ptr);
30414         LDKAPIError e_conv = *(LDKAPIError*)(e_ptr);
30415         e_conv = APIError_clone((LDKAPIError*)untag_ptr(e));
30416         LDKCResult_ThirtyTwoBytesAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesAPIErrorZ), "LDKCResult_ThirtyTwoBytesAPIErrorZ");
30417         *ret_conv = CResult_ThirtyTwoBytesAPIErrorZ_err(e_conv);
30418         return tag_ptr(ret_conv, true);
30419 }
30420
30421 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesAPIErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
30422         LDKCResult_ThirtyTwoBytesAPIErrorZ* o_conv = (LDKCResult_ThirtyTwoBytesAPIErrorZ*)untag_ptr(o);
30423         jboolean ret_conv = CResult_ThirtyTwoBytesAPIErrorZ_is_ok(o_conv);
30424         return ret_conv;
30425 }
30426
30427 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesAPIErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
30428         if (!ptr_is_owned(_res)) return;
30429         void* _res_ptr = untag_ptr(_res);
30430         CHECK_ACCESS(_res_ptr);
30431         LDKCResult_ThirtyTwoBytesAPIErrorZ _res_conv = *(LDKCResult_ThirtyTwoBytesAPIErrorZ*)(_res_ptr);
30432         FREE(untag_ptr(_res));
30433         CResult_ThirtyTwoBytesAPIErrorZ_free(_res_conv);
30434 }
30435
30436 static inline uint64_t CResult_ThirtyTwoBytesAPIErrorZ_clone_ptr(LDKCResult_ThirtyTwoBytesAPIErrorZ *NONNULL_PTR arg) {
30437         LDKCResult_ThirtyTwoBytesAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesAPIErrorZ), "LDKCResult_ThirtyTwoBytesAPIErrorZ");
30438         *ret_conv = CResult_ThirtyTwoBytesAPIErrorZ_clone(arg);
30439         return tag_ptr(ret_conv, true);
30440 }
30441 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesAPIErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30442         LDKCResult_ThirtyTwoBytesAPIErrorZ* arg_conv = (LDKCResult_ThirtyTwoBytesAPIErrorZ*)untag_ptr(arg);
30443         int64_t ret_conv = CResult_ThirtyTwoBytesAPIErrorZ_clone_ptr(arg_conv);
30444         return ret_conv;
30445 }
30446
30447 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ThirtyTwoBytesAPIErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30448         LDKCResult_ThirtyTwoBytesAPIErrorZ* orig_conv = (LDKCResult_ThirtyTwoBytesAPIErrorZ*)untag_ptr(orig);
30449         LDKCResult_ThirtyTwoBytesAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesAPIErrorZ), "LDKCResult_ThirtyTwoBytesAPIErrorZ");
30450         *ret_conv = CResult_ThirtyTwoBytesAPIErrorZ_clone(orig_conv);
30451         return tag_ptr(ret_conv, true);
30452 }
30453
30454 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1OffersMessageZ_1some(JNIEnv *env, jclass clz, int64_t o) {
30455         void* o_ptr = untag_ptr(o);
30456         CHECK_ACCESS(o_ptr);
30457         LDKOffersMessage o_conv = *(LDKOffersMessage*)(o_ptr);
30458         o_conv = OffersMessage_clone((LDKOffersMessage*)untag_ptr(o));
30459         LDKCOption_OffersMessageZ *ret_copy = MALLOC(sizeof(LDKCOption_OffersMessageZ), "LDKCOption_OffersMessageZ");
30460         *ret_copy = COption_OffersMessageZ_some(o_conv);
30461         int64_t ret_ref = tag_ptr(ret_copy, true);
30462         return ret_ref;
30463 }
30464
30465 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1OffersMessageZ_1none(JNIEnv *env, jclass clz) {
30466         LDKCOption_OffersMessageZ *ret_copy = MALLOC(sizeof(LDKCOption_OffersMessageZ), "LDKCOption_OffersMessageZ");
30467         *ret_copy = COption_OffersMessageZ_none();
30468         int64_t ret_ref = tag_ptr(ret_copy, true);
30469         return ret_ref;
30470 }
30471
30472 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1OffersMessageZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
30473         if (!ptr_is_owned(_res)) return;
30474         void* _res_ptr = untag_ptr(_res);
30475         CHECK_ACCESS(_res_ptr);
30476         LDKCOption_OffersMessageZ _res_conv = *(LDKCOption_OffersMessageZ*)(_res_ptr);
30477         FREE(untag_ptr(_res));
30478         COption_OffersMessageZ_free(_res_conv);
30479 }
30480
30481 static inline uint64_t COption_OffersMessageZ_clone_ptr(LDKCOption_OffersMessageZ *NONNULL_PTR arg) {
30482         LDKCOption_OffersMessageZ *ret_copy = MALLOC(sizeof(LDKCOption_OffersMessageZ), "LDKCOption_OffersMessageZ");
30483         *ret_copy = COption_OffersMessageZ_clone(arg);
30484         int64_t ret_ref = tag_ptr(ret_copy, true);
30485         return ret_ref;
30486 }
30487 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1OffersMessageZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30488         LDKCOption_OffersMessageZ* arg_conv = (LDKCOption_OffersMessageZ*)untag_ptr(arg);
30489         int64_t ret_conv = COption_OffersMessageZ_clone_ptr(arg_conv);
30490         return ret_conv;
30491 }
30492
30493 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1OffersMessageZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30494         LDKCOption_OffersMessageZ* orig_conv = (LDKCOption_OffersMessageZ*)untag_ptr(orig);
30495         LDKCOption_OffersMessageZ *ret_copy = MALLOC(sizeof(LDKCOption_OffersMessageZ), "LDKCOption_OffersMessageZ");
30496         *ret_copy = COption_OffersMessageZ_clone(orig_conv);
30497         int64_t ret_ref = tag_ptr(ret_copy, true);
30498         return ret_ref;
30499 }
30500
30501 static inline uint64_t C3Tuple_OffersMessageDestinationBlindedPathZ_clone_ptr(LDKC3Tuple_OffersMessageDestinationBlindedPathZ *NONNULL_PTR arg) {
30502         LDKC3Tuple_OffersMessageDestinationBlindedPathZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_OffersMessageDestinationBlindedPathZ), "LDKC3Tuple_OffersMessageDestinationBlindedPathZ");
30503         *ret_conv = C3Tuple_OffersMessageDestinationBlindedPathZ_clone(arg);
30504         return tag_ptr(ret_conv, true);
30505 }
30506 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1OffersMessageDestinationBlindedPathZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30507         LDKC3Tuple_OffersMessageDestinationBlindedPathZ* arg_conv = (LDKC3Tuple_OffersMessageDestinationBlindedPathZ*)untag_ptr(arg);
30508         int64_t ret_conv = C3Tuple_OffersMessageDestinationBlindedPathZ_clone_ptr(arg_conv);
30509         return ret_conv;
30510 }
30511
30512 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1OffersMessageDestinationBlindedPathZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30513         LDKC3Tuple_OffersMessageDestinationBlindedPathZ* orig_conv = (LDKC3Tuple_OffersMessageDestinationBlindedPathZ*)untag_ptr(orig);
30514         LDKC3Tuple_OffersMessageDestinationBlindedPathZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_OffersMessageDestinationBlindedPathZ), "LDKC3Tuple_OffersMessageDestinationBlindedPathZ");
30515         *ret_conv = C3Tuple_OffersMessageDestinationBlindedPathZ_clone(orig_conv);
30516         return tag_ptr(ret_conv, true);
30517 }
30518
30519 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) {
30520         void* a_ptr = untag_ptr(a);
30521         CHECK_ACCESS(a_ptr);
30522         LDKOffersMessage a_conv = *(LDKOffersMessage*)(a_ptr);
30523         a_conv = OffersMessage_clone((LDKOffersMessage*)untag_ptr(a));
30524         void* b_ptr = untag_ptr(b);
30525         CHECK_ACCESS(b_ptr);
30526         LDKDestination b_conv = *(LDKDestination*)(b_ptr);
30527         b_conv = Destination_clone((LDKDestination*)untag_ptr(b));
30528         LDKBlindedPath c_conv;
30529         c_conv.inner = untag_ptr(c);
30530         c_conv.is_owned = ptr_is_owned(c);
30531         CHECK_INNER_FIELD_ACCESS_OR_NULL(c_conv);
30532         c_conv = BlindedPath_clone(&c_conv);
30533         LDKC3Tuple_OffersMessageDestinationBlindedPathZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_OffersMessageDestinationBlindedPathZ), "LDKC3Tuple_OffersMessageDestinationBlindedPathZ");
30534         *ret_conv = C3Tuple_OffersMessageDestinationBlindedPathZ_new(a_conv, b_conv, c_conv);
30535         return tag_ptr(ret_conv, true);
30536 }
30537
30538 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C3Tuple_1OffersMessageDestinationBlindedPathZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
30539         if (!ptr_is_owned(_res)) return;
30540         void* _res_ptr = untag_ptr(_res);
30541         CHECK_ACCESS(_res_ptr);
30542         LDKC3Tuple_OffersMessageDestinationBlindedPathZ _res_conv = *(LDKC3Tuple_OffersMessageDestinationBlindedPathZ*)(_res_ptr);
30543         FREE(untag_ptr(_res));
30544         C3Tuple_OffersMessageDestinationBlindedPathZ_free(_res_conv);
30545 }
30546
30547 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C3Tuple_1OffersMessageDestinationBlindedPathZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
30548         LDKCVec_C3Tuple_OffersMessageDestinationBlindedPathZZ _res_constr;
30549         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
30550         if (_res_constr.datalen > 0)
30551                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC3Tuple_OffersMessageDestinationBlindedPathZ), "LDKCVec_C3Tuple_OffersMessageDestinationBlindedPathZZ Elements");
30552         else
30553                 _res_constr.data = NULL;
30554         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
30555         for (size_t x = 0; x < _res_constr.datalen; x++) {
30556                 int64_t _res_conv_49 = _res_vals[x];
30557                 void* _res_conv_49_ptr = untag_ptr(_res_conv_49);
30558                 CHECK_ACCESS(_res_conv_49_ptr);
30559                 LDKC3Tuple_OffersMessageDestinationBlindedPathZ _res_conv_49_conv = *(LDKC3Tuple_OffersMessageDestinationBlindedPathZ*)(_res_conv_49_ptr);
30560                 FREE(untag_ptr(_res_conv_49));
30561                 _res_constr.data[x] = _res_conv_49_conv;
30562         }
30563         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
30564         CVec_C3Tuple_OffersMessageDestinationBlindedPathZZ_free(_res_constr);
30565 }
30566
30567 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyForwardingInfoDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
30568         LDKCounterpartyForwardingInfo o_conv;
30569         o_conv.inner = untag_ptr(o);
30570         o_conv.is_owned = ptr_is_owned(o);
30571         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
30572         o_conv = CounterpartyForwardingInfo_clone(&o_conv);
30573         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
30574         *ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_ok(o_conv);
30575         return tag_ptr(ret_conv, true);
30576 }
30577
30578 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyForwardingInfoDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
30579         void* e_ptr = untag_ptr(e);
30580         CHECK_ACCESS(e_ptr);
30581         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
30582         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
30583         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
30584         *ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_err(e_conv);
30585         return tag_ptr(ret_conv, true);
30586 }
30587
30588 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyForwardingInfoDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
30589         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* o_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)untag_ptr(o);
30590         jboolean ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_is_ok(o_conv);
30591         return ret_conv;
30592 }
30593
30594 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyForwardingInfoDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
30595         if (!ptr_is_owned(_res)) return;
30596         void* _res_ptr = untag_ptr(_res);
30597         CHECK_ACCESS(_res_ptr);
30598         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ _res_conv = *(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)(_res_ptr);
30599         FREE(untag_ptr(_res));
30600         CResult_CounterpartyForwardingInfoDecodeErrorZ_free(_res_conv);
30601 }
30602
30603 static inline uint64_t CResult_CounterpartyForwardingInfoDecodeErrorZ_clone_ptr(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ *NONNULL_PTR arg) {
30604         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
30605         *ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_clone(arg);
30606         return tag_ptr(ret_conv, true);
30607 }
30608 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyForwardingInfoDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30609         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* arg_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)untag_ptr(arg);
30610         int64_t ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_clone_ptr(arg_conv);
30611         return ret_conv;
30612 }
30613
30614 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyForwardingInfoDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30615         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* orig_conv = (LDKCResult_CounterpartyForwardingInfoDecodeErrorZ*)untag_ptr(orig);
30616         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
30617         *ret_conv = CResult_CounterpartyForwardingInfoDecodeErrorZ_clone(orig_conv);
30618         return tag_ptr(ret_conv, true);
30619 }
30620
30621 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelCounterpartyDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
30622         LDKChannelCounterparty o_conv;
30623         o_conv.inner = untag_ptr(o);
30624         o_conv.is_owned = ptr_is_owned(o);
30625         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
30626         o_conv = ChannelCounterparty_clone(&o_conv);
30627         LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
30628         *ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_ok(o_conv);
30629         return tag_ptr(ret_conv, true);
30630 }
30631
30632 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelCounterpartyDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
30633         void* e_ptr = untag_ptr(e);
30634         CHECK_ACCESS(e_ptr);
30635         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
30636         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
30637         LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
30638         *ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_err(e_conv);
30639         return tag_ptr(ret_conv, true);
30640 }
30641
30642 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelCounterpartyDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
30643         LDKCResult_ChannelCounterpartyDecodeErrorZ* o_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)untag_ptr(o);
30644         jboolean ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_is_ok(o_conv);
30645         return ret_conv;
30646 }
30647
30648 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelCounterpartyDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
30649         if (!ptr_is_owned(_res)) return;
30650         void* _res_ptr = untag_ptr(_res);
30651         CHECK_ACCESS(_res_ptr);
30652         LDKCResult_ChannelCounterpartyDecodeErrorZ _res_conv = *(LDKCResult_ChannelCounterpartyDecodeErrorZ*)(_res_ptr);
30653         FREE(untag_ptr(_res));
30654         CResult_ChannelCounterpartyDecodeErrorZ_free(_res_conv);
30655 }
30656
30657 static inline uint64_t CResult_ChannelCounterpartyDecodeErrorZ_clone_ptr(LDKCResult_ChannelCounterpartyDecodeErrorZ *NONNULL_PTR arg) {
30658         LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
30659         *ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_clone(arg);
30660         return tag_ptr(ret_conv, true);
30661 }
30662 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelCounterpartyDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30663         LDKCResult_ChannelCounterpartyDecodeErrorZ* arg_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)untag_ptr(arg);
30664         int64_t ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_clone_ptr(arg_conv);
30665         return ret_conv;
30666 }
30667
30668 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelCounterpartyDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30669         LDKCResult_ChannelCounterpartyDecodeErrorZ* orig_conv = (LDKCResult_ChannelCounterpartyDecodeErrorZ*)untag_ptr(orig);
30670         LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
30671         *ret_conv = CResult_ChannelCounterpartyDecodeErrorZ_clone(orig_conv);
30672         return tag_ptr(ret_conv, true);
30673 }
30674
30675 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDetailsDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
30676         LDKChannelDetails o_conv;
30677         o_conv.inner = untag_ptr(o);
30678         o_conv.is_owned = ptr_is_owned(o);
30679         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
30680         o_conv = ChannelDetails_clone(&o_conv);
30681         LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
30682         *ret_conv = CResult_ChannelDetailsDecodeErrorZ_ok(o_conv);
30683         return tag_ptr(ret_conv, true);
30684 }
30685
30686 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDetailsDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
30687         void* e_ptr = untag_ptr(e);
30688         CHECK_ACCESS(e_ptr);
30689         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
30690         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
30691         LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
30692         *ret_conv = CResult_ChannelDetailsDecodeErrorZ_err(e_conv);
30693         return tag_ptr(ret_conv, true);
30694 }
30695
30696 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDetailsDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
30697         LDKCResult_ChannelDetailsDecodeErrorZ* o_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)untag_ptr(o);
30698         jboolean ret_conv = CResult_ChannelDetailsDecodeErrorZ_is_ok(o_conv);
30699         return ret_conv;
30700 }
30701
30702 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDetailsDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
30703         if (!ptr_is_owned(_res)) return;
30704         void* _res_ptr = untag_ptr(_res);
30705         CHECK_ACCESS(_res_ptr);
30706         LDKCResult_ChannelDetailsDecodeErrorZ _res_conv = *(LDKCResult_ChannelDetailsDecodeErrorZ*)(_res_ptr);
30707         FREE(untag_ptr(_res));
30708         CResult_ChannelDetailsDecodeErrorZ_free(_res_conv);
30709 }
30710
30711 static inline uint64_t CResult_ChannelDetailsDecodeErrorZ_clone_ptr(LDKCResult_ChannelDetailsDecodeErrorZ *NONNULL_PTR arg) {
30712         LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
30713         *ret_conv = CResult_ChannelDetailsDecodeErrorZ_clone(arg);
30714         return tag_ptr(ret_conv, true);
30715 }
30716 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDetailsDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30717         LDKCResult_ChannelDetailsDecodeErrorZ* arg_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)untag_ptr(arg);
30718         int64_t ret_conv = CResult_ChannelDetailsDecodeErrorZ_clone_ptr(arg_conv);
30719         return ret_conv;
30720 }
30721
30722 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDetailsDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30723         LDKCResult_ChannelDetailsDecodeErrorZ* orig_conv = (LDKCResult_ChannelDetailsDecodeErrorZ*)untag_ptr(orig);
30724         LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
30725         *ret_conv = CResult_ChannelDetailsDecodeErrorZ_clone(orig_conv);
30726         return tag_ptr(ret_conv, true);
30727 }
30728
30729 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PhantomRouteHintsDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
30730         LDKPhantomRouteHints o_conv;
30731         o_conv.inner = untag_ptr(o);
30732         o_conv.is_owned = ptr_is_owned(o);
30733         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
30734         o_conv = PhantomRouteHints_clone(&o_conv);
30735         LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
30736         *ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_ok(o_conv);
30737         return tag_ptr(ret_conv, true);
30738 }
30739
30740 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PhantomRouteHintsDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
30741         void* e_ptr = untag_ptr(e);
30742         CHECK_ACCESS(e_ptr);
30743         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
30744         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
30745         LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
30746         *ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_err(e_conv);
30747         return tag_ptr(ret_conv, true);
30748 }
30749
30750 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PhantomRouteHintsDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
30751         LDKCResult_PhantomRouteHintsDecodeErrorZ* o_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)untag_ptr(o);
30752         jboolean ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_is_ok(o_conv);
30753         return ret_conv;
30754 }
30755
30756 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PhantomRouteHintsDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
30757         if (!ptr_is_owned(_res)) return;
30758         void* _res_ptr = untag_ptr(_res);
30759         CHECK_ACCESS(_res_ptr);
30760         LDKCResult_PhantomRouteHintsDecodeErrorZ _res_conv = *(LDKCResult_PhantomRouteHintsDecodeErrorZ*)(_res_ptr);
30761         FREE(untag_ptr(_res));
30762         CResult_PhantomRouteHintsDecodeErrorZ_free(_res_conv);
30763 }
30764
30765 static inline uint64_t CResult_PhantomRouteHintsDecodeErrorZ_clone_ptr(LDKCResult_PhantomRouteHintsDecodeErrorZ *NONNULL_PTR arg) {
30766         LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
30767         *ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_clone(arg);
30768         return tag_ptr(ret_conv, true);
30769 }
30770 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PhantomRouteHintsDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30771         LDKCResult_PhantomRouteHintsDecodeErrorZ* arg_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)untag_ptr(arg);
30772         int64_t ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_clone_ptr(arg_conv);
30773         return ret_conv;
30774 }
30775
30776 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PhantomRouteHintsDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30777         LDKCResult_PhantomRouteHintsDecodeErrorZ* orig_conv = (LDKCResult_PhantomRouteHintsDecodeErrorZ*)untag_ptr(orig);
30778         LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
30779         *ret_conv = CResult_PhantomRouteHintsDecodeErrorZ_clone(orig_conv);
30780         return tag_ptr(ret_conv, true);
30781 }
30782
30783 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedForwardDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
30784         LDKBlindedForward o_conv;
30785         o_conv.inner = untag_ptr(o);
30786         o_conv.is_owned = ptr_is_owned(o);
30787         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
30788         o_conv = BlindedForward_clone(&o_conv);
30789         LDKCResult_BlindedForwardDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedForwardDecodeErrorZ), "LDKCResult_BlindedForwardDecodeErrorZ");
30790         *ret_conv = CResult_BlindedForwardDecodeErrorZ_ok(o_conv);
30791         return tag_ptr(ret_conv, true);
30792 }
30793
30794 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedForwardDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
30795         void* e_ptr = untag_ptr(e);
30796         CHECK_ACCESS(e_ptr);
30797         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
30798         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
30799         LDKCResult_BlindedForwardDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedForwardDecodeErrorZ), "LDKCResult_BlindedForwardDecodeErrorZ");
30800         *ret_conv = CResult_BlindedForwardDecodeErrorZ_err(e_conv);
30801         return tag_ptr(ret_conv, true);
30802 }
30803
30804 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedForwardDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
30805         LDKCResult_BlindedForwardDecodeErrorZ* o_conv = (LDKCResult_BlindedForwardDecodeErrorZ*)untag_ptr(o);
30806         jboolean ret_conv = CResult_BlindedForwardDecodeErrorZ_is_ok(o_conv);
30807         return ret_conv;
30808 }
30809
30810 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedForwardDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
30811         if (!ptr_is_owned(_res)) return;
30812         void* _res_ptr = untag_ptr(_res);
30813         CHECK_ACCESS(_res_ptr);
30814         LDKCResult_BlindedForwardDecodeErrorZ _res_conv = *(LDKCResult_BlindedForwardDecodeErrorZ*)(_res_ptr);
30815         FREE(untag_ptr(_res));
30816         CResult_BlindedForwardDecodeErrorZ_free(_res_conv);
30817 }
30818
30819 static inline uint64_t CResult_BlindedForwardDecodeErrorZ_clone_ptr(LDKCResult_BlindedForwardDecodeErrorZ *NONNULL_PTR arg) {
30820         LDKCResult_BlindedForwardDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedForwardDecodeErrorZ), "LDKCResult_BlindedForwardDecodeErrorZ");
30821         *ret_conv = CResult_BlindedForwardDecodeErrorZ_clone(arg);
30822         return tag_ptr(ret_conv, true);
30823 }
30824 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedForwardDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30825         LDKCResult_BlindedForwardDecodeErrorZ* arg_conv = (LDKCResult_BlindedForwardDecodeErrorZ*)untag_ptr(arg);
30826         int64_t ret_conv = CResult_BlindedForwardDecodeErrorZ_clone_ptr(arg_conv);
30827         return ret_conv;
30828 }
30829
30830 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedForwardDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30831         LDKCResult_BlindedForwardDecodeErrorZ* orig_conv = (LDKCResult_BlindedForwardDecodeErrorZ*)untag_ptr(orig);
30832         LDKCResult_BlindedForwardDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedForwardDecodeErrorZ), "LDKCResult_BlindedForwardDecodeErrorZ");
30833         *ret_conv = CResult_BlindedForwardDecodeErrorZ_clone(orig_conv);
30834         return tag_ptr(ret_conv, true);
30835 }
30836
30837 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PendingHTLCRoutingDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
30838         void* o_ptr = untag_ptr(o);
30839         CHECK_ACCESS(o_ptr);
30840         LDKPendingHTLCRouting o_conv = *(LDKPendingHTLCRouting*)(o_ptr);
30841         o_conv = PendingHTLCRouting_clone((LDKPendingHTLCRouting*)untag_ptr(o));
30842         LDKCResult_PendingHTLCRoutingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PendingHTLCRoutingDecodeErrorZ), "LDKCResult_PendingHTLCRoutingDecodeErrorZ");
30843         *ret_conv = CResult_PendingHTLCRoutingDecodeErrorZ_ok(o_conv);
30844         return tag_ptr(ret_conv, true);
30845 }
30846
30847 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PendingHTLCRoutingDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
30848         void* e_ptr = untag_ptr(e);
30849         CHECK_ACCESS(e_ptr);
30850         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
30851         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
30852         LDKCResult_PendingHTLCRoutingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PendingHTLCRoutingDecodeErrorZ), "LDKCResult_PendingHTLCRoutingDecodeErrorZ");
30853         *ret_conv = CResult_PendingHTLCRoutingDecodeErrorZ_err(e_conv);
30854         return tag_ptr(ret_conv, true);
30855 }
30856
30857 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PendingHTLCRoutingDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
30858         LDKCResult_PendingHTLCRoutingDecodeErrorZ* o_conv = (LDKCResult_PendingHTLCRoutingDecodeErrorZ*)untag_ptr(o);
30859         jboolean ret_conv = CResult_PendingHTLCRoutingDecodeErrorZ_is_ok(o_conv);
30860         return ret_conv;
30861 }
30862
30863 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PendingHTLCRoutingDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
30864         if (!ptr_is_owned(_res)) return;
30865         void* _res_ptr = untag_ptr(_res);
30866         CHECK_ACCESS(_res_ptr);
30867         LDKCResult_PendingHTLCRoutingDecodeErrorZ _res_conv = *(LDKCResult_PendingHTLCRoutingDecodeErrorZ*)(_res_ptr);
30868         FREE(untag_ptr(_res));
30869         CResult_PendingHTLCRoutingDecodeErrorZ_free(_res_conv);
30870 }
30871
30872 static inline uint64_t CResult_PendingHTLCRoutingDecodeErrorZ_clone_ptr(LDKCResult_PendingHTLCRoutingDecodeErrorZ *NONNULL_PTR arg) {
30873         LDKCResult_PendingHTLCRoutingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PendingHTLCRoutingDecodeErrorZ), "LDKCResult_PendingHTLCRoutingDecodeErrorZ");
30874         *ret_conv = CResult_PendingHTLCRoutingDecodeErrorZ_clone(arg);
30875         return tag_ptr(ret_conv, true);
30876 }
30877 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PendingHTLCRoutingDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30878         LDKCResult_PendingHTLCRoutingDecodeErrorZ* arg_conv = (LDKCResult_PendingHTLCRoutingDecodeErrorZ*)untag_ptr(arg);
30879         int64_t ret_conv = CResult_PendingHTLCRoutingDecodeErrorZ_clone_ptr(arg_conv);
30880         return ret_conv;
30881 }
30882
30883 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PendingHTLCRoutingDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30884         LDKCResult_PendingHTLCRoutingDecodeErrorZ* orig_conv = (LDKCResult_PendingHTLCRoutingDecodeErrorZ*)untag_ptr(orig);
30885         LDKCResult_PendingHTLCRoutingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PendingHTLCRoutingDecodeErrorZ), "LDKCResult_PendingHTLCRoutingDecodeErrorZ");
30886         *ret_conv = CResult_PendingHTLCRoutingDecodeErrorZ_clone(orig_conv);
30887         return tag_ptr(ret_conv, true);
30888 }
30889
30890 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PendingHTLCInfoDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
30891         LDKPendingHTLCInfo o_conv;
30892         o_conv.inner = untag_ptr(o);
30893         o_conv.is_owned = ptr_is_owned(o);
30894         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
30895         o_conv = PendingHTLCInfo_clone(&o_conv);
30896         LDKCResult_PendingHTLCInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PendingHTLCInfoDecodeErrorZ), "LDKCResult_PendingHTLCInfoDecodeErrorZ");
30897         *ret_conv = CResult_PendingHTLCInfoDecodeErrorZ_ok(o_conv);
30898         return tag_ptr(ret_conv, true);
30899 }
30900
30901 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PendingHTLCInfoDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
30902         void* e_ptr = untag_ptr(e);
30903         CHECK_ACCESS(e_ptr);
30904         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
30905         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
30906         LDKCResult_PendingHTLCInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PendingHTLCInfoDecodeErrorZ), "LDKCResult_PendingHTLCInfoDecodeErrorZ");
30907         *ret_conv = CResult_PendingHTLCInfoDecodeErrorZ_err(e_conv);
30908         return tag_ptr(ret_conv, true);
30909 }
30910
30911 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PendingHTLCInfoDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
30912         LDKCResult_PendingHTLCInfoDecodeErrorZ* o_conv = (LDKCResult_PendingHTLCInfoDecodeErrorZ*)untag_ptr(o);
30913         jboolean ret_conv = CResult_PendingHTLCInfoDecodeErrorZ_is_ok(o_conv);
30914         return ret_conv;
30915 }
30916
30917 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PendingHTLCInfoDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
30918         if (!ptr_is_owned(_res)) return;
30919         void* _res_ptr = untag_ptr(_res);
30920         CHECK_ACCESS(_res_ptr);
30921         LDKCResult_PendingHTLCInfoDecodeErrorZ _res_conv = *(LDKCResult_PendingHTLCInfoDecodeErrorZ*)(_res_ptr);
30922         FREE(untag_ptr(_res));
30923         CResult_PendingHTLCInfoDecodeErrorZ_free(_res_conv);
30924 }
30925
30926 static inline uint64_t CResult_PendingHTLCInfoDecodeErrorZ_clone_ptr(LDKCResult_PendingHTLCInfoDecodeErrorZ *NONNULL_PTR arg) {
30927         LDKCResult_PendingHTLCInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PendingHTLCInfoDecodeErrorZ), "LDKCResult_PendingHTLCInfoDecodeErrorZ");
30928         *ret_conv = CResult_PendingHTLCInfoDecodeErrorZ_clone(arg);
30929         return tag_ptr(ret_conv, true);
30930 }
30931 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PendingHTLCInfoDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30932         LDKCResult_PendingHTLCInfoDecodeErrorZ* arg_conv = (LDKCResult_PendingHTLCInfoDecodeErrorZ*)untag_ptr(arg);
30933         int64_t ret_conv = CResult_PendingHTLCInfoDecodeErrorZ_clone_ptr(arg_conv);
30934         return ret_conv;
30935 }
30936
30937 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PendingHTLCInfoDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30938         LDKCResult_PendingHTLCInfoDecodeErrorZ* orig_conv = (LDKCResult_PendingHTLCInfoDecodeErrorZ*)untag_ptr(orig);
30939         LDKCResult_PendingHTLCInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PendingHTLCInfoDecodeErrorZ), "LDKCResult_PendingHTLCInfoDecodeErrorZ");
30940         *ret_conv = CResult_PendingHTLCInfoDecodeErrorZ_clone(orig_conv);
30941         return tag_ptr(ret_conv, true);
30942 }
30943
30944 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedFailureDecodeErrorZ_1ok(JNIEnv *env, jclass clz, jclass o) {
30945         LDKBlindedFailure o_conv = LDKBlindedFailure_from_java(env, o);
30946         LDKCResult_BlindedFailureDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedFailureDecodeErrorZ), "LDKCResult_BlindedFailureDecodeErrorZ");
30947         *ret_conv = CResult_BlindedFailureDecodeErrorZ_ok(o_conv);
30948         return tag_ptr(ret_conv, true);
30949 }
30950
30951 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedFailureDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
30952         void* e_ptr = untag_ptr(e);
30953         CHECK_ACCESS(e_ptr);
30954         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
30955         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
30956         LDKCResult_BlindedFailureDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedFailureDecodeErrorZ), "LDKCResult_BlindedFailureDecodeErrorZ");
30957         *ret_conv = CResult_BlindedFailureDecodeErrorZ_err(e_conv);
30958         return tag_ptr(ret_conv, true);
30959 }
30960
30961 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedFailureDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
30962         LDKCResult_BlindedFailureDecodeErrorZ* o_conv = (LDKCResult_BlindedFailureDecodeErrorZ*)untag_ptr(o);
30963         jboolean ret_conv = CResult_BlindedFailureDecodeErrorZ_is_ok(o_conv);
30964         return ret_conv;
30965 }
30966
30967 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedFailureDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
30968         if (!ptr_is_owned(_res)) return;
30969         void* _res_ptr = untag_ptr(_res);
30970         CHECK_ACCESS(_res_ptr);
30971         LDKCResult_BlindedFailureDecodeErrorZ _res_conv = *(LDKCResult_BlindedFailureDecodeErrorZ*)(_res_ptr);
30972         FREE(untag_ptr(_res));
30973         CResult_BlindedFailureDecodeErrorZ_free(_res_conv);
30974 }
30975
30976 static inline uint64_t CResult_BlindedFailureDecodeErrorZ_clone_ptr(LDKCResult_BlindedFailureDecodeErrorZ *NONNULL_PTR arg) {
30977         LDKCResult_BlindedFailureDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedFailureDecodeErrorZ), "LDKCResult_BlindedFailureDecodeErrorZ");
30978         *ret_conv = CResult_BlindedFailureDecodeErrorZ_clone(arg);
30979         return tag_ptr(ret_conv, true);
30980 }
30981 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedFailureDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
30982         LDKCResult_BlindedFailureDecodeErrorZ* arg_conv = (LDKCResult_BlindedFailureDecodeErrorZ*)untag_ptr(arg);
30983         int64_t ret_conv = CResult_BlindedFailureDecodeErrorZ_clone_ptr(arg_conv);
30984         return ret_conv;
30985 }
30986
30987 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedFailureDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
30988         LDKCResult_BlindedFailureDecodeErrorZ* orig_conv = (LDKCResult_BlindedFailureDecodeErrorZ*)untag_ptr(orig);
30989         LDKCResult_BlindedFailureDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedFailureDecodeErrorZ), "LDKCResult_BlindedFailureDecodeErrorZ");
30990         *ret_conv = CResult_BlindedFailureDecodeErrorZ_clone(orig_conv);
30991         return tag_ptr(ret_conv, true);
30992 }
30993
30994 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelShutdownStateDecodeErrorZ_1ok(JNIEnv *env, jclass clz, jclass o) {
30995         LDKChannelShutdownState o_conv = LDKChannelShutdownState_from_java(env, o);
30996         LDKCResult_ChannelShutdownStateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelShutdownStateDecodeErrorZ), "LDKCResult_ChannelShutdownStateDecodeErrorZ");
30997         *ret_conv = CResult_ChannelShutdownStateDecodeErrorZ_ok(o_conv);
30998         return tag_ptr(ret_conv, true);
30999 }
31000
31001 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelShutdownStateDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
31002         void* e_ptr = untag_ptr(e);
31003         CHECK_ACCESS(e_ptr);
31004         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
31005         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
31006         LDKCResult_ChannelShutdownStateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelShutdownStateDecodeErrorZ), "LDKCResult_ChannelShutdownStateDecodeErrorZ");
31007         *ret_conv = CResult_ChannelShutdownStateDecodeErrorZ_err(e_conv);
31008         return tag_ptr(ret_conv, true);
31009 }
31010
31011 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelShutdownStateDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
31012         LDKCResult_ChannelShutdownStateDecodeErrorZ* o_conv = (LDKCResult_ChannelShutdownStateDecodeErrorZ*)untag_ptr(o);
31013         jboolean ret_conv = CResult_ChannelShutdownStateDecodeErrorZ_is_ok(o_conv);
31014         return ret_conv;
31015 }
31016
31017 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelShutdownStateDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
31018         if (!ptr_is_owned(_res)) return;
31019         void* _res_ptr = untag_ptr(_res);
31020         CHECK_ACCESS(_res_ptr);
31021         LDKCResult_ChannelShutdownStateDecodeErrorZ _res_conv = *(LDKCResult_ChannelShutdownStateDecodeErrorZ*)(_res_ptr);
31022         FREE(untag_ptr(_res));
31023         CResult_ChannelShutdownStateDecodeErrorZ_free(_res_conv);
31024 }
31025
31026 static inline uint64_t CResult_ChannelShutdownStateDecodeErrorZ_clone_ptr(LDKCResult_ChannelShutdownStateDecodeErrorZ *NONNULL_PTR arg) {
31027         LDKCResult_ChannelShutdownStateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelShutdownStateDecodeErrorZ), "LDKCResult_ChannelShutdownStateDecodeErrorZ");
31028         *ret_conv = CResult_ChannelShutdownStateDecodeErrorZ_clone(arg);
31029         return tag_ptr(ret_conv, true);
31030 }
31031 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelShutdownStateDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31032         LDKCResult_ChannelShutdownStateDecodeErrorZ* arg_conv = (LDKCResult_ChannelShutdownStateDecodeErrorZ*)untag_ptr(arg);
31033         int64_t ret_conv = CResult_ChannelShutdownStateDecodeErrorZ_clone_ptr(arg_conv);
31034         return ret_conv;
31035 }
31036
31037 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelShutdownStateDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31038         LDKCResult_ChannelShutdownStateDecodeErrorZ* orig_conv = (LDKCResult_ChannelShutdownStateDecodeErrorZ*)untag_ptr(orig);
31039         LDKCResult_ChannelShutdownStateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelShutdownStateDecodeErrorZ), "LDKCResult_ChannelShutdownStateDecodeErrorZ");
31040         *ret_conv = CResult_ChannelShutdownStateDecodeErrorZ_clone(orig_conv);
31041         return tag_ptr(ret_conv, true);
31042 }
31043
31044 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1ChannelMonitorZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
31045         LDKCVec_ChannelMonitorZ _res_constr;
31046         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
31047         if (_res_constr.datalen > 0)
31048                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKChannelMonitor), "LDKCVec_ChannelMonitorZ Elements");
31049         else
31050                 _res_constr.data = NULL;
31051         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
31052         for (size_t q = 0; q < _res_constr.datalen; q++) {
31053                 int64_t _res_conv_16 = _res_vals[q];
31054                 LDKChannelMonitor _res_conv_16_conv;
31055                 _res_conv_16_conv.inner = untag_ptr(_res_conv_16);
31056                 _res_conv_16_conv.is_owned = ptr_is_owned(_res_conv_16);
31057                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_16_conv);
31058                 _res_constr.data[q] = _res_conv_16_conv;
31059         }
31060         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
31061         CVec_ChannelMonitorZ_free(_res_constr);
31062 }
31063
31064 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesChannelManagerZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_t b) {
31065         LDKThirtyTwoBytes a_ref;
31066         CHECK((*env)->GetArrayLength(env, a) == 32);
31067         (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
31068         LDKChannelManager b_conv;
31069         b_conv.inner = untag_ptr(b);
31070         b_conv.is_owned = ptr_is_owned(b);
31071         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
31072         // WARNING: we need a move here but no clone is available for LDKChannelManager
31073         
31074         LDKC2Tuple_ThirtyTwoBytesChannelManagerZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesChannelManagerZ), "LDKC2Tuple_ThirtyTwoBytesChannelManagerZ");
31075         *ret_conv = C2Tuple_ThirtyTwoBytesChannelManagerZ_new(a_ref, b_conv);
31076         return tag_ptr(ret_conv, true);
31077 }
31078
31079 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesChannelManagerZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
31080         if (!ptr_is_owned(_res)) return;
31081         void* _res_ptr = untag_ptr(_res);
31082         CHECK_ACCESS(_res_ptr);
31083         LDKC2Tuple_ThirtyTwoBytesChannelManagerZ _res_conv = *(LDKC2Tuple_ThirtyTwoBytesChannelManagerZ*)(_res_ptr);
31084         FREE(untag_ptr(_res));
31085         C2Tuple_ThirtyTwoBytesChannelManagerZ_free(_res_conv);
31086 }
31087
31088 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesChannelManagerZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
31089         void* o_ptr = untag_ptr(o);
31090         CHECK_ACCESS(o_ptr);
31091         LDKC2Tuple_ThirtyTwoBytesChannelManagerZ o_conv = *(LDKC2Tuple_ThirtyTwoBytesChannelManagerZ*)(o_ptr);
31092         // WARNING: we may need a move here but no clone is available for LDKC2Tuple_ThirtyTwoBytesChannelManagerZ
31093         LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ");
31094         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_ok(o_conv);
31095         return tag_ptr(ret_conv, true);
31096 }
31097
31098 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesChannelManagerZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
31099         void* e_ptr = untag_ptr(e);
31100         CHECK_ACCESS(e_ptr);
31101         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
31102         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
31103         LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ");
31104         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_err(e_conv);
31105         return tag_ptr(ret_conv, true);
31106 }
31107
31108 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesChannelManagerZDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
31109         LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ* o_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ*)untag_ptr(o);
31110         jboolean ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_is_ok(o_conv);
31111         return ret_conv;
31112 }
31113
31114 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesChannelManagerZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
31115         if (!ptr_is_owned(_res)) return;
31116         void* _res_ptr = untag_ptr(_res);
31117         CHECK_ACCESS(_res_ptr);
31118         LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ _res_conv = *(LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ*)(_res_ptr);
31119         FREE(untag_ptr(_res));
31120         CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_free(_res_conv);
31121 }
31122
31123 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1MaxDustHTLCExposureDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
31124         void* o_ptr = untag_ptr(o);
31125         CHECK_ACCESS(o_ptr);
31126         LDKMaxDustHTLCExposure o_conv = *(LDKMaxDustHTLCExposure*)(o_ptr);
31127         o_conv = MaxDustHTLCExposure_clone((LDKMaxDustHTLCExposure*)untag_ptr(o));
31128         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_MaxDustHTLCExposureDecodeErrorZ), "LDKCResult_MaxDustHTLCExposureDecodeErrorZ");
31129         *ret_conv = CResult_MaxDustHTLCExposureDecodeErrorZ_ok(o_conv);
31130         return tag_ptr(ret_conv, true);
31131 }
31132
31133 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1MaxDustHTLCExposureDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
31134         void* e_ptr = untag_ptr(e);
31135         CHECK_ACCESS(e_ptr);
31136         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
31137         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
31138         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_MaxDustHTLCExposureDecodeErrorZ), "LDKCResult_MaxDustHTLCExposureDecodeErrorZ");
31139         *ret_conv = CResult_MaxDustHTLCExposureDecodeErrorZ_err(e_conv);
31140         return tag_ptr(ret_conv, true);
31141 }
31142
31143 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1MaxDustHTLCExposureDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
31144         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* o_conv = (LDKCResult_MaxDustHTLCExposureDecodeErrorZ*)untag_ptr(o);
31145         jboolean ret_conv = CResult_MaxDustHTLCExposureDecodeErrorZ_is_ok(o_conv);
31146         return ret_conv;
31147 }
31148
31149 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1MaxDustHTLCExposureDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
31150         if (!ptr_is_owned(_res)) return;
31151         void* _res_ptr = untag_ptr(_res);
31152         CHECK_ACCESS(_res_ptr);
31153         LDKCResult_MaxDustHTLCExposureDecodeErrorZ _res_conv = *(LDKCResult_MaxDustHTLCExposureDecodeErrorZ*)(_res_ptr);
31154         FREE(untag_ptr(_res));
31155         CResult_MaxDustHTLCExposureDecodeErrorZ_free(_res_conv);
31156 }
31157
31158 static inline uint64_t CResult_MaxDustHTLCExposureDecodeErrorZ_clone_ptr(LDKCResult_MaxDustHTLCExposureDecodeErrorZ *NONNULL_PTR arg) {
31159         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_MaxDustHTLCExposureDecodeErrorZ), "LDKCResult_MaxDustHTLCExposureDecodeErrorZ");
31160         *ret_conv = CResult_MaxDustHTLCExposureDecodeErrorZ_clone(arg);
31161         return tag_ptr(ret_conv, true);
31162 }
31163 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1MaxDustHTLCExposureDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31164         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* arg_conv = (LDKCResult_MaxDustHTLCExposureDecodeErrorZ*)untag_ptr(arg);
31165         int64_t ret_conv = CResult_MaxDustHTLCExposureDecodeErrorZ_clone_ptr(arg_conv);
31166         return ret_conv;
31167 }
31168
31169 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1MaxDustHTLCExposureDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31170         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* orig_conv = (LDKCResult_MaxDustHTLCExposureDecodeErrorZ*)untag_ptr(orig);
31171         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_MaxDustHTLCExposureDecodeErrorZ), "LDKCResult_MaxDustHTLCExposureDecodeErrorZ");
31172         *ret_conv = CResult_MaxDustHTLCExposureDecodeErrorZ_clone(orig_conv);
31173         return tag_ptr(ret_conv, true);
31174 }
31175
31176 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
31177         LDKChannelConfig o_conv;
31178         o_conv.inner = untag_ptr(o);
31179         o_conv.is_owned = ptr_is_owned(o);
31180         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
31181         o_conv = ChannelConfig_clone(&o_conv);
31182         LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
31183         *ret_conv = CResult_ChannelConfigDecodeErrorZ_ok(o_conv);
31184         return tag_ptr(ret_conv, true);
31185 }
31186
31187 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
31188         void* e_ptr = untag_ptr(e);
31189         CHECK_ACCESS(e_ptr);
31190         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
31191         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
31192         LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
31193         *ret_conv = CResult_ChannelConfigDecodeErrorZ_err(e_conv);
31194         return tag_ptr(ret_conv, true);
31195 }
31196
31197 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
31198         LDKCResult_ChannelConfigDecodeErrorZ* o_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)untag_ptr(o);
31199         jboolean ret_conv = CResult_ChannelConfigDecodeErrorZ_is_ok(o_conv);
31200         return ret_conv;
31201 }
31202
31203 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
31204         if (!ptr_is_owned(_res)) return;
31205         void* _res_ptr = untag_ptr(_res);
31206         CHECK_ACCESS(_res_ptr);
31207         LDKCResult_ChannelConfigDecodeErrorZ _res_conv = *(LDKCResult_ChannelConfigDecodeErrorZ*)(_res_ptr);
31208         FREE(untag_ptr(_res));
31209         CResult_ChannelConfigDecodeErrorZ_free(_res_conv);
31210 }
31211
31212 static inline uint64_t CResult_ChannelConfigDecodeErrorZ_clone_ptr(LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR arg) {
31213         LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
31214         *ret_conv = CResult_ChannelConfigDecodeErrorZ_clone(arg);
31215         return tag_ptr(ret_conv, true);
31216 }
31217 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31218         LDKCResult_ChannelConfigDecodeErrorZ* arg_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)untag_ptr(arg);
31219         int64_t ret_conv = CResult_ChannelConfigDecodeErrorZ_clone_ptr(arg_conv);
31220         return ret_conv;
31221 }
31222
31223 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31224         LDKCResult_ChannelConfigDecodeErrorZ* orig_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)untag_ptr(orig);
31225         LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
31226         *ret_conv = CResult_ChannelConfigDecodeErrorZ_clone(orig_conv);
31227         return tag_ptr(ret_conv, true);
31228 }
31229
31230 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1MaxDustHTLCExposureZ_1some(JNIEnv *env, jclass clz, int64_t o) {
31231         void* o_ptr = untag_ptr(o);
31232         CHECK_ACCESS(o_ptr);
31233         LDKMaxDustHTLCExposure o_conv = *(LDKMaxDustHTLCExposure*)(o_ptr);
31234         o_conv = MaxDustHTLCExposure_clone((LDKMaxDustHTLCExposure*)untag_ptr(o));
31235         LDKCOption_MaxDustHTLCExposureZ *ret_copy = MALLOC(sizeof(LDKCOption_MaxDustHTLCExposureZ), "LDKCOption_MaxDustHTLCExposureZ");
31236         *ret_copy = COption_MaxDustHTLCExposureZ_some(o_conv);
31237         int64_t ret_ref = tag_ptr(ret_copy, true);
31238         return ret_ref;
31239 }
31240
31241 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1MaxDustHTLCExposureZ_1none(JNIEnv *env, jclass clz) {
31242         LDKCOption_MaxDustHTLCExposureZ *ret_copy = MALLOC(sizeof(LDKCOption_MaxDustHTLCExposureZ), "LDKCOption_MaxDustHTLCExposureZ");
31243         *ret_copy = COption_MaxDustHTLCExposureZ_none();
31244         int64_t ret_ref = tag_ptr(ret_copy, true);
31245         return ret_ref;
31246 }
31247
31248 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1MaxDustHTLCExposureZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
31249         if (!ptr_is_owned(_res)) return;
31250         void* _res_ptr = untag_ptr(_res);
31251         CHECK_ACCESS(_res_ptr);
31252         LDKCOption_MaxDustHTLCExposureZ _res_conv = *(LDKCOption_MaxDustHTLCExposureZ*)(_res_ptr);
31253         FREE(untag_ptr(_res));
31254         COption_MaxDustHTLCExposureZ_free(_res_conv);
31255 }
31256
31257 static inline uint64_t COption_MaxDustHTLCExposureZ_clone_ptr(LDKCOption_MaxDustHTLCExposureZ *NONNULL_PTR arg) {
31258         LDKCOption_MaxDustHTLCExposureZ *ret_copy = MALLOC(sizeof(LDKCOption_MaxDustHTLCExposureZ), "LDKCOption_MaxDustHTLCExposureZ");
31259         *ret_copy = COption_MaxDustHTLCExposureZ_clone(arg);
31260         int64_t ret_ref = tag_ptr(ret_copy, true);
31261         return ret_ref;
31262 }
31263 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1MaxDustHTLCExposureZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31264         LDKCOption_MaxDustHTLCExposureZ* arg_conv = (LDKCOption_MaxDustHTLCExposureZ*)untag_ptr(arg);
31265         int64_t ret_conv = COption_MaxDustHTLCExposureZ_clone_ptr(arg_conv);
31266         return ret_conv;
31267 }
31268
31269 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1MaxDustHTLCExposureZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31270         LDKCOption_MaxDustHTLCExposureZ* orig_conv = (LDKCOption_MaxDustHTLCExposureZ*)untag_ptr(orig);
31271         LDKCOption_MaxDustHTLCExposureZ *ret_copy = MALLOC(sizeof(LDKCOption_MaxDustHTLCExposureZ), "LDKCOption_MaxDustHTLCExposureZ");
31272         *ret_copy = COption_MaxDustHTLCExposureZ_clone(orig_conv);
31273         int64_t ret_ref = tag_ptr(ret_copy, true);
31274         return ret_ref;
31275 }
31276
31277 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1APIErrorZ_1some(JNIEnv *env, jclass clz, int64_t o) {
31278         void* o_ptr = untag_ptr(o);
31279         CHECK_ACCESS(o_ptr);
31280         LDKAPIError o_conv = *(LDKAPIError*)(o_ptr);
31281         o_conv = APIError_clone((LDKAPIError*)untag_ptr(o));
31282         LDKCOption_APIErrorZ *ret_copy = MALLOC(sizeof(LDKCOption_APIErrorZ), "LDKCOption_APIErrorZ");
31283         *ret_copy = COption_APIErrorZ_some(o_conv);
31284         int64_t ret_ref = tag_ptr(ret_copy, true);
31285         return ret_ref;
31286 }
31287
31288 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1APIErrorZ_1none(JNIEnv *env, jclass clz) {
31289         LDKCOption_APIErrorZ *ret_copy = MALLOC(sizeof(LDKCOption_APIErrorZ), "LDKCOption_APIErrorZ");
31290         *ret_copy = COption_APIErrorZ_none();
31291         int64_t ret_ref = tag_ptr(ret_copy, true);
31292         return ret_ref;
31293 }
31294
31295 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1APIErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
31296         if (!ptr_is_owned(_res)) return;
31297         void* _res_ptr = untag_ptr(_res);
31298         CHECK_ACCESS(_res_ptr);
31299         LDKCOption_APIErrorZ _res_conv = *(LDKCOption_APIErrorZ*)(_res_ptr);
31300         FREE(untag_ptr(_res));
31301         COption_APIErrorZ_free(_res_conv);
31302 }
31303
31304 static inline uint64_t COption_APIErrorZ_clone_ptr(LDKCOption_APIErrorZ *NONNULL_PTR arg) {
31305         LDKCOption_APIErrorZ *ret_copy = MALLOC(sizeof(LDKCOption_APIErrorZ), "LDKCOption_APIErrorZ");
31306         *ret_copy = COption_APIErrorZ_clone(arg);
31307         int64_t ret_ref = tag_ptr(ret_copy, true);
31308         return ret_ref;
31309 }
31310 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1APIErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31311         LDKCOption_APIErrorZ* arg_conv = (LDKCOption_APIErrorZ*)untag_ptr(arg);
31312         int64_t ret_conv = COption_APIErrorZ_clone_ptr(arg_conv);
31313         return ret_conv;
31314 }
31315
31316 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1APIErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31317         LDKCOption_APIErrorZ* orig_conv = (LDKCOption_APIErrorZ*)untag_ptr(orig);
31318         LDKCOption_APIErrorZ *ret_copy = MALLOC(sizeof(LDKCOption_APIErrorZ), "LDKCOption_APIErrorZ");
31319         *ret_copy = COption_APIErrorZ_clone(orig_conv);
31320         int64_t ret_ref = tag_ptr(ret_copy, true);
31321         return ret_ref;
31322 }
31323
31324 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1APIErrorZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
31325         void* o_ptr = untag_ptr(o);
31326         CHECK_ACCESS(o_ptr);
31327         LDKCOption_APIErrorZ o_conv = *(LDKCOption_APIErrorZ*)(o_ptr);
31328         o_conv = COption_APIErrorZ_clone((LDKCOption_APIErrorZ*)untag_ptr(o));
31329         LDKCResult_COption_APIErrorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_APIErrorZDecodeErrorZ), "LDKCResult_COption_APIErrorZDecodeErrorZ");
31330         *ret_conv = CResult_COption_APIErrorZDecodeErrorZ_ok(o_conv);
31331         return tag_ptr(ret_conv, true);
31332 }
31333
31334 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1APIErrorZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
31335         void* e_ptr = untag_ptr(e);
31336         CHECK_ACCESS(e_ptr);
31337         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
31338         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
31339         LDKCResult_COption_APIErrorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_APIErrorZDecodeErrorZ), "LDKCResult_COption_APIErrorZDecodeErrorZ");
31340         *ret_conv = CResult_COption_APIErrorZDecodeErrorZ_err(e_conv);
31341         return tag_ptr(ret_conv, true);
31342 }
31343
31344 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1APIErrorZDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
31345         LDKCResult_COption_APIErrorZDecodeErrorZ* o_conv = (LDKCResult_COption_APIErrorZDecodeErrorZ*)untag_ptr(o);
31346         jboolean ret_conv = CResult_COption_APIErrorZDecodeErrorZ_is_ok(o_conv);
31347         return ret_conv;
31348 }
31349
31350 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1APIErrorZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
31351         if (!ptr_is_owned(_res)) return;
31352         void* _res_ptr = untag_ptr(_res);
31353         CHECK_ACCESS(_res_ptr);
31354         LDKCResult_COption_APIErrorZDecodeErrorZ _res_conv = *(LDKCResult_COption_APIErrorZDecodeErrorZ*)(_res_ptr);
31355         FREE(untag_ptr(_res));
31356         CResult_COption_APIErrorZDecodeErrorZ_free(_res_conv);
31357 }
31358
31359 static inline uint64_t CResult_COption_APIErrorZDecodeErrorZ_clone_ptr(LDKCResult_COption_APIErrorZDecodeErrorZ *NONNULL_PTR arg) {
31360         LDKCResult_COption_APIErrorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_APIErrorZDecodeErrorZ), "LDKCResult_COption_APIErrorZDecodeErrorZ");
31361         *ret_conv = CResult_COption_APIErrorZDecodeErrorZ_clone(arg);
31362         return tag_ptr(ret_conv, true);
31363 }
31364 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1APIErrorZDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31365         LDKCResult_COption_APIErrorZDecodeErrorZ* arg_conv = (LDKCResult_COption_APIErrorZDecodeErrorZ*)untag_ptr(arg);
31366         int64_t ret_conv = CResult_COption_APIErrorZDecodeErrorZ_clone_ptr(arg_conv);
31367         return ret_conv;
31368 }
31369
31370 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1APIErrorZDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31371         LDKCResult_COption_APIErrorZDecodeErrorZ* orig_conv = (LDKCResult_COption_APIErrorZDecodeErrorZ*)untag_ptr(orig);
31372         LDKCResult_COption_APIErrorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_APIErrorZDecodeErrorZ), "LDKCResult_COption_APIErrorZDecodeErrorZ");
31373         *ret_conv = CResult_COption_APIErrorZDecodeErrorZ_clone(orig_conv);
31374         return tag_ptr(ret_conv, true);
31375 }
31376
31377 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
31378         LDKChannelMonitorUpdate o_conv;
31379         o_conv.inner = untag_ptr(o);
31380         o_conv.is_owned = ptr_is_owned(o);
31381         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
31382         o_conv = ChannelMonitorUpdate_clone(&o_conv);
31383         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
31384         *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_ok(o_conv);
31385         return tag_ptr(ret_conv, true);
31386 }
31387
31388 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
31389         void* e_ptr = untag_ptr(e);
31390         CHECK_ACCESS(e_ptr);
31391         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
31392         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
31393         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
31394         *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_err(e_conv);
31395         return tag_ptr(ret_conv, true);
31396 }
31397
31398 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
31399         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* o_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)untag_ptr(o);
31400         jboolean ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_is_ok(o_conv);
31401         return ret_conv;
31402 }
31403
31404 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
31405         if (!ptr_is_owned(_res)) return;
31406         void* _res_ptr = untag_ptr(_res);
31407         CHECK_ACCESS(_res_ptr);
31408         LDKCResult_ChannelMonitorUpdateDecodeErrorZ _res_conv = *(LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(_res_ptr);
31409         FREE(untag_ptr(_res));
31410         CResult_ChannelMonitorUpdateDecodeErrorZ_free(_res_conv);
31411 }
31412
31413 static inline uint64_t CResult_ChannelMonitorUpdateDecodeErrorZ_clone_ptr(LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR arg) {
31414         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
31415         *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_clone(arg);
31416         return tag_ptr(ret_conv, true);
31417 }
31418 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31419         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* arg_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)untag_ptr(arg);
31420         int64_t ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_clone_ptr(arg_conv);
31421         return ret_conv;
31422 }
31423
31424 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31425         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* orig_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)untag_ptr(orig);
31426         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
31427         *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_clone(orig_conv);
31428         return tag_ptr(ret_conv, true);
31429 }
31430
31431 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1MonitorEventZ_1some(JNIEnv *env, jclass clz, int64_t o) {
31432         void* o_ptr = untag_ptr(o);
31433         CHECK_ACCESS(o_ptr);
31434         LDKMonitorEvent o_conv = *(LDKMonitorEvent*)(o_ptr);
31435         o_conv = MonitorEvent_clone((LDKMonitorEvent*)untag_ptr(o));
31436         LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
31437         *ret_copy = COption_MonitorEventZ_some(o_conv);
31438         int64_t ret_ref = tag_ptr(ret_copy, true);
31439         return ret_ref;
31440 }
31441
31442 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1MonitorEventZ_1none(JNIEnv *env, jclass clz) {
31443         LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
31444         *ret_copy = COption_MonitorEventZ_none();
31445         int64_t ret_ref = tag_ptr(ret_copy, true);
31446         return ret_ref;
31447 }
31448
31449 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1MonitorEventZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
31450         if (!ptr_is_owned(_res)) return;
31451         void* _res_ptr = untag_ptr(_res);
31452         CHECK_ACCESS(_res_ptr);
31453         LDKCOption_MonitorEventZ _res_conv = *(LDKCOption_MonitorEventZ*)(_res_ptr);
31454         FREE(untag_ptr(_res));
31455         COption_MonitorEventZ_free(_res_conv);
31456 }
31457
31458 static inline uint64_t COption_MonitorEventZ_clone_ptr(LDKCOption_MonitorEventZ *NONNULL_PTR arg) {
31459         LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
31460         *ret_copy = COption_MonitorEventZ_clone(arg);
31461         int64_t ret_ref = tag_ptr(ret_copy, true);
31462         return ret_ref;
31463 }
31464 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1MonitorEventZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31465         LDKCOption_MonitorEventZ* arg_conv = (LDKCOption_MonitorEventZ*)untag_ptr(arg);
31466         int64_t ret_conv = COption_MonitorEventZ_clone_ptr(arg_conv);
31467         return ret_conv;
31468 }
31469
31470 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1MonitorEventZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31471         LDKCOption_MonitorEventZ* orig_conv = (LDKCOption_MonitorEventZ*)untag_ptr(orig);
31472         LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ");
31473         *ret_copy = COption_MonitorEventZ_clone(orig_conv);
31474         int64_t ret_ref = tag_ptr(ret_copy, true);
31475         return ret_ref;
31476 }
31477
31478 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1MonitorEventZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
31479         void* o_ptr = untag_ptr(o);
31480         CHECK_ACCESS(o_ptr);
31481         LDKCOption_MonitorEventZ o_conv = *(LDKCOption_MonitorEventZ*)(o_ptr);
31482         o_conv = COption_MonitorEventZ_clone((LDKCOption_MonitorEventZ*)untag_ptr(o));
31483         LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
31484         *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_ok(o_conv);
31485         return tag_ptr(ret_conv, true);
31486 }
31487
31488 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1MonitorEventZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
31489         void* e_ptr = untag_ptr(e);
31490         CHECK_ACCESS(e_ptr);
31491         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
31492         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
31493         LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
31494         *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_err(e_conv);
31495         return tag_ptr(ret_conv, true);
31496 }
31497
31498 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1MonitorEventZDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
31499         LDKCResult_COption_MonitorEventZDecodeErrorZ* o_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)untag_ptr(o);
31500         jboolean ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_is_ok(o_conv);
31501         return ret_conv;
31502 }
31503
31504 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1MonitorEventZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
31505         if (!ptr_is_owned(_res)) return;
31506         void* _res_ptr = untag_ptr(_res);
31507         CHECK_ACCESS(_res_ptr);
31508         LDKCResult_COption_MonitorEventZDecodeErrorZ _res_conv = *(LDKCResult_COption_MonitorEventZDecodeErrorZ*)(_res_ptr);
31509         FREE(untag_ptr(_res));
31510         CResult_COption_MonitorEventZDecodeErrorZ_free(_res_conv);
31511 }
31512
31513 static inline uint64_t CResult_COption_MonitorEventZDecodeErrorZ_clone_ptr(LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR arg) {
31514         LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
31515         *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_clone(arg);
31516         return tag_ptr(ret_conv, true);
31517 }
31518 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1MonitorEventZDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31519         LDKCResult_COption_MonitorEventZDecodeErrorZ* arg_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)untag_ptr(arg);
31520         int64_t ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_clone_ptr(arg_conv);
31521         return ret_conv;
31522 }
31523
31524 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1MonitorEventZDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31525         LDKCResult_COption_MonitorEventZDecodeErrorZ* orig_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)untag_ptr(orig);
31526         LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
31527         *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_clone(orig_conv);
31528         return tag_ptr(ret_conv, true);
31529 }
31530
31531 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
31532         LDKHTLCUpdate o_conv;
31533         o_conv.inner = untag_ptr(o);
31534         o_conv.is_owned = ptr_is_owned(o);
31535         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
31536         o_conv = HTLCUpdate_clone(&o_conv);
31537         LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
31538         *ret_conv = CResult_HTLCUpdateDecodeErrorZ_ok(o_conv);
31539         return tag_ptr(ret_conv, true);
31540 }
31541
31542 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
31543         void* e_ptr = untag_ptr(e);
31544         CHECK_ACCESS(e_ptr);
31545         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
31546         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
31547         LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
31548         *ret_conv = CResult_HTLCUpdateDecodeErrorZ_err(e_conv);
31549         return tag_ptr(ret_conv, true);
31550 }
31551
31552 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
31553         LDKCResult_HTLCUpdateDecodeErrorZ* o_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)untag_ptr(o);
31554         jboolean ret_conv = CResult_HTLCUpdateDecodeErrorZ_is_ok(o_conv);
31555         return ret_conv;
31556 }
31557
31558 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
31559         if (!ptr_is_owned(_res)) return;
31560         void* _res_ptr = untag_ptr(_res);
31561         CHECK_ACCESS(_res_ptr);
31562         LDKCResult_HTLCUpdateDecodeErrorZ _res_conv = *(LDKCResult_HTLCUpdateDecodeErrorZ*)(_res_ptr);
31563         FREE(untag_ptr(_res));
31564         CResult_HTLCUpdateDecodeErrorZ_free(_res_conv);
31565 }
31566
31567 static inline uint64_t CResult_HTLCUpdateDecodeErrorZ_clone_ptr(LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR arg) {
31568         LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
31569         *ret_conv = CResult_HTLCUpdateDecodeErrorZ_clone(arg);
31570         return tag_ptr(ret_conv, true);
31571 }
31572 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31573         LDKCResult_HTLCUpdateDecodeErrorZ* arg_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)untag_ptr(arg);
31574         int64_t ret_conv = CResult_HTLCUpdateDecodeErrorZ_clone_ptr(arg_conv);
31575         return ret_conv;
31576 }
31577
31578 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31579         LDKCResult_HTLCUpdateDecodeErrorZ* orig_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)untag_ptr(orig);
31580         LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
31581         *ret_conv = CResult_HTLCUpdateDecodeErrorZ_clone(orig_conv);
31582         return tag_ptr(ret_conv, true);
31583 }
31584
31585 static inline uint64_t C2Tuple_OutPointCVec_u8ZZ_clone_ptr(LDKC2Tuple_OutPointCVec_u8ZZ *NONNULL_PTR arg) {
31586         LDKC2Tuple_OutPointCVec_u8ZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_u8ZZ), "LDKC2Tuple_OutPointCVec_u8ZZ");
31587         *ret_conv = C2Tuple_OutPointCVec_u8ZZ_clone(arg);
31588         return tag_ptr(ret_conv, true);
31589 }
31590 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointCVec_1u8ZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31591         LDKC2Tuple_OutPointCVec_u8ZZ* arg_conv = (LDKC2Tuple_OutPointCVec_u8ZZ*)untag_ptr(arg);
31592         int64_t ret_conv = C2Tuple_OutPointCVec_u8ZZ_clone_ptr(arg_conv);
31593         return ret_conv;
31594 }
31595
31596 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointCVec_1u8ZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31597         LDKC2Tuple_OutPointCVec_u8ZZ* orig_conv = (LDKC2Tuple_OutPointCVec_u8ZZ*)untag_ptr(orig);
31598         LDKC2Tuple_OutPointCVec_u8ZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_u8ZZ), "LDKC2Tuple_OutPointCVec_u8ZZ");
31599         *ret_conv = C2Tuple_OutPointCVec_u8ZZ_clone(orig_conv);
31600         return tag_ptr(ret_conv, true);
31601 }
31602
31603 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointCVec_1u8ZZ_1new(JNIEnv *env, jclass clz, int64_t a, int8_tArray b) {
31604         LDKOutPoint a_conv;
31605         a_conv.inner = untag_ptr(a);
31606         a_conv.is_owned = ptr_is_owned(a);
31607         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
31608         a_conv = OutPoint_clone(&a_conv);
31609         LDKCVec_u8Z b_ref;
31610         b_ref.datalen = (*env)->GetArrayLength(env, b);
31611         b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
31612         (*env)->GetByteArrayRegion(env, b, 0, b_ref.datalen, b_ref.data);
31613         LDKC2Tuple_OutPointCVec_u8ZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_u8ZZ), "LDKC2Tuple_OutPointCVec_u8ZZ");
31614         *ret_conv = C2Tuple_OutPointCVec_u8ZZ_new(a_conv, b_ref);
31615         return tag_ptr(ret_conv, true);
31616 }
31617
31618 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointCVec_1u8ZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
31619         if (!ptr_is_owned(_res)) return;
31620         void* _res_ptr = untag_ptr(_res);
31621         CHECK_ACCESS(_res_ptr);
31622         LDKC2Tuple_OutPointCVec_u8ZZ _res_conv = *(LDKC2Tuple_OutPointCVec_u8ZZ*)(_res_ptr);
31623         FREE(untag_ptr(_res));
31624         C2Tuple_OutPointCVec_u8ZZ_free(_res_conv);
31625 }
31626
31627 static inline uint64_t C2Tuple_u32CVec_u8ZZ_clone_ptr(LDKC2Tuple_u32CVec_u8ZZ *NONNULL_PTR arg) {
31628         LDKC2Tuple_u32CVec_u8ZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32CVec_u8ZZ), "LDKC2Tuple_u32CVec_u8ZZ");
31629         *ret_conv = C2Tuple_u32CVec_u8ZZ_clone(arg);
31630         return tag_ptr(ret_conv, true);
31631 }
31632 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32CVec_1u8ZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31633         LDKC2Tuple_u32CVec_u8ZZ* arg_conv = (LDKC2Tuple_u32CVec_u8ZZ*)untag_ptr(arg);
31634         int64_t ret_conv = C2Tuple_u32CVec_u8ZZ_clone_ptr(arg_conv);
31635         return ret_conv;
31636 }
31637
31638 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32CVec_1u8ZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31639         LDKC2Tuple_u32CVec_u8ZZ* orig_conv = (LDKC2Tuple_u32CVec_u8ZZ*)untag_ptr(orig);
31640         LDKC2Tuple_u32CVec_u8ZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32CVec_u8ZZ), "LDKC2Tuple_u32CVec_u8ZZ");
31641         *ret_conv = C2Tuple_u32CVec_u8ZZ_clone(orig_conv);
31642         return tag_ptr(ret_conv, true);
31643 }
31644
31645 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32CVec_1u8ZZ_1new(JNIEnv *env, jclass clz, int32_t a, int8_tArray b) {
31646         LDKCVec_u8Z b_ref;
31647         b_ref.datalen = (*env)->GetArrayLength(env, b);
31648         b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
31649         (*env)->GetByteArrayRegion(env, b, 0, b_ref.datalen, b_ref.data);
31650         LDKC2Tuple_u32CVec_u8ZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32CVec_u8ZZ), "LDKC2Tuple_u32CVec_u8ZZ");
31651         *ret_conv = C2Tuple_u32CVec_u8ZZ_new(a, b_ref);
31652         return tag_ptr(ret_conv, true);
31653 }
31654
31655 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32CVec_1u8ZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
31656         if (!ptr_is_owned(_res)) return;
31657         void* _res_ptr = untag_ptr(_res);
31658         CHECK_ACCESS(_res_ptr);
31659         LDKC2Tuple_u32CVec_u8ZZ _res_conv = *(LDKC2Tuple_u32CVec_u8ZZ*)(_res_ptr);
31660         FREE(untag_ptr(_res));
31661         C2Tuple_u32CVec_u8ZZ_free(_res_conv);
31662 }
31663
31664 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1u32CVec_1u8ZZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
31665         LDKCVec_C2Tuple_u32CVec_u8ZZZ _res_constr;
31666         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
31667         if (_res_constr.datalen > 0)
31668                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_u32CVec_u8ZZ), "LDKCVec_C2Tuple_u32CVec_u8ZZZ Elements");
31669         else
31670                 _res_constr.data = NULL;
31671         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
31672         for (size_t x = 0; x < _res_constr.datalen; x++) {
31673                 int64_t _res_conv_23 = _res_vals[x];
31674                 void* _res_conv_23_ptr = untag_ptr(_res_conv_23);
31675                 CHECK_ACCESS(_res_conv_23_ptr);
31676                 LDKC2Tuple_u32CVec_u8ZZ _res_conv_23_conv = *(LDKC2Tuple_u32CVec_u8ZZ*)(_res_conv_23_ptr);
31677                 FREE(untag_ptr(_res_conv_23));
31678                 _res_constr.data[x] = _res_conv_23_conv;
31679         }
31680         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
31681         CVec_C2Tuple_u32CVec_u8ZZZ_free(_res_constr);
31682 }
31683
31684 static inline uint64_t C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_clone_ptr(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ *NONNULL_PTR arg) {
31685         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ), "LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ");
31686         *ret_conv = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_clone(arg);
31687         return tag_ptr(ret_conv, true);
31688 }
31689 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesCVec_1C2Tuple_1u32CVec_1u8ZZZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31690         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ* arg_conv = (LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ*)untag_ptr(arg);
31691         int64_t ret_conv = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_clone_ptr(arg_conv);
31692         return ret_conv;
31693 }
31694
31695 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesCVec_1C2Tuple_1u32CVec_1u8ZZZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31696         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ* orig_conv = (LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ*)untag_ptr(orig);
31697         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ), "LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ");
31698         *ret_conv = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_clone(orig_conv);
31699         return tag_ptr(ret_conv, true);
31700 }
31701
31702 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) {
31703         LDKThirtyTwoBytes a_ref;
31704         CHECK((*env)->GetArrayLength(env, a) == 32);
31705         (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
31706         LDKCVec_C2Tuple_u32CVec_u8ZZZ b_constr;
31707         b_constr.datalen = (*env)->GetArrayLength(env, b);
31708         if (b_constr.datalen > 0)
31709                 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32CVec_u8ZZ), "LDKCVec_C2Tuple_u32CVec_u8ZZZ Elements");
31710         else
31711                 b_constr.data = NULL;
31712         int64_t* b_vals = (*env)->GetLongArrayElements (env, b, NULL);
31713         for (size_t x = 0; x < b_constr.datalen; x++) {
31714                 int64_t b_conv_23 = b_vals[x];
31715                 void* b_conv_23_ptr = untag_ptr(b_conv_23);
31716                 CHECK_ACCESS(b_conv_23_ptr);
31717                 LDKC2Tuple_u32CVec_u8ZZ b_conv_23_conv = *(LDKC2Tuple_u32CVec_u8ZZ*)(b_conv_23_ptr);
31718                 b_conv_23_conv = C2Tuple_u32CVec_u8ZZ_clone((LDKC2Tuple_u32CVec_u8ZZ*)untag_ptr(b_conv_23));
31719                 b_constr.data[x] = b_conv_23_conv;
31720         }
31721         (*env)->ReleaseLongArrayElements(env, b, b_vals, 0);
31722         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ), "LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ");
31723         *ret_conv = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_new(a_ref, b_constr);
31724         return tag_ptr(ret_conv, true);
31725 }
31726
31727 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesCVec_1C2Tuple_1u32CVec_1u8ZZZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
31728         if (!ptr_is_owned(_res)) return;
31729         void* _res_ptr = untag_ptr(_res);
31730         CHECK_ACCESS(_res_ptr);
31731         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ _res_conv = *(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ*)(_res_ptr);
31732         FREE(untag_ptr(_res));
31733         C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_free(_res_conv);
31734 }
31735
31736 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1ThirtyTwoBytesCVec_1C2Tuple_1u32CVec_1u8ZZZZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
31737         LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ _res_constr;
31738         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
31739         if (_res_constr.datalen > 0)
31740                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ), "LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ Elements");
31741         else
31742                 _res_constr.data = NULL;
31743         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
31744         for (size_t a = 0; a < _res_constr.datalen; a++) {
31745                 int64_t _res_conv_52 = _res_vals[a];
31746                 void* _res_conv_52_ptr = untag_ptr(_res_conv_52);
31747                 CHECK_ACCESS(_res_conv_52_ptr);
31748                 LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ _res_conv_52_conv = *(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ*)(_res_conv_52_ptr);
31749                 FREE(untag_ptr(_res_conv_52));
31750                 _res_constr.data[a] = _res_conv_52_conv;
31751         }
31752         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
31753         CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ_free(_res_constr);
31754 }
31755
31756 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1CommitmentTransactionZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
31757         LDKCVec_CommitmentTransactionZ _res_constr;
31758         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
31759         if (_res_constr.datalen > 0)
31760                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCommitmentTransaction), "LDKCVec_CommitmentTransactionZ Elements");
31761         else
31762                 _res_constr.data = NULL;
31763         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
31764         for (size_t x = 0; x < _res_constr.datalen; x++) {
31765                 int64_t _res_conv_23 = _res_vals[x];
31766                 LDKCommitmentTransaction _res_conv_23_conv;
31767                 _res_conv_23_conv.inner = untag_ptr(_res_conv_23);
31768                 _res_conv_23_conv.is_owned = ptr_is_owned(_res_conv_23);
31769                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_23_conv);
31770                 _res_constr.data[x] = _res_conv_23_conv;
31771         }
31772         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
31773         CVec_CommitmentTransactionZ_free(_res_constr);
31774 }
31775
31776 static inline uint64_t C2Tuple_u32TxOutZ_clone_ptr(LDKC2Tuple_u32TxOutZ *NONNULL_PTR arg) {
31777         LDKC2Tuple_u32TxOutZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
31778         *ret_conv = C2Tuple_u32TxOutZ_clone(arg);
31779         return tag_ptr(ret_conv, true);
31780 }
31781 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32TxOutZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31782         LDKC2Tuple_u32TxOutZ* arg_conv = (LDKC2Tuple_u32TxOutZ*)untag_ptr(arg);
31783         int64_t ret_conv = C2Tuple_u32TxOutZ_clone_ptr(arg_conv);
31784         return ret_conv;
31785 }
31786
31787 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32TxOutZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31788         LDKC2Tuple_u32TxOutZ* orig_conv = (LDKC2Tuple_u32TxOutZ*)untag_ptr(orig);
31789         LDKC2Tuple_u32TxOutZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
31790         *ret_conv = C2Tuple_u32TxOutZ_clone(orig_conv);
31791         return tag_ptr(ret_conv, true);
31792 }
31793
31794 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32TxOutZ_1new(JNIEnv *env, jclass clz, int32_t a, int64_t b) {
31795         void* b_ptr = untag_ptr(b);
31796         CHECK_ACCESS(b_ptr);
31797         LDKTxOut b_conv = *(LDKTxOut*)(b_ptr);
31798         b_conv = TxOut_clone((LDKTxOut*)untag_ptr(b));
31799         LDKC2Tuple_u32TxOutZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
31800         *ret_conv = C2Tuple_u32TxOutZ_new(a, b_conv);
31801         return tag_ptr(ret_conv, true);
31802 }
31803
31804 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32TxOutZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
31805         if (!ptr_is_owned(_res)) return;
31806         void* _res_ptr = untag_ptr(_res);
31807         CHECK_ACCESS(_res_ptr);
31808         LDKC2Tuple_u32TxOutZ _res_conv = *(LDKC2Tuple_u32TxOutZ*)(_res_ptr);
31809         FREE(untag_ptr(_res));
31810         C2Tuple_u32TxOutZ_free(_res_conv);
31811 }
31812
31813 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1u32TxOutZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
31814         LDKCVec_C2Tuple_u32TxOutZZ _res_constr;
31815         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
31816         if (_res_constr.datalen > 0)
31817                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
31818         else
31819                 _res_constr.data = NULL;
31820         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
31821         for (size_t u = 0; u < _res_constr.datalen; u++) {
31822                 int64_t _res_conv_20 = _res_vals[u];
31823                 void* _res_conv_20_ptr = untag_ptr(_res_conv_20);
31824                 CHECK_ACCESS(_res_conv_20_ptr);
31825                 LDKC2Tuple_u32TxOutZ _res_conv_20_conv = *(LDKC2Tuple_u32TxOutZ*)(_res_conv_20_ptr);
31826                 FREE(untag_ptr(_res_conv_20));
31827                 _res_constr.data[u] = _res_conv_20_conv;
31828         }
31829         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
31830         CVec_C2Tuple_u32TxOutZZ_free(_res_constr);
31831 }
31832
31833 static inline uint64_t C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_clone_ptr(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR arg) {
31834         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ");
31835         *ret_conv = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_clone(arg);
31836         return tag_ptr(ret_conv, true);
31837 }
31838 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesCVec_1C2Tuple_1u32TxOutZZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31839         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ* arg_conv = (LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ*)untag_ptr(arg);
31840         int64_t ret_conv = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_clone_ptr(arg_conv);
31841         return ret_conv;
31842 }
31843
31844 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesCVec_1C2Tuple_1u32TxOutZZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31845         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ* orig_conv = (LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ*)untag_ptr(orig);
31846         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ");
31847         *ret_conv = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_clone(orig_conv);
31848         return tag_ptr(ret_conv, true);
31849 }
31850
31851 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesCVec_1C2Tuple_1u32TxOutZZZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_tArray b) {
31852         LDKThirtyTwoBytes a_ref;
31853         CHECK((*env)->GetArrayLength(env, a) == 32);
31854         (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
31855         LDKCVec_C2Tuple_u32TxOutZZ b_constr;
31856         b_constr.datalen = (*env)->GetArrayLength(env, b);
31857         if (b_constr.datalen > 0)
31858                 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
31859         else
31860                 b_constr.data = NULL;
31861         int64_t* b_vals = (*env)->GetLongArrayElements (env, b, NULL);
31862         for (size_t u = 0; u < b_constr.datalen; u++) {
31863                 int64_t b_conv_20 = b_vals[u];
31864                 void* b_conv_20_ptr = untag_ptr(b_conv_20);
31865                 CHECK_ACCESS(b_conv_20_ptr);
31866                 LDKC2Tuple_u32TxOutZ b_conv_20_conv = *(LDKC2Tuple_u32TxOutZ*)(b_conv_20_ptr);
31867                 b_conv_20_conv = C2Tuple_u32TxOutZ_clone((LDKC2Tuple_u32TxOutZ*)untag_ptr(b_conv_20));
31868                 b_constr.data[u] = b_conv_20_conv;
31869         }
31870         (*env)->ReleaseLongArrayElements(env, b, b_vals, 0);
31871         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ");
31872         *ret_conv = C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_new(a_ref, b_constr);
31873         return tag_ptr(ret_conv, true);
31874 }
31875
31876 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesCVec_1C2Tuple_1u32TxOutZZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
31877         if (!ptr_is_owned(_res)) return;
31878         void* _res_ptr = untag_ptr(_res);
31879         CHECK_ACCESS(_res_ptr);
31880         LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ _res_conv = *(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ*)(_res_ptr);
31881         FREE(untag_ptr(_res));
31882         C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_free(_res_conv);
31883 }
31884
31885 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1ThirtyTwoBytesCVec_1C2Tuple_1u32TxOutZZZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
31886         LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZZ _res_constr;
31887         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
31888         if (_res_constr.datalen > 0)
31889                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ), "LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZZ Elements");
31890         else
31891                 _res_constr.data = NULL;
31892         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
31893         for (size_t x = 0; x < _res_constr.datalen; x++) {
31894                 int64_t _res_conv_49 = _res_vals[x];
31895                 void* _res_conv_49_ptr = untag_ptr(_res_conv_49);
31896                 CHECK_ACCESS(_res_conv_49_ptr);
31897                 LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ _res_conv_49_conv = *(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ*)(_res_conv_49_ptr);
31898                 FREE(untag_ptr(_res_conv_49));
31899                 _res_constr.data[x] = _res_conv_49_conv;
31900         }
31901         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
31902         CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZZ_free(_res_constr);
31903 }
31904
31905 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1BalanceZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
31906         LDKCVec_BalanceZ _res_constr;
31907         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
31908         if (_res_constr.datalen > 0)
31909                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKBalance), "LDKCVec_BalanceZ Elements");
31910         else
31911                 _res_constr.data = NULL;
31912         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
31913         for (size_t j = 0; j < _res_constr.datalen; j++) {
31914                 int64_t _res_conv_9 = _res_vals[j];
31915                 void* _res_conv_9_ptr = untag_ptr(_res_conv_9);
31916                 CHECK_ACCESS(_res_conv_9_ptr);
31917                 LDKBalance _res_conv_9_conv = *(LDKBalance*)(_res_conv_9_ptr);
31918                 FREE(untag_ptr(_res_conv_9));
31919                 _res_constr.data[j] = _res_conv_9_conv;
31920         }
31921         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
31922         CVec_BalanceZ_free(_res_constr);
31923 }
31924
31925 static inline uint64_t C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone_ptr(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ *NONNULL_PTR arg) {
31926         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ), "LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ");
31927         *ret_conv = C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone(arg);
31928         return tag_ptr(ret_conv, true);
31929 }
31930 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesChannelMonitorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
31931         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ* arg_conv = (LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)untag_ptr(arg);
31932         int64_t ret_conv = C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone_ptr(arg_conv);
31933         return ret_conv;
31934 }
31935
31936 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesChannelMonitorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
31937         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ* orig_conv = (LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)untag_ptr(orig);
31938         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ), "LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ");
31939         *ret_conv = C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone(orig_conv);
31940         return tag_ptr(ret_conv, true);
31941 }
31942
31943 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesChannelMonitorZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_t b) {
31944         LDKThirtyTwoBytes a_ref;
31945         CHECK((*env)->GetArrayLength(env, a) == 32);
31946         (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
31947         LDKChannelMonitor b_conv;
31948         b_conv.inner = untag_ptr(b);
31949         b_conv.is_owned = ptr_is_owned(b);
31950         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
31951         b_conv = ChannelMonitor_clone(&b_conv);
31952         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ), "LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ");
31953         *ret_conv = C2Tuple_ThirtyTwoBytesChannelMonitorZ_new(a_ref, b_conv);
31954         return tag_ptr(ret_conv, true);
31955 }
31956
31957 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesChannelMonitorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
31958         if (!ptr_is_owned(_res)) return;
31959         void* _res_ptr = untag_ptr(_res);
31960         CHECK_ACCESS(_res_ptr);
31961         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ _res_conv = *(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)(_res_ptr);
31962         FREE(untag_ptr(_res));
31963         C2Tuple_ThirtyTwoBytesChannelMonitorZ_free(_res_conv);
31964 }
31965
31966 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesChannelMonitorZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
31967         void* o_ptr = untag_ptr(o);
31968         CHECK_ACCESS(o_ptr);
31969         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ o_conv = *(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)(o_ptr);
31970         o_conv = C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone((LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)untag_ptr(o));
31971         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ");
31972         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_ok(o_conv);
31973         return tag_ptr(ret_conv, true);
31974 }
31975
31976 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesChannelMonitorZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
31977         void* e_ptr = untag_ptr(e);
31978         CHECK_ACCESS(e_ptr);
31979         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
31980         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
31981         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ");
31982         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_err(e_conv);
31983         return tag_ptr(ret_conv, true);
31984 }
31985
31986 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesChannelMonitorZDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
31987         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ* o_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ*)untag_ptr(o);
31988         jboolean ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_is_ok(o_conv);
31989         return ret_conv;
31990 }
31991
31992 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesChannelMonitorZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
31993         if (!ptr_is_owned(_res)) return;
31994         void* _res_ptr = untag_ptr(_res);
31995         CHECK_ACCESS(_res_ptr);
31996         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ _res_conv = *(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ*)(_res_ptr);
31997         FREE(untag_ptr(_res));
31998         CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_free(_res_conv);
31999 }
32000
32001 static inline uint64_t CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_clone_ptr(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ *NONNULL_PTR arg) {
32002         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ");
32003         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_clone(arg);
32004         return tag_ptr(ret_conv, true);
32005 }
32006 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesChannelMonitorZDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32007         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ* arg_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ*)untag_ptr(arg);
32008         int64_t ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_clone_ptr(arg_conv);
32009         return ret_conv;
32010 }
32011
32012 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesChannelMonitorZDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32013         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ* orig_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ*)untag_ptr(orig);
32014         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ");
32015         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_clone(orig_conv);
32016         return tag_ptr(ret_conv, true);
32017 }
32018
32019 static inline uint64_t C2Tuple_PublicKeyTypeZ_clone_ptr(LDKC2Tuple_PublicKeyTypeZ *NONNULL_PTR arg) {
32020         LDKC2Tuple_PublicKeyTypeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
32021         *ret_conv = C2Tuple_PublicKeyTypeZ_clone(arg);
32022         return tag_ptr(ret_conv, true);
32023 }
32024 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyTypeZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32025         LDKC2Tuple_PublicKeyTypeZ* arg_conv = (LDKC2Tuple_PublicKeyTypeZ*)untag_ptr(arg);
32026         int64_t ret_conv = C2Tuple_PublicKeyTypeZ_clone_ptr(arg_conv);
32027         return ret_conv;
32028 }
32029
32030 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyTypeZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32031         LDKC2Tuple_PublicKeyTypeZ* orig_conv = (LDKC2Tuple_PublicKeyTypeZ*)untag_ptr(orig);
32032         LDKC2Tuple_PublicKeyTypeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
32033         *ret_conv = C2Tuple_PublicKeyTypeZ_clone(orig_conv);
32034         return tag_ptr(ret_conv, true);
32035 }
32036
32037 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyTypeZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_t b) {
32038         LDKPublicKey a_ref;
32039         CHECK((*env)->GetArrayLength(env, a) == 33);
32040         (*env)->GetByteArrayRegion(env, a, 0, 33, a_ref.compressed_form);
32041         void* b_ptr = untag_ptr(b);
32042         CHECK_ACCESS(b_ptr);
32043         LDKType b_conv = *(LDKType*)(b_ptr);
32044         if (b_conv.free == LDKType_JCalls_free) {
32045                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
32046                 LDKType_JCalls_cloned(&b_conv);
32047         }
32048         LDKC2Tuple_PublicKeyTypeZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
32049         *ret_conv = C2Tuple_PublicKeyTypeZ_new(a_ref, b_conv);
32050         return tag_ptr(ret_conv, true);
32051 }
32052
32053 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyTypeZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
32054         if (!ptr_is_owned(_res)) return;
32055         void* _res_ptr = untag_ptr(_res);
32056         CHECK_ACCESS(_res_ptr);
32057         LDKC2Tuple_PublicKeyTypeZ _res_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(_res_ptr);
32058         FREE(untag_ptr(_res));
32059         C2Tuple_PublicKeyTypeZ_free(_res_conv);
32060 }
32061
32062 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1PublicKeyTypeZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
32063         LDKCVec_C2Tuple_PublicKeyTypeZZ _res_constr;
32064         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
32065         if (_res_constr.datalen > 0)
32066                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKCVec_C2Tuple_PublicKeyTypeZZ Elements");
32067         else
32068                 _res_constr.data = NULL;
32069         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
32070         for (size_t z = 0; z < _res_constr.datalen; z++) {
32071                 int64_t _res_conv_25 = _res_vals[z];
32072                 void* _res_conv_25_ptr = untag_ptr(_res_conv_25);
32073                 CHECK_ACCESS(_res_conv_25_ptr);
32074                 LDKC2Tuple_PublicKeyTypeZ _res_conv_25_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(_res_conv_25_ptr);
32075                 FREE(untag_ptr(_res_conv_25));
32076                 _res_constr.data[z] = _res_conv_25_conv;
32077         }
32078         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
32079         CVec_C2Tuple_PublicKeyTypeZZ_free(_res_constr);
32080 }
32081
32082 static inline uint64_t C2Tuple_PublicKeyCVec_SocketAddressZZ_clone_ptr(LDKC2Tuple_PublicKeyCVec_SocketAddressZZ *NONNULL_PTR arg) {
32083         LDKC2Tuple_PublicKeyCVec_SocketAddressZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyCVec_SocketAddressZZ), "LDKC2Tuple_PublicKeyCVec_SocketAddressZZ");
32084         *ret_conv = C2Tuple_PublicKeyCVec_SocketAddressZZ_clone(arg);
32085         return tag_ptr(ret_conv, true);
32086 }
32087 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyCVec_1SocketAddressZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32088         LDKC2Tuple_PublicKeyCVec_SocketAddressZZ* arg_conv = (LDKC2Tuple_PublicKeyCVec_SocketAddressZZ*)untag_ptr(arg);
32089         int64_t ret_conv = C2Tuple_PublicKeyCVec_SocketAddressZZ_clone_ptr(arg_conv);
32090         return ret_conv;
32091 }
32092
32093 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyCVec_1SocketAddressZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32094         LDKC2Tuple_PublicKeyCVec_SocketAddressZZ* orig_conv = (LDKC2Tuple_PublicKeyCVec_SocketAddressZZ*)untag_ptr(orig);
32095         LDKC2Tuple_PublicKeyCVec_SocketAddressZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyCVec_SocketAddressZZ), "LDKC2Tuple_PublicKeyCVec_SocketAddressZZ");
32096         *ret_conv = C2Tuple_PublicKeyCVec_SocketAddressZZ_clone(orig_conv);
32097         return tag_ptr(ret_conv, true);
32098 }
32099
32100 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyCVec_1SocketAddressZZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_tArray b) {
32101         LDKPublicKey a_ref;
32102         CHECK((*env)->GetArrayLength(env, a) == 33);
32103         (*env)->GetByteArrayRegion(env, a, 0, 33, a_ref.compressed_form);
32104         LDKCVec_SocketAddressZ b_constr;
32105         b_constr.datalen = (*env)->GetArrayLength(env, b);
32106         if (b_constr.datalen > 0)
32107                 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKSocketAddress), "LDKCVec_SocketAddressZ Elements");
32108         else
32109                 b_constr.data = NULL;
32110         int64_t* b_vals = (*env)->GetLongArrayElements (env, b, NULL);
32111         for (size_t p = 0; p < b_constr.datalen; p++) {
32112                 int64_t b_conv_15 = b_vals[p];
32113                 void* b_conv_15_ptr = untag_ptr(b_conv_15);
32114                 CHECK_ACCESS(b_conv_15_ptr);
32115                 LDKSocketAddress b_conv_15_conv = *(LDKSocketAddress*)(b_conv_15_ptr);
32116                 b_conv_15_conv = SocketAddress_clone((LDKSocketAddress*)untag_ptr(b_conv_15));
32117                 b_constr.data[p] = b_conv_15_conv;
32118         }
32119         (*env)->ReleaseLongArrayElements(env, b, b_vals, 0);
32120         LDKC2Tuple_PublicKeyCVec_SocketAddressZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyCVec_SocketAddressZZ), "LDKC2Tuple_PublicKeyCVec_SocketAddressZZ");
32121         *ret_conv = C2Tuple_PublicKeyCVec_SocketAddressZZ_new(a_ref, b_constr);
32122         return tag_ptr(ret_conv, true);
32123 }
32124
32125 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyCVec_1SocketAddressZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
32126         if (!ptr_is_owned(_res)) return;
32127         void* _res_ptr = untag_ptr(_res);
32128         CHECK_ACCESS(_res_ptr);
32129         LDKC2Tuple_PublicKeyCVec_SocketAddressZZ _res_conv = *(LDKC2Tuple_PublicKeyCVec_SocketAddressZZ*)(_res_ptr);
32130         FREE(untag_ptr(_res));
32131         C2Tuple_PublicKeyCVec_SocketAddressZZ_free(_res_conv);
32132 }
32133
32134 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1PublicKeyCVec_1SocketAddressZZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
32135         LDKCVec_C2Tuple_PublicKeyCVec_SocketAddressZZZ _res_constr;
32136         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
32137         if (_res_constr.datalen > 0)
32138                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_PublicKeyCVec_SocketAddressZZ), "LDKCVec_C2Tuple_PublicKeyCVec_SocketAddressZZZ Elements");
32139         else
32140                 _res_constr.data = NULL;
32141         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
32142         for (size_t o = 0; o < _res_constr.datalen; o++) {
32143                 int64_t _res_conv_40 = _res_vals[o];
32144                 void* _res_conv_40_ptr = untag_ptr(_res_conv_40);
32145                 CHECK_ACCESS(_res_conv_40_ptr);
32146                 LDKC2Tuple_PublicKeyCVec_SocketAddressZZ _res_conv_40_conv = *(LDKC2Tuple_PublicKeyCVec_SocketAddressZZ*)(_res_conv_40_ptr);
32147                 FREE(untag_ptr(_res_conv_40));
32148                 _res_constr.data[o] = _res_conv_40_conv;
32149         }
32150         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
32151         CVec_C2Tuple_PublicKeyCVec_SocketAddressZZZ_free(_res_constr);
32152 }
32153
32154 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1OnionMessageContentsZ_1some(JNIEnv *env, jclass clz, int64_t o) {
32155         void* o_ptr = untag_ptr(o);
32156         CHECK_ACCESS(o_ptr);
32157         LDKOnionMessageContents o_conv = *(LDKOnionMessageContents*)(o_ptr);
32158         if (o_conv.free == LDKOnionMessageContents_JCalls_free) {
32159                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
32160                 LDKOnionMessageContents_JCalls_cloned(&o_conv);
32161         }
32162         LDKCOption_OnionMessageContentsZ *ret_copy = MALLOC(sizeof(LDKCOption_OnionMessageContentsZ), "LDKCOption_OnionMessageContentsZ");
32163         *ret_copy = COption_OnionMessageContentsZ_some(o_conv);
32164         int64_t ret_ref = tag_ptr(ret_copy, true);
32165         return ret_ref;
32166 }
32167
32168 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1OnionMessageContentsZ_1none(JNIEnv *env, jclass clz) {
32169         LDKCOption_OnionMessageContentsZ *ret_copy = MALLOC(sizeof(LDKCOption_OnionMessageContentsZ), "LDKCOption_OnionMessageContentsZ");
32170         *ret_copy = COption_OnionMessageContentsZ_none();
32171         int64_t ret_ref = tag_ptr(ret_copy, true);
32172         return ret_ref;
32173 }
32174
32175 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1OnionMessageContentsZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
32176         if (!ptr_is_owned(_res)) return;
32177         void* _res_ptr = untag_ptr(_res);
32178         CHECK_ACCESS(_res_ptr);
32179         LDKCOption_OnionMessageContentsZ _res_conv = *(LDKCOption_OnionMessageContentsZ*)(_res_ptr);
32180         FREE(untag_ptr(_res));
32181         COption_OnionMessageContentsZ_free(_res_conv);
32182 }
32183
32184 static inline uint64_t COption_OnionMessageContentsZ_clone_ptr(LDKCOption_OnionMessageContentsZ *NONNULL_PTR arg) {
32185         LDKCOption_OnionMessageContentsZ *ret_copy = MALLOC(sizeof(LDKCOption_OnionMessageContentsZ), "LDKCOption_OnionMessageContentsZ");
32186         *ret_copy = COption_OnionMessageContentsZ_clone(arg);
32187         int64_t ret_ref = tag_ptr(ret_copy, true);
32188         return ret_ref;
32189 }
32190 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1OnionMessageContentsZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32191         LDKCOption_OnionMessageContentsZ* arg_conv = (LDKCOption_OnionMessageContentsZ*)untag_ptr(arg);
32192         int64_t ret_conv = COption_OnionMessageContentsZ_clone_ptr(arg_conv);
32193         return ret_conv;
32194 }
32195
32196 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1OnionMessageContentsZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32197         LDKCOption_OnionMessageContentsZ* orig_conv = (LDKCOption_OnionMessageContentsZ*)untag_ptr(orig);
32198         LDKCOption_OnionMessageContentsZ *ret_copy = MALLOC(sizeof(LDKCOption_OnionMessageContentsZ), "LDKCOption_OnionMessageContentsZ");
32199         *ret_copy = COption_OnionMessageContentsZ_clone(orig_conv);
32200         int64_t ret_ref = tag_ptr(ret_copy, true);
32201         return ret_ref;
32202 }
32203
32204 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1OnionMessageContentsZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
32205         void* o_ptr = untag_ptr(o);
32206         CHECK_ACCESS(o_ptr);
32207         LDKCOption_OnionMessageContentsZ o_conv = *(LDKCOption_OnionMessageContentsZ*)(o_ptr);
32208         o_conv = COption_OnionMessageContentsZ_clone((LDKCOption_OnionMessageContentsZ*)untag_ptr(o));
32209         LDKCResult_COption_OnionMessageContentsZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_OnionMessageContentsZDecodeErrorZ), "LDKCResult_COption_OnionMessageContentsZDecodeErrorZ");
32210         *ret_conv = CResult_COption_OnionMessageContentsZDecodeErrorZ_ok(o_conv);
32211         return tag_ptr(ret_conv, true);
32212 }
32213
32214 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1OnionMessageContentsZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
32215         void* e_ptr = untag_ptr(e);
32216         CHECK_ACCESS(e_ptr);
32217         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
32218         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
32219         LDKCResult_COption_OnionMessageContentsZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_OnionMessageContentsZDecodeErrorZ), "LDKCResult_COption_OnionMessageContentsZDecodeErrorZ");
32220         *ret_conv = CResult_COption_OnionMessageContentsZDecodeErrorZ_err(e_conv);
32221         return tag_ptr(ret_conv, true);
32222 }
32223
32224 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1OnionMessageContentsZDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
32225         LDKCResult_COption_OnionMessageContentsZDecodeErrorZ* o_conv = (LDKCResult_COption_OnionMessageContentsZDecodeErrorZ*)untag_ptr(o);
32226         jboolean ret_conv = CResult_COption_OnionMessageContentsZDecodeErrorZ_is_ok(o_conv);
32227         return ret_conv;
32228 }
32229
32230 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1OnionMessageContentsZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
32231         if (!ptr_is_owned(_res)) return;
32232         void* _res_ptr = untag_ptr(_res);
32233         CHECK_ACCESS(_res_ptr);
32234         LDKCResult_COption_OnionMessageContentsZDecodeErrorZ _res_conv = *(LDKCResult_COption_OnionMessageContentsZDecodeErrorZ*)(_res_ptr);
32235         FREE(untag_ptr(_res));
32236         CResult_COption_OnionMessageContentsZDecodeErrorZ_free(_res_conv);
32237 }
32238
32239 static inline uint64_t CResult_COption_OnionMessageContentsZDecodeErrorZ_clone_ptr(LDKCResult_COption_OnionMessageContentsZDecodeErrorZ *NONNULL_PTR arg) {
32240         LDKCResult_COption_OnionMessageContentsZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_OnionMessageContentsZDecodeErrorZ), "LDKCResult_COption_OnionMessageContentsZDecodeErrorZ");
32241         *ret_conv = CResult_COption_OnionMessageContentsZDecodeErrorZ_clone(arg);
32242         return tag_ptr(ret_conv, true);
32243 }
32244 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1OnionMessageContentsZDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32245         LDKCResult_COption_OnionMessageContentsZDecodeErrorZ* arg_conv = (LDKCResult_COption_OnionMessageContentsZDecodeErrorZ*)untag_ptr(arg);
32246         int64_t ret_conv = CResult_COption_OnionMessageContentsZDecodeErrorZ_clone_ptr(arg_conv);
32247         return ret_conv;
32248 }
32249
32250 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1OnionMessageContentsZDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32251         LDKCResult_COption_OnionMessageContentsZDecodeErrorZ* orig_conv = (LDKCResult_COption_OnionMessageContentsZDecodeErrorZ*)untag_ptr(orig);
32252         LDKCResult_COption_OnionMessageContentsZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_OnionMessageContentsZDecodeErrorZ), "LDKCResult_COption_OnionMessageContentsZDecodeErrorZ");
32253         *ret_conv = CResult_COption_OnionMessageContentsZDecodeErrorZ_clone(orig_conv);
32254         return tag_ptr(ret_conv, true);
32255 }
32256
32257 static inline uint64_t C3Tuple_OnionMessageContentsDestinationBlindedPathZ_clone_ptr(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ *NONNULL_PTR arg) {
32258         LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ), "LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ");
32259         *ret_conv = C3Tuple_OnionMessageContentsDestinationBlindedPathZ_clone(arg);
32260         return tag_ptr(ret_conv, true);
32261 }
32262 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1OnionMessageContentsDestinationBlindedPathZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32263         LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ* arg_conv = (LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ*)untag_ptr(arg);
32264         int64_t ret_conv = C3Tuple_OnionMessageContentsDestinationBlindedPathZ_clone_ptr(arg_conv);
32265         return ret_conv;
32266 }
32267
32268 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1OnionMessageContentsDestinationBlindedPathZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32269         LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ* orig_conv = (LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ*)untag_ptr(orig);
32270         LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ), "LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ");
32271         *ret_conv = C3Tuple_OnionMessageContentsDestinationBlindedPathZ_clone(orig_conv);
32272         return tag_ptr(ret_conv, true);
32273 }
32274
32275 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) {
32276         void* a_ptr = untag_ptr(a);
32277         CHECK_ACCESS(a_ptr);
32278         LDKOnionMessageContents a_conv = *(LDKOnionMessageContents*)(a_ptr);
32279         if (a_conv.free == LDKOnionMessageContents_JCalls_free) {
32280                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
32281                 LDKOnionMessageContents_JCalls_cloned(&a_conv);
32282         }
32283         void* b_ptr = untag_ptr(b);
32284         CHECK_ACCESS(b_ptr);
32285         LDKDestination b_conv = *(LDKDestination*)(b_ptr);
32286         b_conv = Destination_clone((LDKDestination*)untag_ptr(b));
32287         LDKBlindedPath c_conv;
32288         c_conv.inner = untag_ptr(c);
32289         c_conv.is_owned = ptr_is_owned(c);
32290         CHECK_INNER_FIELD_ACCESS_OR_NULL(c_conv);
32291         c_conv = BlindedPath_clone(&c_conv);
32292         LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ), "LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ");
32293         *ret_conv = C3Tuple_OnionMessageContentsDestinationBlindedPathZ_new(a_conv, b_conv, c_conv);
32294         return tag_ptr(ret_conv, true);
32295 }
32296
32297 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C3Tuple_1OnionMessageContentsDestinationBlindedPathZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
32298         if (!ptr_is_owned(_res)) return;
32299         void* _res_ptr = untag_ptr(_res);
32300         CHECK_ACCESS(_res_ptr);
32301         LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ _res_conv = *(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ*)(_res_ptr);
32302         FREE(untag_ptr(_res));
32303         C3Tuple_OnionMessageContentsDestinationBlindedPathZ_free(_res_conv);
32304 }
32305
32306 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C3Tuple_1OnionMessageContentsDestinationBlindedPathZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
32307         LDKCVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ _res_constr;
32308         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
32309         if (_res_constr.datalen > 0)
32310                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ), "LDKCVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ Elements");
32311         else
32312                 _res_constr.data = NULL;
32313         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
32314         for (size_t e = 0; e < _res_constr.datalen; e++) {
32315                 int64_t _res_conv_56 = _res_vals[e];
32316                 void* _res_conv_56_ptr = untag_ptr(_res_conv_56);
32317                 CHECK_ACCESS(_res_conv_56_ptr);
32318                 LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ _res_conv_56_conv = *(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ*)(_res_conv_56_ptr);
32319                 FREE(untag_ptr(_res_conv_56));
32320                 _res_constr.data[e] = _res_conv_56_conv;
32321         }
32322         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
32323         CVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ_free(_res_constr);
32324 }
32325
32326 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1TypeZ_1some(JNIEnv *env, jclass clz, int64_t o) {
32327         void* o_ptr = untag_ptr(o);
32328         CHECK_ACCESS(o_ptr);
32329         LDKType o_conv = *(LDKType*)(o_ptr);
32330         if (o_conv.free == LDKType_JCalls_free) {
32331                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
32332                 LDKType_JCalls_cloned(&o_conv);
32333         }
32334         LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
32335         *ret_copy = COption_TypeZ_some(o_conv);
32336         int64_t ret_ref = tag_ptr(ret_copy, true);
32337         return ret_ref;
32338 }
32339
32340 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1TypeZ_1none(JNIEnv *env, jclass clz) {
32341         LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
32342         *ret_copy = COption_TypeZ_none();
32343         int64_t ret_ref = tag_ptr(ret_copy, true);
32344         return ret_ref;
32345 }
32346
32347 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1TypeZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
32348         if (!ptr_is_owned(_res)) return;
32349         void* _res_ptr = untag_ptr(_res);
32350         CHECK_ACCESS(_res_ptr);
32351         LDKCOption_TypeZ _res_conv = *(LDKCOption_TypeZ*)(_res_ptr);
32352         FREE(untag_ptr(_res));
32353         COption_TypeZ_free(_res_conv);
32354 }
32355
32356 static inline uint64_t COption_TypeZ_clone_ptr(LDKCOption_TypeZ *NONNULL_PTR arg) {
32357         LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
32358         *ret_copy = COption_TypeZ_clone(arg);
32359         int64_t ret_ref = tag_ptr(ret_copy, true);
32360         return ret_ref;
32361 }
32362 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1TypeZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32363         LDKCOption_TypeZ* arg_conv = (LDKCOption_TypeZ*)untag_ptr(arg);
32364         int64_t ret_conv = COption_TypeZ_clone_ptr(arg_conv);
32365         return ret_conv;
32366 }
32367
32368 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1TypeZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32369         LDKCOption_TypeZ* orig_conv = (LDKCOption_TypeZ*)untag_ptr(orig);
32370         LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
32371         *ret_copy = COption_TypeZ_clone(orig_conv);
32372         int64_t ret_ref = tag_ptr(ret_copy, true);
32373         return ret_ref;
32374 }
32375
32376 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1TypeZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
32377         void* o_ptr = untag_ptr(o);
32378         CHECK_ACCESS(o_ptr);
32379         LDKCOption_TypeZ o_conv = *(LDKCOption_TypeZ*)(o_ptr);
32380         o_conv = COption_TypeZ_clone((LDKCOption_TypeZ*)untag_ptr(o));
32381         LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
32382         *ret_conv = CResult_COption_TypeZDecodeErrorZ_ok(o_conv);
32383         return tag_ptr(ret_conv, true);
32384 }
32385
32386 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1TypeZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
32387         void* e_ptr = untag_ptr(e);
32388         CHECK_ACCESS(e_ptr);
32389         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
32390         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
32391         LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
32392         *ret_conv = CResult_COption_TypeZDecodeErrorZ_err(e_conv);
32393         return tag_ptr(ret_conv, true);
32394 }
32395
32396 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1TypeZDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
32397         LDKCResult_COption_TypeZDecodeErrorZ* o_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)untag_ptr(o);
32398         jboolean ret_conv = CResult_COption_TypeZDecodeErrorZ_is_ok(o_conv);
32399         return ret_conv;
32400 }
32401
32402 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1TypeZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
32403         if (!ptr_is_owned(_res)) return;
32404         void* _res_ptr = untag_ptr(_res);
32405         CHECK_ACCESS(_res_ptr);
32406         LDKCResult_COption_TypeZDecodeErrorZ _res_conv = *(LDKCResult_COption_TypeZDecodeErrorZ*)(_res_ptr);
32407         FREE(untag_ptr(_res));
32408         CResult_COption_TypeZDecodeErrorZ_free(_res_conv);
32409 }
32410
32411 static inline uint64_t CResult_COption_TypeZDecodeErrorZ_clone_ptr(LDKCResult_COption_TypeZDecodeErrorZ *NONNULL_PTR arg) {
32412         LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
32413         *ret_conv = CResult_COption_TypeZDecodeErrorZ_clone(arg);
32414         return tag_ptr(ret_conv, true);
32415 }
32416 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1TypeZDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32417         LDKCResult_COption_TypeZDecodeErrorZ* arg_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)untag_ptr(arg);
32418         int64_t ret_conv = CResult_COption_TypeZDecodeErrorZ_clone_ptr(arg_conv);
32419         return ret_conv;
32420 }
32421
32422 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1TypeZDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32423         LDKCResult_COption_TypeZDecodeErrorZ* orig_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)untag_ptr(orig);
32424         LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
32425         *ret_conv = CResult_COption_TypeZDecodeErrorZ_clone(orig_conv);
32426         return tag_ptr(ret_conv, true);
32427 }
32428
32429 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1SocketAddressZ_1some(JNIEnv *env, jclass clz, int64_t o) {
32430         void* o_ptr = untag_ptr(o);
32431         CHECK_ACCESS(o_ptr);
32432         LDKSocketAddress o_conv = *(LDKSocketAddress*)(o_ptr);
32433         o_conv = SocketAddress_clone((LDKSocketAddress*)untag_ptr(o));
32434         LDKCOption_SocketAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_SocketAddressZ), "LDKCOption_SocketAddressZ");
32435         *ret_copy = COption_SocketAddressZ_some(o_conv);
32436         int64_t ret_ref = tag_ptr(ret_copy, true);
32437         return ret_ref;
32438 }
32439
32440 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1SocketAddressZ_1none(JNIEnv *env, jclass clz) {
32441         LDKCOption_SocketAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_SocketAddressZ), "LDKCOption_SocketAddressZ");
32442         *ret_copy = COption_SocketAddressZ_none();
32443         int64_t ret_ref = tag_ptr(ret_copy, true);
32444         return ret_ref;
32445 }
32446
32447 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1SocketAddressZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
32448         if (!ptr_is_owned(_res)) return;
32449         void* _res_ptr = untag_ptr(_res);
32450         CHECK_ACCESS(_res_ptr);
32451         LDKCOption_SocketAddressZ _res_conv = *(LDKCOption_SocketAddressZ*)(_res_ptr);
32452         FREE(untag_ptr(_res));
32453         COption_SocketAddressZ_free(_res_conv);
32454 }
32455
32456 static inline uint64_t COption_SocketAddressZ_clone_ptr(LDKCOption_SocketAddressZ *NONNULL_PTR arg) {
32457         LDKCOption_SocketAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_SocketAddressZ), "LDKCOption_SocketAddressZ");
32458         *ret_copy = COption_SocketAddressZ_clone(arg);
32459         int64_t ret_ref = tag_ptr(ret_copy, true);
32460         return ret_ref;
32461 }
32462 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1SocketAddressZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32463         LDKCOption_SocketAddressZ* arg_conv = (LDKCOption_SocketAddressZ*)untag_ptr(arg);
32464         int64_t ret_conv = COption_SocketAddressZ_clone_ptr(arg_conv);
32465         return ret_conv;
32466 }
32467
32468 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1SocketAddressZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32469         LDKCOption_SocketAddressZ* orig_conv = (LDKCOption_SocketAddressZ*)untag_ptr(orig);
32470         LDKCOption_SocketAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_SocketAddressZ), "LDKCOption_SocketAddressZ");
32471         *ret_copy = COption_SocketAddressZ_clone(orig_conv);
32472         int64_t ret_ref = tag_ptr(ret_copy, true);
32473         return ret_ref;
32474 }
32475
32476 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1PeerDetailsZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
32477         LDKCVec_PeerDetailsZ _res_constr;
32478         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
32479         if (_res_constr.datalen > 0)
32480                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPeerDetails), "LDKCVec_PeerDetailsZ Elements");
32481         else
32482                 _res_constr.data = NULL;
32483         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
32484         for (size_t n = 0; n < _res_constr.datalen; n++) {
32485                 int64_t _res_conv_13 = _res_vals[n];
32486                 LDKPeerDetails _res_conv_13_conv;
32487                 _res_conv_13_conv.inner = untag_ptr(_res_conv_13);
32488                 _res_conv_13_conv.is_owned = ptr_is_owned(_res_conv_13);
32489                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_13_conv);
32490                 _res_constr.data[n] = _res_conv_13_conv;
32491         }
32492         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
32493         CVec_PeerDetailsZ_free(_res_constr);
32494 }
32495
32496 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
32497         LDKCVec_u8Z o_ref;
32498         o_ref.datalen = (*env)->GetArrayLength(env, o);
32499         o_ref.data = MALLOC(o_ref.datalen, "LDKCVec_u8Z Bytes");
32500         (*env)->GetByteArrayRegion(env, o, 0, o_ref.datalen, o_ref.data);
32501         LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
32502         *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_ok(o_ref);
32503         return tag_ptr(ret_conv, true);
32504 }
32505
32506 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
32507         LDKPeerHandleError e_conv;
32508         e_conv.inner = untag_ptr(e);
32509         e_conv.is_owned = ptr_is_owned(e);
32510         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
32511         e_conv = PeerHandleError_clone(&e_conv);
32512         LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
32513         *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_err(e_conv);
32514         return tag_ptr(ret_conv, true);
32515 }
32516
32517 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
32518         LDKCResult_CVec_u8ZPeerHandleErrorZ* o_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)untag_ptr(o);
32519         jboolean ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_is_ok(o_conv);
32520         return ret_conv;
32521 }
32522
32523 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
32524         if (!ptr_is_owned(_res)) return;
32525         void* _res_ptr = untag_ptr(_res);
32526         CHECK_ACCESS(_res_ptr);
32527         LDKCResult_CVec_u8ZPeerHandleErrorZ _res_conv = *(LDKCResult_CVec_u8ZPeerHandleErrorZ*)(_res_ptr);
32528         FREE(untag_ptr(_res));
32529         CResult_CVec_u8ZPeerHandleErrorZ_free(_res_conv);
32530 }
32531
32532 static inline uint64_t CResult_CVec_u8ZPeerHandleErrorZ_clone_ptr(LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR arg) {
32533         LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
32534         *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_clone(arg);
32535         return tag_ptr(ret_conv, true);
32536 }
32537 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32538         LDKCResult_CVec_u8ZPeerHandleErrorZ* arg_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)untag_ptr(arg);
32539         int64_t ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_clone_ptr(arg_conv);
32540         return ret_conv;
32541 }
32542
32543 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32544         LDKCResult_CVec_u8ZPeerHandleErrorZ* orig_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)untag_ptr(orig);
32545         LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
32546         *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_clone(orig_conv);
32547         return tag_ptr(ret_conv, true);
32548 }
32549
32550 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1ok(JNIEnv *env, jclass clz) {
32551         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
32552         *ret_conv = CResult_NonePeerHandleErrorZ_ok();
32553         return tag_ptr(ret_conv, true);
32554 }
32555
32556 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
32557         LDKPeerHandleError e_conv;
32558         e_conv.inner = untag_ptr(e);
32559         e_conv.is_owned = ptr_is_owned(e);
32560         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
32561         e_conv = PeerHandleError_clone(&e_conv);
32562         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
32563         *ret_conv = CResult_NonePeerHandleErrorZ_err(e_conv);
32564         return tag_ptr(ret_conv, true);
32565 }
32566
32567 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
32568         LDKCResult_NonePeerHandleErrorZ* o_conv = (LDKCResult_NonePeerHandleErrorZ*)untag_ptr(o);
32569         jboolean ret_conv = CResult_NonePeerHandleErrorZ_is_ok(o_conv);
32570         return ret_conv;
32571 }
32572
32573 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
32574         if (!ptr_is_owned(_res)) return;
32575         void* _res_ptr = untag_ptr(_res);
32576         CHECK_ACCESS(_res_ptr);
32577         LDKCResult_NonePeerHandleErrorZ _res_conv = *(LDKCResult_NonePeerHandleErrorZ*)(_res_ptr);
32578         FREE(untag_ptr(_res));
32579         CResult_NonePeerHandleErrorZ_free(_res_conv);
32580 }
32581
32582 static inline uint64_t CResult_NonePeerHandleErrorZ_clone_ptr(LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR arg) {
32583         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
32584         *ret_conv = CResult_NonePeerHandleErrorZ_clone(arg);
32585         return tag_ptr(ret_conv, true);
32586 }
32587 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32588         LDKCResult_NonePeerHandleErrorZ* arg_conv = (LDKCResult_NonePeerHandleErrorZ*)untag_ptr(arg);
32589         int64_t ret_conv = CResult_NonePeerHandleErrorZ_clone_ptr(arg_conv);
32590         return ret_conv;
32591 }
32592
32593 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32594         LDKCResult_NonePeerHandleErrorZ* orig_conv = (LDKCResult_NonePeerHandleErrorZ*)untag_ptr(orig);
32595         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
32596         *ret_conv = CResult_NonePeerHandleErrorZ_clone(orig_conv);
32597         return tag_ptr(ret_conv, true);
32598 }
32599
32600 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1ok(JNIEnv *env, jclass clz, jboolean o) {
32601         LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
32602         *ret_conv = CResult_boolPeerHandleErrorZ_ok(o);
32603         return tag_ptr(ret_conv, true);
32604 }
32605
32606 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
32607         LDKPeerHandleError e_conv;
32608         e_conv.inner = untag_ptr(e);
32609         e_conv.is_owned = ptr_is_owned(e);
32610         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
32611         e_conv = PeerHandleError_clone(&e_conv);
32612         LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
32613         *ret_conv = CResult_boolPeerHandleErrorZ_err(e_conv);
32614         return tag_ptr(ret_conv, true);
32615 }
32616
32617 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
32618         LDKCResult_boolPeerHandleErrorZ* o_conv = (LDKCResult_boolPeerHandleErrorZ*)untag_ptr(o);
32619         jboolean ret_conv = CResult_boolPeerHandleErrorZ_is_ok(o_conv);
32620         return ret_conv;
32621 }
32622
32623 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
32624         if (!ptr_is_owned(_res)) return;
32625         void* _res_ptr = untag_ptr(_res);
32626         CHECK_ACCESS(_res_ptr);
32627         LDKCResult_boolPeerHandleErrorZ _res_conv = *(LDKCResult_boolPeerHandleErrorZ*)(_res_ptr);
32628         FREE(untag_ptr(_res));
32629         CResult_boolPeerHandleErrorZ_free(_res_conv);
32630 }
32631
32632 static inline uint64_t CResult_boolPeerHandleErrorZ_clone_ptr(LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR arg) {
32633         LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
32634         *ret_conv = CResult_boolPeerHandleErrorZ_clone(arg);
32635         return tag_ptr(ret_conv, true);
32636 }
32637 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32638         LDKCResult_boolPeerHandleErrorZ* arg_conv = (LDKCResult_boolPeerHandleErrorZ*)untag_ptr(arg);
32639         int64_t ret_conv = CResult_boolPeerHandleErrorZ_clone_ptr(arg_conv);
32640         return ret_conv;
32641 }
32642
32643 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32644         LDKCResult_boolPeerHandleErrorZ* orig_conv = (LDKCResult_boolPeerHandleErrorZ*)untag_ptr(orig);
32645         LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
32646         *ret_conv = CResult_boolPeerHandleErrorZ_clone(orig_conv);
32647         return tag_ptr(ret_conv, true);
32648 }
32649
32650 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1u32GraphSyncErrorZ_1ok(JNIEnv *env, jclass clz, int32_t o) {
32651         LDKCResult_u32GraphSyncErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_u32GraphSyncErrorZ), "LDKCResult_u32GraphSyncErrorZ");
32652         *ret_conv = CResult_u32GraphSyncErrorZ_ok(o);
32653         return tag_ptr(ret_conv, true);
32654 }
32655
32656 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1u32GraphSyncErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
32657         void* e_ptr = untag_ptr(e);
32658         CHECK_ACCESS(e_ptr);
32659         LDKGraphSyncError e_conv = *(LDKGraphSyncError*)(e_ptr);
32660         e_conv = GraphSyncError_clone((LDKGraphSyncError*)untag_ptr(e));
32661         LDKCResult_u32GraphSyncErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_u32GraphSyncErrorZ), "LDKCResult_u32GraphSyncErrorZ");
32662         *ret_conv = CResult_u32GraphSyncErrorZ_err(e_conv);
32663         return tag_ptr(ret_conv, true);
32664 }
32665
32666 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1u32GraphSyncErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
32667         LDKCResult_u32GraphSyncErrorZ* o_conv = (LDKCResult_u32GraphSyncErrorZ*)untag_ptr(o);
32668         jboolean ret_conv = CResult_u32GraphSyncErrorZ_is_ok(o_conv);
32669         return ret_conv;
32670 }
32671
32672 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1u32GraphSyncErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
32673         if (!ptr_is_owned(_res)) return;
32674         void* _res_ptr = untag_ptr(_res);
32675         CHECK_ACCESS(_res_ptr);
32676         LDKCResult_u32GraphSyncErrorZ _res_conv = *(LDKCResult_u32GraphSyncErrorZ*)(_res_ptr);
32677         FREE(untag_ptr(_res));
32678         CResult_u32GraphSyncErrorZ_free(_res_conv);
32679 }
32680
32681 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZIOErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
32682         LDKCVec_u8Z o_ref;
32683         o_ref.datalen = (*env)->GetArrayLength(env, o);
32684         o_ref.data = MALLOC(o_ref.datalen, "LDKCVec_u8Z Bytes");
32685         (*env)->GetByteArrayRegion(env, o, 0, o_ref.datalen, o_ref.data);
32686         LDKCResult_CVec_u8ZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZIOErrorZ), "LDKCResult_CVec_u8ZIOErrorZ");
32687         *ret_conv = CResult_CVec_u8ZIOErrorZ_ok(o_ref);
32688         return tag_ptr(ret_conv, true);
32689 }
32690
32691 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZIOErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
32692         LDKIOError e_conv = LDKIOError_from_java(env, e);
32693         LDKCResult_CVec_u8ZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZIOErrorZ), "LDKCResult_CVec_u8ZIOErrorZ");
32694         *ret_conv = CResult_CVec_u8ZIOErrorZ_err(e_conv);
32695         return tag_ptr(ret_conv, true);
32696 }
32697
32698 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZIOErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
32699         LDKCResult_CVec_u8ZIOErrorZ* o_conv = (LDKCResult_CVec_u8ZIOErrorZ*)untag_ptr(o);
32700         jboolean ret_conv = CResult_CVec_u8ZIOErrorZ_is_ok(o_conv);
32701         return ret_conv;
32702 }
32703
32704 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZIOErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
32705         if (!ptr_is_owned(_res)) return;
32706         void* _res_ptr = untag_ptr(_res);
32707         CHECK_ACCESS(_res_ptr);
32708         LDKCResult_CVec_u8ZIOErrorZ _res_conv = *(LDKCResult_CVec_u8ZIOErrorZ*)(_res_ptr);
32709         FREE(untag_ptr(_res));
32710         CResult_CVec_u8ZIOErrorZ_free(_res_conv);
32711 }
32712
32713 static inline uint64_t CResult_CVec_u8ZIOErrorZ_clone_ptr(LDKCResult_CVec_u8ZIOErrorZ *NONNULL_PTR arg) {
32714         LDKCResult_CVec_u8ZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZIOErrorZ), "LDKCResult_CVec_u8ZIOErrorZ");
32715         *ret_conv = CResult_CVec_u8ZIOErrorZ_clone(arg);
32716         return tag_ptr(ret_conv, true);
32717 }
32718 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZIOErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32719         LDKCResult_CVec_u8ZIOErrorZ* arg_conv = (LDKCResult_CVec_u8ZIOErrorZ*)untag_ptr(arg);
32720         int64_t ret_conv = CResult_CVec_u8ZIOErrorZ_clone_ptr(arg_conv);
32721         return ret_conv;
32722 }
32723
32724 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZIOErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32725         LDKCResult_CVec_u8ZIOErrorZ* orig_conv = (LDKCResult_CVec_u8ZIOErrorZ*)untag_ptr(orig);
32726         LDKCResult_CVec_u8ZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZIOErrorZ), "LDKCResult_CVec_u8ZIOErrorZ");
32727         *ret_conv = CResult_CVec_u8ZIOErrorZ_clone(orig_conv);
32728         return tag_ptr(ret_conv, true);
32729 }
32730
32731 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1StrZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
32732         LDKCVec_StrZ _res_constr;
32733         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
32734         if (_res_constr.datalen > 0)
32735                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKStr), "LDKCVec_StrZ Elements");
32736         else
32737                 _res_constr.data = NULL;
32738         for (size_t i = 0; i < _res_constr.datalen; i++) {
32739                 jstring _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
32740                 LDKStr dummy = { .chars = NULL, .len = 0, .chars_is_owned = false };
32741                 _res_constr.data[i] = dummy;
32742         }
32743         CVec_StrZ_free(_res_constr);
32744 }
32745
32746 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1StrZIOErrorZ_1ok(JNIEnv *env, jclass clz, jobjectArray o) {
32747         LDKCVec_StrZ o_constr;
32748         o_constr.datalen = (*env)->GetArrayLength(env, o);
32749         if (o_constr.datalen > 0)
32750                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKStr), "LDKCVec_StrZ Elements");
32751         else
32752                 o_constr.data = NULL;
32753         for (size_t i = 0; i < o_constr.datalen; i++) {
32754                 jstring o_conv_8 = (*env)->GetObjectArrayElement(env, o, i);
32755                 LDKStr o_conv_8_conv = java_to_owned_str(env, o_conv_8);
32756                 o_constr.data[i] = o_conv_8_conv;
32757         }
32758         LDKCResult_CVec_StrZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_StrZIOErrorZ), "LDKCResult_CVec_StrZIOErrorZ");
32759         *ret_conv = CResult_CVec_StrZIOErrorZ_ok(o_constr);
32760         return tag_ptr(ret_conv, true);
32761 }
32762
32763 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1StrZIOErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
32764         LDKIOError e_conv = LDKIOError_from_java(env, e);
32765         LDKCResult_CVec_StrZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_StrZIOErrorZ), "LDKCResult_CVec_StrZIOErrorZ");
32766         *ret_conv = CResult_CVec_StrZIOErrorZ_err(e_conv);
32767         return tag_ptr(ret_conv, true);
32768 }
32769
32770 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1StrZIOErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
32771         LDKCResult_CVec_StrZIOErrorZ* o_conv = (LDKCResult_CVec_StrZIOErrorZ*)untag_ptr(o);
32772         jboolean ret_conv = CResult_CVec_StrZIOErrorZ_is_ok(o_conv);
32773         return ret_conv;
32774 }
32775
32776 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1StrZIOErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
32777         if (!ptr_is_owned(_res)) return;
32778         void* _res_ptr = untag_ptr(_res);
32779         CHECK_ACCESS(_res_ptr);
32780         LDKCResult_CVec_StrZIOErrorZ _res_conv = *(LDKCResult_CVec_StrZIOErrorZ*)(_res_ptr);
32781         FREE(untag_ptr(_res));
32782         CResult_CVec_StrZIOErrorZ_free(_res_conv);
32783 }
32784
32785 static inline uint64_t CResult_CVec_StrZIOErrorZ_clone_ptr(LDKCResult_CVec_StrZIOErrorZ *NONNULL_PTR arg) {
32786         LDKCResult_CVec_StrZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_StrZIOErrorZ), "LDKCResult_CVec_StrZIOErrorZ");
32787         *ret_conv = CResult_CVec_StrZIOErrorZ_clone(arg);
32788         return tag_ptr(ret_conv, true);
32789 }
32790 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1StrZIOErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32791         LDKCResult_CVec_StrZIOErrorZ* arg_conv = (LDKCResult_CVec_StrZIOErrorZ*)untag_ptr(arg);
32792         int64_t ret_conv = CResult_CVec_StrZIOErrorZ_clone_ptr(arg_conv);
32793         return ret_conv;
32794 }
32795
32796 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1StrZIOErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32797         LDKCResult_CVec_StrZIOErrorZ* orig_conv = (LDKCResult_CVec_StrZIOErrorZ*)untag_ptr(orig);
32798         LDKCResult_CVec_StrZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_StrZIOErrorZ), "LDKCResult_CVec_StrZIOErrorZ");
32799         *ret_conv = CResult_CVec_StrZIOErrorZ_clone(orig_conv);
32800         return tag_ptr(ret_conv, true);
32801 }
32802
32803 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1ThirtyTwoBytesChannelMonitorZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
32804         LDKCVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ _res_constr;
32805         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
32806         if (_res_constr.datalen > 0)
32807                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ), "LDKCVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ Elements");
32808         else
32809                 _res_constr.data = NULL;
32810         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
32811         for (size_t o = 0; o < _res_constr.datalen; o++) {
32812                 int64_t _res_conv_40 = _res_vals[o];
32813                 void* _res_conv_40_ptr = untag_ptr(_res_conv_40);
32814                 CHECK_ACCESS(_res_conv_40_ptr);
32815                 LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ _res_conv_40_conv = *(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)(_res_conv_40_ptr);
32816                 FREE(untag_ptr(_res_conv_40));
32817                 _res_constr.data[o] = _res_conv_40_conv;
32818         }
32819         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
32820         CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ_free(_res_constr);
32821 }
32822
32823 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1ThirtyTwoBytesChannelMonitorZZIOErrorZ_1ok(JNIEnv *env, jclass clz, int64_tArray o) {
32824         LDKCVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ o_constr;
32825         o_constr.datalen = (*env)->GetArrayLength(env, o);
32826         if (o_constr.datalen > 0)
32827                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ), "LDKCVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ Elements");
32828         else
32829                 o_constr.data = NULL;
32830         int64_t* o_vals = (*env)->GetLongArrayElements (env, o, NULL);
32831         for (size_t o = 0; o < o_constr.datalen; o++) {
32832                 int64_t o_conv_40 = o_vals[o];
32833                 void* o_conv_40_ptr = untag_ptr(o_conv_40);
32834                 CHECK_ACCESS(o_conv_40_ptr);
32835                 LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ o_conv_40_conv = *(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)(o_conv_40_ptr);
32836                 o_conv_40_conv = C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone((LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)untag_ptr(o_conv_40));
32837                 o_constr.data[o] = o_conv_40_conv;
32838         }
32839         (*env)->ReleaseLongArrayElements(env, o, o_vals, 0);
32840         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ");
32841         *ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_ok(o_constr);
32842         return tag_ptr(ret_conv, true);
32843 }
32844
32845 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1ThirtyTwoBytesChannelMonitorZZIOErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
32846         LDKIOError e_conv = LDKIOError_from_java(env, e);
32847         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ");
32848         *ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_err(e_conv);
32849         return tag_ptr(ret_conv, true);
32850 }
32851
32852 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1ThirtyTwoBytesChannelMonitorZZIOErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
32853         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ* o_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ*)untag_ptr(o);
32854         jboolean ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_is_ok(o_conv);
32855         return ret_conv;
32856 }
32857
32858 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1ThirtyTwoBytesChannelMonitorZZIOErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
32859         if (!ptr_is_owned(_res)) return;
32860         void* _res_ptr = untag_ptr(_res);
32861         CHECK_ACCESS(_res_ptr);
32862         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ _res_conv = *(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ*)(_res_ptr);
32863         FREE(untag_ptr(_res));
32864         CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_free(_res_conv);
32865 }
32866
32867 static inline uint64_t CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_clone_ptr(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ *NONNULL_PTR arg) {
32868         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ");
32869         *ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_clone(arg);
32870         return tag_ptr(ret_conv, true);
32871 }
32872 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1ThirtyTwoBytesChannelMonitorZZIOErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32873         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ* arg_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ*)untag_ptr(arg);
32874         int64_t ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_clone_ptr(arg_conv);
32875         return ret_conv;
32876 }
32877
32878 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1ThirtyTwoBytesChannelMonitorZZIOErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32879         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ* orig_conv = (LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ*)untag_ptr(orig);
32880         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ");
32881         *ret_conv = CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_clone(orig_conv);
32882         return tag_ptr(ret_conv, true);
32883 }
32884
32885 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesChannelMonitorZIOErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
32886         void* o_ptr = untag_ptr(o);
32887         CHECK_ACCESS(o_ptr);
32888         LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ o_conv = *(LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)(o_ptr);
32889         o_conv = C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone((LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ*)untag_ptr(o));
32890         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ");
32891         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_ok(o_conv);
32892         return tag_ptr(ret_conv, true);
32893 }
32894
32895 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesChannelMonitorZIOErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
32896         LDKIOError e_conv = LDKIOError_from_java(env, e);
32897         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ");
32898         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_err(e_conv);
32899         return tag_ptr(ret_conv, true);
32900 }
32901
32902 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesChannelMonitorZIOErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
32903         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ* o_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ*)untag_ptr(o);
32904         jboolean ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_is_ok(o_conv);
32905         return ret_conv;
32906 }
32907
32908 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesChannelMonitorZIOErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
32909         if (!ptr_is_owned(_res)) return;
32910         void* _res_ptr = untag_ptr(_res);
32911         CHECK_ACCESS(_res_ptr);
32912         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ _res_conv = *(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ*)(_res_ptr);
32913         FREE(untag_ptr(_res));
32914         CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_free(_res_conv);
32915 }
32916
32917 static inline uint64_t CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_clone_ptr(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ *NONNULL_PTR arg) {
32918         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ");
32919         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_clone(arg);
32920         return tag_ptr(ret_conv, true);
32921 }
32922 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesChannelMonitorZIOErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32923         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ* arg_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ*)untag_ptr(arg);
32924         int64_t ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_clone_ptr(arg_conv);
32925         return ret_conv;
32926 }
32927
32928 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesChannelMonitorZIOErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32929         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ* orig_conv = (LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ*)untag_ptr(orig);
32930         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ");
32931         *ret_conv = CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_clone(orig_conv);
32932         return tag_ptr(ret_conv, true);
32933 }
32934
32935 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedInvoiceRequestBolt12SemanticErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
32936         LDKUnsignedInvoiceRequest o_conv;
32937         o_conv.inner = untag_ptr(o);
32938         o_conv.is_owned = ptr_is_owned(o);
32939         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
32940         o_conv = UnsignedInvoiceRequest_clone(&o_conv);
32941         LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ), "LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ");
32942         *ret_conv = CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ_ok(o_conv);
32943         return tag_ptr(ret_conv, true);
32944 }
32945
32946 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedInvoiceRequestBolt12SemanticErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
32947         LDKBolt12SemanticError e_conv = LDKBolt12SemanticError_from_java(env, e);
32948         LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ), "LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ");
32949         *ret_conv = CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ_err(e_conv);
32950         return tag_ptr(ret_conv, true);
32951 }
32952
32953 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedInvoiceRequestBolt12SemanticErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
32954         LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ* o_conv = (LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ*)untag_ptr(o);
32955         jboolean ret_conv = CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ_is_ok(o_conv);
32956         return ret_conv;
32957 }
32958
32959 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedInvoiceRequestBolt12SemanticErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
32960         if (!ptr_is_owned(_res)) return;
32961         void* _res_ptr = untag_ptr(_res);
32962         CHECK_ACCESS(_res_ptr);
32963         LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ _res_conv = *(LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ*)(_res_ptr);
32964         FREE(untag_ptr(_res));
32965         CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ_free(_res_conv);
32966 }
32967
32968 static inline uint64_t CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ_clone_ptr(LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ *NONNULL_PTR arg) {
32969         LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ), "LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ");
32970         *ret_conv = CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ_clone(arg);
32971         return tag_ptr(ret_conv, true);
32972 }
32973 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedInvoiceRequestBolt12SemanticErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
32974         LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ* arg_conv = (LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ*)untag_ptr(arg);
32975         int64_t ret_conv = CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ_clone_ptr(arg_conv);
32976         return ret_conv;
32977 }
32978
32979 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedInvoiceRequestBolt12SemanticErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
32980         LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ* orig_conv = (LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ*)untag_ptr(orig);
32981         LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ), "LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ");
32982         *ret_conv = CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ_clone(orig_conv);
32983         return tag_ptr(ret_conv, true);
32984 }
32985
32986 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceRequestBolt12SemanticErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
32987         LDKInvoiceRequest o_conv;
32988         o_conv.inner = untag_ptr(o);
32989         o_conv.is_owned = ptr_is_owned(o);
32990         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
32991         o_conv = InvoiceRequest_clone(&o_conv);
32992         LDKCResult_InvoiceRequestBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceRequestBolt12SemanticErrorZ), "LDKCResult_InvoiceRequestBolt12SemanticErrorZ");
32993         *ret_conv = CResult_InvoiceRequestBolt12SemanticErrorZ_ok(o_conv);
32994         return tag_ptr(ret_conv, true);
32995 }
32996
32997 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceRequestBolt12SemanticErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
32998         LDKBolt12SemanticError e_conv = LDKBolt12SemanticError_from_java(env, e);
32999         LDKCResult_InvoiceRequestBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceRequestBolt12SemanticErrorZ), "LDKCResult_InvoiceRequestBolt12SemanticErrorZ");
33000         *ret_conv = CResult_InvoiceRequestBolt12SemanticErrorZ_err(e_conv);
33001         return tag_ptr(ret_conv, true);
33002 }
33003
33004 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceRequestBolt12SemanticErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
33005         LDKCResult_InvoiceRequestBolt12SemanticErrorZ* o_conv = (LDKCResult_InvoiceRequestBolt12SemanticErrorZ*)untag_ptr(o);
33006         jboolean ret_conv = CResult_InvoiceRequestBolt12SemanticErrorZ_is_ok(o_conv);
33007         return ret_conv;
33008 }
33009
33010 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceRequestBolt12SemanticErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
33011         if (!ptr_is_owned(_res)) return;
33012         void* _res_ptr = untag_ptr(_res);
33013         CHECK_ACCESS(_res_ptr);
33014         LDKCResult_InvoiceRequestBolt12SemanticErrorZ _res_conv = *(LDKCResult_InvoiceRequestBolt12SemanticErrorZ*)(_res_ptr);
33015         FREE(untag_ptr(_res));
33016         CResult_InvoiceRequestBolt12SemanticErrorZ_free(_res_conv);
33017 }
33018
33019 static inline uint64_t CResult_InvoiceRequestBolt12SemanticErrorZ_clone_ptr(LDKCResult_InvoiceRequestBolt12SemanticErrorZ *NONNULL_PTR arg) {
33020         LDKCResult_InvoiceRequestBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceRequestBolt12SemanticErrorZ), "LDKCResult_InvoiceRequestBolt12SemanticErrorZ");
33021         *ret_conv = CResult_InvoiceRequestBolt12SemanticErrorZ_clone(arg);
33022         return tag_ptr(ret_conv, true);
33023 }
33024 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceRequestBolt12SemanticErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33025         LDKCResult_InvoiceRequestBolt12SemanticErrorZ* arg_conv = (LDKCResult_InvoiceRequestBolt12SemanticErrorZ*)untag_ptr(arg);
33026         int64_t ret_conv = CResult_InvoiceRequestBolt12SemanticErrorZ_clone_ptr(arg_conv);
33027         return ret_conv;
33028 }
33029
33030 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceRequestBolt12SemanticErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33031         LDKCResult_InvoiceRequestBolt12SemanticErrorZ* orig_conv = (LDKCResult_InvoiceRequestBolt12SemanticErrorZ*)untag_ptr(orig);
33032         LDKCResult_InvoiceRequestBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceRequestBolt12SemanticErrorZ), "LDKCResult_InvoiceRequestBolt12SemanticErrorZ");
33033         *ret_conv = CResult_InvoiceRequestBolt12SemanticErrorZ_clone(orig_conv);
33034         return tag_ptr(ret_conv, true);
33035 }
33036
33037 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1SecretKeyZ_1some(JNIEnv *env, jclass clz, int8_tArray o) {
33038         LDKSecretKey o_ref;
33039         CHECK((*env)->GetArrayLength(env, o) == 32);
33040         (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.bytes);
33041         LDKCOption_SecretKeyZ *ret_copy = MALLOC(sizeof(LDKCOption_SecretKeyZ), "LDKCOption_SecretKeyZ");
33042         *ret_copy = COption_SecretKeyZ_some(o_ref);
33043         int64_t ret_ref = tag_ptr(ret_copy, true);
33044         return ret_ref;
33045 }
33046
33047 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1SecretKeyZ_1none(JNIEnv *env, jclass clz) {
33048         LDKCOption_SecretKeyZ *ret_copy = MALLOC(sizeof(LDKCOption_SecretKeyZ), "LDKCOption_SecretKeyZ");
33049         *ret_copy = COption_SecretKeyZ_none();
33050         int64_t ret_ref = tag_ptr(ret_copy, true);
33051         return ret_ref;
33052 }
33053
33054 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1SecretKeyZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
33055         if (!ptr_is_owned(_res)) return;
33056         void* _res_ptr = untag_ptr(_res);
33057         CHECK_ACCESS(_res_ptr);
33058         LDKCOption_SecretKeyZ _res_conv = *(LDKCOption_SecretKeyZ*)(_res_ptr);
33059         FREE(untag_ptr(_res));
33060         COption_SecretKeyZ_free(_res_conv);
33061 }
33062
33063 static inline uint64_t COption_SecretKeyZ_clone_ptr(LDKCOption_SecretKeyZ *NONNULL_PTR arg) {
33064         LDKCOption_SecretKeyZ *ret_copy = MALLOC(sizeof(LDKCOption_SecretKeyZ), "LDKCOption_SecretKeyZ");
33065         *ret_copy = COption_SecretKeyZ_clone(arg);
33066         int64_t ret_ref = tag_ptr(ret_copy, true);
33067         return ret_ref;
33068 }
33069 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1SecretKeyZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33070         LDKCOption_SecretKeyZ* arg_conv = (LDKCOption_SecretKeyZ*)untag_ptr(arg);
33071         int64_t ret_conv = COption_SecretKeyZ_clone_ptr(arg_conv);
33072         return ret_conv;
33073 }
33074
33075 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1SecretKeyZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33076         LDKCOption_SecretKeyZ* orig_conv = (LDKCOption_SecretKeyZ*)untag_ptr(orig);
33077         LDKCOption_SecretKeyZ *ret_copy = MALLOC(sizeof(LDKCOption_SecretKeyZ), "LDKCOption_SecretKeyZ");
33078         *ret_copy = COption_SecretKeyZ_clone(orig_conv);
33079         int64_t ret_ref = tag_ptr(ret_copy, true);
33080         return ret_ref;
33081 }
33082
33083 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
33084         LDKInvoiceWithExplicitSigningPubkeyBuilder o_conv;
33085         o_conv.inner = untag_ptr(o);
33086         o_conv.is_owned = ptr_is_owned(o);
33087         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
33088         // WARNING: we need a move here but no clone is available for LDKInvoiceWithExplicitSigningPubkeyBuilder
33089         
33090         LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ), "LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ");
33091         *ret_conv = CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ_ok(o_conv);
33092         return tag_ptr(ret_conv, true);
33093 }
33094
33095 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
33096         LDKBolt12SemanticError e_conv = LDKBolt12SemanticError_from_java(env, e);
33097         LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ), "LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ");
33098         *ret_conv = CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ_err(e_conv);
33099         return tag_ptr(ret_conv, true);
33100 }
33101
33102 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
33103         LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ* o_conv = (LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ*)untag_ptr(o);
33104         jboolean ret_conv = CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ_is_ok(o_conv);
33105         return ret_conv;
33106 }
33107
33108 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
33109         if (!ptr_is_owned(_res)) return;
33110         void* _res_ptr = untag_ptr(_res);
33111         CHECK_ACCESS(_res_ptr);
33112         LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ _res_conv = *(LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ*)(_res_ptr);
33113         FREE(untag_ptr(_res));
33114         CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ_free(_res_conv);
33115 }
33116
33117 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1VerifiedInvoiceRequestNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
33118         LDKVerifiedInvoiceRequest o_conv;
33119         o_conv.inner = untag_ptr(o);
33120         o_conv.is_owned = ptr_is_owned(o);
33121         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
33122         o_conv = VerifiedInvoiceRequest_clone(&o_conv);
33123         LDKCResult_VerifiedInvoiceRequestNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_VerifiedInvoiceRequestNoneZ), "LDKCResult_VerifiedInvoiceRequestNoneZ");
33124         *ret_conv = CResult_VerifiedInvoiceRequestNoneZ_ok(o_conv);
33125         return tag_ptr(ret_conv, true);
33126 }
33127
33128 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1VerifiedInvoiceRequestNoneZ_1err(JNIEnv *env, jclass clz) {
33129         LDKCResult_VerifiedInvoiceRequestNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_VerifiedInvoiceRequestNoneZ), "LDKCResult_VerifiedInvoiceRequestNoneZ");
33130         *ret_conv = CResult_VerifiedInvoiceRequestNoneZ_err();
33131         return tag_ptr(ret_conv, true);
33132 }
33133
33134 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1VerifiedInvoiceRequestNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
33135         LDKCResult_VerifiedInvoiceRequestNoneZ* o_conv = (LDKCResult_VerifiedInvoiceRequestNoneZ*)untag_ptr(o);
33136         jboolean ret_conv = CResult_VerifiedInvoiceRequestNoneZ_is_ok(o_conv);
33137         return ret_conv;
33138 }
33139
33140 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1VerifiedInvoiceRequestNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
33141         if (!ptr_is_owned(_res)) return;
33142         void* _res_ptr = untag_ptr(_res);
33143         CHECK_ACCESS(_res_ptr);
33144         LDKCResult_VerifiedInvoiceRequestNoneZ _res_conv = *(LDKCResult_VerifiedInvoiceRequestNoneZ*)(_res_ptr);
33145         FREE(untag_ptr(_res));
33146         CResult_VerifiedInvoiceRequestNoneZ_free(_res_conv);
33147 }
33148
33149 static inline uint64_t CResult_VerifiedInvoiceRequestNoneZ_clone_ptr(LDKCResult_VerifiedInvoiceRequestNoneZ *NONNULL_PTR arg) {
33150         LDKCResult_VerifiedInvoiceRequestNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_VerifiedInvoiceRequestNoneZ), "LDKCResult_VerifiedInvoiceRequestNoneZ");
33151         *ret_conv = CResult_VerifiedInvoiceRequestNoneZ_clone(arg);
33152         return tag_ptr(ret_conv, true);
33153 }
33154 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1VerifiedInvoiceRequestNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33155         LDKCResult_VerifiedInvoiceRequestNoneZ* arg_conv = (LDKCResult_VerifiedInvoiceRequestNoneZ*)untag_ptr(arg);
33156         int64_t ret_conv = CResult_VerifiedInvoiceRequestNoneZ_clone_ptr(arg_conv);
33157         return ret_conv;
33158 }
33159
33160 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1VerifiedInvoiceRequestNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33161         LDKCResult_VerifiedInvoiceRequestNoneZ* orig_conv = (LDKCResult_VerifiedInvoiceRequestNoneZ*)untag_ptr(orig);
33162         LDKCResult_VerifiedInvoiceRequestNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_VerifiedInvoiceRequestNoneZ), "LDKCResult_VerifiedInvoiceRequestNoneZ");
33163         *ret_conv = CResult_VerifiedInvoiceRequestNoneZ_clone(orig_conv);
33164         return tag_ptr(ret_conv, true);
33165 }
33166
33167 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
33168         LDKInvoiceWithDerivedSigningPubkeyBuilder o_conv;
33169         o_conv.inner = untag_ptr(o);
33170         o_conv.is_owned = ptr_is_owned(o);
33171         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
33172         // WARNING: we need a move here but no clone is available for LDKInvoiceWithDerivedSigningPubkeyBuilder
33173         
33174         LDKCResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ), "LDKCResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ");
33175         *ret_conv = CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ_ok(o_conv);
33176         return tag_ptr(ret_conv, true);
33177 }
33178
33179 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
33180         LDKBolt12SemanticError e_conv = LDKBolt12SemanticError_from_java(env, e);
33181         LDKCResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ), "LDKCResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ");
33182         *ret_conv = CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ_err(e_conv);
33183         return tag_ptr(ret_conv, true);
33184 }
33185
33186 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
33187         LDKCResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ* o_conv = (LDKCResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ*)untag_ptr(o);
33188         jboolean ret_conv = CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ_is_ok(o_conv);
33189         return ret_conv;
33190 }
33191
33192 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
33193         if (!ptr_is_owned(_res)) return;
33194         void* _res_ptr = untag_ptr(_res);
33195         CHECK_ACCESS(_res_ptr);
33196         LDKCResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ _res_conv = *(LDKCResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ*)(_res_ptr);
33197         FREE(untag_ptr(_res));
33198         CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ_free(_res_conv);
33199 }
33200
33201 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceRequestFieldsDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
33202         LDKInvoiceRequestFields o_conv;
33203         o_conv.inner = untag_ptr(o);
33204         o_conv.is_owned = ptr_is_owned(o);
33205         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
33206         o_conv = InvoiceRequestFields_clone(&o_conv);
33207         LDKCResult_InvoiceRequestFieldsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceRequestFieldsDecodeErrorZ), "LDKCResult_InvoiceRequestFieldsDecodeErrorZ");
33208         *ret_conv = CResult_InvoiceRequestFieldsDecodeErrorZ_ok(o_conv);
33209         return tag_ptr(ret_conv, true);
33210 }
33211
33212 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceRequestFieldsDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
33213         void* e_ptr = untag_ptr(e);
33214         CHECK_ACCESS(e_ptr);
33215         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
33216         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
33217         LDKCResult_InvoiceRequestFieldsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceRequestFieldsDecodeErrorZ), "LDKCResult_InvoiceRequestFieldsDecodeErrorZ");
33218         *ret_conv = CResult_InvoiceRequestFieldsDecodeErrorZ_err(e_conv);
33219         return tag_ptr(ret_conv, true);
33220 }
33221
33222 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceRequestFieldsDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
33223         LDKCResult_InvoiceRequestFieldsDecodeErrorZ* o_conv = (LDKCResult_InvoiceRequestFieldsDecodeErrorZ*)untag_ptr(o);
33224         jboolean ret_conv = CResult_InvoiceRequestFieldsDecodeErrorZ_is_ok(o_conv);
33225         return ret_conv;
33226 }
33227
33228 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceRequestFieldsDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
33229         if (!ptr_is_owned(_res)) return;
33230         void* _res_ptr = untag_ptr(_res);
33231         CHECK_ACCESS(_res_ptr);
33232         LDKCResult_InvoiceRequestFieldsDecodeErrorZ _res_conv = *(LDKCResult_InvoiceRequestFieldsDecodeErrorZ*)(_res_ptr);
33233         FREE(untag_ptr(_res));
33234         CResult_InvoiceRequestFieldsDecodeErrorZ_free(_res_conv);
33235 }
33236
33237 static inline uint64_t CResult_InvoiceRequestFieldsDecodeErrorZ_clone_ptr(LDKCResult_InvoiceRequestFieldsDecodeErrorZ *NONNULL_PTR arg) {
33238         LDKCResult_InvoiceRequestFieldsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceRequestFieldsDecodeErrorZ), "LDKCResult_InvoiceRequestFieldsDecodeErrorZ");
33239         *ret_conv = CResult_InvoiceRequestFieldsDecodeErrorZ_clone(arg);
33240         return tag_ptr(ret_conv, true);
33241 }
33242 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceRequestFieldsDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33243         LDKCResult_InvoiceRequestFieldsDecodeErrorZ* arg_conv = (LDKCResult_InvoiceRequestFieldsDecodeErrorZ*)untag_ptr(arg);
33244         int64_t ret_conv = CResult_InvoiceRequestFieldsDecodeErrorZ_clone_ptr(arg_conv);
33245         return ret_conv;
33246 }
33247
33248 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceRequestFieldsDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33249         LDKCResult_InvoiceRequestFieldsDecodeErrorZ* orig_conv = (LDKCResult_InvoiceRequestFieldsDecodeErrorZ*)untag_ptr(orig);
33250         LDKCResult_InvoiceRequestFieldsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceRequestFieldsDecodeErrorZ), "LDKCResult_InvoiceRequestFieldsDecodeErrorZ");
33251         *ret_conv = CResult_InvoiceRequestFieldsDecodeErrorZ_clone(orig_conv);
33252         return tag_ptr(ret_conv, true);
33253 }
33254
33255 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_COption_1NoneZ_1some(JNIEnv *env, jclass clz) {
33256         jclass ret_conv = LDKCOption_NoneZ_to_java(env, COption_NoneZ_some());
33257         return ret_conv;
33258 }
33259
33260 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_COption_1NoneZ_1none(JNIEnv *env, jclass clz) {
33261         jclass ret_conv = LDKCOption_NoneZ_to_java(env, COption_NoneZ_none());
33262         return ret_conv;
33263 }
33264
33265 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1NoneZ_1free(JNIEnv *env, jclass clz, jclass _res) {
33266         LDKCOption_NoneZ _res_conv = LDKCOption_NoneZ_from_java(env, _res);
33267         COption_NoneZ_free(_res_conv);
33268 }
33269
33270 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1WitnessZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
33271         LDKCVec_WitnessZ _res_constr;
33272         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
33273         if (_res_constr.datalen > 0)
33274                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKWitness), "LDKCVec_WitnessZ Elements");
33275         else
33276                 _res_constr.data = NULL;
33277         for (size_t i = 0; i < _res_constr.datalen; i++) {
33278                 int8_tArray _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
33279                 LDKWitness _res_conv_8_ref;
33280                 _res_conv_8_ref.datalen = (*env)->GetArrayLength(env, _res_conv_8);
33281                 _res_conv_8_ref.data = MALLOC(_res_conv_8_ref.datalen, "LDKWitness Bytes");
33282                 (*env)->GetByteArrayRegion(env, _res_conv_8, 0, _res_conv_8_ref.datalen, _res_conv_8_ref.data);
33283                 _res_conv_8_ref.data_is_owned = true;
33284                 _res_constr.data[i] = _res_conv_8_ref;
33285         }
33286         CVec_WitnessZ_free(_res_constr);
33287 }
33288
33289 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1ECDSASignatureZ_1some(JNIEnv *env, jclass clz, int8_tArray o) {
33290         LDKECDSASignature o_ref;
33291         CHECK((*env)->GetArrayLength(env, o) == 64);
33292         (*env)->GetByteArrayRegion(env, o, 0, 64, o_ref.compact_form);
33293         LDKCOption_ECDSASignatureZ *ret_copy = MALLOC(sizeof(LDKCOption_ECDSASignatureZ), "LDKCOption_ECDSASignatureZ");
33294         *ret_copy = COption_ECDSASignatureZ_some(o_ref);
33295         int64_t ret_ref = tag_ptr(ret_copy, true);
33296         return ret_ref;
33297 }
33298
33299 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1ECDSASignatureZ_1none(JNIEnv *env, jclass clz) {
33300         LDKCOption_ECDSASignatureZ *ret_copy = MALLOC(sizeof(LDKCOption_ECDSASignatureZ), "LDKCOption_ECDSASignatureZ");
33301         *ret_copy = COption_ECDSASignatureZ_none();
33302         int64_t ret_ref = tag_ptr(ret_copy, true);
33303         return ret_ref;
33304 }
33305
33306 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1ECDSASignatureZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
33307         if (!ptr_is_owned(_res)) return;
33308         void* _res_ptr = untag_ptr(_res);
33309         CHECK_ACCESS(_res_ptr);
33310         LDKCOption_ECDSASignatureZ _res_conv = *(LDKCOption_ECDSASignatureZ*)(_res_ptr);
33311         FREE(untag_ptr(_res));
33312         COption_ECDSASignatureZ_free(_res_conv);
33313 }
33314
33315 static inline uint64_t COption_ECDSASignatureZ_clone_ptr(LDKCOption_ECDSASignatureZ *NONNULL_PTR arg) {
33316         LDKCOption_ECDSASignatureZ *ret_copy = MALLOC(sizeof(LDKCOption_ECDSASignatureZ), "LDKCOption_ECDSASignatureZ");
33317         *ret_copy = COption_ECDSASignatureZ_clone(arg);
33318         int64_t ret_ref = tag_ptr(ret_copy, true);
33319         return ret_ref;
33320 }
33321 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1ECDSASignatureZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33322         LDKCOption_ECDSASignatureZ* arg_conv = (LDKCOption_ECDSASignatureZ*)untag_ptr(arg);
33323         int64_t ret_conv = COption_ECDSASignatureZ_clone_ptr(arg_conv);
33324         return ret_conv;
33325 }
33326
33327 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1ECDSASignatureZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33328         LDKCOption_ECDSASignatureZ* orig_conv = (LDKCOption_ECDSASignatureZ*)untag_ptr(orig);
33329         LDKCOption_ECDSASignatureZ *ret_copy = MALLOC(sizeof(LDKCOption_ECDSASignatureZ), "LDKCOption_ECDSASignatureZ");
33330         *ret_copy = COption_ECDSASignatureZ_clone(orig_conv);
33331         int64_t ret_ref = tag_ptr(ret_copy, true);
33332         return ret_ref;
33333 }
33334
33335 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1i64Z_1some(JNIEnv *env, jclass clz, int64_t o) {
33336         LDKCOption_i64Z *ret_copy = MALLOC(sizeof(LDKCOption_i64Z), "LDKCOption_i64Z");
33337         *ret_copy = COption_i64Z_some(o);
33338         int64_t ret_ref = tag_ptr(ret_copy, true);
33339         return ret_ref;
33340 }
33341
33342 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1i64Z_1none(JNIEnv *env, jclass clz) {
33343         LDKCOption_i64Z *ret_copy = MALLOC(sizeof(LDKCOption_i64Z), "LDKCOption_i64Z");
33344         *ret_copy = COption_i64Z_none();
33345         int64_t ret_ref = tag_ptr(ret_copy, true);
33346         return ret_ref;
33347 }
33348
33349 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1i64Z_1free(JNIEnv *env, jclass clz, int64_t _res) {
33350         if (!ptr_is_owned(_res)) return;
33351         void* _res_ptr = untag_ptr(_res);
33352         CHECK_ACCESS(_res_ptr);
33353         LDKCOption_i64Z _res_conv = *(LDKCOption_i64Z*)(_res_ptr);
33354         FREE(untag_ptr(_res));
33355         COption_i64Z_free(_res_conv);
33356 }
33357
33358 static inline uint64_t COption_i64Z_clone_ptr(LDKCOption_i64Z *NONNULL_PTR arg) {
33359         LDKCOption_i64Z *ret_copy = MALLOC(sizeof(LDKCOption_i64Z), "LDKCOption_i64Z");
33360         *ret_copy = COption_i64Z_clone(arg);
33361         int64_t ret_ref = tag_ptr(ret_copy, true);
33362         return ret_ref;
33363 }
33364 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1i64Z_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33365         LDKCOption_i64Z* arg_conv = (LDKCOption_i64Z*)untag_ptr(arg);
33366         int64_t ret_conv = COption_i64Z_clone_ptr(arg_conv);
33367         return ret_conv;
33368 }
33369
33370 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1i64Z_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33371         LDKCOption_i64Z* orig_conv = (LDKCOption_i64Z*)untag_ptr(orig);
33372         LDKCOption_i64Z *ret_copy = MALLOC(sizeof(LDKCOption_i64Z), "LDKCOption_i64Z");
33373         *ret_copy = COption_i64Z_clone(orig_conv);
33374         int64_t ret_ref = tag_ptr(ret_copy, true);
33375         return ret_ref;
33376 }
33377
33378 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SocketAddressDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
33379         void* o_ptr = untag_ptr(o);
33380         CHECK_ACCESS(o_ptr);
33381         LDKSocketAddress o_conv = *(LDKSocketAddress*)(o_ptr);
33382         o_conv = SocketAddress_clone((LDKSocketAddress*)untag_ptr(o));
33383         LDKCResult_SocketAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SocketAddressDecodeErrorZ), "LDKCResult_SocketAddressDecodeErrorZ");
33384         *ret_conv = CResult_SocketAddressDecodeErrorZ_ok(o_conv);
33385         return tag_ptr(ret_conv, true);
33386 }
33387
33388 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SocketAddressDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
33389         void* e_ptr = untag_ptr(e);
33390         CHECK_ACCESS(e_ptr);
33391         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
33392         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
33393         LDKCResult_SocketAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SocketAddressDecodeErrorZ), "LDKCResult_SocketAddressDecodeErrorZ");
33394         *ret_conv = CResult_SocketAddressDecodeErrorZ_err(e_conv);
33395         return tag_ptr(ret_conv, true);
33396 }
33397
33398 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1SocketAddressDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
33399         LDKCResult_SocketAddressDecodeErrorZ* o_conv = (LDKCResult_SocketAddressDecodeErrorZ*)untag_ptr(o);
33400         jboolean ret_conv = CResult_SocketAddressDecodeErrorZ_is_ok(o_conv);
33401         return ret_conv;
33402 }
33403
33404 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SocketAddressDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
33405         if (!ptr_is_owned(_res)) return;
33406         void* _res_ptr = untag_ptr(_res);
33407         CHECK_ACCESS(_res_ptr);
33408         LDKCResult_SocketAddressDecodeErrorZ _res_conv = *(LDKCResult_SocketAddressDecodeErrorZ*)(_res_ptr);
33409         FREE(untag_ptr(_res));
33410         CResult_SocketAddressDecodeErrorZ_free(_res_conv);
33411 }
33412
33413 static inline uint64_t CResult_SocketAddressDecodeErrorZ_clone_ptr(LDKCResult_SocketAddressDecodeErrorZ *NONNULL_PTR arg) {
33414         LDKCResult_SocketAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SocketAddressDecodeErrorZ), "LDKCResult_SocketAddressDecodeErrorZ");
33415         *ret_conv = CResult_SocketAddressDecodeErrorZ_clone(arg);
33416         return tag_ptr(ret_conv, true);
33417 }
33418 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SocketAddressDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33419         LDKCResult_SocketAddressDecodeErrorZ* arg_conv = (LDKCResult_SocketAddressDecodeErrorZ*)untag_ptr(arg);
33420         int64_t ret_conv = CResult_SocketAddressDecodeErrorZ_clone_ptr(arg_conv);
33421         return ret_conv;
33422 }
33423
33424 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SocketAddressDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33425         LDKCResult_SocketAddressDecodeErrorZ* orig_conv = (LDKCResult_SocketAddressDecodeErrorZ*)untag_ptr(orig);
33426         LDKCResult_SocketAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SocketAddressDecodeErrorZ), "LDKCResult_SocketAddressDecodeErrorZ");
33427         *ret_conv = CResult_SocketAddressDecodeErrorZ_clone(orig_conv);
33428         return tag_ptr(ret_conv, true);
33429 }
33430
33431 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SocketAddressSocketAddressParseErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
33432         void* o_ptr = untag_ptr(o);
33433         CHECK_ACCESS(o_ptr);
33434         LDKSocketAddress o_conv = *(LDKSocketAddress*)(o_ptr);
33435         o_conv = SocketAddress_clone((LDKSocketAddress*)untag_ptr(o));
33436         LDKCResult_SocketAddressSocketAddressParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SocketAddressSocketAddressParseErrorZ), "LDKCResult_SocketAddressSocketAddressParseErrorZ");
33437         *ret_conv = CResult_SocketAddressSocketAddressParseErrorZ_ok(o_conv);
33438         return tag_ptr(ret_conv, true);
33439 }
33440
33441 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SocketAddressSocketAddressParseErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
33442         LDKSocketAddressParseError e_conv = LDKSocketAddressParseError_from_java(env, e);
33443         LDKCResult_SocketAddressSocketAddressParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SocketAddressSocketAddressParseErrorZ), "LDKCResult_SocketAddressSocketAddressParseErrorZ");
33444         *ret_conv = CResult_SocketAddressSocketAddressParseErrorZ_err(e_conv);
33445         return tag_ptr(ret_conv, true);
33446 }
33447
33448 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1SocketAddressSocketAddressParseErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
33449         LDKCResult_SocketAddressSocketAddressParseErrorZ* o_conv = (LDKCResult_SocketAddressSocketAddressParseErrorZ*)untag_ptr(o);
33450         jboolean ret_conv = CResult_SocketAddressSocketAddressParseErrorZ_is_ok(o_conv);
33451         return ret_conv;
33452 }
33453
33454 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SocketAddressSocketAddressParseErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
33455         if (!ptr_is_owned(_res)) return;
33456         void* _res_ptr = untag_ptr(_res);
33457         CHECK_ACCESS(_res_ptr);
33458         LDKCResult_SocketAddressSocketAddressParseErrorZ _res_conv = *(LDKCResult_SocketAddressSocketAddressParseErrorZ*)(_res_ptr);
33459         FREE(untag_ptr(_res));
33460         CResult_SocketAddressSocketAddressParseErrorZ_free(_res_conv);
33461 }
33462
33463 static inline uint64_t CResult_SocketAddressSocketAddressParseErrorZ_clone_ptr(LDKCResult_SocketAddressSocketAddressParseErrorZ *NONNULL_PTR arg) {
33464         LDKCResult_SocketAddressSocketAddressParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SocketAddressSocketAddressParseErrorZ), "LDKCResult_SocketAddressSocketAddressParseErrorZ");
33465         *ret_conv = CResult_SocketAddressSocketAddressParseErrorZ_clone(arg);
33466         return tag_ptr(ret_conv, true);
33467 }
33468 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SocketAddressSocketAddressParseErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33469         LDKCResult_SocketAddressSocketAddressParseErrorZ* arg_conv = (LDKCResult_SocketAddressSocketAddressParseErrorZ*)untag_ptr(arg);
33470         int64_t ret_conv = CResult_SocketAddressSocketAddressParseErrorZ_clone_ptr(arg_conv);
33471         return ret_conv;
33472 }
33473
33474 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SocketAddressSocketAddressParseErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33475         LDKCResult_SocketAddressSocketAddressParseErrorZ* orig_conv = (LDKCResult_SocketAddressSocketAddressParseErrorZ*)untag_ptr(orig);
33476         LDKCResult_SocketAddressSocketAddressParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SocketAddressSocketAddressParseErrorZ), "LDKCResult_SocketAddressSocketAddressParseErrorZ");
33477         *ret_conv = CResult_SocketAddressSocketAddressParseErrorZ_clone(orig_conv);
33478         return tag_ptr(ret_conv, true);
33479 }
33480
33481 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateAddHTLCZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
33482         LDKCVec_UpdateAddHTLCZ _res_constr;
33483         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
33484         if (_res_constr.datalen > 0)
33485                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
33486         else
33487                 _res_constr.data = NULL;
33488         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
33489         for (size_t p = 0; p < _res_constr.datalen; p++) {
33490                 int64_t _res_conv_15 = _res_vals[p];
33491                 LDKUpdateAddHTLC _res_conv_15_conv;
33492                 _res_conv_15_conv.inner = untag_ptr(_res_conv_15);
33493                 _res_conv_15_conv.is_owned = ptr_is_owned(_res_conv_15);
33494                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_15_conv);
33495                 _res_constr.data[p] = _res_conv_15_conv;
33496         }
33497         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
33498         CVec_UpdateAddHTLCZ_free(_res_constr);
33499 }
33500
33501 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateFulfillHTLCZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
33502         LDKCVec_UpdateFulfillHTLCZ _res_constr;
33503         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
33504         if (_res_constr.datalen > 0)
33505                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
33506         else
33507                 _res_constr.data = NULL;
33508         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
33509         for (size_t t = 0; t < _res_constr.datalen; t++) {
33510                 int64_t _res_conv_19 = _res_vals[t];
33511                 LDKUpdateFulfillHTLC _res_conv_19_conv;
33512                 _res_conv_19_conv.inner = untag_ptr(_res_conv_19);
33513                 _res_conv_19_conv.is_owned = ptr_is_owned(_res_conv_19);
33514                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_19_conv);
33515                 _res_constr.data[t] = _res_conv_19_conv;
33516         }
33517         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
33518         CVec_UpdateFulfillHTLCZ_free(_res_constr);
33519 }
33520
33521 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateFailHTLCZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
33522         LDKCVec_UpdateFailHTLCZ _res_constr;
33523         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
33524         if (_res_constr.datalen > 0)
33525                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
33526         else
33527                 _res_constr.data = NULL;
33528         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
33529         for (size_t q = 0; q < _res_constr.datalen; q++) {
33530                 int64_t _res_conv_16 = _res_vals[q];
33531                 LDKUpdateFailHTLC _res_conv_16_conv;
33532                 _res_conv_16_conv.inner = untag_ptr(_res_conv_16);
33533                 _res_conv_16_conv.is_owned = ptr_is_owned(_res_conv_16);
33534                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_16_conv);
33535                 _res_constr.data[q] = _res_conv_16_conv;
33536         }
33537         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
33538         CVec_UpdateFailHTLCZ_free(_res_constr);
33539 }
33540
33541 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateFailMalformedHTLCZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
33542         LDKCVec_UpdateFailMalformedHTLCZ _res_constr;
33543         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
33544         if (_res_constr.datalen > 0)
33545                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
33546         else
33547                 _res_constr.data = NULL;
33548         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
33549         for (size_t z = 0; z < _res_constr.datalen; z++) {
33550                 int64_t _res_conv_25 = _res_vals[z];
33551                 LDKUpdateFailMalformedHTLC _res_conv_25_conv;
33552                 _res_conv_25_conv.inner = untag_ptr(_res_conv_25);
33553                 _res_conv_25_conv.is_owned = ptr_is_owned(_res_conv_25);
33554                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_25_conv);
33555                 _res_constr.data[z] = _res_conv_25_conv;
33556         }
33557         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
33558         CVec_UpdateFailMalformedHTLCZ_free(_res_constr);
33559 }
33560
33561 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
33562         LDKAcceptChannel o_conv;
33563         o_conv.inner = untag_ptr(o);
33564         o_conv.is_owned = ptr_is_owned(o);
33565         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
33566         o_conv = AcceptChannel_clone(&o_conv);
33567         LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
33568         *ret_conv = CResult_AcceptChannelDecodeErrorZ_ok(o_conv);
33569         return tag_ptr(ret_conv, true);
33570 }
33571
33572 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
33573         void* e_ptr = untag_ptr(e);
33574         CHECK_ACCESS(e_ptr);
33575         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
33576         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
33577         LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
33578         *ret_conv = CResult_AcceptChannelDecodeErrorZ_err(e_conv);
33579         return tag_ptr(ret_conv, true);
33580 }
33581
33582 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
33583         LDKCResult_AcceptChannelDecodeErrorZ* o_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)untag_ptr(o);
33584         jboolean ret_conv = CResult_AcceptChannelDecodeErrorZ_is_ok(o_conv);
33585         return ret_conv;
33586 }
33587
33588 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
33589         if (!ptr_is_owned(_res)) return;
33590         void* _res_ptr = untag_ptr(_res);
33591         CHECK_ACCESS(_res_ptr);
33592         LDKCResult_AcceptChannelDecodeErrorZ _res_conv = *(LDKCResult_AcceptChannelDecodeErrorZ*)(_res_ptr);
33593         FREE(untag_ptr(_res));
33594         CResult_AcceptChannelDecodeErrorZ_free(_res_conv);
33595 }
33596
33597 static inline uint64_t CResult_AcceptChannelDecodeErrorZ_clone_ptr(LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR arg) {
33598         LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
33599         *ret_conv = CResult_AcceptChannelDecodeErrorZ_clone(arg);
33600         return tag_ptr(ret_conv, true);
33601 }
33602 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33603         LDKCResult_AcceptChannelDecodeErrorZ* arg_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)untag_ptr(arg);
33604         int64_t ret_conv = CResult_AcceptChannelDecodeErrorZ_clone_ptr(arg_conv);
33605         return ret_conv;
33606 }
33607
33608 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33609         LDKCResult_AcceptChannelDecodeErrorZ* orig_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)untag_ptr(orig);
33610         LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
33611         *ret_conv = CResult_AcceptChannelDecodeErrorZ_clone(orig_conv);
33612         return tag_ptr(ret_conv, true);
33613 }
33614
33615 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelV2DecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
33616         LDKAcceptChannelV2 o_conv;
33617         o_conv.inner = untag_ptr(o);
33618         o_conv.is_owned = ptr_is_owned(o);
33619         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
33620         o_conv = AcceptChannelV2_clone(&o_conv);
33621         LDKCResult_AcceptChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelV2DecodeErrorZ), "LDKCResult_AcceptChannelV2DecodeErrorZ");
33622         *ret_conv = CResult_AcceptChannelV2DecodeErrorZ_ok(o_conv);
33623         return tag_ptr(ret_conv, true);
33624 }
33625
33626 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelV2DecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
33627         void* e_ptr = untag_ptr(e);
33628         CHECK_ACCESS(e_ptr);
33629         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
33630         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
33631         LDKCResult_AcceptChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelV2DecodeErrorZ), "LDKCResult_AcceptChannelV2DecodeErrorZ");
33632         *ret_conv = CResult_AcceptChannelV2DecodeErrorZ_err(e_conv);
33633         return tag_ptr(ret_conv, true);
33634 }
33635
33636 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelV2DecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
33637         LDKCResult_AcceptChannelV2DecodeErrorZ* o_conv = (LDKCResult_AcceptChannelV2DecodeErrorZ*)untag_ptr(o);
33638         jboolean ret_conv = CResult_AcceptChannelV2DecodeErrorZ_is_ok(o_conv);
33639         return ret_conv;
33640 }
33641
33642 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelV2DecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
33643         if (!ptr_is_owned(_res)) return;
33644         void* _res_ptr = untag_ptr(_res);
33645         CHECK_ACCESS(_res_ptr);
33646         LDKCResult_AcceptChannelV2DecodeErrorZ _res_conv = *(LDKCResult_AcceptChannelV2DecodeErrorZ*)(_res_ptr);
33647         FREE(untag_ptr(_res));
33648         CResult_AcceptChannelV2DecodeErrorZ_free(_res_conv);
33649 }
33650
33651 static inline uint64_t CResult_AcceptChannelV2DecodeErrorZ_clone_ptr(LDKCResult_AcceptChannelV2DecodeErrorZ *NONNULL_PTR arg) {
33652         LDKCResult_AcceptChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelV2DecodeErrorZ), "LDKCResult_AcceptChannelV2DecodeErrorZ");
33653         *ret_conv = CResult_AcceptChannelV2DecodeErrorZ_clone(arg);
33654         return tag_ptr(ret_conv, true);
33655 }
33656 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelV2DecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33657         LDKCResult_AcceptChannelV2DecodeErrorZ* arg_conv = (LDKCResult_AcceptChannelV2DecodeErrorZ*)untag_ptr(arg);
33658         int64_t ret_conv = CResult_AcceptChannelV2DecodeErrorZ_clone_ptr(arg_conv);
33659         return ret_conv;
33660 }
33661
33662 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelV2DecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33663         LDKCResult_AcceptChannelV2DecodeErrorZ* orig_conv = (LDKCResult_AcceptChannelV2DecodeErrorZ*)untag_ptr(orig);
33664         LDKCResult_AcceptChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelV2DecodeErrorZ), "LDKCResult_AcceptChannelV2DecodeErrorZ");
33665         *ret_conv = CResult_AcceptChannelV2DecodeErrorZ_clone(orig_conv);
33666         return tag_ptr(ret_conv, true);
33667 }
33668
33669 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StfuDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
33670         LDKStfu o_conv;
33671         o_conv.inner = untag_ptr(o);
33672         o_conv.is_owned = ptr_is_owned(o);
33673         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
33674         o_conv = Stfu_clone(&o_conv);
33675         LDKCResult_StfuDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StfuDecodeErrorZ), "LDKCResult_StfuDecodeErrorZ");
33676         *ret_conv = CResult_StfuDecodeErrorZ_ok(o_conv);
33677         return tag_ptr(ret_conv, true);
33678 }
33679
33680 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StfuDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
33681         void* e_ptr = untag_ptr(e);
33682         CHECK_ACCESS(e_ptr);
33683         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
33684         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
33685         LDKCResult_StfuDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StfuDecodeErrorZ), "LDKCResult_StfuDecodeErrorZ");
33686         *ret_conv = CResult_StfuDecodeErrorZ_err(e_conv);
33687         return tag_ptr(ret_conv, true);
33688 }
33689
33690 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1StfuDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
33691         LDKCResult_StfuDecodeErrorZ* o_conv = (LDKCResult_StfuDecodeErrorZ*)untag_ptr(o);
33692         jboolean ret_conv = CResult_StfuDecodeErrorZ_is_ok(o_conv);
33693         return ret_conv;
33694 }
33695
33696 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1StfuDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
33697         if (!ptr_is_owned(_res)) return;
33698         void* _res_ptr = untag_ptr(_res);
33699         CHECK_ACCESS(_res_ptr);
33700         LDKCResult_StfuDecodeErrorZ _res_conv = *(LDKCResult_StfuDecodeErrorZ*)(_res_ptr);
33701         FREE(untag_ptr(_res));
33702         CResult_StfuDecodeErrorZ_free(_res_conv);
33703 }
33704
33705 static inline uint64_t CResult_StfuDecodeErrorZ_clone_ptr(LDKCResult_StfuDecodeErrorZ *NONNULL_PTR arg) {
33706         LDKCResult_StfuDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StfuDecodeErrorZ), "LDKCResult_StfuDecodeErrorZ");
33707         *ret_conv = CResult_StfuDecodeErrorZ_clone(arg);
33708         return tag_ptr(ret_conv, true);
33709 }
33710 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StfuDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33711         LDKCResult_StfuDecodeErrorZ* arg_conv = (LDKCResult_StfuDecodeErrorZ*)untag_ptr(arg);
33712         int64_t ret_conv = CResult_StfuDecodeErrorZ_clone_ptr(arg_conv);
33713         return ret_conv;
33714 }
33715
33716 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StfuDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33717         LDKCResult_StfuDecodeErrorZ* orig_conv = (LDKCResult_StfuDecodeErrorZ*)untag_ptr(orig);
33718         LDKCResult_StfuDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StfuDecodeErrorZ), "LDKCResult_StfuDecodeErrorZ");
33719         *ret_conv = CResult_StfuDecodeErrorZ_clone(orig_conv);
33720         return tag_ptr(ret_conv, true);
33721 }
33722
33723 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpliceDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
33724         LDKSplice o_conv;
33725         o_conv.inner = untag_ptr(o);
33726         o_conv.is_owned = ptr_is_owned(o);
33727         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
33728         o_conv = Splice_clone(&o_conv);
33729         LDKCResult_SpliceDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpliceDecodeErrorZ), "LDKCResult_SpliceDecodeErrorZ");
33730         *ret_conv = CResult_SpliceDecodeErrorZ_ok(o_conv);
33731         return tag_ptr(ret_conv, true);
33732 }
33733
33734 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpliceDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
33735         void* e_ptr = untag_ptr(e);
33736         CHECK_ACCESS(e_ptr);
33737         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
33738         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
33739         LDKCResult_SpliceDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpliceDecodeErrorZ), "LDKCResult_SpliceDecodeErrorZ");
33740         *ret_conv = CResult_SpliceDecodeErrorZ_err(e_conv);
33741         return tag_ptr(ret_conv, true);
33742 }
33743
33744 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1SpliceDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
33745         LDKCResult_SpliceDecodeErrorZ* o_conv = (LDKCResult_SpliceDecodeErrorZ*)untag_ptr(o);
33746         jboolean ret_conv = CResult_SpliceDecodeErrorZ_is_ok(o_conv);
33747         return ret_conv;
33748 }
33749
33750 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SpliceDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
33751         if (!ptr_is_owned(_res)) return;
33752         void* _res_ptr = untag_ptr(_res);
33753         CHECK_ACCESS(_res_ptr);
33754         LDKCResult_SpliceDecodeErrorZ _res_conv = *(LDKCResult_SpliceDecodeErrorZ*)(_res_ptr);
33755         FREE(untag_ptr(_res));
33756         CResult_SpliceDecodeErrorZ_free(_res_conv);
33757 }
33758
33759 static inline uint64_t CResult_SpliceDecodeErrorZ_clone_ptr(LDKCResult_SpliceDecodeErrorZ *NONNULL_PTR arg) {
33760         LDKCResult_SpliceDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpliceDecodeErrorZ), "LDKCResult_SpliceDecodeErrorZ");
33761         *ret_conv = CResult_SpliceDecodeErrorZ_clone(arg);
33762         return tag_ptr(ret_conv, true);
33763 }
33764 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpliceDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33765         LDKCResult_SpliceDecodeErrorZ* arg_conv = (LDKCResult_SpliceDecodeErrorZ*)untag_ptr(arg);
33766         int64_t ret_conv = CResult_SpliceDecodeErrorZ_clone_ptr(arg_conv);
33767         return ret_conv;
33768 }
33769
33770 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpliceDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33771         LDKCResult_SpliceDecodeErrorZ* orig_conv = (LDKCResult_SpliceDecodeErrorZ*)untag_ptr(orig);
33772         LDKCResult_SpliceDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpliceDecodeErrorZ), "LDKCResult_SpliceDecodeErrorZ");
33773         *ret_conv = CResult_SpliceDecodeErrorZ_clone(orig_conv);
33774         return tag_ptr(ret_conv, true);
33775 }
33776
33777 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpliceAckDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
33778         LDKSpliceAck o_conv;
33779         o_conv.inner = untag_ptr(o);
33780         o_conv.is_owned = ptr_is_owned(o);
33781         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
33782         o_conv = SpliceAck_clone(&o_conv);
33783         LDKCResult_SpliceAckDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpliceAckDecodeErrorZ), "LDKCResult_SpliceAckDecodeErrorZ");
33784         *ret_conv = CResult_SpliceAckDecodeErrorZ_ok(o_conv);
33785         return tag_ptr(ret_conv, true);
33786 }
33787
33788 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpliceAckDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
33789         void* e_ptr = untag_ptr(e);
33790         CHECK_ACCESS(e_ptr);
33791         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
33792         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
33793         LDKCResult_SpliceAckDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpliceAckDecodeErrorZ), "LDKCResult_SpliceAckDecodeErrorZ");
33794         *ret_conv = CResult_SpliceAckDecodeErrorZ_err(e_conv);
33795         return tag_ptr(ret_conv, true);
33796 }
33797
33798 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1SpliceAckDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
33799         LDKCResult_SpliceAckDecodeErrorZ* o_conv = (LDKCResult_SpliceAckDecodeErrorZ*)untag_ptr(o);
33800         jboolean ret_conv = CResult_SpliceAckDecodeErrorZ_is_ok(o_conv);
33801         return ret_conv;
33802 }
33803
33804 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SpliceAckDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
33805         if (!ptr_is_owned(_res)) return;
33806         void* _res_ptr = untag_ptr(_res);
33807         CHECK_ACCESS(_res_ptr);
33808         LDKCResult_SpliceAckDecodeErrorZ _res_conv = *(LDKCResult_SpliceAckDecodeErrorZ*)(_res_ptr);
33809         FREE(untag_ptr(_res));
33810         CResult_SpliceAckDecodeErrorZ_free(_res_conv);
33811 }
33812
33813 static inline uint64_t CResult_SpliceAckDecodeErrorZ_clone_ptr(LDKCResult_SpliceAckDecodeErrorZ *NONNULL_PTR arg) {
33814         LDKCResult_SpliceAckDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpliceAckDecodeErrorZ), "LDKCResult_SpliceAckDecodeErrorZ");
33815         *ret_conv = CResult_SpliceAckDecodeErrorZ_clone(arg);
33816         return tag_ptr(ret_conv, true);
33817 }
33818 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpliceAckDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33819         LDKCResult_SpliceAckDecodeErrorZ* arg_conv = (LDKCResult_SpliceAckDecodeErrorZ*)untag_ptr(arg);
33820         int64_t ret_conv = CResult_SpliceAckDecodeErrorZ_clone_ptr(arg_conv);
33821         return ret_conv;
33822 }
33823
33824 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpliceAckDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33825         LDKCResult_SpliceAckDecodeErrorZ* orig_conv = (LDKCResult_SpliceAckDecodeErrorZ*)untag_ptr(orig);
33826         LDKCResult_SpliceAckDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpliceAckDecodeErrorZ), "LDKCResult_SpliceAckDecodeErrorZ");
33827         *ret_conv = CResult_SpliceAckDecodeErrorZ_clone(orig_conv);
33828         return tag_ptr(ret_conv, true);
33829 }
33830
33831 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpliceLockedDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
33832         LDKSpliceLocked o_conv;
33833         o_conv.inner = untag_ptr(o);
33834         o_conv.is_owned = ptr_is_owned(o);
33835         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
33836         o_conv = SpliceLocked_clone(&o_conv);
33837         LDKCResult_SpliceLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpliceLockedDecodeErrorZ), "LDKCResult_SpliceLockedDecodeErrorZ");
33838         *ret_conv = CResult_SpliceLockedDecodeErrorZ_ok(o_conv);
33839         return tag_ptr(ret_conv, true);
33840 }
33841
33842 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpliceLockedDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
33843         void* e_ptr = untag_ptr(e);
33844         CHECK_ACCESS(e_ptr);
33845         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
33846         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
33847         LDKCResult_SpliceLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpliceLockedDecodeErrorZ), "LDKCResult_SpliceLockedDecodeErrorZ");
33848         *ret_conv = CResult_SpliceLockedDecodeErrorZ_err(e_conv);
33849         return tag_ptr(ret_conv, true);
33850 }
33851
33852 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1SpliceLockedDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
33853         LDKCResult_SpliceLockedDecodeErrorZ* o_conv = (LDKCResult_SpliceLockedDecodeErrorZ*)untag_ptr(o);
33854         jboolean ret_conv = CResult_SpliceLockedDecodeErrorZ_is_ok(o_conv);
33855         return ret_conv;
33856 }
33857
33858 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SpliceLockedDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
33859         if (!ptr_is_owned(_res)) return;
33860         void* _res_ptr = untag_ptr(_res);
33861         CHECK_ACCESS(_res_ptr);
33862         LDKCResult_SpliceLockedDecodeErrorZ _res_conv = *(LDKCResult_SpliceLockedDecodeErrorZ*)(_res_ptr);
33863         FREE(untag_ptr(_res));
33864         CResult_SpliceLockedDecodeErrorZ_free(_res_conv);
33865 }
33866
33867 static inline uint64_t CResult_SpliceLockedDecodeErrorZ_clone_ptr(LDKCResult_SpliceLockedDecodeErrorZ *NONNULL_PTR arg) {
33868         LDKCResult_SpliceLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpliceLockedDecodeErrorZ), "LDKCResult_SpliceLockedDecodeErrorZ");
33869         *ret_conv = CResult_SpliceLockedDecodeErrorZ_clone(arg);
33870         return tag_ptr(ret_conv, true);
33871 }
33872 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpliceLockedDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33873         LDKCResult_SpliceLockedDecodeErrorZ* arg_conv = (LDKCResult_SpliceLockedDecodeErrorZ*)untag_ptr(arg);
33874         int64_t ret_conv = CResult_SpliceLockedDecodeErrorZ_clone_ptr(arg_conv);
33875         return ret_conv;
33876 }
33877
33878 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpliceLockedDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33879         LDKCResult_SpliceLockedDecodeErrorZ* orig_conv = (LDKCResult_SpliceLockedDecodeErrorZ*)untag_ptr(orig);
33880         LDKCResult_SpliceLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpliceLockedDecodeErrorZ), "LDKCResult_SpliceLockedDecodeErrorZ");
33881         *ret_conv = CResult_SpliceLockedDecodeErrorZ_clone(orig_conv);
33882         return tag_ptr(ret_conv, true);
33883 }
33884
33885 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAddInputDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
33886         LDKTxAddInput o_conv;
33887         o_conv.inner = untag_ptr(o);
33888         o_conv.is_owned = ptr_is_owned(o);
33889         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
33890         o_conv = TxAddInput_clone(&o_conv);
33891         LDKCResult_TxAddInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddInputDecodeErrorZ), "LDKCResult_TxAddInputDecodeErrorZ");
33892         *ret_conv = CResult_TxAddInputDecodeErrorZ_ok(o_conv);
33893         return tag_ptr(ret_conv, true);
33894 }
33895
33896 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAddInputDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
33897         void* e_ptr = untag_ptr(e);
33898         CHECK_ACCESS(e_ptr);
33899         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
33900         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
33901         LDKCResult_TxAddInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddInputDecodeErrorZ), "LDKCResult_TxAddInputDecodeErrorZ");
33902         *ret_conv = CResult_TxAddInputDecodeErrorZ_err(e_conv);
33903         return tag_ptr(ret_conv, true);
33904 }
33905
33906 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TxAddInputDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
33907         LDKCResult_TxAddInputDecodeErrorZ* o_conv = (LDKCResult_TxAddInputDecodeErrorZ*)untag_ptr(o);
33908         jboolean ret_conv = CResult_TxAddInputDecodeErrorZ_is_ok(o_conv);
33909         return ret_conv;
33910 }
33911
33912 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxAddInputDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
33913         if (!ptr_is_owned(_res)) return;
33914         void* _res_ptr = untag_ptr(_res);
33915         CHECK_ACCESS(_res_ptr);
33916         LDKCResult_TxAddInputDecodeErrorZ _res_conv = *(LDKCResult_TxAddInputDecodeErrorZ*)(_res_ptr);
33917         FREE(untag_ptr(_res));
33918         CResult_TxAddInputDecodeErrorZ_free(_res_conv);
33919 }
33920
33921 static inline uint64_t CResult_TxAddInputDecodeErrorZ_clone_ptr(LDKCResult_TxAddInputDecodeErrorZ *NONNULL_PTR arg) {
33922         LDKCResult_TxAddInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddInputDecodeErrorZ), "LDKCResult_TxAddInputDecodeErrorZ");
33923         *ret_conv = CResult_TxAddInputDecodeErrorZ_clone(arg);
33924         return tag_ptr(ret_conv, true);
33925 }
33926 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAddInputDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33927         LDKCResult_TxAddInputDecodeErrorZ* arg_conv = (LDKCResult_TxAddInputDecodeErrorZ*)untag_ptr(arg);
33928         int64_t ret_conv = CResult_TxAddInputDecodeErrorZ_clone_ptr(arg_conv);
33929         return ret_conv;
33930 }
33931
33932 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAddInputDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33933         LDKCResult_TxAddInputDecodeErrorZ* orig_conv = (LDKCResult_TxAddInputDecodeErrorZ*)untag_ptr(orig);
33934         LDKCResult_TxAddInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddInputDecodeErrorZ), "LDKCResult_TxAddInputDecodeErrorZ");
33935         *ret_conv = CResult_TxAddInputDecodeErrorZ_clone(orig_conv);
33936         return tag_ptr(ret_conv, true);
33937 }
33938
33939 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAddOutputDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
33940         LDKTxAddOutput o_conv;
33941         o_conv.inner = untag_ptr(o);
33942         o_conv.is_owned = ptr_is_owned(o);
33943         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
33944         o_conv = TxAddOutput_clone(&o_conv);
33945         LDKCResult_TxAddOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddOutputDecodeErrorZ), "LDKCResult_TxAddOutputDecodeErrorZ");
33946         *ret_conv = CResult_TxAddOutputDecodeErrorZ_ok(o_conv);
33947         return tag_ptr(ret_conv, true);
33948 }
33949
33950 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAddOutputDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
33951         void* e_ptr = untag_ptr(e);
33952         CHECK_ACCESS(e_ptr);
33953         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
33954         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
33955         LDKCResult_TxAddOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddOutputDecodeErrorZ), "LDKCResult_TxAddOutputDecodeErrorZ");
33956         *ret_conv = CResult_TxAddOutputDecodeErrorZ_err(e_conv);
33957         return tag_ptr(ret_conv, true);
33958 }
33959
33960 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TxAddOutputDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
33961         LDKCResult_TxAddOutputDecodeErrorZ* o_conv = (LDKCResult_TxAddOutputDecodeErrorZ*)untag_ptr(o);
33962         jboolean ret_conv = CResult_TxAddOutputDecodeErrorZ_is_ok(o_conv);
33963         return ret_conv;
33964 }
33965
33966 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxAddOutputDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
33967         if (!ptr_is_owned(_res)) return;
33968         void* _res_ptr = untag_ptr(_res);
33969         CHECK_ACCESS(_res_ptr);
33970         LDKCResult_TxAddOutputDecodeErrorZ _res_conv = *(LDKCResult_TxAddOutputDecodeErrorZ*)(_res_ptr);
33971         FREE(untag_ptr(_res));
33972         CResult_TxAddOutputDecodeErrorZ_free(_res_conv);
33973 }
33974
33975 static inline uint64_t CResult_TxAddOutputDecodeErrorZ_clone_ptr(LDKCResult_TxAddOutputDecodeErrorZ *NONNULL_PTR arg) {
33976         LDKCResult_TxAddOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddOutputDecodeErrorZ), "LDKCResult_TxAddOutputDecodeErrorZ");
33977         *ret_conv = CResult_TxAddOutputDecodeErrorZ_clone(arg);
33978         return tag_ptr(ret_conv, true);
33979 }
33980 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAddOutputDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
33981         LDKCResult_TxAddOutputDecodeErrorZ* arg_conv = (LDKCResult_TxAddOutputDecodeErrorZ*)untag_ptr(arg);
33982         int64_t ret_conv = CResult_TxAddOutputDecodeErrorZ_clone_ptr(arg_conv);
33983         return ret_conv;
33984 }
33985
33986 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAddOutputDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
33987         LDKCResult_TxAddOutputDecodeErrorZ* orig_conv = (LDKCResult_TxAddOutputDecodeErrorZ*)untag_ptr(orig);
33988         LDKCResult_TxAddOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddOutputDecodeErrorZ), "LDKCResult_TxAddOutputDecodeErrorZ");
33989         *ret_conv = CResult_TxAddOutputDecodeErrorZ_clone(orig_conv);
33990         return tag_ptr(ret_conv, true);
33991 }
33992
33993 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxRemoveInputDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
33994         LDKTxRemoveInput o_conv;
33995         o_conv.inner = untag_ptr(o);
33996         o_conv.is_owned = ptr_is_owned(o);
33997         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
33998         o_conv = TxRemoveInput_clone(&o_conv);
33999         LDKCResult_TxRemoveInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveInputDecodeErrorZ), "LDKCResult_TxRemoveInputDecodeErrorZ");
34000         *ret_conv = CResult_TxRemoveInputDecodeErrorZ_ok(o_conv);
34001         return tag_ptr(ret_conv, true);
34002 }
34003
34004 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxRemoveInputDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
34005         void* e_ptr = untag_ptr(e);
34006         CHECK_ACCESS(e_ptr);
34007         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
34008         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
34009         LDKCResult_TxRemoveInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveInputDecodeErrorZ), "LDKCResult_TxRemoveInputDecodeErrorZ");
34010         *ret_conv = CResult_TxRemoveInputDecodeErrorZ_err(e_conv);
34011         return tag_ptr(ret_conv, true);
34012 }
34013
34014 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TxRemoveInputDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
34015         LDKCResult_TxRemoveInputDecodeErrorZ* o_conv = (LDKCResult_TxRemoveInputDecodeErrorZ*)untag_ptr(o);
34016         jboolean ret_conv = CResult_TxRemoveInputDecodeErrorZ_is_ok(o_conv);
34017         return ret_conv;
34018 }
34019
34020 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxRemoveInputDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
34021         if (!ptr_is_owned(_res)) return;
34022         void* _res_ptr = untag_ptr(_res);
34023         CHECK_ACCESS(_res_ptr);
34024         LDKCResult_TxRemoveInputDecodeErrorZ _res_conv = *(LDKCResult_TxRemoveInputDecodeErrorZ*)(_res_ptr);
34025         FREE(untag_ptr(_res));
34026         CResult_TxRemoveInputDecodeErrorZ_free(_res_conv);
34027 }
34028
34029 static inline uint64_t CResult_TxRemoveInputDecodeErrorZ_clone_ptr(LDKCResult_TxRemoveInputDecodeErrorZ *NONNULL_PTR arg) {
34030         LDKCResult_TxRemoveInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveInputDecodeErrorZ), "LDKCResult_TxRemoveInputDecodeErrorZ");
34031         *ret_conv = CResult_TxRemoveInputDecodeErrorZ_clone(arg);
34032         return tag_ptr(ret_conv, true);
34033 }
34034 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxRemoveInputDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
34035         LDKCResult_TxRemoveInputDecodeErrorZ* arg_conv = (LDKCResult_TxRemoveInputDecodeErrorZ*)untag_ptr(arg);
34036         int64_t ret_conv = CResult_TxRemoveInputDecodeErrorZ_clone_ptr(arg_conv);
34037         return ret_conv;
34038 }
34039
34040 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxRemoveInputDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
34041         LDKCResult_TxRemoveInputDecodeErrorZ* orig_conv = (LDKCResult_TxRemoveInputDecodeErrorZ*)untag_ptr(orig);
34042         LDKCResult_TxRemoveInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveInputDecodeErrorZ), "LDKCResult_TxRemoveInputDecodeErrorZ");
34043         *ret_conv = CResult_TxRemoveInputDecodeErrorZ_clone(orig_conv);
34044         return tag_ptr(ret_conv, true);
34045 }
34046
34047 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxRemoveOutputDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
34048         LDKTxRemoveOutput o_conv;
34049         o_conv.inner = untag_ptr(o);
34050         o_conv.is_owned = ptr_is_owned(o);
34051         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
34052         o_conv = TxRemoveOutput_clone(&o_conv);
34053         LDKCResult_TxRemoveOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveOutputDecodeErrorZ), "LDKCResult_TxRemoveOutputDecodeErrorZ");
34054         *ret_conv = CResult_TxRemoveOutputDecodeErrorZ_ok(o_conv);
34055         return tag_ptr(ret_conv, true);
34056 }
34057
34058 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxRemoveOutputDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
34059         void* e_ptr = untag_ptr(e);
34060         CHECK_ACCESS(e_ptr);
34061         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
34062         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
34063         LDKCResult_TxRemoveOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveOutputDecodeErrorZ), "LDKCResult_TxRemoveOutputDecodeErrorZ");
34064         *ret_conv = CResult_TxRemoveOutputDecodeErrorZ_err(e_conv);
34065         return tag_ptr(ret_conv, true);
34066 }
34067
34068 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TxRemoveOutputDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
34069         LDKCResult_TxRemoveOutputDecodeErrorZ* o_conv = (LDKCResult_TxRemoveOutputDecodeErrorZ*)untag_ptr(o);
34070         jboolean ret_conv = CResult_TxRemoveOutputDecodeErrorZ_is_ok(o_conv);
34071         return ret_conv;
34072 }
34073
34074 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxRemoveOutputDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
34075         if (!ptr_is_owned(_res)) return;
34076         void* _res_ptr = untag_ptr(_res);
34077         CHECK_ACCESS(_res_ptr);
34078         LDKCResult_TxRemoveOutputDecodeErrorZ _res_conv = *(LDKCResult_TxRemoveOutputDecodeErrorZ*)(_res_ptr);
34079         FREE(untag_ptr(_res));
34080         CResult_TxRemoveOutputDecodeErrorZ_free(_res_conv);
34081 }
34082
34083 static inline uint64_t CResult_TxRemoveOutputDecodeErrorZ_clone_ptr(LDKCResult_TxRemoveOutputDecodeErrorZ *NONNULL_PTR arg) {
34084         LDKCResult_TxRemoveOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveOutputDecodeErrorZ), "LDKCResult_TxRemoveOutputDecodeErrorZ");
34085         *ret_conv = CResult_TxRemoveOutputDecodeErrorZ_clone(arg);
34086         return tag_ptr(ret_conv, true);
34087 }
34088 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxRemoveOutputDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
34089         LDKCResult_TxRemoveOutputDecodeErrorZ* arg_conv = (LDKCResult_TxRemoveOutputDecodeErrorZ*)untag_ptr(arg);
34090         int64_t ret_conv = CResult_TxRemoveOutputDecodeErrorZ_clone_ptr(arg_conv);
34091         return ret_conv;
34092 }
34093
34094 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxRemoveOutputDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
34095         LDKCResult_TxRemoveOutputDecodeErrorZ* orig_conv = (LDKCResult_TxRemoveOutputDecodeErrorZ*)untag_ptr(orig);
34096         LDKCResult_TxRemoveOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveOutputDecodeErrorZ), "LDKCResult_TxRemoveOutputDecodeErrorZ");
34097         *ret_conv = CResult_TxRemoveOutputDecodeErrorZ_clone(orig_conv);
34098         return tag_ptr(ret_conv, true);
34099 }
34100
34101 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCompleteDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
34102         LDKTxComplete o_conv;
34103         o_conv.inner = untag_ptr(o);
34104         o_conv.is_owned = ptr_is_owned(o);
34105         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
34106         o_conv = TxComplete_clone(&o_conv);
34107         LDKCResult_TxCompleteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCompleteDecodeErrorZ), "LDKCResult_TxCompleteDecodeErrorZ");
34108         *ret_conv = CResult_TxCompleteDecodeErrorZ_ok(o_conv);
34109         return tag_ptr(ret_conv, true);
34110 }
34111
34112 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCompleteDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
34113         void* e_ptr = untag_ptr(e);
34114         CHECK_ACCESS(e_ptr);
34115         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
34116         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
34117         LDKCResult_TxCompleteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCompleteDecodeErrorZ), "LDKCResult_TxCompleteDecodeErrorZ");
34118         *ret_conv = CResult_TxCompleteDecodeErrorZ_err(e_conv);
34119         return tag_ptr(ret_conv, true);
34120 }
34121
34122 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TxCompleteDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
34123         LDKCResult_TxCompleteDecodeErrorZ* o_conv = (LDKCResult_TxCompleteDecodeErrorZ*)untag_ptr(o);
34124         jboolean ret_conv = CResult_TxCompleteDecodeErrorZ_is_ok(o_conv);
34125         return ret_conv;
34126 }
34127
34128 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxCompleteDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
34129         if (!ptr_is_owned(_res)) return;
34130         void* _res_ptr = untag_ptr(_res);
34131         CHECK_ACCESS(_res_ptr);
34132         LDKCResult_TxCompleteDecodeErrorZ _res_conv = *(LDKCResult_TxCompleteDecodeErrorZ*)(_res_ptr);
34133         FREE(untag_ptr(_res));
34134         CResult_TxCompleteDecodeErrorZ_free(_res_conv);
34135 }
34136
34137 static inline uint64_t CResult_TxCompleteDecodeErrorZ_clone_ptr(LDKCResult_TxCompleteDecodeErrorZ *NONNULL_PTR arg) {
34138         LDKCResult_TxCompleteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCompleteDecodeErrorZ), "LDKCResult_TxCompleteDecodeErrorZ");
34139         *ret_conv = CResult_TxCompleteDecodeErrorZ_clone(arg);
34140         return tag_ptr(ret_conv, true);
34141 }
34142 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCompleteDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
34143         LDKCResult_TxCompleteDecodeErrorZ* arg_conv = (LDKCResult_TxCompleteDecodeErrorZ*)untag_ptr(arg);
34144         int64_t ret_conv = CResult_TxCompleteDecodeErrorZ_clone_ptr(arg_conv);
34145         return ret_conv;
34146 }
34147
34148 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCompleteDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
34149         LDKCResult_TxCompleteDecodeErrorZ* orig_conv = (LDKCResult_TxCompleteDecodeErrorZ*)untag_ptr(orig);
34150         LDKCResult_TxCompleteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCompleteDecodeErrorZ), "LDKCResult_TxCompleteDecodeErrorZ");
34151         *ret_conv = CResult_TxCompleteDecodeErrorZ_clone(orig_conv);
34152         return tag_ptr(ret_conv, true);
34153 }
34154
34155 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxSignaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
34156         LDKTxSignatures o_conv;
34157         o_conv.inner = untag_ptr(o);
34158         o_conv.is_owned = ptr_is_owned(o);
34159         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
34160         o_conv = TxSignatures_clone(&o_conv);
34161         LDKCResult_TxSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxSignaturesDecodeErrorZ), "LDKCResult_TxSignaturesDecodeErrorZ");
34162         *ret_conv = CResult_TxSignaturesDecodeErrorZ_ok(o_conv);
34163         return tag_ptr(ret_conv, true);
34164 }
34165
34166 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxSignaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
34167         void* e_ptr = untag_ptr(e);
34168         CHECK_ACCESS(e_ptr);
34169         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
34170         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
34171         LDKCResult_TxSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxSignaturesDecodeErrorZ), "LDKCResult_TxSignaturesDecodeErrorZ");
34172         *ret_conv = CResult_TxSignaturesDecodeErrorZ_err(e_conv);
34173         return tag_ptr(ret_conv, true);
34174 }
34175
34176 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TxSignaturesDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
34177         LDKCResult_TxSignaturesDecodeErrorZ* o_conv = (LDKCResult_TxSignaturesDecodeErrorZ*)untag_ptr(o);
34178         jboolean ret_conv = CResult_TxSignaturesDecodeErrorZ_is_ok(o_conv);
34179         return ret_conv;
34180 }
34181
34182 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxSignaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
34183         if (!ptr_is_owned(_res)) return;
34184         void* _res_ptr = untag_ptr(_res);
34185         CHECK_ACCESS(_res_ptr);
34186         LDKCResult_TxSignaturesDecodeErrorZ _res_conv = *(LDKCResult_TxSignaturesDecodeErrorZ*)(_res_ptr);
34187         FREE(untag_ptr(_res));
34188         CResult_TxSignaturesDecodeErrorZ_free(_res_conv);
34189 }
34190
34191 static inline uint64_t CResult_TxSignaturesDecodeErrorZ_clone_ptr(LDKCResult_TxSignaturesDecodeErrorZ *NONNULL_PTR arg) {
34192         LDKCResult_TxSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxSignaturesDecodeErrorZ), "LDKCResult_TxSignaturesDecodeErrorZ");
34193         *ret_conv = CResult_TxSignaturesDecodeErrorZ_clone(arg);
34194         return tag_ptr(ret_conv, true);
34195 }
34196 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxSignaturesDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
34197         LDKCResult_TxSignaturesDecodeErrorZ* arg_conv = (LDKCResult_TxSignaturesDecodeErrorZ*)untag_ptr(arg);
34198         int64_t ret_conv = CResult_TxSignaturesDecodeErrorZ_clone_ptr(arg_conv);
34199         return ret_conv;
34200 }
34201
34202 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxSignaturesDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
34203         LDKCResult_TxSignaturesDecodeErrorZ* orig_conv = (LDKCResult_TxSignaturesDecodeErrorZ*)untag_ptr(orig);
34204         LDKCResult_TxSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxSignaturesDecodeErrorZ), "LDKCResult_TxSignaturesDecodeErrorZ");
34205         *ret_conv = CResult_TxSignaturesDecodeErrorZ_clone(orig_conv);
34206         return tag_ptr(ret_conv, true);
34207 }
34208
34209 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxInitRbfDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
34210         LDKTxInitRbf o_conv;
34211         o_conv.inner = untag_ptr(o);
34212         o_conv.is_owned = ptr_is_owned(o);
34213         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
34214         o_conv = TxInitRbf_clone(&o_conv);
34215         LDKCResult_TxInitRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxInitRbfDecodeErrorZ), "LDKCResult_TxInitRbfDecodeErrorZ");
34216         *ret_conv = CResult_TxInitRbfDecodeErrorZ_ok(o_conv);
34217         return tag_ptr(ret_conv, true);
34218 }
34219
34220 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxInitRbfDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
34221         void* e_ptr = untag_ptr(e);
34222         CHECK_ACCESS(e_ptr);
34223         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
34224         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
34225         LDKCResult_TxInitRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxInitRbfDecodeErrorZ), "LDKCResult_TxInitRbfDecodeErrorZ");
34226         *ret_conv = CResult_TxInitRbfDecodeErrorZ_err(e_conv);
34227         return tag_ptr(ret_conv, true);
34228 }
34229
34230 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TxInitRbfDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
34231         LDKCResult_TxInitRbfDecodeErrorZ* o_conv = (LDKCResult_TxInitRbfDecodeErrorZ*)untag_ptr(o);
34232         jboolean ret_conv = CResult_TxInitRbfDecodeErrorZ_is_ok(o_conv);
34233         return ret_conv;
34234 }
34235
34236 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxInitRbfDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
34237         if (!ptr_is_owned(_res)) return;
34238         void* _res_ptr = untag_ptr(_res);
34239         CHECK_ACCESS(_res_ptr);
34240         LDKCResult_TxInitRbfDecodeErrorZ _res_conv = *(LDKCResult_TxInitRbfDecodeErrorZ*)(_res_ptr);
34241         FREE(untag_ptr(_res));
34242         CResult_TxInitRbfDecodeErrorZ_free(_res_conv);
34243 }
34244
34245 static inline uint64_t CResult_TxInitRbfDecodeErrorZ_clone_ptr(LDKCResult_TxInitRbfDecodeErrorZ *NONNULL_PTR arg) {
34246         LDKCResult_TxInitRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxInitRbfDecodeErrorZ), "LDKCResult_TxInitRbfDecodeErrorZ");
34247         *ret_conv = CResult_TxInitRbfDecodeErrorZ_clone(arg);
34248         return tag_ptr(ret_conv, true);
34249 }
34250 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxInitRbfDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
34251         LDKCResult_TxInitRbfDecodeErrorZ* arg_conv = (LDKCResult_TxInitRbfDecodeErrorZ*)untag_ptr(arg);
34252         int64_t ret_conv = CResult_TxInitRbfDecodeErrorZ_clone_ptr(arg_conv);
34253         return ret_conv;
34254 }
34255
34256 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxInitRbfDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
34257         LDKCResult_TxInitRbfDecodeErrorZ* orig_conv = (LDKCResult_TxInitRbfDecodeErrorZ*)untag_ptr(orig);
34258         LDKCResult_TxInitRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxInitRbfDecodeErrorZ), "LDKCResult_TxInitRbfDecodeErrorZ");
34259         *ret_conv = CResult_TxInitRbfDecodeErrorZ_clone(orig_conv);
34260         return tag_ptr(ret_conv, true);
34261 }
34262
34263 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAckRbfDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
34264         LDKTxAckRbf o_conv;
34265         o_conv.inner = untag_ptr(o);
34266         o_conv.is_owned = ptr_is_owned(o);
34267         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
34268         o_conv = TxAckRbf_clone(&o_conv);
34269         LDKCResult_TxAckRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAckRbfDecodeErrorZ), "LDKCResult_TxAckRbfDecodeErrorZ");
34270         *ret_conv = CResult_TxAckRbfDecodeErrorZ_ok(o_conv);
34271         return tag_ptr(ret_conv, true);
34272 }
34273
34274 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAckRbfDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
34275         void* e_ptr = untag_ptr(e);
34276         CHECK_ACCESS(e_ptr);
34277         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
34278         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
34279         LDKCResult_TxAckRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAckRbfDecodeErrorZ), "LDKCResult_TxAckRbfDecodeErrorZ");
34280         *ret_conv = CResult_TxAckRbfDecodeErrorZ_err(e_conv);
34281         return tag_ptr(ret_conv, true);
34282 }
34283
34284 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TxAckRbfDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
34285         LDKCResult_TxAckRbfDecodeErrorZ* o_conv = (LDKCResult_TxAckRbfDecodeErrorZ*)untag_ptr(o);
34286         jboolean ret_conv = CResult_TxAckRbfDecodeErrorZ_is_ok(o_conv);
34287         return ret_conv;
34288 }
34289
34290 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxAckRbfDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
34291         if (!ptr_is_owned(_res)) return;
34292         void* _res_ptr = untag_ptr(_res);
34293         CHECK_ACCESS(_res_ptr);
34294         LDKCResult_TxAckRbfDecodeErrorZ _res_conv = *(LDKCResult_TxAckRbfDecodeErrorZ*)(_res_ptr);
34295         FREE(untag_ptr(_res));
34296         CResult_TxAckRbfDecodeErrorZ_free(_res_conv);
34297 }
34298
34299 static inline uint64_t CResult_TxAckRbfDecodeErrorZ_clone_ptr(LDKCResult_TxAckRbfDecodeErrorZ *NONNULL_PTR arg) {
34300         LDKCResult_TxAckRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAckRbfDecodeErrorZ), "LDKCResult_TxAckRbfDecodeErrorZ");
34301         *ret_conv = CResult_TxAckRbfDecodeErrorZ_clone(arg);
34302         return tag_ptr(ret_conv, true);
34303 }
34304 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAckRbfDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
34305         LDKCResult_TxAckRbfDecodeErrorZ* arg_conv = (LDKCResult_TxAckRbfDecodeErrorZ*)untag_ptr(arg);
34306         int64_t ret_conv = CResult_TxAckRbfDecodeErrorZ_clone_ptr(arg_conv);
34307         return ret_conv;
34308 }
34309
34310 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAckRbfDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
34311         LDKCResult_TxAckRbfDecodeErrorZ* orig_conv = (LDKCResult_TxAckRbfDecodeErrorZ*)untag_ptr(orig);
34312         LDKCResult_TxAckRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAckRbfDecodeErrorZ), "LDKCResult_TxAckRbfDecodeErrorZ");
34313         *ret_conv = CResult_TxAckRbfDecodeErrorZ_clone(orig_conv);
34314         return tag_ptr(ret_conv, true);
34315 }
34316
34317 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAbortDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
34318         LDKTxAbort o_conv;
34319         o_conv.inner = untag_ptr(o);
34320         o_conv.is_owned = ptr_is_owned(o);
34321         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
34322         o_conv = TxAbort_clone(&o_conv);
34323         LDKCResult_TxAbortDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAbortDecodeErrorZ), "LDKCResult_TxAbortDecodeErrorZ");
34324         *ret_conv = CResult_TxAbortDecodeErrorZ_ok(o_conv);
34325         return tag_ptr(ret_conv, true);
34326 }
34327
34328 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAbortDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
34329         void* e_ptr = untag_ptr(e);
34330         CHECK_ACCESS(e_ptr);
34331         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
34332         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
34333         LDKCResult_TxAbortDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAbortDecodeErrorZ), "LDKCResult_TxAbortDecodeErrorZ");
34334         *ret_conv = CResult_TxAbortDecodeErrorZ_err(e_conv);
34335         return tag_ptr(ret_conv, true);
34336 }
34337
34338 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TxAbortDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
34339         LDKCResult_TxAbortDecodeErrorZ* o_conv = (LDKCResult_TxAbortDecodeErrorZ*)untag_ptr(o);
34340         jboolean ret_conv = CResult_TxAbortDecodeErrorZ_is_ok(o_conv);
34341         return ret_conv;
34342 }
34343
34344 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxAbortDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
34345         if (!ptr_is_owned(_res)) return;
34346         void* _res_ptr = untag_ptr(_res);
34347         CHECK_ACCESS(_res_ptr);
34348         LDKCResult_TxAbortDecodeErrorZ _res_conv = *(LDKCResult_TxAbortDecodeErrorZ*)(_res_ptr);
34349         FREE(untag_ptr(_res));
34350         CResult_TxAbortDecodeErrorZ_free(_res_conv);
34351 }
34352
34353 static inline uint64_t CResult_TxAbortDecodeErrorZ_clone_ptr(LDKCResult_TxAbortDecodeErrorZ *NONNULL_PTR arg) {
34354         LDKCResult_TxAbortDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAbortDecodeErrorZ), "LDKCResult_TxAbortDecodeErrorZ");
34355         *ret_conv = CResult_TxAbortDecodeErrorZ_clone(arg);
34356         return tag_ptr(ret_conv, true);
34357 }
34358 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAbortDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
34359         LDKCResult_TxAbortDecodeErrorZ* arg_conv = (LDKCResult_TxAbortDecodeErrorZ*)untag_ptr(arg);
34360         int64_t ret_conv = CResult_TxAbortDecodeErrorZ_clone_ptr(arg_conv);
34361         return ret_conv;
34362 }
34363
34364 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxAbortDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
34365         LDKCResult_TxAbortDecodeErrorZ* orig_conv = (LDKCResult_TxAbortDecodeErrorZ*)untag_ptr(orig);
34366         LDKCResult_TxAbortDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAbortDecodeErrorZ), "LDKCResult_TxAbortDecodeErrorZ");
34367         *ret_conv = CResult_TxAbortDecodeErrorZ_clone(orig_conv);
34368         return tag_ptr(ret_conv, true);
34369 }
34370
34371 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
34372         LDKAnnouncementSignatures o_conv;
34373         o_conv.inner = untag_ptr(o);
34374         o_conv.is_owned = ptr_is_owned(o);
34375         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
34376         o_conv = AnnouncementSignatures_clone(&o_conv);
34377         LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
34378         *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_ok(o_conv);
34379         return tag_ptr(ret_conv, true);
34380 }
34381
34382 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
34383         void* e_ptr = untag_ptr(e);
34384         CHECK_ACCESS(e_ptr);
34385         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
34386         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
34387         LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
34388         *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_err(e_conv);
34389         return tag_ptr(ret_conv, true);
34390 }
34391
34392 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
34393         LDKCResult_AnnouncementSignaturesDecodeErrorZ* o_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)untag_ptr(o);
34394         jboolean ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_is_ok(o_conv);
34395         return ret_conv;
34396 }
34397
34398 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
34399         if (!ptr_is_owned(_res)) return;
34400         void* _res_ptr = untag_ptr(_res);
34401         CHECK_ACCESS(_res_ptr);
34402         LDKCResult_AnnouncementSignaturesDecodeErrorZ _res_conv = *(LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(_res_ptr);
34403         FREE(untag_ptr(_res));
34404         CResult_AnnouncementSignaturesDecodeErrorZ_free(_res_conv);
34405 }
34406
34407 static inline uint64_t CResult_AnnouncementSignaturesDecodeErrorZ_clone_ptr(LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR arg) {
34408         LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
34409         *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_clone(arg);
34410         return tag_ptr(ret_conv, true);
34411 }
34412 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
34413         LDKCResult_AnnouncementSignaturesDecodeErrorZ* arg_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)untag_ptr(arg);
34414         int64_t ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_clone_ptr(arg_conv);
34415         return ret_conv;
34416 }
34417
34418 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
34419         LDKCResult_AnnouncementSignaturesDecodeErrorZ* orig_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)untag_ptr(orig);
34420         LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
34421         *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_clone(orig_conv);
34422         return tag_ptr(ret_conv, true);
34423 }
34424
34425 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
34426         LDKChannelReestablish o_conv;
34427         o_conv.inner = untag_ptr(o);
34428         o_conv.is_owned = ptr_is_owned(o);
34429         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
34430         o_conv = ChannelReestablish_clone(&o_conv);
34431         LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
34432         *ret_conv = CResult_ChannelReestablishDecodeErrorZ_ok(o_conv);
34433         return tag_ptr(ret_conv, true);
34434 }
34435
34436 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
34437         void* e_ptr = untag_ptr(e);
34438         CHECK_ACCESS(e_ptr);
34439         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
34440         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
34441         LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
34442         *ret_conv = CResult_ChannelReestablishDecodeErrorZ_err(e_conv);
34443         return tag_ptr(ret_conv, true);
34444 }
34445
34446 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
34447         LDKCResult_ChannelReestablishDecodeErrorZ* o_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)untag_ptr(o);
34448         jboolean ret_conv = CResult_ChannelReestablishDecodeErrorZ_is_ok(o_conv);
34449         return ret_conv;
34450 }
34451
34452 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
34453         if (!ptr_is_owned(_res)) return;
34454         void* _res_ptr = untag_ptr(_res);
34455         CHECK_ACCESS(_res_ptr);
34456         LDKCResult_ChannelReestablishDecodeErrorZ _res_conv = *(LDKCResult_ChannelReestablishDecodeErrorZ*)(_res_ptr);
34457         FREE(untag_ptr(_res));
34458         CResult_ChannelReestablishDecodeErrorZ_free(_res_conv);
34459 }
34460
34461 static inline uint64_t CResult_ChannelReestablishDecodeErrorZ_clone_ptr(LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR arg) {
34462         LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
34463         *ret_conv = CResult_ChannelReestablishDecodeErrorZ_clone(arg);
34464         return tag_ptr(ret_conv, true);
34465 }
34466 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
34467         LDKCResult_ChannelReestablishDecodeErrorZ* arg_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)untag_ptr(arg);
34468         int64_t ret_conv = CResult_ChannelReestablishDecodeErrorZ_clone_ptr(arg_conv);
34469         return ret_conv;
34470 }
34471
34472 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
34473         LDKCResult_ChannelReestablishDecodeErrorZ* orig_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)untag_ptr(orig);
34474         LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
34475         *ret_conv = CResult_ChannelReestablishDecodeErrorZ_clone(orig_conv);
34476         return tag_ptr(ret_conv, true);
34477 }
34478
34479 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
34480         LDKClosingSigned o_conv;
34481         o_conv.inner = untag_ptr(o);
34482         o_conv.is_owned = ptr_is_owned(o);
34483         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
34484         o_conv = ClosingSigned_clone(&o_conv);
34485         LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
34486         *ret_conv = CResult_ClosingSignedDecodeErrorZ_ok(o_conv);
34487         return tag_ptr(ret_conv, true);
34488 }
34489
34490 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
34491         void* e_ptr = untag_ptr(e);
34492         CHECK_ACCESS(e_ptr);
34493         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
34494         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
34495         LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
34496         *ret_conv = CResult_ClosingSignedDecodeErrorZ_err(e_conv);
34497         return tag_ptr(ret_conv, true);
34498 }
34499
34500 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
34501         LDKCResult_ClosingSignedDecodeErrorZ* o_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)untag_ptr(o);
34502         jboolean ret_conv = CResult_ClosingSignedDecodeErrorZ_is_ok(o_conv);
34503         return ret_conv;
34504 }
34505
34506 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
34507         if (!ptr_is_owned(_res)) return;
34508         void* _res_ptr = untag_ptr(_res);
34509         CHECK_ACCESS(_res_ptr);
34510         LDKCResult_ClosingSignedDecodeErrorZ _res_conv = *(LDKCResult_ClosingSignedDecodeErrorZ*)(_res_ptr);
34511         FREE(untag_ptr(_res));
34512         CResult_ClosingSignedDecodeErrorZ_free(_res_conv);
34513 }
34514
34515 static inline uint64_t CResult_ClosingSignedDecodeErrorZ_clone_ptr(LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR arg) {
34516         LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
34517         *ret_conv = CResult_ClosingSignedDecodeErrorZ_clone(arg);
34518         return tag_ptr(ret_conv, true);
34519 }
34520 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
34521         LDKCResult_ClosingSignedDecodeErrorZ* arg_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)untag_ptr(arg);
34522         int64_t ret_conv = CResult_ClosingSignedDecodeErrorZ_clone_ptr(arg_conv);
34523         return ret_conv;
34524 }
34525
34526 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
34527         LDKCResult_ClosingSignedDecodeErrorZ* orig_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)untag_ptr(orig);
34528         LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
34529         *ret_conv = CResult_ClosingSignedDecodeErrorZ_clone(orig_conv);
34530         return tag_ptr(ret_conv, true);
34531 }
34532
34533 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedFeeRangeDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
34534         LDKClosingSignedFeeRange o_conv;
34535         o_conv.inner = untag_ptr(o);
34536         o_conv.is_owned = ptr_is_owned(o);
34537         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
34538         o_conv = ClosingSignedFeeRange_clone(&o_conv);
34539         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
34540         *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_ok(o_conv);
34541         return tag_ptr(ret_conv, true);
34542 }
34543
34544 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedFeeRangeDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
34545         void* e_ptr = untag_ptr(e);
34546         CHECK_ACCESS(e_ptr);
34547         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
34548         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
34549         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
34550         *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_err(e_conv);
34551         return tag_ptr(ret_conv, true);
34552 }
34553
34554 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedFeeRangeDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
34555         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* o_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)untag_ptr(o);
34556         jboolean ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_is_ok(o_conv);
34557         return ret_conv;
34558 }
34559
34560 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedFeeRangeDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
34561         if (!ptr_is_owned(_res)) return;
34562         void* _res_ptr = untag_ptr(_res);
34563         CHECK_ACCESS(_res_ptr);
34564         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ _res_conv = *(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(_res_ptr);
34565         FREE(untag_ptr(_res));
34566         CResult_ClosingSignedFeeRangeDecodeErrorZ_free(_res_conv);
34567 }
34568
34569 static inline uint64_t CResult_ClosingSignedFeeRangeDecodeErrorZ_clone_ptr(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *NONNULL_PTR arg) {
34570         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
34571         *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(arg);
34572         return tag_ptr(ret_conv, true);
34573 }
34574 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedFeeRangeDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
34575         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* arg_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)untag_ptr(arg);
34576         int64_t ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_clone_ptr(arg_conv);
34577         return ret_conv;
34578 }
34579
34580 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedFeeRangeDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
34581         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* orig_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)untag_ptr(orig);
34582         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
34583         *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(orig_conv);
34584         return tag_ptr(ret_conv, true);
34585 }
34586
34587 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
34588         LDKCommitmentSigned o_conv;
34589         o_conv.inner = untag_ptr(o);
34590         o_conv.is_owned = ptr_is_owned(o);
34591         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
34592         o_conv = CommitmentSigned_clone(&o_conv);
34593         LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
34594         *ret_conv = CResult_CommitmentSignedDecodeErrorZ_ok(o_conv);
34595         return tag_ptr(ret_conv, true);
34596 }
34597
34598 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
34599         void* e_ptr = untag_ptr(e);
34600         CHECK_ACCESS(e_ptr);
34601         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
34602         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
34603         LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
34604         *ret_conv = CResult_CommitmentSignedDecodeErrorZ_err(e_conv);
34605         return tag_ptr(ret_conv, true);
34606 }
34607
34608 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
34609         LDKCResult_CommitmentSignedDecodeErrorZ* o_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)untag_ptr(o);
34610         jboolean ret_conv = CResult_CommitmentSignedDecodeErrorZ_is_ok(o_conv);
34611         return ret_conv;
34612 }
34613
34614 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
34615         if (!ptr_is_owned(_res)) return;
34616         void* _res_ptr = untag_ptr(_res);
34617         CHECK_ACCESS(_res_ptr);
34618         LDKCResult_CommitmentSignedDecodeErrorZ _res_conv = *(LDKCResult_CommitmentSignedDecodeErrorZ*)(_res_ptr);
34619         FREE(untag_ptr(_res));
34620         CResult_CommitmentSignedDecodeErrorZ_free(_res_conv);
34621 }
34622
34623 static inline uint64_t CResult_CommitmentSignedDecodeErrorZ_clone_ptr(LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR arg) {
34624         LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
34625         *ret_conv = CResult_CommitmentSignedDecodeErrorZ_clone(arg);
34626         return tag_ptr(ret_conv, true);
34627 }
34628 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
34629         LDKCResult_CommitmentSignedDecodeErrorZ* arg_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)untag_ptr(arg);
34630         int64_t ret_conv = CResult_CommitmentSignedDecodeErrorZ_clone_ptr(arg_conv);
34631         return ret_conv;
34632 }
34633
34634 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
34635         LDKCResult_CommitmentSignedDecodeErrorZ* orig_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)untag_ptr(orig);
34636         LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
34637         *ret_conv = CResult_CommitmentSignedDecodeErrorZ_clone(orig_conv);
34638         return tag_ptr(ret_conv, true);
34639 }
34640
34641 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
34642         LDKFundingCreated o_conv;
34643         o_conv.inner = untag_ptr(o);
34644         o_conv.is_owned = ptr_is_owned(o);
34645         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
34646         o_conv = FundingCreated_clone(&o_conv);
34647         LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
34648         *ret_conv = CResult_FundingCreatedDecodeErrorZ_ok(o_conv);
34649         return tag_ptr(ret_conv, true);
34650 }
34651
34652 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
34653         void* e_ptr = untag_ptr(e);
34654         CHECK_ACCESS(e_ptr);
34655         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
34656         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
34657         LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
34658         *ret_conv = CResult_FundingCreatedDecodeErrorZ_err(e_conv);
34659         return tag_ptr(ret_conv, true);
34660 }
34661
34662 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
34663         LDKCResult_FundingCreatedDecodeErrorZ* o_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)untag_ptr(o);
34664         jboolean ret_conv = CResult_FundingCreatedDecodeErrorZ_is_ok(o_conv);
34665         return ret_conv;
34666 }
34667
34668 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
34669         if (!ptr_is_owned(_res)) return;
34670         void* _res_ptr = untag_ptr(_res);
34671         CHECK_ACCESS(_res_ptr);
34672         LDKCResult_FundingCreatedDecodeErrorZ _res_conv = *(LDKCResult_FundingCreatedDecodeErrorZ*)(_res_ptr);
34673         FREE(untag_ptr(_res));
34674         CResult_FundingCreatedDecodeErrorZ_free(_res_conv);
34675 }
34676
34677 static inline uint64_t CResult_FundingCreatedDecodeErrorZ_clone_ptr(LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR arg) {
34678         LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
34679         *ret_conv = CResult_FundingCreatedDecodeErrorZ_clone(arg);
34680         return tag_ptr(ret_conv, true);
34681 }
34682 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
34683         LDKCResult_FundingCreatedDecodeErrorZ* arg_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)untag_ptr(arg);
34684         int64_t ret_conv = CResult_FundingCreatedDecodeErrorZ_clone_ptr(arg_conv);
34685         return ret_conv;
34686 }
34687
34688 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
34689         LDKCResult_FundingCreatedDecodeErrorZ* orig_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)untag_ptr(orig);
34690         LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
34691         *ret_conv = CResult_FundingCreatedDecodeErrorZ_clone(orig_conv);
34692         return tag_ptr(ret_conv, true);
34693 }
34694
34695 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
34696         LDKFundingSigned o_conv;
34697         o_conv.inner = untag_ptr(o);
34698         o_conv.is_owned = ptr_is_owned(o);
34699         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
34700         o_conv = FundingSigned_clone(&o_conv);
34701         LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
34702         *ret_conv = CResult_FundingSignedDecodeErrorZ_ok(o_conv);
34703         return tag_ptr(ret_conv, true);
34704 }
34705
34706 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
34707         void* e_ptr = untag_ptr(e);
34708         CHECK_ACCESS(e_ptr);
34709         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
34710         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
34711         LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
34712         *ret_conv = CResult_FundingSignedDecodeErrorZ_err(e_conv);
34713         return tag_ptr(ret_conv, true);
34714 }
34715
34716 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
34717         LDKCResult_FundingSignedDecodeErrorZ* o_conv = (LDKCResult_FundingSignedDecodeErrorZ*)untag_ptr(o);
34718         jboolean ret_conv = CResult_FundingSignedDecodeErrorZ_is_ok(o_conv);
34719         return ret_conv;
34720 }
34721
34722 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
34723         if (!ptr_is_owned(_res)) return;
34724         void* _res_ptr = untag_ptr(_res);
34725         CHECK_ACCESS(_res_ptr);
34726         LDKCResult_FundingSignedDecodeErrorZ _res_conv = *(LDKCResult_FundingSignedDecodeErrorZ*)(_res_ptr);
34727         FREE(untag_ptr(_res));
34728         CResult_FundingSignedDecodeErrorZ_free(_res_conv);
34729 }
34730
34731 static inline uint64_t CResult_FundingSignedDecodeErrorZ_clone_ptr(LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR arg) {
34732         LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
34733         *ret_conv = CResult_FundingSignedDecodeErrorZ_clone(arg);
34734         return tag_ptr(ret_conv, true);
34735 }
34736 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
34737         LDKCResult_FundingSignedDecodeErrorZ* arg_conv = (LDKCResult_FundingSignedDecodeErrorZ*)untag_ptr(arg);
34738         int64_t ret_conv = CResult_FundingSignedDecodeErrorZ_clone_ptr(arg_conv);
34739         return ret_conv;
34740 }
34741
34742 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
34743         LDKCResult_FundingSignedDecodeErrorZ* orig_conv = (LDKCResult_FundingSignedDecodeErrorZ*)untag_ptr(orig);
34744         LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
34745         *ret_conv = CResult_FundingSignedDecodeErrorZ_clone(orig_conv);
34746         return tag_ptr(ret_conv, true);
34747 }
34748
34749 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReadyDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
34750         LDKChannelReady o_conv;
34751         o_conv.inner = untag_ptr(o);
34752         o_conv.is_owned = ptr_is_owned(o);
34753         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
34754         o_conv = ChannelReady_clone(&o_conv);
34755         LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
34756         *ret_conv = CResult_ChannelReadyDecodeErrorZ_ok(o_conv);
34757         return tag_ptr(ret_conv, true);
34758 }
34759
34760 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReadyDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
34761         void* e_ptr = untag_ptr(e);
34762         CHECK_ACCESS(e_ptr);
34763         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
34764         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
34765         LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
34766         *ret_conv = CResult_ChannelReadyDecodeErrorZ_err(e_conv);
34767         return tag_ptr(ret_conv, true);
34768 }
34769
34770 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReadyDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
34771         LDKCResult_ChannelReadyDecodeErrorZ* o_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)untag_ptr(o);
34772         jboolean ret_conv = CResult_ChannelReadyDecodeErrorZ_is_ok(o_conv);
34773         return ret_conv;
34774 }
34775
34776 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReadyDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
34777         if (!ptr_is_owned(_res)) return;
34778         void* _res_ptr = untag_ptr(_res);
34779         CHECK_ACCESS(_res_ptr);
34780         LDKCResult_ChannelReadyDecodeErrorZ _res_conv = *(LDKCResult_ChannelReadyDecodeErrorZ*)(_res_ptr);
34781         FREE(untag_ptr(_res));
34782         CResult_ChannelReadyDecodeErrorZ_free(_res_conv);
34783 }
34784
34785 static inline uint64_t CResult_ChannelReadyDecodeErrorZ_clone_ptr(LDKCResult_ChannelReadyDecodeErrorZ *NONNULL_PTR arg) {
34786         LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
34787         *ret_conv = CResult_ChannelReadyDecodeErrorZ_clone(arg);
34788         return tag_ptr(ret_conv, true);
34789 }
34790 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReadyDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
34791         LDKCResult_ChannelReadyDecodeErrorZ* arg_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)untag_ptr(arg);
34792         int64_t ret_conv = CResult_ChannelReadyDecodeErrorZ_clone_ptr(arg_conv);
34793         return ret_conv;
34794 }
34795
34796 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReadyDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
34797         LDKCResult_ChannelReadyDecodeErrorZ* orig_conv = (LDKCResult_ChannelReadyDecodeErrorZ*)untag_ptr(orig);
34798         LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
34799         *ret_conv = CResult_ChannelReadyDecodeErrorZ_clone(orig_conv);
34800         return tag_ptr(ret_conv, true);
34801 }
34802
34803 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
34804         LDKInit o_conv;
34805         o_conv.inner = untag_ptr(o);
34806         o_conv.is_owned = ptr_is_owned(o);
34807         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
34808         o_conv = Init_clone(&o_conv);
34809         LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
34810         *ret_conv = CResult_InitDecodeErrorZ_ok(o_conv);
34811         return tag_ptr(ret_conv, true);
34812 }
34813
34814 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
34815         void* e_ptr = untag_ptr(e);
34816         CHECK_ACCESS(e_ptr);
34817         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
34818         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
34819         LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
34820         *ret_conv = CResult_InitDecodeErrorZ_err(e_conv);
34821         return tag_ptr(ret_conv, true);
34822 }
34823
34824 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
34825         LDKCResult_InitDecodeErrorZ* o_conv = (LDKCResult_InitDecodeErrorZ*)untag_ptr(o);
34826         jboolean ret_conv = CResult_InitDecodeErrorZ_is_ok(o_conv);
34827         return ret_conv;
34828 }
34829
34830 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
34831         if (!ptr_is_owned(_res)) return;
34832         void* _res_ptr = untag_ptr(_res);
34833         CHECK_ACCESS(_res_ptr);
34834         LDKCResult_InitDecodeErrorZ _res_conv = *(LDKCResult_InitDecodeErrorZ*)(_res_ptr);
34835         FREE(untag_ptr(_res));
34836         CResult_InitDecodeErrorZ_free(_res_conv);
34837 }
34838
34839 static inline uint64_t CResult_InitDecodeErrorZ_clone_ptr(LDKCResult_InitDecodeErrorZ *NONNULL_PTR arg) {
34840         LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
34841         *ret_conv = CResult_InitDecodeErrorZ_clone(arg);
34842         return tag_ptr(ret_conv, true);
34843 }
34844 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
34845         LDKCResult_InitDecodeErrorZ* arg_conv = (LDKCResult_InitDecodeErrorZ*)untag_ptr(arg);
34846         int64_t ret_conv = CResult_InitDecodeErrorZ_clone_ptr(arg_conv);
34847         return ret_conv;
34848 }
34849
34850 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
34851         LDKCResult_InitDecodeErrorZ* orig_conv = (LDKCResult_InitDecodeErrorZ*)untag_ptr(orig);
34852         LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
34853         *ret_conv = CResult_InitDecodeErrorZ_clone(orig_conv);
34854         return tag_ptr(ret_conv, true);
34855 }
34856
34857 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
34858         LDKOpenChannel o_conv;
34859         o_conv.inner = untag_ptr(o);
34860         o_conv.is_owned = ptr_is_owned(o);
34861         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
34862         o_conv = OpenChannel_clone(&o_conv);
34863         LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
34864         *ret_conv = CResult_OpenChannelDecodeErrorZ_ok(o_conv);
34865         return tag_ptr(ret_conv, true);
34866 }
34867
34868 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
34869         void* e_ptr = untag_ptr(e);
34870         CHECK_ACCESS(e_ptr);
34871         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
34872         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
34873         LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
34874         *ret_conv = CResult_OpenChannelDecodeErrorZ_err(e_conv);
34875         return tag_ptr(ret_conv, true);
34876 }
34877
34878 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
34879         LDKCResult_OpenChannelDecodeErrorZ* o_conv = (LDKCResult_OpenChannelDecodeErrorZ*)untag_ptr(o);
34880         jboolean ret_conv = CResult_OpenChannelDecodeErrorZ_is_ok(o_conv);
34881         return ret_conv;
34882 }
34883
34884 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
34885         if (!ptr_is_owned(_res)) return;
34886         void* _res_ptr = untag_ptr(_res);
34887         CHECK_ACCESS(_res_ptr);
34888         LDKCResult_OpenChannelDecodeErrorZ _res_conv = *(LDKCResult_OpenChannelDecodeErrorZ*)(_res_ptr);
34889         FREE(untag_ptr(_res));
34890         CResult_OpenChannelDecodeErrorZ_free(_res_conv);
34891 }
34892
34893 static inline uint64_t CResult_OpenChannelDecodeErrorZ_clone_ptr(LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR arg) {
34894         LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
34895         *ret_conv = CResult_OpenChannelDecodeErrorZ_clone(arg);
34896         return tag_ptr(ret_conv, true);
34897 }
34898 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
34899         LDKCResult_OpenChannelDecodeErrorZ* arg_conv = (LDKCResult_OpenChannelDecodeErrorZ*)untag_ptr(arg);
34900         int64_t ret_conv = CResult_OpenChannelDecodeErrorZ_clone_ptr(arg_conv);
34901         return ret_conv;
34902 }
34903
34904 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
34905         LDKCResult_OpenChannelDecodeErrorZ* orig_conv = (LDKCResult_OpenChannelDecodeErrorZ*)untag_ptr(orig);
34906         LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
34907         *ret_conv = CResult_OpenChannelDecodeErrorZ_clone(orig_conv);
34908         return tag_ptr(ret_conv, true);
34909 }
34910
34911 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelV2DecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
34912         LDKOpenChannelV2 o_conv;
34913         o_conv.inner = untag_ptr(o);
34914         o_conv.is_owned = ptr_is_owned(o);
34915         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
34916         o_conv = OpenChannelV2_clone(&o_conv);
34917         LDKCResult_OpenChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelV2DecodeErrorZ), "LDKCResult_OpenChannelV2DecodeErrorZ");
34918         *ret_conv = CResult_OpenChannelV2DecodeErrorZ_ok(o_conv);
34919         return tag_ptr(ret_conv, true);
34920 }
34921
34922 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelV2DecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
34923         void* e_ptr = untag_ptr(e);
34924         CHECK_ACCESS(e_ptr);
34925         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
34926         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
34927         LDKCResult_OpenChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelV2DecodeErrorZ), "LDKCResult_OpenChannelV2DecodeErrorZ");
34928         *ret_conv = CResult_OpenChannelV2DecodeErrorZ_err(e_conv);
34929         return tag_ptr(ret_conv, true);
34930 }
34931
34932 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelV2DecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
34933         LDKCResult_OpenChannelV2DecodeErrorZ* o_conv = (LDKCResult_OpenChannelV2DecodeErrorZ*)untag_ptr(o);
34934         jboolean ret_conv = CResult_OpenChannelV2DecodeErrorZ_is_ok(o_conv);
34935         return ret_conv;
34936 }
34937
34938 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelV2DecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
34939         if (!ptr_is_owned(_res)) return;
34940         void* _res_ptr = untag_ptr(_res);
34941         CHECK_ACCESS(_res_ptr);
34942         LDKCResult_OpenChannelV2DecodeErrorZ _res_conv = *(LDKCResult_OpenChannelV2DecodeErrorZ*)(_res_ptr);
34943         FREE(untag_ptr(_res));
34944         CResult_OpenChannelV2DecodeErrorZ_free(_res_conv);
34945 }
34946
34947 static inline uint64_t CResult_OpenChannelV2DecodeErrorZ_clone_ptr(LDKCResult_OpenChannelV2DecodeErrorZ *NONNULL_PTR arg) {
34948         LDKCResult_OpenChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelV2DecodeErrorZ), "LDKCResult_OpenChannelV2DecodeErrorZ");
34949         *ret_conv = CResult_OpenChannelV2DecodeErrorZ_clone(arg);
34950         return tag_ptr(ret_conv, true);
34951 }
34952 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelV2DecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
34953         LDKCResult_OpenChannelV2DecodeErrorZ* arg_conv = (LDKCResult_OpenChannelV2DecodeErrorZ*)untag_ptr(arg);
34954         int64_t ret_conv = CResult_OpenChannelV2DecodeErrorZ_clone_ptr(arg_conv);
34955         return ret_conv;
34956 }
34957
34958 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelV2DecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
34959         LDKCResult_OpenChannelV2DecodeErrorZ* orig_conv = (LDKCResult_OpenChannelV2DecodeErrorZ*)untag_ptr(orig);
34960         LDKCResult_OpenChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelV2DecodeErrorZ), "LDKCResult_OpenChannelV2DecodeErrorZ");
34961         *ret_conv = CResult_OpenChannelV2DecodeErrorZ_clone(orig_conv);
34962         return tag_ptr(ret_conv, true);
34963 }
34964
34965 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
34966         LDKRevokeAndACK o_conv;
34967         o_conv.inner = untag_ptr(o);
34968         o_conv.is_owned = ptr_is_owned(o);
34969         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
34970         o_conv = RevokeAndACK_clone(&o_conv);
34971         LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
34972         *ret_conv = CResult_RevokeAndACKDecodeErrorZ_ok(o_conv);
34973         return tag_ptr(ret_conv, true);
34974 }
34975
34976 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
34977         void* e_ptr = untag_ptr(e);
34978         CHECK_ACCESS(e_ptr);
34979         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
34980         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
34981         LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
34982         *ret_conv = CResult_RevokeAndACKDecodeErrorZ_err(e_conv);
34983         return tag_ptr(ret_conv, true);
34984 }
34985
34986 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
34987         LDKCResult_RevokeAndACKDecodeErrorZ* o_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)untag_ptr(o);
34988         jboolean ret_conv = CResult_RevokeAndACKDecodeErrorZ_is_ok(o_conv);
34989         return ret_conv;
34990 }
34991
34992 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
34993         if (!ptr_is_owned(_res)) return;
34994         void* _res_ptr = untag_ptr(_res);
34995         CHECK_ACCESS(_res_ptr);
34996         LDKCResult_RevokeAndACKDecodeErrorZ _res_conv = *(LDKCResult_RevokeAndACKDecodeErrorZ*)(_res_ptr);
34997         FREE(untag_ptr(_res));
34998         CResult_RevokeAndACKDecodeErrorZ_free(_res_conv);
34999 }
35000
35001 static inline uint64_t CResult_RevokeAndACKDecodeErrorZ_clone_ptr(LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR arg) {
35002         LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
35003         *ret_conv = CResult_RevokeAndACKDecodeErrorZ_clone(arg);
35004         return tag_ptr(ret_conv, true);
35005 }
35006 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
35007         LDKCResult_RevokeAndACKDecodeErrorZ* arg_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)untag_ptr(arg);
35008         int64_t ret_conv = CResult_RevokeAndACKDecodeErrorZ_clone_ptr(arg_conv);
35009         return ret_conv;
35010 }
35011
35012 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
35013         LDKCResult_RevokeAndACKDecodeErrorZ* orig_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)untag_ptr(orig);
35014         LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
35015         *ret_conv = CResult_RevokeAndACKDecodeErrorZ_clone(orig_conv);
35016         return tag_ptr(ret_conv, true);
35017 }
35018
35019 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
35020         LDKShutdown o_conv;
35021         o_conv.inner = untag_ptr(o);
35022         o_conv.is_owned = ptr_is_owned(o);
35023         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
35024         o_conv = Shutdown_clone(&o_conv);
35025         LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
35026         *ret_conv = CResult_ShutdownDecodeErrorZ_ok(o_conv);
35027         return tag_ptr(ret_conv, true);
35028 }
35029
35030 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
35031         void* e_ptr = untag_ptr(e);
35032         CHECK_ACCESS(e_ptr);
35033         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
35034         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
35035         LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
35036         *ret_conv = CResult_ShutdownDecodeErrorZ_err(e_conv);
35037         return tag_ptr(ret_conv, true);
35038 }
35039
35040 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
35041         LDKCResult_ShutdownDecodeErrorZ* o_conv = (LDKCResult_ShutdownDecodeErrorZ*)untag_ptr(o);
35042         jboolean ret_conv = CResult_ShutdownDecodeErrorZ_is_ok(o_conv);
35043         return ret_conv;
35044 }
35045
35046 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
35047         if (!ptr_is_owned(_res)) return;
35048         void* _res_ptr = untag_ptr(_res);
35049         CHECK_ACCESS(_res_ptr);
35050         LDKCResult_ShutdownDecodeErrorZ _res_conv = *(LDKCResult_ShutdownDecodeErrorZ*)(_res_ptr);
35051         FREE(untag_ptr(_res));
35052         CResult_ShutdownDecodeErrorZ_free(_res_conv);
35053 }
35054
35055 static inline uint64_t CResult_ShutdownDecodeErrorZ_clone_ptr(LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR arg) {
35056         LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
35057         *ret_conv = CResult_ShutdownDecodeErrorZ_clone(arg);
35058         return tag_ptr(ret_conv, true);
35059 }
35060 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
35061         LDKCResult_ShutdownDecodeErrorZ* arg_conv = (LDKCResult_ShutdownDecodeErrorZ*)untag_ptr(arg);
35062         int64_t ret_conv = CResult_ShutdownDecodeErrorZ_clone_ptr(arg_conv);
35063         return ret_conv;
35064 }
35065
35066 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
35067         LDKCResult_ShutdownDecodeErrorZ* orig_conv = (LDKCResult_ShutdownDecodeErrorZ*)untag_ptr(orig);
35068         LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
35069         *ret_conv = CResult_ShutdownDecodeErrorZ_clone(orig_conv);
35070         return tag_ptr(ret_conv, true);
35071 }
35072
35073 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
35074         LDKUpdateFailHTLC o_conv;
35075         o_conv.inner = untag_ptr(o);
35076         o_conv.is_owned = ptr_is_owned(o);
35077         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
35078         o_conv = UpdateFailHTLC_clone(&o_conv);
35079         LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
35080         *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_ok(o_conv);
35081         return tag_ptr(ret_conv, true);
35082 }
35083
35084 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
35085         void* e_ptr = untag_ptr(e);
35086         CHECK_ACCESS(e_ptr);
35087         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
35088         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
35089         LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
35090         *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_err(e_conv);
35091         return tag_ptr(ret_conv, true);
35092 }
35093
35094 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
35095         LDKCResult_UpdateFailHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)untag_ptr(o);
35096         jboolean ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_is_ok(o_conv);
35097         return ret_conv;
35098 }
35099
35100 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
35101         if (!ptr_is_owned(_res)) return;
35102         void* _res_ptr = untag_ptr(_res);
35103         CHECK_ACCESS(_res_ptr);
35104         LDKCResult_UpdateFailHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFailHTLCDecodeErrorZ*)(_res_ptr);
35105         FREE(untag_ptr(_res));
35106         CResult_UpdateFailHTLCDecodeErrorZ_free(_res_conv);
35107 }
35108
35109 static inline uint64_t CResult_UpdateFailHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR arg) {
35110         LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
35111         *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_clone(arg);
35112         return tag_ptr(ret_conv, true);
35113 }
35114 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
35115         LDKCResult_UpdateFailHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)untag_ptr(arg);
35116         int64_t ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_clone_ptr(arg_conv);
35117         return ret_conv;
35118 }
35119
35120 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
35121         LDKCResult_UpdateFailHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)untag_ptr(orig);
35122         LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
35123         *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_clone(orig_conv);
35124         return tag_ptr(ret_conv, true);
35125 }
35126
35127 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
35128         LDKUpdateFailMalformedHTLC o_conv;
35129         o_conv.inner = untag_ptr(o);
35130         o_conv.is_owned = ptr_is_owned(o);
35131         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
35132         o_conv = UpdateFailMalformedHTLC_clone(&o_conv);
35133         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
35134         *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(o_conv);
35135         return tag_ptr(ret_conv, true);
35136 }
35137
35138 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
35139         void* e_ptr = untag_ptr(e);
35140         CHECK_ACCESS(e_ptr);
35141         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
35142         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
35143         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
35144         *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(e_conv);
35145         return tag_ptr(ret_conv, true);
35146 }
35147
35148 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
35149         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)untag_ptr(o);
35150         jboolean ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_is_ok(o_conv);
35151         return ret_conv;
35152 }
35153
35154 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
35155         if (!ptr_is_owned(_res)) return;
35156         void* _res_ptr = untag_ptr(_res);
35157         CHECK_ACCESS(_res_ptr);
35158         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(_res_ptr);
35159         FREE(untag_ptr(_res));
35160         CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(_res_conv);
35161 }
35162
35163 static inline uint64_t CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR arg) {
35164         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
35165         *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(arg);
35166         return tag_ptr(ret_conv, true);
35167 }
35168 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
35169         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)untag_ptr(arg);
35170         int64_t ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone_ptr(arg_conv);
35171         return ret_conv;
35172 }
35173
35174 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
35175         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)untag_ptr(orig);
35176         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
35177         *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(orig_conv);
35178         return tag_ptr(ret_conv, true);
35179 }
35180
35181 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
35182         LDKUpdateFee o_conv;
35183         o_conv.inner = untag_ptr(o);
35184         o_conv.is_owned = ptr_is_owned(o);
35185         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
35186         o_conv = UpdateFee_clone(&o_conv);
35187         LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
35188         *ret_conv = CResult_UpdateFeeDecodeErrorZ_ok(o_conv);
35189         return tag_ptr(ret_conv, true);
35190 }
35191
35192 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
35193         void* e_ptr = untag_ptr(e);
35194         CHECK_ACCESS(e_ptr);
35195         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
35196         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
35197         LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
35198         *ret_conv = CResult_UpdateFeeDecodeErrorZ_err(e_conv);
35199         return tag_ptr(ret_conv, true);
35200 }
35201
35202 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
35203         LDKCResult_UpdateFeeDecodeErrorZ* o_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)untag_ptr(o);
35204         jboolean ret_conv = CResult_UpdateFeeDecodeErrorZ_is_ok(o_conv);
35205         return ret_conv;
35206 }
35207
35208 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
35209         if (!ptr_is_owned(_res)) return;
35210         void* _res_ptr = untag_ptr(_res);
35211         CHECK_ACCESS(_res_ptr);
35212         LDKCResult_UpdateFeeDecodeErrorZ _res_conv = *(LDKCResult_UpdateFeeDecodeErrorZ*)(_res_ptr);
35213         FREE(untag_ptr(_res));
35214         CResult_UpdateFeeDecodeErrorZ_free(_res_conv);
35215 }
35216
35217 static inline uint64_t CResult_UpdateFeeDecodeErrorZ_clone_ptr(LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR arg) {
35218         LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
35219         *ret_conv = CResult_UpdateFeeDecodeErrorZ_clone(arg);
35220         return tag_ptr(ret_conv, true);
35221 }
35222 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
35223         LDKCResult_UpdateFeeDecodeErrorZ* arg_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)untag_ptr(arg);
35224         int64_t ret_conv = CResult_UpdateFeeDecodeErrorZ_clone_ptr(arg_conv);
35225         return ret_conv;
35226 }
35227
35228 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
35229         LDKCResult_UpdateFeeDecodeErrorZ* orig_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)untag_ptr(orig);
35230         LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
35231         *ret_conv = CResult_UpdateFeeDecodeErrorZ_clone(orig_conv);
35232         return tag_ptr(ret_conv, true);
35233 }
35234
35235 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
35236         LDKUpdateFulfillHTLC o_conv;
35237         o_conv.inner = untag_ptr(o);
35238         o_conv.is_owned = ptr_is_owned(o);
35239         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
35240         o_conv = UpdateFulfillHTLC_clone(&o_conv);
35241         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
35242         *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_ok(o_conv);
35243         return tag_ptr(ret_conv, true);
35244 }
35245
35246 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
35247         void* e_ptr = untag_ptr(e);
35248         CHECK_ACCESS(e_ptr);
35249         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
35250         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
35251         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
35252         *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_err(e_conv);
35253         return tag_ptr(ret_conv, true);
35254 }
35255
35256 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
35257         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)untag_ptr(o);
35258         jboolean ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_is_ok(o_conv);
35259         return ret_conv;
35260 }
35261
35262 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
35263         if (!ptr_is_owned(_res)) return;
35264         void* _res_ptr = untag_ptr(_res);
35265         CHECK_ACCESS(_res_ptr);
35266         LDKCResult_UpdateFulfillHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(_res_ptr);
35267         FREE(untag_ptr(_res));
35268         CResult_UpdateFulfillHTLCDecodeErrorZ_free(_res_conv);
35269 }
35270
35271 static inline uint64_t CResult_UpdateFulfillHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR arg) {
35272         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
35273         *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_clone(arg);
35274         return tag_ptr(ret_conv, true);
35275 }
35276 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
35277         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)untag_ptr(arg);
35278         int64_t ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_clone_ptr(arg_conv);
35279         return ret_conv;
35280 }
35281
35282 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
35283         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)untag_ptr(orig);
35284         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
35285         *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_clone(orig_conv);
35286         return tag_ptr(ret_conv, true);
35287 }
35288
35289 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OnionPacketDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
35290         LDKOnionPacket o_conv;
35291         o_conv.inner = untag_ptr(o);
35292         o_conv.is_owned = ptr_is_owned(o);
35293         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
35294         o_conv = OnionPacket_clone(&o_conv);
35295         LDKCResult_OnionPacketDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionPacketDecodeErrorZ), "LDKCResult_OnionPacketDecodeErrorZ");
35296         *ret_conv = CResult_OnionPacketDecodeErrorZ_ok(o_conv);
35297         return tag_ptr(ret_conv, true);
35298 }
35299
35300 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OnionPacketDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
35301         void* e_ptr = untag_ptr(e);
35302         CHECK_ACCESS(e_ptr);
35303         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
35304         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
35305         LDKCResult_OnionPacketDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionPacketDecodeErrorZ), "LDKCResult_OnionPacketDecodeErrorZ");
35306         *ret_conv = CResult_OnionPacketDecodeErrorZ_err(e_conv);
35307         return tag_ptr(ret_conv, true);
35308 }
35309
35310 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1OnionPacketDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
35311         LDKCResult_OnionPacketDecodeErrorZ* o_conv = (LDKCResult_OnionPacketDecodeErrorZ*)untag_ptr(o);
35312         jboolean ret_conv = CResult_OnionPacketDecodeErrorZ_is_ok(o_conv);
35313         return ret_conv;
35314 }
35315
35316 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1OnionPacketDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
35317         if (!ptr_is_owned(_res)) return;
35318         void* _res_ptr = untag_ptr(_res);
35319         CHECK_ACCESS(_res_ptr);
35320         LDKCResult_OnionPacketDecodeErrorZ _res_conv = *(LDKCResult_OnionPacketDecodeErrorZ*)(_res_ptr);
35321         FREE(untag_ptr(_res));
35322         CResult_OnionPacketDecodeErrorZ_free(_res_conv);
35323 }
35324
35325 static inline uint64_t CResult_OnionPacketDecodeErrorZ_clone_ptr(LDKCResult_OnionPacketDecodeErrorZ *NONNULL_PTR arg) {
35326         LDKCResult_OnionPacketDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionPacketDecodeErrorZ), "LDKCResult_OnionPacketDecodeErrorZ");
35327         *ret_conv = CResult_OnionPacketDecodeErrorZ_clone(arg);
35328         return tag_ptr(ret_conv, true);
35329 }
35330 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OnionPacketDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
35331         LDKCResult_OnionPacketDecodeErrorZ* arg_conv = (LDKCResult_OnionPacketDecodeErrorZ*)untag_ptr(arg);
35332         int64_t ret_conv = CResult_OnionPacketDecodeErrorZ_clone_ptr(arg_conv);
35333         return ret_conv;
35334 }
35335
35336 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OnionPacketDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
35337         LDKCResult_OnionPacketDecodeErrorZ* orig_conv = (LDKCResult_OnionPacketDecodeErrorZ*)untag_ptr(orig);
35338         LDKCResult_OnionPacketDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionPacketDecodeErrorZ), "LDKCResult_OnionPacketDecodeErrorZ");
35339         *ret_conv = CResult_OnionPacketDecodeErrorZ_clone(orig_conv);
35340         return tag_ptr(ret_conv, true);
35341 }
35342
35343 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
35344         LDKUpdateAddHTLC o_conv;
35345         o_conv.inner = untag_ptr(o);
35346         o_conv.is_owned = ptr_is_owned(o);
35347         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
35348         o_conv = UpdateAddHTLC_clone(&o_conv);
35349         LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
35350         *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_ok(o_conv);
35351         return tag_ptr(ret_conv, true);
35352 }
35353
35354 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
35355         void* e_ptr = untag_ptr(e);
35356         CHECK_ACCESS(e_ptr);
35357         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
35358         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
35359         LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
35360         *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_err(e_conv);
35361         return tag_ptr(ret_conv, true);
35362 }
35363
35364 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
35365         LDKCResult_UpdateAddHTLCDecodeErrorZ* o_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)untag_ptr(o);
35366         jboolean ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_is_ok(o_conv);
35367         return ret_conv;
35368 }
35369
35370 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
35371         if (!ptr_is_owned(_res)) return;
35372         void* _res_ptr = untag_ptr(_res);
35373         CHECK_ACCESS(_res_ptr);
35374         LDKCResult_UpdateAddHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateAddHTLCDecodeErrorZ*)(_res_ptr);
35375         FREE(untag_ptr(_res));
35376         CResult_UpdateAddHTLCDecodeErrorZ_free(_res_conv);
35377 }
35378
35379 static inline uint64_t CResult_UpdateAddHTLCDecodeErrorZ_clone_ptr(LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR arg) {
35380         LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
35381         *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_clone(arg);
35382         return tag_ptr(ret_conv, true);
35383 }
35384 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
35385         LDKCResult_UpdateAddHTLCDecodeErrorZ* arg_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)untag_ptr(arg);
35386         int64_t ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_clone_ptr(arg_conv);
35387         return ret_conv;
35388 }
35389
35390 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
35391         LDKCResult_UpdateAddHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)untag_ptr(orig);
35392         LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
35393         *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_clone(orig_conv);
35394         return tag_ptr(ret_conv, true);
35395 }
35396
35397 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OnionMessageDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
35398         LDKOnionMessage o_conv;
35399         o_conv.inner = untag_ptr(o);
35400         o_conv.is_owned = ptr_is_owned(o);
35401         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
35402         o_conv = OnionMessage_clone(&o_conv);
35403         LDKCResult_OnionMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessageDecodeErrorZ), "LDKCResult_OnionMessageDecodeErrorZ");
35404         *ret_conv = CResult_OnionMessageDecodeErrorZ_ok(o_conv);
35405         return tag_ptr(ret_conv, true);
35406 }
35407
35408 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OnionMessageDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
35409         void* e_ptr = untag_ptr(e);
35410         CHECK_ACCESS(e_ptr);
35411         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
35412         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
35413         LDKCResult_OnionMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessageDecodeErrorZ), "LDKCResult_OnionMessageDecodeErrorZ");
35414         *ret_conv = CResult_OnionMessageDecodeErrorZ_err(e_conv);
35415         return tag_ptr(ret_conv, true);
35416 }
35417
35418 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1OnionMessageDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
35419         LDKCResult_OnionMessageDecodeErrorZ* o_conv = (LDKCResult_OnionMessageDecodeErrorZ*)untag_ptr(o);
35420         jboolean ret_conv = CResult_OnionMessageDecodeErrorZ_is_ok(o_conv);
35421         return ret_conv;
35422 }
35423
35424 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1OnionMessageDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
35425         if (!ptr_is_owned(_res)) return;
35426         void* _res_ptr = untag_ptr(_res);
35427         CHECK_ACCESS(_res_ptr);
35428         LDKCResult_OnionMessageDecodeErrorZ _res_conv = *(LDKCResult_OnionMessageDecodeErrorZ*)(_res_ptr);
35429         FREE(untag_ptr(_res));
35430         CResult_OnionMessageDecodeErrorZ_free(_res_conv);
35431 }
35432
35433 static inline uint64_t CResult_OnionMessageDecodeErrorZ_clone_ptr(LDKCResult_OnionMessageDecodeErrorZ *NONNULL_PTR arg) {
35434         LDKCResult_OnionMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessageDecodeErrorZ), "LDKCResult_OnionMessageDecodeErrorZ");
35435         *ret_conv = CResult_OnionMessageDecodeErrorZ_clone(arg);
35436         return tag_ptr(ret_conv, true);
35437 }
35438 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OnionMessageDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
35439         LDKCResult_OnionMessageDecodeErrorZ* arg_conv = (LDKCResult_OnionMessageDecodeErrorZ*)untag_ptr(arg);
35440         int64_t ret_conv = CResult_OnionMessageDecodeErrorZ_clone_ptr(arg_conv);
35441         return ret_conv;
35442 }
35443
35444 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OnionMessageDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
35445         LDKCResult_OnionMessageDecodeErrorZ* orig_conv = (LDKCResult_OnionMessageDecodeErrorZ*)untag_ptr(orig);
35446         LDKCResult_OnionMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessageDecodeErrorZ), "LDKCResult_OnionMessageDecodeErrorZ");
35447         *ret_conv = CResult_OnionMessageDecodeErrorZ_clone(orig_conv);
35448         return tag_ptr(ret_conv, true);
35449 }
35450
35451 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FinalOnionHopDataDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
35452         LDKFinalOnionHopData o_conv;
35453         o_conv.inner = untag_ptr(o);
35454         o_conv.is_owned = ptr_is_owned(o);
35455         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
35456         o_conv = FinalOnionHopData_clone(&o_conv);
35457         LDKCResult_FinalOnionHopDataDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FinalOnionHopDataDecodeErrorZ), "LDKCResult_FinalOnionHopDataDecodeErrorZ");
35458         *ret_conv = CResult_FinalOnionHopDataDecodeErrorZ_ok(o_conv);
35459         return tag_ptr(ret_conv, true);
35460 }
35461
35462 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FinalOnionHopDataDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
35463         void* e_ptr = untag_ptr(e);
35464         CHECK_ACCESS(e_ptr);
35465         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
35466         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
35467         LDKCResult_FinalOnionHopDataDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FinalOnionHopDataDecodeErrorZ), "LDKCResult_FinalOnionHopDataDecodeErrorZ");
35468         *ret_conv = CResult_FinalOnionHopDataDecodeErrorZ_err(e_conv);
35469         return tag_ptr(ret_conv, true);
35470 }
35471
35472 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1FinalOnionHopDataDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
35473         LDKCResult_FinalOnionHopDataDecodeErrorZ* o_conv = (LDKCResult_FinalOnionHopDataDecodeErrorZ*)untag_ptr(o);
35474         jboolean ret_conv = CResult_FinalOnionHopDataDecodeErrorZ_is_ok(o_conv);
35475         return ret_conv;
35476 }
35477
35478 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1FinalOnionHopDataDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
35479         if (!ptr_is_owned(_res)) return;
35480         void* _res_ptr = untag_ptr(_res);
35481         CHECK_ACCESS(_res_ptr);
35482         LDKCResult_FinalOnionHopDataDecodeErrorZ _res_conv = *(LDKCResult_FinalOnionHopDataDecodeErrorZ*)(_res_ptr);
35483         FREE(untag_ptr(_res));
35484         CResult_FinalOnionHopDataDecodeErrorZ_free(_res_conv);
35485 }
35486
35487 static inline uint64_t CResult_FinalOnionHopDataDecodeErrorZ_clone_ptr(LDKCResult_FinalOnionHopDataDecodeErrorZ *NONNULL_PTR arg) {
35488         LDKCResult_FinalOnionHopDataDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FinalOnionHopDataDecodeErrorZ), "LDKCResult_FinalOnionHopDataDecodeErrorZ");
35489         *ret_conv = CResult_FinalOnionHopDataDecodeErrorZ_clone(arg);
35490         return tag_ptr(ret_conv, true);
35491 }
35492 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FinalOnionHopDataDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
35493         LDKCResult_FinalOnionHopDataDecodeErrorZ* arg_conv = (LDKCResult_FinalOnionHopDataDecodeErrorZ*)untag_ptr(arg);
35494         int64_t ret_conv = CResult_FinalOnionHopDataDecodeErrorZ_clone_ptr(arg_conv);
35495         return ret_conv;
35496 }
35497
35498 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FinalOnionHopDataDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
35499         LDKCResult_FinalOnionHopDataDecodeErrorZ* orig_conv = (LDKCResult_FinalOnionHopDataDecodeErrorZ*)untag_ptr(orig);
35500         LDKCResult_FinalOnionHopDataDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FinalOnionHopDataDecodeErrorZ), "LDKCResult_FinalOnionHopDataDecodeErrorZ");
35501         *ret_conv = CResult_FinalOnionHopDataDecodeErrorZ_clone(orig_conv);
35502         return tag_ptr(ret_conv, true);
35503 }
35504
35505 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
35506         LDKPing o_conv;
35507         o_conv.inner = untag_ptr(o);
35508         o_conv.is_owned = ptr_is_owned(o);
35509         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
35510         o_conv = Ping_clone(&o_conv);
35511         LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
35512         *ret_conv = CResult_PingDecodeErrorZ_ok(o_conv);
35513         return tag_ptr(ret_conv, true);
35514 }
35515
35516 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
35517         void* e_ptr = untag_ptr(e);
35518         CHECK_ACCESS(e_ptr);
35519         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
35520         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
35521         LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
35522         *ret_conv = CResult_PingDecodeErrorZ_err(e_conv);
35523         return tag_ptr(ret_conv, true);
35524 }
35525
35526 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
35527         LDKCResult_PingDecodeErrorZ* o_conv = (LDKCResult_PingDecodeErrorZ*)untag_ptr(o);
35528         jboolean ret_conv = CResult_PingDecodeErrorZ_is_ok(o_conv);
35529         return ret_conv;
35530 }
35531
35532 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
35533         if (!ptr_is_owned(_res)) return;
35534         void* _res_ptr = untag_ptr(_res);
35535         CHECK_ACCESS(_res_ptr);
35536         LDKCResult_PingDecodeErrorZ _res_conv = *(LDKCResult_PingDecodeErrorZ*)(_res_ptr);
35537         FREE(untag_ptr(_res));
35538         CResult_PingDecodeErrorZ_free(_res_conv);
35539 }
35540
35541 static inline uint64_t CResult_PingDecodeErrorZ_clone_ptr(LDKCResult_PingDecodeErrorZ *NONNULL_PTR arg) {
35542         LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
35543         *ret_conv = CResult_PingDecodeErrorZ_clone(arg);
35544         return tag_ptr(ret_conv, true);
35545 }
35546 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
35547         LDKCResult_PingDecodeErrorZ* arg_conv = (LDKCResult_PingDecodeErrorZ*)untag_ptr(arg);
35548         int64_t ret_conv = CResult_PingDecodeErrorZ_clone_ptr(arg_conv);
35549         return ret_conv;
35550 }
35551
35552 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
35553         LDKCResult_PingDecodeErrorZ* orig_conv = (LDKCResult_PingDecodeErrorZ*)untag_ptr(orig);
35554         LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
35555         *ret_conv = CResult_PingDecodeErrorZ_clone(orig_conv);
35556         return tag_ptr(ret_conv, true);
35557 }
35558
35559 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
35560         LDKPong o_conv;
35561         o_conv.inner = untag_ptr(o);
35562         o_conv.is_owned = ptr_is_owned(o);
35563         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
35564         o_conv = Pong_clone(&o_conv);
35565         LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
35566         *ret_conv = CResult_PongDecodeErrorZ_ok(o_conv);
35567         return tag_ptr(ret_conv, true);
35568 }
35569
35570 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
35571         void* e_ptr = untag_ptr(e);
35572         CHECK_ACCESS(e_ptr);
35573         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
35574         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
35575         LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
35576         *ret_conv = CResult_PongDecodeErrorZ_err(e_conv);
35577         return tag_ptr(ret_conv, true);
35578 }
35579
35580 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
35581         LDKCResult_PongDecodeErrorZ* o_conv = (LDKCResult_PongDecodeErrorZ*)untag_ptr(o);
35582         jboolean ret_conv = CResult_PongDecodeErrorZ_is_ok(o_conv);
35583         return ret_conv;
35584 }
35585
35586 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
35587         if (!ptr_is_owned(_res)) return;
35588         void* _res_ptr = untag_ptr(_res);
35589         CHECK_ACCESS(_res_ptr);
35590         LDKCResult_PongDecodeErrorZ _res_conv = *(LDKCResult_PongDecodeErrorZ*)(_res_ptr);
35591         FREE(untag_ptr(_res));
35592         CResult_PongDecodeErrorZ_free(_res_conv);
35593 }
35594
35595 static inline uint64_t CResult_PongDecodeErrorZ_clone_ptr(LDKCResult_PongDecodeErrorZ *NONNULL_PTR arg) {
35596         LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
35597         *ret_conv = CResult_PongDecodeErrorZ_clone(arg);
35598         return tag_ptr(ret_conv, true);
35599 }
35600 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
35601         LDKCResult_PongDecodeErrorZ* arg_conv = (LDKCResult_PongDecodeErrorZ*)untag_ptr(arg);
35602         int64_t ret_conv = CResult_PongDecodeErrorZ_clone_ptr(arg_conv);
35603         return ret_conv;
35604 }
35605
35606 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
35607         LDKCResult_PongDecodeErrorZ* orig_conv = (LDKCResult_PongDecodeErrorZ*)untag_ptr(orig);
35608         LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
35609         *ret_conv = CResult_PongDecodeErrorZ_clone(orig_conv);
35610         return tag_ptr(ret_conv, true);
35611 }
35612
35613 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
35614         LDKUnsignedChannelAnnouncement o_conv;
35615         o_conv.inner = untag_ptr(o);
35616         o_conv.is_owned = ptr_is_owned(o);
35617         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
35618         o_conv = UnsignedChannelAnnouncement_clone(&o_conv);
35619         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
35620         *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(o_conv);
35621         return tag_ptr(ret_conv, true);
35622 }
35623
35624 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
35625         void* e_ptr = untag_ptr(e);
35626         CHECK_ACCESS(e_ptr);
35627         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
35628         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
35629         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
35630         *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(e_conv);
35631         return tag_ptr(ret_conv, true);
35632 }
35633
35634 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
35635         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* o_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)untag_ptr(o);
35636         jboolean ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_is_ok(o_conv);
35637         return ret_conv;
35638 }
35639
35640 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
35641         if (!ptr_is_owned(_res)) return;
35642         void* _res_ptr = untag_ptr(_res);
35643         CHECK_ACCESS(_res_ptr);
35644         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(_res_ptr);
35645         FREE(untag_ptr(_res));
35646         CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(_res_conv);
35647 }
35648
35649 static inline uint64_t CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
35650         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
35651         *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(arg);
35652         return tag_ptr(ret_conv, true);
35653 }
35654 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
35655         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)untag_ptr(arg);
35656         int64_t ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
35657         return ret_conv;
35658 }
35659
35660 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
35661         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)untag_ptr(orig);
35662         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
35663         *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(orig_conv);
35664         return tag_ptr(ret_conv, true);
35665 }
35666
35667 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
35668         LDKChannelAnnouncement o_conv;
35669         o_conv.inner = untag_ptr(o);
35670         o_conv.is_owned = ptr_is_owned(o);
35671         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
35672         o_conv = ChannelAnnouncement_clone(&o_conv);
35673         LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
35674         *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_ok(o_conv);
35675         return tag_ptr(ret_conv, true);
35676 }
35677
35678 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
35679         void* e_ptr = untag_ptr(e);
35680         CHECK_ACCESS(e_ptr);
35681         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
35682         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
35683         LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
35684         *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_err(e_conv);
35685         return tag_ptr(ret_conv, true);
35686 }
35687
35688 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
35689         LDKCResult_ChannelAnnouncementDecodeErrorZ* o_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)untag_ptr(o);
35690         jboolean ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_is_ok(o_conv);
35691         return ret_conv;
35692 }
35693
35694 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
35695         if (!ptr_is_owned(_res)) return;
35696         void* _res_ptr = untag_ptr(_res);
35697         CHECK_ACCESS(_res_ptr);
35698         LDKCResult_ChannelAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_ChannelAnnouncementDecodeErrorZ*)(_res_ptr);
35699         FREE(untag_ptr(_res));
35700         CResult_ChannelAnnouncementDecodeErrorZ_free(_res_conv);
35701 }
35702
35703 static inline uint64_t CResult_ChannelAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
35704         LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
35705         *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_clone(arg);
35706         return tag_ptr(ret_conv, true);
35707 }
35708 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
35709         LDKCResult_ChannelAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)untag_ptr(arg);
35710         int64_t ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
35711         return ret_conv;
35712 }
35713
35714 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
35715         LDKCResult_ChannelAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)untag_ptr(orig);
35716         LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
35717         *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_clone(orig_conv);
35718         return tag_ptr(ret_conv, true);
35719 }
35720
35721 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
35722         LDKUnsignedChannelUpdate o_conv;
35723         o_conv.inner = untag_ptr(o);
35724         o_conv.is_owned = ptr_is_owned(o);
35725         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
35726         o_conv = UnsignedChannelUpdate_clone(&o_conv);
35727         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
35728         *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_ok(o_conv);
35729         return tag_ptr(ret_conv, true);
35730 }
35731
35732 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
35733         void* e_ptr = untag_ptr(e);
35734         CHECK_ACCESS(e_ptr);
35735         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
35736         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
35737         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
35738         *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_err(e_conv);
35739         return tag_ptr(ret_conv, true);
35740 }
35741
35742 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
35743         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* o_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)untag_ptr(o);
35744         jboolean ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_is_ok(o_conv);
35745         return ret_conv;
35746 }
35747
35748 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
35749         if (!ptr_is_owned(_res)) return;
35750         void* _res_ptr = untag_ptr(_res);
35751         CHECK_ACCESS(_res_ptr);
35752         LDKCResult_UnsignedChannelUpdateDecodeErrorZ _res_conv = *(LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(_res_ptr);
35753         FREE(untag_ptr(_res));
35754         CResult_UnsignedChannelUpdateDecodeErrorZ_free(_res_conv);
35755 }
35756
35757 static inline uint64_t CResult_UnsignedChannelUpdateDecodeErrorZ_clone_ptr(LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR arg) {
35758         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
35759         *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_clone(arg);
35760         return tag_ptr(ret_conv, true);
35761 }
35762 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
35763         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* arg_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)untag_ptr(arg);
35764         int64_t ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_clone_ptr(arg_conv);
35765         return ret_conv;
35766 }
35767
35768 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
35769         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* orig_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)untag_ptr(orig);
35770         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
35771         *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_clone(orig_conv);
35772         return tag_ptr(ret_conv, true);
35773 }
35774
35775 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
35776         LDKChannelUpdate o_conv;
35777         o_conv.inner = untag_ptr(o);
35778         o_conv.is_owned = ptr_is_owned(o);
35779         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
35780         o_conv = ChannelUpdate_clone(&o_conv);
35781         LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
35782         *ret_conv = CResult_ChannelUpdateDecodeErrorZ_ok(o_conv);
35783         return tag_ptr(ret_conv, true);
35784 }
35785
35786 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
35787         void* e_ptr = untag_ptr(e);
35788         CHECK_ACCESS(e_ptr);
35789         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
35790         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
35791         LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
35792         *ret_conv = CResult_ChannelUpdateDecodeErrorZ_err(e_conv);
35793         return tag_ptr(ret_conv, true);
35794 }
35795
35796 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
35797         LDKCResult_ChannelUpdateDecodeErrorZ* o_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)untag_ptr(o);
35798         jboolean ret_conv = CResult_ChannelUpdateDecodeErrorZ_is_ok(o_conv);
35799         return ret_conv;
35800 }
35801
35802 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
35803         if (!ptr_is_owned(_res)) return;
35804         void* _res_ptr = untag_ptr(_res);
35805         CHECK_ACCESS(_res_ptr);
35806         LDKCResult_ChannelUpdateDecodeErrorZ _res_conv = *(LDKCResult_ChannelUpdateDecodeErrorZ*)(_res_ptr);
35807         FREE(untag_ptr(_res));
35808         CResult_ChannelUpdateDecodeErrorZ_free(_res_conv);
35809 }
35810
35811 static inline uint64_t CResult_ChannelUpdateDecodeErrorZ_clone_ptr(LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR arg) {
35812         LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
35813         *ret_conv = CResult_ChannelUpdateDecodeErrorZ_clone(arg);
35814         return tag_ptr(ret_conv, true);
35815 }
35816 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
35817         LDKCResult_ChannelUpdateDecodeErrorZ* arg_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)untag_ptr(arg);
35818         int64_t ret_conv = CResult_ChannelUpdateDecodeErrorZ_clone_ptr(arg_conv);
35819         return ret_conv;
35820 }
35821
35822 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
35823         LDKCResult_ChannelUpdateDecodeErrorZ* orig_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)untag_ptr(orig);
35824         LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
35825         *ret_conv = CResult_ChannelUpdateDecodeErrorZ_clone(orig_conv);
35826         return tag_ptr(ret_conv, true);
35827 }
35828
35829 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
35830         LDKErrorMessage o_conv;
35831         o_conv.inner = untag_ptr(o);
35832         o_conv.is_owned = ptr_is_owned(o);
35833         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
35834         o_conv = ErrorMessage_clone(&o_conv);
35835         LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
35836         *ret_conv = CResult_ErrorMessageDecodeErrorZ_ok(o_conv);
35837         return tag_ptr(ret_conv, true);
35838 }
35839
35840 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
35841         void* e_ptr = untag_ptr(e);
35842         CHECK_ACCESS(e_ptr);
35843         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
35844         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
35845         LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
35846         *ret_conv = CResult_ErrorMessageDecodeErrorZ_err(e_conv);
35847         return tag_ptr(ret_conv, true);
35848 }
35849
35850 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
35851         LDKCResult_ErrorMessageDecodeErrorZ* o_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)untag_ptr(o);
35852         jboolean ret_conv = CResult_ErrorMessageDecodeErrorZ_is_ok(o_conv);
35853         return ret_conv;
35854 }
35855
35856 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
35857         if (!ptr_is_owned(_res)) return;
35858         void* _res_ptr = untag_ptr(_res);
35859         CHECK_ACCESS(_res_ptr);
35860         LDKCResult_ErrorMessageDecodeErrorZ _res_conv = *(LDKCResult_ErrorMessageDecodeErrorZ*)(_res_ptr);
35861         FREE(untag_ptr(_res));
35862         CResult_ErrorMessageDecodeErrorZ_free(_res_conv);
35863 }
35864
35865 static inline uint64_t CResult_ErrorMessageDecodeErrorZ_clone_ptr(LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR arg) {
35866         LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
35867         *ret_conv = CResult_ErrorMessageDecodeErrorZ_clone(arg);
35868         return tag_ptr(ret_conv, true);
35869 }
35870 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
35871         LDKCResult_ErrorMessageDecodeErrorZ* arg_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)untag_ptr(arg);
35872         int64_t ret_conv = CResult_ErrorMessageDecodeErrorZ_clone_ptr(arg_conv);
35873         return ret_conv;
35874 }
35875
35876 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
35877         LDKCResult_ErrorMessageDecodeErrorZ* orig_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)untag_ptr(orig);
35878         LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
35879         *ret_conv = CResult_ErrorMessageDecodeErrorZ_clone(orig_conv);
35880         return tag_ptr(ret_conv, true);
35881 }
35882
35883 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1WarningMessageDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
35884         LDKWarningMessage o_conv;
35885         o_conv.inner = untag_ptr(o);
35886         o_conv.is_owned = ptr_is_owned(o);
35887         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
35888         o_conv = WarningMessage_clone(&o_conv);
35889         LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
35890         *ret_conv = CResult_WarningMessageDecodeErrorZ_ok(o_conv);
35891         return tag_ptr(ret_conv, true);
35892 }
35893
35894 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1WarningMessageDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
35895         void* e_ptr = untag_ptr(e);
35896         CHECK_ACCESS(e_ptr);
35897         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
35898         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
35899         LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
35900         *ret_conv = CResult_WarningMessageDecodeErrorZ_err(e_conv);
35901         return tag_ptr(ret_conv, true);
35902 }
35903
35904 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1WarningMessageDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
35905         LDKCResult_WarningMessageDecodeErrorZ* o_conv = (LDKCResult_WarningMessageDecodeErrorZ*)untag_ptr(o);
35906         jboolean ret_conv = CResult_WarningMessageDecodeErrorZ_is_ok(o_conv);
35907         return ret_conv;
35908 }
35909
35910 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1WarningMessageDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
35911         if (!ptr_is_owned(_res)) return;
35912         void* _res_ptr = untag_ptr(_res);
35913         CHECK_ACCESS(_res_ptr);
35914         LDKCResult_WarningMessageDecodeErrorZ _res_conv = *(LDKCResult_WarningMessageDecodeErrorZ*)(_res_ptr);
35915         FREE(untag_ptr(_res));
35916         CResult_WarningMessageDecodeErrorZ_free(_res_conv);
35917 }
35918
35919 static inline uint64_t CResult_WarningMessageDecodeErrorZ_clone_ptr(LDKCResult_WarningMessageDecodeErrorZ *NONNULL_PTR arg) {
35920         LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
35921         *ret_conv = CResult_WarningMessageDecodeErrorZ_clone(arg);
35922         return tag_ptr(ret_conv, true);
35923 }
35924 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1WarningMessageDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
35925         LDKCResult_WarningMessageDecodeErrorZ* arg_conv = (LDKCResult_WarningMessageDecodeErrorZ*)untag_ptr(arg);
35926         int64_t ret_conv = CResult_WarningMessageDecodeErrorZ_clone_ptr(arg_conv);
35927         return ret_conv;
35928 }
35929
35930 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1WarningMessageDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
35931         LDKCResult_WarningMessageDecodeErrorZ* orig_conv = (LDKCResult_WarningMessageDecodeErrorZ*)untag_ptr(orig);
35932         LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
35933         *ret_conv = CResult_WarningMessageDecodeErrorZ_clone(orig_conv);
35934         return tag_ptr(ret_conv, true);
35935 }
35936
35937 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
35938         LDKUnsignedNodeAnnouncement o_conv;
35939         o_conv.inner = untag_ptr(o);
35940         o_conv.is_owned = ptr_is_owned(o);
35941         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
35942         o_conv = UnsignedNodeAnnouncement_clone(&o_conv);
35943         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
35944         *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(o_conv);
35945         return tag_ptr(ret_conv, true);
35946 }
35947
35948 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
35949         void* e_ptr = untag_ptr(e);
35950         CHECK_ACCESS(e_ptr);
35951         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
35952         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
35953         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
35954         *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(e_conv);
35955         return tag_ptr(ret_conv, true);
35956 }
35957
35958 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
35959         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* o_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)untag_ptr(o);
35960         jboolean ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_is_ok(o_conv);
35961         return ret_conv;
35962 }
35963
35964 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
35965         if (!ptr_is_owned(_res)) return;
35966         void* _res_ptr = untag_ptr(_res);
35967         CHECK_ACCESS(_res_ptr);
35968         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(_res_ptr);
35969         FREE(untag_ptr(_res));
35970         CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(_res_conv);
35971 }
35972
35973 static inline uint64_t CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
35974         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
35975         *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(arg);
35976         return tag_ptr(ret_conv, true);
35977 }
35978 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
35979         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)untag_ptr(arg);
35980         int64_t ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
35981         return ret_conv;
35982 }
35983
35984 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
35985         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)untag_ptr(orig);
35986         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
35987         *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(orig_conv);
35988         return tag_ptr(ret_conv, true);
35989 }
35990
35991 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
35992         LDKNodeAnnouncement o_conv;
35993         o_conv.inner = untag_ptr(o);
35994         o_conv.is_owned = ptr_is_owned(o);
35995         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
35996         o_conv = NodeAnnouncement_clone(&o_conv);
35997         LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
35998         *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_ok(o_conv);
35999         return tag_ptr(ret_conv, true);
36000 }
36001
36002 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
36003         void* e_ptr = untag_ptr(e);
36004         CHECK_ACCESS(e_ptr);
36005         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
36006         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
36007         LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
36008         *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_err(e_conv);
36009         return tag_ptr(ret_conv, true);
36010 }
36011
36012 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
36013         LDKCResult_NodeAnnouncementDecodeErrorZ* o_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)untag_ptr(o);
36014         jboolean ret_conv = CResult_NodeAnnouncementDecodeErrorZ_is_ok(o_conv);
36015         return ret_conv;
36016 }
36017
36018 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
36019         if (!ptr_is_owned(_res)) return;
36020         void* _res_ptr = untag_ptr(_res);
36021         CHECK_ACCESS(_res_ptr);
36022         LDKCResult_NodeAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_NodeAnnouncementDecodeErrorZ*)(_res_ptr);
36023         FREE(untag_ptr(_res));
36024         CResult_NodeAnnouncementDecodeErrorZ_free(_res_conv);
36025 }
36026
36027 static inline uint64_t CResult_NodeAnnouncementDecodeErrorZ_clone_ptr(LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR arg) {
36028         LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
36029         *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_clone(arg);
36030         return tag_ptr(ret_conv, true);
36031 }
36032 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
36033         LDKCResult_NodeAnnouncementDecodeErrorZ* arg_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)untag_ptr(arg);
36034         int64_t ret_conv = CResult_NodeAnnouncementDecodeErrorZ_clone_ptr(arg_conv);
36035         return ret_conv;
36036 }
36037
36038 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
36039         LDKCResult_NodeAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)untag_ptr(orig);
36040         LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
36041         *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_clone(orig_conv);
36042         return tag_ptr(ret_conv, true);
36043 }
36044
36045 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
36046         LDKQueryShortChannelIds o_conv;
36047         o_conv.inner = untag_ptr(o);
36048         o_conv.is_owned = ptr_is_owned(o);
36049         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
36050         o_conv = QueryShortChannelIds_clone(&o_conv);
36051         LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
36052         *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_ok(o_conv);
36053         return tag_ptr(ret_conv, true);
36054 }
36055
36056 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
36057         void* e_ptr = untag_ptr(e);
36058         CHECK_ACCESS(e_ptr);
36059         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
36060         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
36061         LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
36062         *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_err(e_conv);
36063         return tag_ptr(ret_conv, true);
36064 }
36065
36066 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
36067         LDKCResult_QueryShortChannelIdsDecodeErrorZ* o_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)untag_ptr(o);
36068         jboolean ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_is_ok(o_conv);
36069         return ret_conv;
36070 }
36071
36072 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
36073         if (!ptr_is_owned(_res)) return;
36074         void* _res_ptr = untag_ptr(_res);
36075         CHECK_ACCESS(_res_ptr);
36076         LDKCResult_QueryShortChannelIdsDecodeErrorZ _res_conv = *(LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(_res_ptr);
36077         FREE(untag_ptr(_res));
36078         CResult_QueryShortChannelIdsDecodeErrorZ_free(_res_conv);
36079 }
36080
36081 static inline uint64_t CResult_QueryShortChannelIdsDecodeErrorZ_clone_ptr(LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR arg) {
36082         LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
36083         *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_clone(arg);
36084         return tag_ptr(ret_conv, true);
36085 }
36086 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
36087         LDKCResult_QueryShortChannelIdsDecodeErrorZ* arg_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)untag_ptr(arg);
36088         int64_t ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_clone_ptr(arg_conv);
36089         return ret_conv;
36090 }
36091
36092 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
36093         LDKCResult_QueryShortChannelIdsDecodeErrorZ* orig_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)untag_ptr(orig);
36094         LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
36095         *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_clone(orig_conv);
36096         return tag_ptr(ret_conv, true);
36097 }
36098
36099 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
36100         LDKReplyShortChannelIdsEnd o_conv;
36101         o_conv.inner = untag_ptr(o);
36102         o_conv.is_owned = ptr_is_owned(o);
36103         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
36104         o_conv = ReplyShortChannelIdsEnd_clone(&o_conv);
36105         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
36106         *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(o_conv);
36107         return tag_ptr(ret_conv, true);
36108 }
36109
36110 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
36111         void* e_ptr = untag_ptr(e);
36112         CHECK_ACCESS(e_ptr);
36113         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
36114         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
36115         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
36116         *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(e_conv);
36117         return tag_ptr(ret_conv, true);
36118 }
36119
36120 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
36121         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* o_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)untag_ptr(o);
36122         jboolean ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_is_ok(o_conv);
36123         return ret_conv;
36124 }
36125
36126 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
36127         if (!ptr_is_owned(_res)) return;
36128         void* _res_ptr = untag_ptr(_res);
36129         CHECK_ACCESS(_res_ptr);
36130         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ _res_conv = *(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(_res_ptr);
36131         FREE(untag_ptr(_res));
36132         CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(_res_conv);
36133 }
36134
36135 static inline uint64_t CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone_ptr(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR arg) {
36136         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
36137         *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(arg);
36138         return tag_ptr(ret_conv, true);
36139 }
36140 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
36141         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* arg_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)untag_ptr(arg);
36142         int64_t ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone_ptr(arg_conv);
36143         return ret_conv;
36144 }
36145
36146 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
36147         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* orig_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)untag_ptr(orig);
36148         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
36149         *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(orig_conv);
36150         return tag_ptr(ret_conv, true);
36151 }
36152
36153 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
36154         LDKQueryChannelRange o_conv;
36155         o_conv.inner = untag_ptr(o);
36156         o_conv.is_owned = ptr_is_owned(o);
36157         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
36158         o_conv = QueryChannelRange_clone(&o_conv);
36159         LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
36160         *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_ok(o_conv);
36161         return tag_ptr(ret_conv, true);
36162 }
36163
36164 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
36165         void* e_ptr = untag_ptr(e);
36166         CHECK_ACCESS(e_ptr);
36167         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
36168         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
36169         LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
36170         *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_err(e_conv);
36171         return tag_ptr(ret_conv, true);
36172 }
36173
36174 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
36175         LDKCResult_QueryChannelRangeDecodeErrorZ* o_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)untag_ptr(o);
36176         jboolean ret_conv = CResult_QueryChannelRangeDecodeErrorZ_is_ok(o_conv);
36177         return ret_conv;
36178 }
36179
36180 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
36181         if (!ptr_is_owned(_res)) return;
36182         void* _res_ptr = untag_ptr(_res);
36183         CHECK_ACCESS(_res_ptr);
36184         LDKCResult_QueryChannelRangeDecodeErrorZ _res_conv = *(LDKCResult_QueryChannelRangeDecodeErrorZ*)(_res_ptr);
36185         FREE(untag_ptr(_res));
36186         CResult_QueryChannelRangeDecodeErrorZ_free(_res_conv);
36187 }
36188
36189 static inline uint64_t CResult_QueryChannelRangeDecodeErrorZ_clone_ptr(LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR arg) {
36190         LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
36191         *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_clone(arg);
36192         return tag_ptr(ret_conv, true);
36193 }
36194 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
36195         LDKCResult_QueryChannelRangeDecodeErrorZ* arg_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)untag_ptr(arg);
36196         int64_t ret_conv = CResult_QueryChannelRangeDecodeErrorZ_clone_ptr(arg_conv);
36197         return ret_conv;
36198 }
36199
36200 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
36201         LDKCResult_QueryChannelRangeDecodeErrorZ* orig_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)untag_ptr(orig);
36202         LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
36203         *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_clone(orig_conv);
36204         return tag_ptr(ret_conv, true);
36205 }
36206
36207 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
36208         LDKReplyChannelRange o_conv;
36209         o_conv.inner = untag_ptr(o);
36210         o_conv.is_owned = ptr_is_owned(o);
36211         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
36212         o_conv = ReplyChannelRange_clone(&o_conv);
36213         LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
36214         *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_ok(o_conv);
36215         return tag_ptr(ret_conv, true);
36216 }
36217
36218 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
36219         void* e_ptr = untag_ptr(e);
36220         CHECK_ACCESS(e_ptr);
36221         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
36222         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
36223         LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
36224         *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_err(e_conv);
36225         return tag_ptr(ret_conv, true);
36226 }
36227
36228 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
36229         LDKCResult_ReplyChannelRangeDecodeErrorZ* o_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)untag_ptr(o);
36230         jboolean ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_is_ok(o_conv);
36231         return ret_conv;
36232 }
36233
36234 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
36235         if (!ptr_is_owned(_res)) return;
36236         void* _res_ptr = untag_ptr(_res);
36237         CHECK_ACCESS(_res_ptr);
36238         LDKCResult_ReplyChannelRangeDecodeErrorZ _res_conv = *(LDKCResult_ReplyChannelRangeDecodeErrorZ*)(_res_ptr);
36239         FREE(untag_ptr(_res));
36240         CResult_ReplyChannelRangeDecodeErrorZ_free(_res_conv);
36241 }
36242
36243 static inline uint64_t CResult_ReplyChannelRangeDecodeErrorZ_clone_ptr(LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR arg) {
36244         LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
36245         *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_clone(arg);
36246         return tag_ptr(ret_conv, true);
36247 }
36248 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
36249         LDKCResult_ReplyChannelRangeDecodeErrorZ* arg_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)untag_ptr(arg);
36250         int64_t ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_clone_ptr(arg_conv);
36251         return ret_conv;
36252 }
36253
36254 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
36255         LDKCResult_ReplyChannelRangeDecodeErrorZ* orig_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)untag_ptr(orig);
36256         LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
36257         *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_clone(orig_conv);
36258         return tag_ptr(ret_conv, true);
36259 }
36260
36261 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
36262         LDKGossipTimestampFilter o_conv;
36263         o_conv.inner = untag_ptr(o);
36264         o_conv.is_owned = ptr_is_owned(o);
36265         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
36266         o_conv = GossipTimestampFilter_clone(&o_conv);
36267         LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
36268         *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_ok(o_conv);
36269         return tag_ptr(ret_conv, true);
36270 }
36271
36272 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
36273         void* e_ptr = untag_ptr(e);
36274         CHECK_ACCESS(e_ptr);
36275         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
36276         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
36277         LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
36278         *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_err(e_conv);
36279         return tag_ptr(ret_conv, true);
36280 }
36281
36282 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
36283         LDKCResult_GossipTimestampFilterDecodeErrorZ* o_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)untag_ptr(o);
36284         jboolean ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_is_ok(o_conv);
36285         return ret_conv;
36286 }
36287
36288 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
36289         if (!ptr_is_owned(_res)) return;
36290         void* _res_ptr = untag_ptr(_res);
36291         CHECK_ACCESS(_res_ptr);
36292         LDKCResult_GossipTimestampFilterDecodeErrorZ _res_conv = *(LDKCResult_GossipTimestampFilterDecodeErrorZ*)(_res_ptr);
36293         FREE(untag_ptr(_res));
36294         CResult_GossipTimestampFilterDecodeErrorZ_free(_res_conv);
36295 }
36296
36297 static inline uint64_t CResult_GossipTimestampFilterDecodeErrorZ_clone_ptr(LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR arg) {
36298         LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
36299         *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_clone(arg);
36300         return tag_ptr(ret_conv, true);
36301 }
36302 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
36303         LDKCResult_GossipTimestampFilterDecodeErrorZ* arg_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)untag_ptr(arg);
36304         int64_t ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_clone_ptr(arg_conv);
36305         return ret_conv;
36306 }
36307
36308 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
36309         LDKCResult_GossipTimestampFilterDecodeErrorZ* orig_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)untag_ptr(orig);
36310         LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
36311         *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_clone(orig_conv);
36312         return tag_ptr(ret_conv, true);
36313 }
36314
36315 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1PhantomRouteHintsZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
36316         LDKCVec_PhantomRouteHintsZ _res_constr;
36317         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
36318         if (_res_constr.datalen > 0)
36319                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPhantomRouteHints), "LDKCVec_PhantomRouteHintsZ Elements");
36320         else
36321                 _res_constr.data = NULL;
36322         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
36323         for (size_t t = 0; t < _res_constr.datalen; t++) {
36324                 int64_t _res_conv_19 = _res_vals[t];
36325                 LDKPhantomRouteHints _res_conv_19_conv;
36326                 _res_conv_19_conv.inner = untag_ptr(_res_conv_19);
36327                 _res_conv_19_conv.is_owned = ptr_is_owned(_res_conv_19);
36328                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_19_conv);
36329                 _res_constr.data[t] = _res_conv_19_conv;
36330         }
36331         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
36332         CVec_PhantomRouteHintsZ_free(_res_constr);
36333 }
36334
36335 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceSignOrCreationErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
36336         LDKBolt11Invoice o_conv;
36337         o_conv.inner = untag_ptr(o);
36338         o_conv.is_owned = ptr_is_owned(o);
36339         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
36340         o_conv = Bolt11Invoice_clone(&o_conv);
36341         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
36342         *ret_conv = CResult_Bolt11InvoiceSignOrCreationErrorZ_ok(o_conv);
36343         return tag_ptr(ret_conv, true);
36344 }
36345
36346 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceSignOrCreationErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
36347         void* e_ptr = untag_ptr(e);
36348         CHECK_ACCESS(e_ptr);
36349         LDKSignOrCreationError e_conv = *(LDKSignOrCreationError*)(e_ptr);
36350         e_conv = SignOrCreationError_clone((LDKSignOrCreationError*)untag_ptr(e));
36351         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
36352         *ret_conv = CResult_Bolt11InvoiceSignOrCreationErrorZ_err(e_conv);
36353         return tag_ptr(ret_conv, true);
36354 }
36355
36356 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceSignOrCreationErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
36357         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* o_conv = (LDKCResult_Bolt11InvoiceSignOrCreationErrorZ*)untag_ptr(o);
36358         jboolean ret_conv = CResult_Bolt11InvoiceSignOrCreationErrorZ_is_ok(o_conv);
36359         return ret_conv;
36360 }
36361
36362 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceSignOrCreationErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
36363         if (!ptr_is_owned(_res)) return;
36364         void* _res_ptr = untag_ptr(_res);
36365         CHECK_ACCESS(_res_ptr);
36366         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ _res_conv = *(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ*)(_res_ptr);
36367         FREE(untag_ptr(_res));
36368         CResult_Bolt11InvoiceSignOrCreationErrorZ_free(_res_conv);
36369 }
36370
36371 static inline uint64_t CResult_Bolt11InvoiceSignOrCreationErrorZ_clone_ptr(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ *NONNULL_PTR arg) {
36372         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
36373         *ret_conv = CResult_Bolt11InvoiceSignOrCreationErrorZ_clone(arg);
36374         return tag_ptr(ret_conv, true);
36375 }
36376 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceSignOrCreationErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
36377         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* arg_conv = (LDKCResult_Bolt11InvoiceSignOrCreationErrorZ*)untag_ptr(arg);
36378         int64_t ret_conv = CResult_Bolt11InvoiceSignOrCreationErrorZ_clone_ptr(arg_conv);
36379         return ret_conv;
36380 }
36381
36382 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceSignOrCreationErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
36383         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* orig_conv = (LDKCResult_Bolt11InvoiceSignOrCreationErrorZ*)untag_ptr(orig);
36384         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
36385         *ret_conv = CResult_Bolt11InvoiceSignOrCreationErrorZ_clone(orig_conv);
36386         return tag_ptr(ret_conv, true);
36387 }
36388
36389 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1FutureZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
36390         LDKCVec_FutureZ _res_constr;
36391         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
36392         if (_res_constr.datalen > 0)
36393                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKFuture), "LDKCVec_FutureZ Elements");
36394         else
36395                 _res_constr.data = NULL;
36396         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
36397         for (size_t i = 0; i < _res_constr.datalen; i++) {
36398                 int64_t _res_conv_8 = _res_vals[i];
36399                 LDKFuture _res_conv_8_conv;
36400                 _res_conv_8_conv.inner = untag_ptr(_res_conv_8);
36401                 _res_conv_8_conv.is_owned = ptr_is_owned(_res_conv_8);
36402                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_8_conv);
36403                 _res_constr.data[i] = _res_conv_8_conv;
36404         }
36405         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
36406         CVec_FutureZ_free(_res_constr);
36407 }
36408
36409 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OffersMessageDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
36410         void* o_ptr = untag_ptr(o);
36411         CHECK_ACCESS(o_ptr);
36412         LDKOffersMessage o_conv = *(LDKOffersMessage*)(o_ptr);
36413         o_conv = OffersMessage_clone((LDKOffersMessage*)untag_ptr(o));
36414         LDKCResult_OffersMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OffersMessageDecodeErrorZ), "LDKCResult_OffersMessageDecodeErrorZ");
36415         *ret_conv = CResult_OffersMessageDecodeErrorZ_ok(o_conv);
36416         return tag_ptr(ret_conv, true);
36417 }
36418
36419 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OffersMessageDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
36420         void* e_ptr = untag_ptr(e);
36421         CHECK_ACCESS(e_ptr);
36422         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
36423         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
36424         LDKCResult_OffersMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OffersMessageDecodeErrorZ), "LDKCResult_OffersMessageDecodeErrorZ");
36425         *ret_conv = CResult_OffersMessageDecodeErrorZ_err(e_conv);
36426         return tag_ptr(ret_conv, true);
36427 }
36428
36429 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1OffersMessageDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
36430         LDKCResult_OffersMessageDecodeErrorZ* o_conv = (LDKCResult_OffersMessageDecodeErrorZ*)untag_ptr(o);
36431         jboolean ret_conv = CResult_OffersMessageDecodeErrorZ_is_ok(o_conv);
36432         return ret_conv;
36433 }
36434
36435 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1OffersMessageDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
36436         if (!ptr_is_owned(_res)) return;
36437         void* _res_ptr = untag_ptr(_res);
36438         CHECK_ACCESS(_res_ptr);
36439         LDKCResult_OffersMessageDecodeErrorZ _res_conv = *(LDKCResult_OffersMessageDecodeErrorZ*)(_res_ptr);
36440         FREE(untag_ptr(_res));
36441         CResult_OffersMessageDecodeErrorZ_free(_res_conv);
36442 }
36443
36444 static inline uint64_t CResult_OffersMessageDecodeErrorZ_clone_ptr(LDKCResult_OffersMessageDecodeErrorZ *NONNULL_PTR arg) {
36445         LDKCResult_OffersMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OffersMessageDecodeErrorZ), "LDKCResult_OffersMessageDecodeErrorZ");
36446         *ret_conv = CResult_OffersMessageDecodeErrorZ_clone(arg);
36447         return tag_ptr(ret_conv, true);
36448 }
36449 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OffersMessageDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
36450         LDKCResult_OffersMessageDecodeErrorZ* arg_conv = (LDKCResult_OffersMessageDecodeErrorZ*)untag_ptr(arg);
36451         int64_t ret_conv = CResult_OffersMessageDecodeErrorZ_clone_ptr(arg_conv);
36452         return ret_conv;
36453 }
36454
36455 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OffersMessageDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
36456         LDKCResult_OffersMessageDecodeErrorZ* orig_conv = (LDKCResult_OffersMessageDecodeErrorZ*)untag_ptr(orig);
36457         LDKCResult_OffersMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OffersMessageDecodeErrorZ), "LDKCResult_OffersMessageDecodeErrorZ");
36458         *ret_conv = CResult_OffersMessageDecodeErrorZ_clone(orig_conv);
36459         return tag_ptr(ret_conv, true);
36460 }
36461
36462 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1HTLCClaimZ_1some(JNIEnv *env, jclass clz, jclass o) {
36463         LDKHTLCClaim o_conv = LDKHTLCClaim_from_java(env, o);
36464         LDKCOption_HTLCClaimZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCClaimZ), "LDKCOption_HTLCClaimZ");
36465         *ret_copy = COption_HTLCClaimZ_some(o_conv);
36466         int64_t ret_ref = tag_ptr(ret_copy, true);
36467         return ret_ref;
36468 }
36469
36470 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1HTLCClaimZ_1none(JNIEnv *env, jclass clz) {
36471         LDKCOption_HTLCClaimZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCClaimZ), "LDKCOption_HTLCClaimZ");
36472         *ret_copy = COption_HTLCClaimZ_none();
36473         int64_t ret_ref = tag_ptr(ret_copy, true);
36474         return ret_ref;
36475 }
36476
36477 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1HTLCClaimZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
36478         if (!ptr_is_owned(_res)) return;
36479         void* _res_ptr = untag_ptr(_res);
36480         CHECK_ACCESS(_res_ptr);
36481         LDKCOption_HTLCClaimZ _res_conv = *(LDKCOption_HTLCClaimZ*)(_res_ptr);
36482         FREE(untag_ptr(_res));
36483         COption_HTLCClaimZ_free(_res_conv);
36484 }
36485
36486 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyCommitmentSecretsDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
36487         LDKCounterpartyCommitmentSecrets o_conv;
36488         o_conv.inner = untag_ptr(o);
36489         o_conv.is_owned = ptr_is_owned(o);
36490         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
36491         o_conv = CounterpartyCommitmentSecrets_clone(&o_conv);
36492         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
36493         *ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_ok(o_conv);
36494         return tag_ptr(ret_conv, true);
36495 }
36496
36497 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyCommitmentSecretsDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
36498         void* e_ptr = untag_ptr(e);
36499         CHECK_ACCESS(e_ptr);
36500         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
36501         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
36502         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
36503         *ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_err(e_conv);
36504         return tag_ptr(ret_conv, true);
36505 }
36506
36507 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyCommitmentSecretsDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
36508         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* o_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)untag_ptr(o);
36509         jboolean ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_is_ok(o_conv);
36510         return ret_conv;
36511 }
36512
36513 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyCommitmentSecretsDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
36514         if (!ptr_is_owned(_res)) return;
36515         void* _res_ptr = untag_ptr(_res);
36516         CHECK_ACCESS(_res_ptr);
36517         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ _res_conv = *(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)(_res_ptr);
36518         FREE(untag_ptr(_res));
36519         CResult_CounterpartyCommitmentSecretsDecodeErrorZ_free(_res_conv);
36520 }
36521
36522 static inline uint64_t CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone_ptr(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ *NONNULL_PTR arg) {
36523         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
36524         *ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone(arg);
36525         return tag_ptr(ret_conv, true);
36526 }
36527 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyCommitmentSecretsDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
36528         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* arg_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)untag_ptr(arg);
36529         int64_t ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone_ptr(arg_conv);
36530         return ret_conv;
36531 }
36532
36533 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyCommitmentSecretsDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
36534         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* orig_conv = (LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ*)untag_ptr(orig);
36535         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
36536         *ret_conv = CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone(orig_conv);
36537         return tag_ptr(ret_conv, true);
36538 }
36539
36540 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
36541         LDKTxCreationKeys o_conv;
36542         o_conv.inner = untag_ptr(o);
36543         o_conv.is_owned = ptr_is_owned(o);
36544         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
36545         o_conv = TxCreationKeys_clone(&o_conv);
36546         LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
36547         *ret_conv = CResult_TxCreationKeysDecodeErrorZ_ok(o_conv);
36548         return tag_ptr(ret_conv, true);
36549 }
36550
36551 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
36552         void* e_ptr = untag_ptr(e);
36553         CHECK_ACCESS(e_ptr);
36554         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
36555         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
36556         LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
36557         *ret_conv = CResult_TxCreationKeysDecodeErrorZ_err(e_conv);
36558         return tag_ptr(ret_conv, true);
36559 }
36560
36561 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
36562         LDKCResult_TxCreationKeysDecodeErrorZ* o_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)untag_ptr(o);
36563         jboolean ret_conv = CResult_TxCreationKeysDecodeErrorZ_is_ok(o_conv);
36564         return ret_conv;
36565 }
36566
36567 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
36568         if (!ptr_is_owned(_res)) return;
36569         void* _res_ptr = untag_ptr(_res);
36570         CHECK_ACCESS(_res_ptr);
36571         LDKCResult_TxCreationKeysDecodeErrorZ _res_conv = *(LDKCResult_TxCreationKeysDecodeErrorZ*)(_res_ptr);
36572         FREE(untag_ptr(_res));
36573         CResult_TxCreationKeysDecodeErrorZ_free(_res_conv);
36574 }
36575
36576 static inline uint64_t CResult_TxCreationKeysDecodeErrorZ_clone_ptr(LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR arg) {
36577         LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
36578         *ret_conv = CResult_TxCreationKeysDecodeErrorZ_clone(arg);
36579         return tag_ptr(ret_conv, true);
36580 }
36581 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
36582         LDKCResult_TxCreationKeysDecodeErrorZ* arg_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)untag_ptr(arg);
36583         int64_t ret_conv = CResult_TxCreationKeysDecodeErrorZ_clone_ptr(arg_conv);
36584         return ret_conv;
36585 }
36586
36587 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
36588         LDKCResult_TxCreationKeysDecodeErrorZ* orig_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)untag_ptr(orig);
36589         LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
36590         *ret_conv = CResult_TxCreationKeysDecodeErrorZ_clone(orig_conv);
36591         return tag_ptr(ret_conv, true);
36592 }
36593
36594 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
36595         LDKChannelPublicKeys o_conv;
36596         o_conv.inner = untag_ptr(o);
36597         o_conv.is_owned = ptr_is_owned(o);
36598         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
36599         o_conv = ChannelPublicKeys_clone(&o_conv);
36600         LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
36601         *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_ok(o_conv);
36602         return tag_ptr(ret_conv, true);
36603 }
36604
36605 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
36606         void* e_ptr = untag_ptr(e);
36607         CHECK_ACCESS(e_ptr);
36608         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
36609         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
36610         LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
36611         *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_err(e_conv);
36612         return tag_ptr(ret_conv, true);
36613 }
36614
36615 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
36616         LDKCResult_ChannelPublicKeysDecodeErrorZ* o_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)untag_ptr(o);
36617         jboolean ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_is_ok(o_conv);
36618         return ret_conv;
36619 }
36620
36621 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
36622         if (!ptr_is_owned(_res)) return;
36623         void* _res_ptr = untag_ptr(_res);
36624         CHECK_ACCESS(_res_ptr);
36625         LDKCResult_ChannelPublicKeysDecodeErrorZ _res_conv = *(LDKCResult_ChannelPublicKeysDecodeErrorZ*)(_res_ptr);
36626         FREE(untag_ptr(_res));
36627         CResult_ChannelPublicKeysDecodeErrorZ_free(_res_conv);
36628 }
36629
36630 static inline uint64_t CResult_ChannelPublicKeysDecodeErrorZ_clone_ptr(LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR arg) {
36631         LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
36632         *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_clone(arg);
36633         return tag_ptr(ret_conv, true);
36634 }
36635 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
36636         LDKCResult_ChannelPublicKeysDecodeErrorZ* arg_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)untag_ptr(arg);
36637         int64_t ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_clone_ptr(arg_conv);
36638         return ret_conv;
36639 }
36640
36641 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
36642         LDKCResult_ChannelPublicKeysDecodeErrorZ* orig_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)untag_ptr(orig);
36643         LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
36644         *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_clone(orig_conv);
36645         return tag_ptr(ret_conv, true);
36646 }
36647
36648 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
36649         LDKHTLCOutputInCommitment o_conv;
36650         o_conv.inner = untag_ptr(o);
36651         o_conv.is_owned = ptr_is_owned(o);
36652         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
36653         o_conv = HTLCOutputInCommitment_clone(&o_conv);
36654         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
36655         *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(o_conv);
36656         return tag_ptr(ret_conv, true);
36657 }
36658
36659 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
36660         void* e_ptr = untag_ptr(e);
36661         CHECK_ACCESS(e_ptr);
36662         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
36663         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
36664         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
36665         *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_err(e_conv);
36666         return tag_ptr(ret_conv, true);
36667 }
36668
36669 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
36670         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* o_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)untag_ptr(o);
36671         jboolean ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_is_ok(o_conv);
36672         return ret_conv;
36673 }
36674
36675 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
36676         if (!ptr_is_owned(_res)) return;
36677         void* _res_ptr = untag_ptr(_res);
36678         CHECK_ACCESS(_res_ptr);
36679         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ _res_conv = *(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(_res_ptr);
36680         FREE(untag_ptr(_res));
36681         CResult_HTLCOutputInCommitmentDecodeErrorZ_free(_res_conv);
36682 }
36683
36684 static inline uint64_t CResult_HTLCOutputInCommitmentDecodeErrorZ_clone_ptr(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR arg) {
36685         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
36686         *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(arg);
36687         return tag_ptr(ret_conv, true);
36688 }
36689 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
36690         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* arg_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)untag_ptr(arg);
36691         int64_t ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_clone_ptr(arg_conv);
36692         return ret_conv;
36693 }
36694
36695 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
36696         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* orig_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)untag_ptr(orig);
36697         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
36698         *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(orig_conv);
36699         return tag_ptr(ret_conv, true);
36700 }
36701
36702 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
36703         LDKCounterpartyChannelTransactionParameters o_conv;
36704         o_conv.inner = untag_ptr(o);
36705         o_conv.is_owned = ptr_is_owned(o);
36706         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
36707         o_conv = CounterpartyChannelTransactionParameters_clone(&o_conv);
36708         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
36709         *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(o_conv);
36710         return tag_ptr(ret_conv, true);
36711 }
36712
36713 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
36714         void* e_ptr = untag_ptr(e);
36715         CHECK_ACCESS(e_ptr);
36716         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
36717         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
36718         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
36719         *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(e_conv);
36720         return tag_ptr(ret_conv, true);
36721 }
36722
36723 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
36724         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* o_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)untag_ptr(o);
36725         jboolean ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_is_ok(o_conv);
36726         return ret_conv;
36727 }
36728
36729 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
36730         if (!ptr_is_owned(_res)) return;
36731         void* _res_ptr = untag_ptr(_res);
36732         CHECK_ACCESS(_res_ptr);
36733         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ _res_conv = *(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(_res_ptr);
36734         FREE(untag_ptr(_res));
36735         CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(_res_conv);
36736 }
36737
36738 static inline uint64_t CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone_ptr(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR arg) {
36739         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
36740         *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(arg);
36741         return tag_ptr(ret_conv, true);
36742 }
36743 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
36744         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* arg_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)untag_ptr(arg);
36745         int64_t ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone_ptr(arg_conv);
36746         return ret_conv;
36747 }
36748
36749 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
36750         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* orig_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)untag_ptr(orig);
36751         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
36752         *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(orig_conv);
36753         return tag_ptr(ret_conv, true);
36754 }
36755
36756 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
36757         LDKChannelTransactionParameters o_conv;
36758         o_conv.inner = untag_ptr(o);
36759         o_conv.is_owned = ptr_is_owned(o);
36760         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
36761         o_conv = ChannelTransactionParameters_clone(&o_conv);
36762         LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
36763         *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_ok(o_conv);
36764         return tag_ptr(ret_conv, true);
36765 }
36766
36767 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
36768         void* e_ptr = untag_ptr(e);
36769         CHECK_ACCESS(e_ptr);
36770         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
36771         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
36772         LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
36773         *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_err(e_conv);
36774         return tag_ptr(ret_conv, true);
36775 }
36776
36777 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
36778         LDKCResult_ChannelTransactionParametersDecodeErrorZ* o_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)untag_ptr(o);
36779         jboolean ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_is_ok(o_conv);
36780         return ret_conv;
36781 }
36782
36783 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
36784         if (!ptr_is_owned(_res)) return;
36785         void* _res_ptr = untag_ptr(_res);
36786         CHECK_ACCESS(_res_ptr);
36787         LDKCResult_ChannelTransactionParametersDecodeErrorZ _res_conv = *(LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(_res_ptr);
36788         FREE(untag_ptr(_res));
36789         CResult_ChannelTransactionParametersDecodeErrorZ_free(_res_conv);
36790 }
36791
36792 static inline uint64_t CResult_ChannelTransactionParametersDecodeErrorZ_clone_ptr(LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR arg) {
36793         LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
36794         *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_clone(arg);
36795         return tag_ptr(ret_conv, true);
36796 }
36797 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
36798         LDKCResult_ChannelTransactionParametersDecodeErrorZ* arg_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)untag_ptr(arg);
36799         int64_t ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_clone_ptr(arg_conv);
36800         return ret_conv;
36801 }
36802
36803 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
36804         LDKCResult_ChannelTransactionParametersDecodeErrorZ* orig_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)untag_ptr(orig);
36805         LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
36806         *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_clone(orig_conv);
36807         return tag_ptr(ret_conv, true);
36808 }
36809
36810 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
36811         LDKHolderCommitmentTransaction o_conv;
36812         o_conv.inner = untag_ptr(o);
36813         o_conv.is_owned = ptr_is_owned(o);
36814         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
36815         o_conv = HolderCommitmentTransaction_clone(&o_conv);
36816         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
36817         *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_ok(o_conv);
36818         return tag_ptr(ret_conv, true);
36819 }
36820
36821 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
36822         void* e_ptr = untag_ptr(e);
36823         CHECK_ACCESS(e_ptr);
36824         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
36825         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
36826         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
36827         *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_err(e_conv);
36828         return tag_ptr(ret_conv, true);
36829 }
36830
36831 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
36832         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* o_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)untag_ptr(o);
36833         jboolean ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_is_ok(o_conv);
36834         return ret_conv;
36835 }
36836
36837 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
36838         if (!ptr_is_owned(_res)) return;
36839         void* _res_ptr = untag_ptr(_res);
36840         CHECK_ACCESS(_res_ptr);
36841         LDKCResult_HolderCommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(_res_ptr);
36842         FREE(untag_ptr(_res));
36843         CResult_HolderCommitmentTransactionDecodeErrorZ_free(_res_conv);
36844 }
36845
36846 static inline uint64_t CResult_HolderCommitmentTransactionDecodeErrorZ_clone_ptr(LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR arg) {
36847         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
36848         *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_clone(arg);
36849         return tag_ptr(ret_conv, true);
36850 }
36851 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
36852         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* arg_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)untag_ptr(arg);
36853         int64_t ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_clone_ptr(arg_conv);
36854         return ret_conv;
36855 }
36856
36857 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
36858         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)untag_ptr(orig);
36859         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
36860         *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_clone(orig_conv);
36861         return tag_ptr(ret_conv, true);
36862 }
36863
36864 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
36865         LDKBuiltCommitmentTransaction o_conv;
36866         o_conv.inner = untag_ptr(o);
36867         o_conv.is_owned = ptr_is_owned(o);
36868         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
36869         o_conv = BuiltCommitmentTransaction_clone(&o_conv);
36870         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
36871         *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(o_conv);
36872         return tag_ptr(ret_conv, true);
36873 }
36874
36875 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
36876         void* e_ptr = untag_ptr(e);
36877         CHECK_ACCESS(e_ptr);
36878         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
36879         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
36880         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
36881         *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_err(e_conv);
36882         return tag_ptr(ret_conv, true);
36883 }
36884
36885 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
36886         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* o_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)untag_ptr(o);
36887         jboolean ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_is_ok(o_conv);
36888         return ret_conv;
36889 }
36890
36891 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
36892         if (!ptr_is_owned(_res)) return;
36893         void* _res_ptr = untag_ptr(_res);
36894         CHECK_ACCESS(_res_ptr);
36895         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(_res_ptr);
36896         FREE(untag_ptr(_res));
36897         CResult_BuiltCommitmentTransactionDecodeErrorZ_free(_res_conv);
36898 }
36899
36900 static inline uint64_t CResult_BuiltCommitmentTransactionDecodeErrorZ_clone_ptr(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR arg) {
36901         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
36902         *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(arg);
36903         return tag_ptr(ret_conv, true);
36904 }
36905 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
36906         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* arg_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)untag_ptr(arg);
36907         int64_t ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_clone_ptr(arg_conv);
36908         return ret_conv;
36909 }
36910
36911 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
36912         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)untag_ptr(orig);
36913         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
36914         *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(orig_conv);
36915         return tag_ptr(ret_conv, true);
36916 }
36917
36918 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedClosingTransactionNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
36919         LDKTrustedClosingTransaction o_conv;
36920         o_conv.inner = untag_ptr(o);
36921         o_conv.is_owned = ptr_is_owned(o);
36922         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
36923         // WARNING: we need a move here but no clone is available for LDKTrustedClosingTransaction
36924         
36925         LDKCResult_TrustedClosingTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedClosingTransactionNoneZ), "LDKCResult_TrustedClosingTransactionNoneZ");
36926         *ret_conv = CResult_TrustedClosingTransactionNoneZ_ok(o_conv);
36927         return tag_ptr(ret_conv, true);
36928 }
36929
36930 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedClosingTransactionNoneZ_1err(JNIEnv *env, jclass clz) {
36931         LDKCResult_TrustedClosingTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedClosingTransactionNoneZ), "LDKCResult_TrustedClosingTransactionNoneZ");
36932         *ret_conv = CResult_TrustedClosingTransactionNoneZ_err();
36933         return tag_ptr(ret_conv, true);
36934 }
36935
36936 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedClosingTransactionNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
36937         LDKCResult_TrustedClosingTransactionNoneZ* o_conv = (LDKCResult_TrustedClosingTransactionNoneZ*)untag_ptr(o);
36938         jboolean ret_conv = CResult_TrustedClosingTransactionNoneZ_is_ok(o_conv);
36939         return ret_conv;
36940 }
36941
36942 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedClosingTransactionNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
36943         if (!ptr_is_owned(_res)) return;
36944         void* _res_ptr = untag_ptr(_res);
36945         CHECK_ACCESS(_res_ptr);
36946         LDKCResult_TrustedClosingTransactionNoneZ _res_conv = *(LDKCResult_TrustedClosingTransactionNoneZ*)(_res_ptr);
36947         FREE(untag_ptr(_res));
36948         CResult_TrustedClosingTransactionNoneZ_free(_res_conv);
36949 }
36950
36951 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
36952         LDKCommitmentTransaction o_conv;
36953         o_conv.inner = untag_ptr(o);
36954         o_conv.is_owned = ptr_is_owned(o);
36955         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
36956         o_conv = CommitmentTransaction_clone(&o_conv);
36957         LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
36958         *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_ok(o_conv);
36959         return tag_ptr(ret_conv, true);
36960 }
36961
36962 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
36963         void* e_ptr = untag_ptr(e);
36964         CHECK_ACCESS(e_ptr);
36965         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
36966         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
36967         LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
36968         *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_err(e_conv);
36969         return tag_ptr(ret_conv, true);
36970 }
36971
36972 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
36973         LDKCResult_CommitmentTransactionDecodeErrorZ* o_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)untag_ptr(o);
36974         jboolean ret_conv = CResult_CommitmentTransactionDecodeErrorZ_is_ok(o_conv);
36975         return ret_conv;
36976 }
36977
36978 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
36979         if (!ptr_is_owned(_res)) return;
36980         void* _res_ptr = untag_ptr(_res);
36981         CHECK_ACCESS(_res_ptr);
36982         LDKCResult_CommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_CommitmentTransactionDecodeErrorZ*)(_res_ptr);
36983         FREE(untag_ptr(_res));
36984         CResult_CommitmentTransactionDecodeErrorZ_free(_res_conv);
36985 }
36986
36987 static inline uint64_t CResult_CommitmentTransactionDecodeErrorZ_clone_ptr(LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR arg) {
36988         LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
36989         *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_clone(arg);
36990         return tag_ptr(ret_conv, true);
36991 }
36992 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
36993         LDKCResult_CommitmentTransactionDecodeErrorZ* arg_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)untag_ptr(arg);
36994         int64_t ret_conv = CResult_CommitmentTransactionDecodeErrorZ_clone_ptr(arg_conv);
36995         return ret_conv;
36996 }
36997
36998 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
36999         LDKCResult_CommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)untag_ptr(orig);
37000         LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
37001         *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_clone(orig_conv);
37002         return tag_ptr(ret_conv, true);
37003 }
37004
37005 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedCommitmentTransactionNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
37006         LDKTrustedCommitmentTransaction o_conv;
37007         o_conv.inner = untag_ptr(o);
37008         o_conv.is_owned = ptr_is_owned(o);
37009         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
37010         // WARNING: we need a move here but no clone is available for LDKTrustedCommitmentTransaction
37011         
37012         LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
37013         *ret_conv = CResult_TrustedCommitmentTransactionNoneZ_ok(o_conv);
37014         return tag_ptr(ret_conv, true);
37015 }
37016
37017 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedCommitmentTransactionNoneZ_1err(JNIEnv *env, jclass clz) {
37018         LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
37019         *ret_conv = CResult_TrustedCommitmentTransactionNoneZ_err();
37020         return tag_ptr(ret_conv, true);
37021 }
37022
37023 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedCommitmentTransactionNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
37024         LDKCResult_TrustedCommitmentTransactionNoneZ* o_conv = (LDKCResult_TrustedCommitmentTransactionNoneZ*)untag_ptr(o);
37025         jboolean ret_conv = CResult_TrustedCommitmentTransactionNoneZ_is_ok(o_conv);
37026         return ret_conv;
37027 }
37028
37029 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedCommitmentTransactionNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
37030         if (!ptr_is_owned(_res)) return;
37031         void* _res_ptr = untag_ptr(_res);
37032         CHECK_ACCESS(_res_ptr);
37033         LDKCResult_TrustedCommitmentTransactionNoneZ _res_conv = *(LDKCResult_TrustedCommitmentTransactionNoneZ*)(_res_ptr);
37034         FREE(untag_ptr(_res));
37035         CResult_TrustedCommitmentTransactionNoneZ_free(_res_conv);
37036 }
37037
37038 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1ECDSASignatureZNoneZ_1ok(JNIEnv *env, jclass clz, jobjectArray o) {
37039         LDKCVec_ECDSASignatureZ o_constr;
37040         o_constr.datalen = (*env)->GetArrayLength(env, o);
37041         if (o_constr.datalen > 0)
37042                 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKECDSASignature), "LDKCVec_ECDSASignatureZ Elements");
37043         else
37044                 o_constr.data = NULL;
37045         for (size_t i = 0; i < o_constr.datalen; i++) {
37046                 int8_tArray o_conv_8 = (*env)->GetObjectArrayElement(env, o, i);
37047                 LDKECDSASignature o_conv_8_ref;
37048                 CHECK((*env)->GetArrayLength(env, o_conv_8) == 64);
37049                 (*env)->GetByteArrayRegion(env, o_conv_8, 0, 64, o_conv_8_ref.compact_form);
37050                 o_constr.data[i] = o_conv_8_ref;
37051         }
37052         LDKCResult_CVec_ECDSASignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_ECDSASignatureZNoneZ), "LDKCResult_CVec_ECDSASignatureZNoneZ");
37053         *ret_conv = CResult_CVec_ECDSASignatureZNoneZ_ok(o_constr);
37054         return tag_ptr(ret_conv, true);
37055 }
37056
37057 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1ECDSASignatureZNoneZ_1err(JNIEnv *env, jclass clz) {
37058         LDKCResult_CVec_ECDSASignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_ECDSASignatureZNoneZ), "LDKCResult_CVec_ECDSASignatureZNoneZ");
37059         *ret_conv = CResult_CVec_ECDSASignatureZNoneZ_err();
37060         return tag_ptr(ret_conv, true);
37061 }
37062
37063 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1ECDSASignatureZNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
37064         LDKCResult_CVec_ECDSASignatureZNoneZ* o_conv = (LDKCResult_CVec_ECDSASignatureZNoneZ*)untag_ptr(o);
37065         jboolean ret_conv = CResult_CVec_ECDSASignatureZNoneZ_is_ok(o_conv);
37066         return ret_conv;
37067 }
37068
37069 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1ECDSASignatureZNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
37070         if (!ptr_is_owned(_res)) return;
37071         void* _res_ptr = untag_ptr(_res);
37072         CHECK_ACCESS(_res_ptr);
37073         LDKCResult_CVec_ECDSASignatureZNoneZ _res_conv = *(LDKCResult_CVec_ECDSASignatureZNoneZ*)(_res_ptr);
37074         FREE(untag_ptr(_res));
37075         CResult_CVec_ECDSASignatureZNoneZ_free(_res_conv);
37076 }
37077
37078 static inline uint64_t CResult_CVec_ECDSASignatureZNoneZ_clone_ptr(LDKCResult_CVec_ECDSASignatureZNoneZ *NONNULL_PTR arg) {
37079         LDKCResult_CVec_ECDSASignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_ECDSASignatureZNoneZ), "LDKCResult_CVec_ECDSASignatureZNoneZ");
37080         *ret_conv = CResult_CVec_ECDSASignatureZNoneZ_clone(arg);
37081         return tag_ptr(ret_conv, true);
37082 }
37083 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1ECDSASignatureZNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
37084         LDKCResult_CVec_ECDSASignatureZNoneZ* arg_conv = (LDKCResult_CVec_ECDSASignatureZNoneZ*)untag_ptr(arg);
37085         int64_t ret_conv = CResult_CVec_ECDSASignatureZNoneZ_clone_ptr(arg_conv);
37086         return ret_conv;
37087 }
37088
37089 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1ECDSASignatureZNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
37090         LDKCResult_CVec_ECDSASignatureZNoneZ* orig_conv = (LDKCResult_CVec_ECDSASignatureZNoneZ*)untag_ptr(orig);
37091         LDKCResult_CVec_ECDSASignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_ECDSASignatureZNoneZ), "LDKCResult_CVec_ECDSASignatureZNoneZ");
37092         *ret_conv = CResult_CVec_ECDSASignatureZNoneZ_clone(orig_conv);
37093         return tag_ptr(ret_conv, true);
37094 }
37095
37096 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1usizeZ_1some(JNIEnv *env, jclass clz, int64_t o) {
37097         LDKCOption_usizeZ *ret_copy = MALLOC(sizeof(LDKCOption_usizeZ), "LDKCOption_usizeZ");
37098         *ret_copy = COption_usizeZ_some(o);
37099         int64_t ret_ref = tag_ptr(ret_copy, true);
37100         return ret_ref;
37101 }
37102
37103 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1usizeZ_1none(JNIEnv *env, jclass clz) {
37104         LDKCOption_usizeZ *ret_copy = MALLOC(sizeof(LDKCOption_usizeZ), "LDKCOption_usizeZ");
37105         *ret_copy = COption_usizeZ_none();
37106         int64_t ret_ref = tag_ptr(ret_copy, true);
37107         return ret_ref;
37108 }
37109
37110 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1usizeZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
37111         if (!ptr_is_owned(_res)) return;
37112         void* _res_ptr = untag_ptr(_res);
37113         CHECK_ACCESS(_res_ptr);
37114         LDKCOption_usizeZ _res_conv = *(LDKCOption_usizeZ*)(_res_ptr);
37115         FREE(untag_ptr(_res));
37116         COption_usizeZ_free(_res_conv);
37117 }
37118
37119 static inline uint64_t COption_usizeZ_clone_ptr(LDKCOption_usizeZ *NONNULL_PTR arg) {
37120         LDKCOption_usizeZ *ret_copy = MALLOC(sizeof(LDKCOption_usizeZ), "LDKCOption_usizeZ");
37121         *ret_copy = COption_usizeZ_clone(arg);
37122         int64_t ret_ref = tag_ptr(ret_copy, true);
37123         return ret_ref;
37124 }
37125 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1usizeZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
37126         LDKCOption_usizeZ* arg_conv = (LDKCOption_usizeZ*)untag_ptr(arg);
37127         int64_t ret_conv = COption_usizeZ_clone_ptr(arg_conv);
37128         return ret_conv;
37129 }
37130
37131 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1usizeZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
37132         LDKCOption_usizeZ* orig_conv = (LDKCOption_usizeZ*)untag_ptr(orig);
37133         LDKCOption_usizeZ *ret_copy = MALLOC(sizeof(LDKCOption_usizeZ), "LDKCOption_usizeZ");
37134         *ret_copy = COption_usizeZ_clone(orig_conv);
37135         int64_t ret_ref = tag_ptr(ret_copy, true);
37136         return ret_ref;
37137 }
37138
37139 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
37140         LDKShutdownScript o_conv;
37141         o_conv.inner = untag_ptr(o);
37142         o_conv.is_owned = ptr_is_owned(o);
37143         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
37144         o_conv = ShutdownScript_clone(&o_conv);
37145         LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
37146         *ret_conv = CResult_ShutdownScriptDecodeErrorZ_ok(o_conv);
37147         return tag_ptr(ret_conv, true);
37148 }
37149
37150 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
37151         void* e_ptr = untag_ptr(e);
37152         CHECK_ACCESS(e_ptr);
37153         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
37154         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
37155         LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
37156         *ret_conv = CResult_ShutdownScriptDecodeErrorZ_err(e_conv);
37157         return tag_ptr(ret_conv, true);
37158 }
37159
37160 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
37161         LDKCResult_ShutdownScriptDecodeErrorZ* o_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)untag_ptr(o);
37162         jboolean ret_conv = CResult_ShutdownScriptDecodeErrorZ_is_ok(o_conv);
37163         return ret_conv;
37164 }
37165
37166 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
37167         if (!ptr_is_owned(_res)) return;
37168         void* _res_ptr = untag_ptr(_res);
37169         CHECK_ACCESS(_res_ptr);
37170         LDKCResult_ShutdownScriptDecodeErrorZ _res_conv = *(LDKCResult_ShutdownScriptDecodeErrorZ*)(_res_ptr);
37171         FREE(untag_ptr(_res));
37172         CResult_ShutdownScriptDecodeErrorZ_free(_res_conv);
37173 }
37174
37175 static inline uint64_t CResult_ShutdownScriptDecodeErrorZ_clone_ptr(LDKCResult_ShutdownScriptDecodeErrorZ *NONNULL_PTR arg) {
37176         LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
37177         *ret_conv = CResult_ShutdownScriptDecodeErrorZ_clone(arg);
37178         return tag_ptr(ret_conv, true);
37179 }
37180 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
37181         LDKCResult_ShutdownScriptDecodeErrorZ* arg_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)untag_ptr(arg);
37182         int64_t ret_conv = CResult_ShutdownScriptDecodeErrorZ_clone_ptr(arg_conv);
37183         return ret_conv;
37184 }
37185
37186 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
37187         LDKCResult_ShutdownScriptDecodeErrorZ* orig_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)untag_ptr(orig);
37188         LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
37189         *ret_conv = CResult_ShutdownScriptDecodeErrorZ_clone(orig_conv);
37190         return tag_ptr(ret_conv, true);
37191 }
37192
37193 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptInvalidShutdownScriptZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
37194         LDKShutdownScript o_conv;
37195         o_conv.inner = untag_ptr(o);
37196         o_conv.is_owned = ptr_is_owned(o);
37197         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
37198         o_conv = ShutdownScript_clone(&o_conv);
37199         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
37200         *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_ok(o_conv);
37201         return tag_ptr(ret_conv, true);
37202 }
37203
37204 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptInvalidShutdownScriptZ_1err(JNIEnv *env, jclass clz, int64_t e) {
37205         LDKInvalidShutdownScript e_conv;
37206         e_conv.inner = untag_ptr(e);
37207         e_conv.is_owned = ptr_is_owned(e);
37208         CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv);
37209         e_conv = InvalidShutdownScript_clone(&e_conv);
37210         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
37211         *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_err(e_conv);
37212         return tag_ptr(ret_conv, true);
37213 }
37214
37215 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptInvalidShutdownScriptZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
37216         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* o_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)untag_ptr(o);
37217         jboolean ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_is_ok(o_conv);
37218         return ret_conv;
37219 }
37220
37221 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptInvalidShutdownScriptZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
37222         if (!ptr_is_owned(_res)) return;
37223         void* _res_ptr = untag_ptr(_res);
37224         CHECK_ACCESS(_res_ptr);
37225         LDKCResult_ShutdownScriptInvalidShutdownScriptZ _res_conv = *(LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)(_res_ptr);
37226         FREE(untag_ptr(_res));
37227         CResult_ShutdownScriptInvalidShutdownScriptZ_free(_res_conv);
37228 }
37229
37230 static inline uint64_t CResult_ShutdownScriptInvalidShutdownScriptZ_clone_ptr(LDKCResult_ShutdownScriptInvalidShutdownScriptZ *NONNULL_PTR arg) {
37231         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
37232         *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_clone(arg);
37233         return tag_ptr(ret_conv, true);
37234 }
37235 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptInvalidShutdownScriptZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
37236         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* arg_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)untag_ptr(arg);
37237         int64_t ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_clone_ptr(arg_conv);
37238         return ret_conv;
37239 }
37240
37241 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptInvalidShutdownScriptZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
37242         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* orig_conv = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)untag_ptr(orig);
37243         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
37244         *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_clone(orig_conv);
37245         return tag_ptr(ret_conv, true);
37246 }
37247
37248 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1TransactionZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
37249         LDKCVec_TransactionZ _res_constr;
37250         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
37251         if (_res_constr.datalen > 0)
37252                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKTransaction), "LDKCVec_TransactionZ Elements");
37253         else
37254                 _res_constr.data = NULL;
37255         for (size_t i = 0; i < _res_constr.datalen; i++) {
37256                 int8_tArray _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
37257                 LDKTransaction _res_conv_8_ref;
37258                 _res_conv_8_ref.datalen = (*env)->GetArrayLength(env, _res_conv_8);
37259                 _res_conv_8_ref.data = MALLOC(_res_conv_8_ref.datalen, "LDKTransaction Bytes");
37260                 (*env)->GetByteArrayRegion(env, _res_conv_8, 0, _res_conv_8_ref.datalen, _res_conv_8_ref.data);
37261                 _res_conv_8_ref.data_is_owned = true;
37262                 _res_constr.data[i] = _res_conv_8_ref;
37263         }
37264         CVec_TransactionZ_free(_res_constr);
37265 }
37266
37267 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPurposeDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
37268         void* o_ptr = untag_ptr(o);
37269         CHECK_ACCESS(o_ptr);
37270         LDKPaymentPurpose o_conv = *(LDKPaymentPurpose*)(o_ptr);
37271         o_conv = PaymentPurpose_clone((LDKPaymentPurpose*)untag_ptr(o));
37272         LDKCResult_PaymentPurposeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPurposeDecodeErrorZ), "LDKCResult_PaymentPurposeDecodeErrorZ");
37273         *ret_conv = CResult_PaymentPurposeDecodeErrorZ_ok(o_conv);
37274         return tag_ptr(ret_conv, true);
37275 }
37276
37277 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPurposeDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
37278         void* e_ptr = untag_ptr(e);
37279         CHECK_ACCESS(e_ptr);
37280         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
37281         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
37282         LDKCResult_PaymentPurposeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPurposeDecodeErrorZ), "LDKCResult_PaymentPurposeDecodeErrorZ");
37283         *ret_conv = CResult_PaymentPurposeDecodeErrorZ_err(e_conv);
37284         return tag_ptr(ret_conv, true);
37285 }
37286
37287 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPurposeDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
37288         LDKCResult_PaymentPurposeDecodeErrorZ* o_conv = (LDKCResult_PaymentPurposeDecodeErrorZ*)untag_ptr(o);
37289         jboolean ret_conv = CResult_PaymentPurposeDecodeErrorZ_is_ok(o_conv);
37290         return ret_conv;
37291 }
37292
37293 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPurposeDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
37294         if (!ptr_is_owned(_res)) return;
37295         void* _res_ptr = untag_ptr(_res);
37296         CHECK_ACCESS(_res_ptr);
37297         LDKCResult_PaymentPurposeDecodeErrorZ _res_conv = *(LDKCResult_PaymentPurposeDecodeErrorZ*)(_res_ptr);
37298         FREE(untag_ptr(_res));
37299         CResult_PaymentPurposeDecodeErrorZ_free(_res_conv);
37300 }
37301
37302 static inline uint64_t CResult_PaymentPurposeDecodeErrorZ_clone_ptr(LDKCResult_PaymentPurposeDecodeErrorZ *NONNULL_PTR arg) {
37303         LDKCResult_PaymentPurposeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPurposeDecodeErrorZ), "LDKCResult_PaymentPurposeDecodeErrorZ");
37304         *ret_conv = CResult_PaymentPurposeDecodeErrorZ_clone(arg);
37305         return tag_ptr(ret_conv, true);
37306 }
37307 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPurposeDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
37308         LDKCResult_PaymentPurposeDecodeErrorZ* arg_conv = (LDKCResult_PaymentPurposeDecodeErrorZ*)untag_ptr(arg);
37309         int64_t ret_conv = CResult_PaymentPurposeDecodeErrorZ_clone_ptr(arg_conv);
37310         return ret_conv;
37311 }
37312
37313 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPurposeDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
37314         LDKCResult_PaymentPurposeDecodeErrorZ* orig_conv = (LDKCResult_PaymentPurposeDecodeErrorZ*)untag_ptr(orig);
37315         LDKCResult_PaymentPurposeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPurposeDecodeErrorZ), "LDKCResult_PaymentPurposeDecodeErrorZ");
37316         *ret_conv = CResult_PaymentPurposeDecodeErrorZ_clone(orig_conv);
37317         return tag_ptr(ret_conv, true);
37318 }
37319
37320 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClaimedHTLCDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
37321         LDKClaimedHTLC o_conv;
37322         o_conv.inner = untag_ptr(o);
37323         o_conv.is_owned = ptr_is_owned(o);
37324         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
37325         o_conv = ClaimedHTLC_clone(&o_conv);
37326         LDKCResult_ClaimedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClaimedHTLCDecodeErrorZ), "LDKCResult_ClaimedHTLCDecodeErrorZ");
37327         *ret_conv = CResult_ClaimedHTLCDecodeErrorZ_ok(o_conv);
37328         return tag_ptr(ret_conv, true);
37329 }
37330
37331 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClaimedHTLCDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
37332         void* e_ptr = untag_ptr(e);
37333         CHECK_ACCESS(e_ptr);
37334         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
37335         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
37336         LDKCResult_ClaimedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClaimedHTLCDecodeErrorZ), "LDKCResult_ClaimedHTLCDecodeErrorZ");
37337         *ret_conv = CResult_ClaimedHTLCDecodeErrorZ_err(e_conv);
37338         return tag_ptr(ret_conv, true);
37339 }
37340
37341 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ClaimedHTLCDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
37342         LDKCResult_ClaimedHTLCDecodeErrorZ* o_conv = (LDKCResult_ClaimedHTLCDecodeErrorZ*)untag_ptr(o);
37343         jboolean ret_conv = CResult_ClaimedHTLCDecodeErrorZ_is_ok(o_conv);
37344         return ret_conv;
37345 }
37346
37347 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ClaimedHTLCDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
37348         if (!ptr_is_owned(_res)) return;
37349         void* _res_ptr = untag_ptr(_res);
37350         CHECK_ACCESS(_res_ptr);
37351         LDKCResult_ClaimedHTLCDecodeErrorZ _res_conv = *(LDKCResult_ClaimedHTLCDecodeErrorZ*)(_res_ptr);
37352         FREE(untag_ptr(_res));
37353         CResult_ClaimedHTLCDecodeErrorZ_free(_res_conv);
37354 }
37355
37356 static inline uint64_t CResult_ClaimedHTLCDecodeErrorZ_clone_ptr(LDKCResult_ClaimedHTLCDecodeErrorZ *NONNULL_PTR arg) {
37357         LDKCResult_ClaimedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClaimedHTLCDecodeErrorZ), "LDKCResult_ClaimedHTLCDecodeErrorZ");
37358         *ret_conv = CResult_ClaimedHTLCDecodeErrorZ_clone(arg);
37359         return tag_ptr(ret_conv, true);
37360 }
37361 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClaimedHTLCDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
37362         LDKCResult_ClaimedHTLCDecodeErrorZ* arg_conv = (LDKCResult_ClaimedHTLCDecodeErrorZ*)untag_ptr(arg);
37363         int64_t ret_conv = CResult_ClaimedHTLCDecodeErrorZ_clone_ptr(arg_conv);
37364         return ret_conv;
37365 }
37366
37367 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClaimedHTLCDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
37368         LDKCResult_ClaimedHTLCDecodeErrorZ* orig_conv = (LDKCResult_ClaimedHTLCDecodeErrorZ*)untag_ptr(orig);
37369         LDKCResult_ClaimedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClaimedHTLCDecodeErrorZ), "LDKCResult_ClaimedHTLCDecodeErrorZ");
37370         *ret_conv = CResult_ClaimedHTLCDecodeErrorZ_clone(orig_conv);
37371         return tag_ptr(ret_conv, true);
37372 }
37373
37374 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1PathFailureZ_1some(JNIEnv *env, jclass clz, int64_t o) {
37375         void* o_ptr = untag_ptr(o);
37376         CHECK_ACCESS(o_ptr);
37377         LDKPathFailure o_conv = *(LDKPathFailure*)(o_ptr);
37378         o_conv = PathFailure_clone((LDKPathFailure*)untag_ptr(o));
37379         LDKCOption_PathFailureZ *ret_copy = MALLOC(sizeof(LDKCOption_PathFailureZ), "LDKCOption_PathFailureZ");
37380         *ret_copy = COption_PathFailureZ_some(o_conv);
37381         int64_t ret_ref = tag_ptr(ret_copy, true);
37382         return ret_ref;
37383 }
37384
37385 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1PathFailureZ_1none(JNIEnv *env, jclass clz) {
37386         LDKCOption_PathFailureZ *ret_copy = MALLOC(sizeof(LDKCOption_PathFailureZ), "LDKCOption_PathFailureZ");
37387         *ret_copy = COption_PathFailureZ_none();
37388         int64_t ret_ref = tag_ptr(ret_copy, true);
37389         return ret_ref;
37390 }
37391
37392 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1PathFailureZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
37393         if (!ptr_is_owned(_res)) return;
37394         void* _res_ptr = untag_ptr(_res);
37395         CHECK_ACCESS(_res_ptr);
37396         LDKCOption_PathFailureZ _res_conv = *(LDKCOption_PathFailureZ*)(_res_ptr);
37397         FREE(untag_ptr(_res));
37398         COption_PathFailureZ_free(_res_conv);
37399 }
37400
37401 static inline uint64_t COption_PathFailureZ_clone_ptr(LDKCOption_PathFailureZ *NONNULL_PTR arg) {
37402         LDKCOption_PathFailureZ *ret_copy = MALLOC(sizeof(LDKCOption_PathFailureZ), "LDKCOption_PathFailureZ");
37403         *ret_copy = COption_PathFailureZ_clone(arg);
37404         int64_t ret_ref = tag_ptr(ret_copy, true);
37405         return ret_ref;
37406 }
37407 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1PathFailureZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
37408         LDKCOption_PathFailureZ* arg_conv = (LDKCOption_PathFailureZ*)untag_ptr(arg);
37409         int64_t ret_conv = COption_PathFailureZ_clone_ptr(arg_conv);
37410         return ret_conv;
37411 }
37412
37413 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1PathFailureZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
37414         LDKCOption_PathFailureZ* orig_conv = (LDKCOption_PathFailureZ*)untag_ptr(orig);
37415         LDKCOption_PathFailureZ *ret_copy = MALLOC(sizeof(LDKCOption_PathFailureZ), "LDKCOption_PathFailureZ");
37416         *ret_copy = COption_PathFailureZ_clone(orig_conv);
37417         int64_t ret_ref = tag_ptr(ret_copy, true);
37418         return ret_ref;
37419 }
37420
37421 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1PathFailureZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
37422         void* o_ptr = untag_ptr(o);
37423         CHECK_ACCESS(o_ptr);
37424         LDKCOption_PathFailureZ o_conv = *(LDKCOption_PathFailureZ*)(o_ptr);
37425         o_conv = COption_PathFailureZ_clone((LDKCOption_PathFailureZ*)untag_ptr(o));
37426         LDKCResult_COption_PathFailureZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_PathFailureZDecodeErrorZ), "LDKCResult_COption_PathFailureZDecodeErrorZ");
37427         *ret_conv = CResult_COption_PathFailureZDecodeErrorZ_ok(o_conv);
37428         return tag_ptr(ret_conv, true);
37429 }
37430
37431 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1PathFailureZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
37432         void* e_ptr = untag_ptr(e);
37433         CHECK_ACCESS(e_ptr);
37434         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
37435         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
37436         LDKCResult_COption_PathFailureZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_PathFailureZDecodeErrorZ), "LDKCResult_COption_PathFailureZDecodeErrorZ");
37437         *ret_conv = CResult_COption_PathFailureZDecodeErrorZ_err(e_conv);
37438         return tag_ptr(ret_conv, true);
37439 }
37440
37441 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1PathFailureZDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
37442         LDKCResult_COption_PathFailureZDecodeErrorZ* o_conv = (LDKCResult_COption_PathFailureZDecodeErrorZ*)untag_ptr(o);
37443         jboolean ret_conv = CResult_COption_PathFailureZDecodeErrorZ_is_ok(o_conv);
37444         return ret_conv;
37445 }
37446
37447 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1PathFailureZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
37448         if (!ptr_is_owned(_res)) return;
37449         void* _res_ptr = untag_ptr(_res);
37450         CHECK_ACCESS(_res_ptr);
37451         LDKCResult_COption_PathFailureZDecodeErrorZ _res_conv = *(LDKCResult_COption_PathFailureZDecodeErrorZ*)(_res_ptr);
37452         FREE(untag_ptr(_res));
37453         CResult_COption_PathFailureZDecodeErrorZ_free(_res_conv);
37454 }
37455
37456 static inline uint64_t CResult_COption_PathFailureZDecodeErrorZ_clone_ptr(LDKCResult_COption_PathFailureZDecodeErrorZ *NONNULL_PTR arg) {
37457         LDKCResult_COption_PathFailureZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_PathFailureZDecodeErrorZ), "LDKCResult_COption_PathFailureZDecodeErrorZ");
37458         *ret_conv = CResult_COption_PathFailureZDecodeErrorZ_clone(arg);
37459         return tag_ptr(ret_conv, true);
37460 }
37461 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1PathFailureZDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
37462         LDKCResult_COption_PathFailureZDecodeErrorZ* arg_conv = (LDKCResult_COption_PathFailureZDecodeErrorZ*)untag_ptr(arg);
37463         int64_t ret_conv = CResult_COption_PathFailureZDecodeErrorZ_clone_ptr(arg_conv);
37464         return ret_conv;
37465 }
37466
37467 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1PathFailureZDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
37468         LDKCResult_COption_PathFailureZDecodeErrorZ* orig_conv = (LDKCResult_COption_PathFailureZDecodeErrorZ*)untag_ptr(orig);
37469         LDKCResult_COption_PathFailureZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_PathFailureZDecodeErrorZ), "LDKCResult_COption_PathFailureZDecodeErrorZ");
37470         *ret_conv = CResult_COption_PathFailureZDecodeErrorZ_clone(orig_conv);
37471         return tag_ptr(ret_conv, true);
37472 }
37473
37474 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1ClosureReasonZ_1some(JNIEnv *env, jclass clz, int64_t o) {
37475         void* o_ptr = untag_ptr(o);
37476         CHECK_ACCESS(o_ptr);
37477         LDKClosureReason o_conv = *(LDKClosureReason*)(o_ptr);
37478         o_conv = ClosureReason_clone((LDKClosureReason*)untag_ptr(o));
37479         LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
37480         *ret_copy = COption_ClosureReasonZ_some(o_conv);
37481         int64_t ret_ref = tag_ptr(ret_copy, true);
37482         return ret_ref;
37483 }
37484
37485 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1ClosureReasonZ_1none(JNIEnv *env, jclass clz) {
37486         LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
37487         *ret_copy = COption_ClosureReasonZ_none();
37488         int64_t ret_ref = tag_ptr(ret_copy, true);
37489         return ret_ref;
37490 }
37491
37492 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1ClosureReasonZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
37493         if (!ptr_is_owned(_res)) return;
37494         void* _res_ptr = untag_ptr(_res);
37495         CHECK_ACCESS(_res_ptr);
37496         LDKCOption_ClosureReasonZ _res_conv = *(LDKCOption_ClosureReasonZ*)(_res_ptr);
37497         FREE(untag_ptr(_res));
37498         COption_ClosureReasonZ_free(_res_conv);
37499 }
37500
37501 static inline uint64_t COption_ClosureReasonZ_clone_ptr(LDKCOption_ClosureReasonZ *NONNULL_PTR arg) {
37502         LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
37503         *ret_copy = COption_ClosureReasonZ_clone(arg);
37504         int64_t ret_ref = tag_ptr(ret_copy, true);
37505         return ret_ref;
37506 }
37507 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1ClosureReasonZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
37508         LDKCOption_ClosureReasonZ* arg_conv = (LDKCOption_ClosureReasonZ*)untag_ptr(arg);
37509         int64_t ret_conv = COption_ClosureReasonZ_clone_ptr(arg_conv);
37510         return ret_conv;
37511 }
37512
37513 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1ClosureReasonZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
37514         LDKCOption_ClosureReasonZ* orig_conv = (LDKCOption_ClosureReasonZ*)untag_ptr(orig);
37515         LDKCOption_ClosureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_ClosureReasonZ), "LDKCOption_ClosureReasonZ");
37516         *ret_copy = COption_ClosureReasonZ_clone(orig_conv);
37517         int64_t ret_ref = tag_ptr(ret_copy, true);
37518         return ret_ref;
37519 }
37520
37521 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1ClosureReasonZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
37522         void* o_ptr = untag_ptr(o);
37523         CHECK_ACCESS(o_ptr);
37524         LDKCOption_ClosureReasonZ o_conv = *(LDKCOption_ClosureReasonZ*)(o_ptr);
37525         o_conv = COption_ClosureReasonZ_clone((LDKCOption_ClosureReasonZ*)untag_ptr(o));
37526         LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
37527         *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_ok(o_conv);
37528         return tag_ptr(ret_conv, true);
37529 }
37530
37531 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1ClosureReasonZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
37532         void* e_ptr = untag_ptr(e);
37533         CHECK_ACCESS(e_ptr);
37534         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
37535         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
37536         LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
37537         *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_err(e_conv);
37538         return tag_ptr(ret_conv, true);
37539 }
37540
37541 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1ClosureReasonZDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
37542         LDKCResult_COption_ClosureReasonZDecodeErrorZ* o_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)untag_ptr(o);
37543         jboolean ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_is_ok(o_conv);
37544         return ret_conv;
37545 }
37546
37547 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1ClosureReasonZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
37548         if (!ptr_is_owned(_res)) return;
37549         void* _res_ptr = untag_ptr(_res);
37550         CHECK_ACCESS(_res_ptr);
37551         LDKCResult_COption_ClosureReasonZDecodeErrorZ _res_conv = *(LDKCResult_COption_ClosureReasonZDecodeErrorZ*)(_res_ptr);
37552         FREE(untag_ptr(_res));
37553         CResult_COption_ClosureReasonZDecodeErrorZ_free(_res_conv);
37554 }
37555
37556 static inline uint64_t CResult_COption_ClosureReasonZDecodeErrorZ_clone_ptr(LDKCResult_COption_ClosureReasonZDecodeErrorZ *NONNULL_PTR arg) {
37557         LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
37558         *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_clone(arg);
37559         return tag_ptr(ret_conv, true);
37560 }
37561 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1ClosureReasonZDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
37562         LDKCResult_COption_ClosureReasonZDecodeErrorZ* arg_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)untag_ptr(arg);
37563         int64_t ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_clone_ptr(arg_conv);
37564         return ret_conv;
37565 }
37566
37567 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1ClosureReasonZDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
37568         LDKCResult_COption_ClosureReasonZDecodeErrorZ* orig_conv = (LDKCResult_COption_ClosureReasonZDecodeErrorZ*)untag_ptr(orig);
37569         LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
37570         *ret_conv = CResult_COption_ClosureReasonZDecodeErrorZ_clone(orig_conv);
37571         return tag_ptr(ret_conv, true);
37572 }
37573
37574 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1HTLCDestinationZ_1some(JNIEnv *env, jclass clz, int64_t o) {
37575         void* o_ptr = untag_ptr(o);
37576         CHECK_ACCESS(o_ptr);
37577         LDKHTLCDestination o_conv = *(LDKHTLCDestination*)(o_ptr);
37578         o_conv = HTLCDestination_clone((LDKHTLCDestination*)untag_ptr(o));
37579         LDKCOption_HTLCDestinationZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCDestinationZ), "LDKCOption_HTLCDestinationZ");
37580         *ret_copy = COption_HTLCDestinationZ_some(o_conv);
37581         int64_t ret_ref = tag_ptr(ret_copy, true);
37582         return ret_ref;
37583 }
37584
37585 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1HTLCDestinationZ_1none(JNIEnv *env, jclass clz) {
37586         LDKCOption_HTLCDestinationZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCDestinationZ), "LDKCOption_HTLCDestinationZ");
37587         *ret_copy = COption_HTLCDestinationZ_none();
37588         int64_t ret_ref = tag_ptr(ret_copy, true);
37589         return ret_ref;
37590 }
37591
37592 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1HTLCDestinationZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
37593         if (!ptr_is_owned(_res)) return;
37594         void* _res_ptr = untag_ptr(_res);
37595         CHECK_ACCESS(_res_ptr);
37596         LDKCOption_HTLCDestinationZ _res_conv = *(LDKCOption_HTLCDestinationZ*)(_res_ptr);
37597         FREE(untag_ptr(_res));
37598         COption_HTLCDestinationZ_free(_res_conv);
37599 }
37600
37601 static inline uint64_t COption_HTLCDestinationZ_clone_ptr(LDKCOption_HTLCDestinationZ *NONNULL_PTR arg) {
37602         LDKCOption_HTLCDestinationZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCDestinationZ), "LDKCOption_HTLCDestinationZ");
37603         *ret_copy = COption_HTLCDestinationZ_clone(arg);
37604         int64_t ret_ref = tag_ptr(ret_copy, true);
37605         return ret_ref;
37606 }
37607 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1HTLCDestinationZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
37608         LDKCOption_HTLCDestinationZ* arg_conv = (LDKCOption_HTLCDestinationZ*)untag_ptr(arg);
37609         int64_t ret_conv = COption_HTLCDestinationZ_clone_ptr(arg_conv);
37610         return ret_conv;
37611 }
37612
37613 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1HTLCDestinationZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
37614         LDKCOption_HTLCDestinationZ* orig_conv = (LDKCOption_HTLCDestinationZ*)untag_ptr(orig);
37615         LDKCOption_HTLCDestinationZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCDestinationZ), "LDKCOption_HTLCDestinationZ");
37616         *ret_copy = COption_HTLCDestinationZ_clone(orig_conv);
37617         int64_t ret_ref = tag_ptr(ret_copy, true);
37618         return ret_ref;
37619 }
37620
37621 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1HTLCDestinationZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
37622         void* o_ptr = untag_ptr(o);
37623         CHECK_ACCESS(o_ptr);
37624         LDKCOption_HTLCDestinationZ o_conv = *(LDKCOption_HTLCDestinationZ*)(o_ptr);
37625         o_conv = COption_HTLCDestinationZ_clone((LDKCOption_HTLCDestinationZ*)untag_ptr(o));
37626         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_HTLCDestinationZDecodeErrorZ), "LDKCResult_COption_HTLCDestinationZDecodeErrorZ");
37627         *ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_ok(o_conv);
37628         return tag_ptr(ret_conv, true);
37629 }
37630
37631 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1HTLCDestinationZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
37632         void* e_ptr = untag_ptr(e);
37633         CHECK_ACCESS(e_ptr);
37634         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
37635         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
37636         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_HTLCDestinationZDecodeErrorZ), "LDKCResult_COption_HTLCDestinationZDecodeErrorZ");
37637         *ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_err(e_conv);
37638         return tag_ptr(ret_conv, true);
37639 }
37640
37641 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1HTLCDestinationZDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
37642         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* o_conv = (LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)untag_ptr(o);
37643         jboolean ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_is_ok(o_conv);
37644         return ret_conv;
37645 }
37646
37647 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1HTLCDestinationZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
37648         if (!ptr_is_owned(_res)) return;
37649         void* _res_ptr = untag_ptr(_res);
37650         CHECK_ACCESS(_res_ptr);
37651         LDKCResult_COption_HTLCDestinationZDecodeErrorZ _res_conv = *(LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)(_res_ptr);
37652         FREE(untag_ptr(_res));
37653         CResult_COption_HTLCDestinationZDecodeErrorZ_free(_res_conv);
37654 }
37655
37656 static inline uint64_t CResult_COption_HTLCDestinationZDecodeErrorZ_clone_ptr(LDKCResult_COption_HTLCDestinationZDecodeErrorZ *NONNULL_PTR arg) {
37657         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_HTLCDestinationZDecodeErrorZ), "LDKCResult_COption_HTLCDestinationZDecodeErrorZ");
37658         *ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_clone(arg);
37659         return tag_ptr(ret_conv, true);
37660 }
37661 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1HTLCDestinationZDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
37662         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* arg_conv = (LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)untag_ptr(arg);
37663         int64_t ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_clone_ptr(arg_conv);
37664         return ret_conv;
37665 }
37666
37667 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1HTLCDestinationZDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
37668         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* orig_conv = (LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)untag_ptr(orig);
37669         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_HTLCDestinationZDecodeErrorZ), "LDKCResult_COption_HTLCDestinationZDecodeErrorZ");
37670         *ret_conv = CResult_COption_HTLCDestinationZDecodeErrorZ_clone(orig_conv);
37671         return tag_ptr(ret_conv, true);
37672 }
37673
37674 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentFailureReasonDecodeErrorZ_1ok(JNIEnv *env, jclass clz, jclass o) {
37675         LDKPaymentFailureReason o_conv = LDKPaymentFailureReason_from_java(env, o);
37676         LDKCResult_PaymentFailureReasonDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentFailureReasonDecodeErrorZ), "LDKCResult_PaymentFailureReasonDecodeErrorZ");
37677         *ret_conv = CResult_PaymentFailureReasonDecodeErrorZ_ok(o_conv);
37678         return tag_ptr(ret_conv, true);
37679 }
37680
37681 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentFailureReasonDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
37682         void* e_ptr = untag_ptr(e);
37683         CHECK_ACCESS(e_ptr);
37684         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
37685         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
37686         LDKCResult_PaymentFailureReasonDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentFailureReasonDecodeErrorZ), "LDKCResult_PaymentFailureReasonDecodeErrorZ");
37687         *ret_conv = CResult_PaymentFailureReasonDecodeErrorZ_err(e_conv);
37688         return tag_ptr(ret_conv, true);
37689 }
37690
37691 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentFailureReasonDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
37692         LDKCResult_PaymentFailureReasonDecodeErrorZ* o_conv = (LDKCResult_PaymentFailureReasonDecodeErrorZ*)untag_ptr(o);
37693         jboolean ret_conv = CResult_PaymentFailureReasonDecodeErrorZ_is_ok(o_conv);
37694         return ret_conv;
37695 }
37696
37697 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentFailureReasonDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
37698         if (!ptr_is_owned(_res)) return;
37699         void* _res_ptr = untag_ptr(_res);
37700         CHECK_ACCESS(_res_ptr);
37701         LDKCResult_PaymentFailureReasonDecodeErrorZ _res_conv = *(LDKCResult_PaymentFailureReasonDecodeErrorZ*)(_res_ptr);
37702         FREE(untag_ptr(_res));
37703         CResult_PaymentFailureReasonDecodeErrorZ_free(_res_conv);
37704 }
37705
37706 static inline uint64_t CResult_PaymentFailureReasonDecodeErrorZ_clone_ptr(LDKCResult_PaymentFailureReasonDecodeErrorZ *NONNULL_PTR arg) {
37707         LDKCResult_PaymentFailureReasonDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentFailureReasonDecodeErrorZ), "LDKCResult_PaymentFailureReasonDecodeErrorZ");
37708         *ret_conv = CResult_PaymentFailureReasonDecodeErrorZ_clone(arg);
37709         return tag_ptr(ret_conv, true);
37710 }
37711 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentFailureReasonDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
37712         LDKCResult_PaymentFailureReasonDecodeErrorZ* arg_conv = (LDKCResult_PaymentFailureReasonDecodeErrorZ*)untag_ptr(arg);
37713         int64_t ret_conv = CResult_PaymentFailureReasonDecodeErrorZ_clone_ptr(arg_conv);
37714         return ret_conv;
37715 }
37716
37717 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentFailureReasonDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
37718         LDKCResult_PaymentFailureReasonDecodeErrorZ* orig_conv = (LDKCResult_PaymentFailureReasonDecodeErrorZ*)untag_ptr(orig);
37719         LDKCResult_PaymentFailureReasonDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentFailureReasonDecodeErrorZ), "LDKCResult_PaymentFailureReasonDecodeErrorZ");
37720         *ret_conv = CResult_PaymentFailureReasonDecodeErrorZ_clone(orig_conv);
37721         return tag_ptr(ret_conv, true);
37722 }
37723
37724 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1U128Z_1some(JNIEnv *env, jclass clz, int8_tArray o) {
37725         LDKU128 o_ref;
37726         CHECK((*env)->GetArrayLength(env, o) == 16);
37727         (*env)->GetByteArrayRegion(env, o, 0, 16, o_ref.le_bytes);
37728         LDKCOption_U128Z *ret_copy = MALLOC(sizeof(LDKCOption_U128Z), "LDKCOption_U128Z");
37729         *ret_copy = COption_U128Z_some(o_ref);
37730         int64_t ret_ref = tag_ptr(ret_copy, true);
37731         return ret_ref;
37732 }
37733
37734 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1U128Z_1none(JNIEnv *env, jclass clz) {
37735         LDKCOption_U128Z *ret_copy = MALLOC(sizeof(LDKCOption_U128Z), "LDKCOption_U128Z");
37736         *ret_copy = COption_U128Z_none();
37737         int64_t ret_ref = tag_ptr(ret_copy, true);
37738         return ret_ref;
37739 }
37740
37741 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1U128Z_1free(JNIEnv *env, jclass clz, int64_t _res) {
37742         if (!ptr_is_owned(_res)) return;
37743         void* _res_ptr = untag_ptr(_res);
37744         CHECK_ACCESS(_res_ptr);
37745         LDKCOption_U128Z _res_conv = *(LDKCOption_U128Z*)(_res_ptr);
37746         FREE(untag_ptr(_res));
37747         COption_U128Z_free(_res_conv);
37748 }
37749
37750 static inline uint64_t COption_U128Z_clone_ptr(LDKCOption_U128Z *NONNULL_PTR arg) {
37751         LDKCOption_U128Z *ret_copy = MALLOC(sizeof(LDKCOption_U128Z), "LDKCOption_U128Z");
37752         *ret_copy = COption_U128Z_clone(arg);
37753         int64_t ret_ref = tag_ptr(ret_copy, true);
37754         return ret_ref;
37755 }
37756 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1U128Z_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
37757         LDKCOption_U128Z* arg_conv = (LDKCOption_U128Z*)untag_ptr(arg);
37758         int64_t ret_conv = COption_U128Z_clone_ptr(arg_conv);
37759         return ret_conv;
37760 }
37761
37762 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1U128Z_1clone(JNIEnv *env, jclass clz, int64_t orig) {
37763         LDKCOption_U128Z* orig_conv = (LDKCOption_U128Z*)untag_ptr(orig);
37764         LDKCOption_U128Z *ret_copy = MALLOC(sizeof(LDKCOption_U128Z), "LDKCOption_U128Z");
37765         *ret_copy = COption_U128Z_clone(orig_conv);
37766         int64_t ret_ref = tag_ptr(ret_copy, true);
37767         return ret_ref;
37768 }
37769
37770 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1ClaimedHTLCZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
37771         LDKCVec_ClaimedHTLCZ _res_constr;
37772         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
37773         if (_res_constr.datalen > 0)
37774                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKClaimedHTLC), "LDKCVec_ClaimedHTLCZ Elements");
37775         else
37776                 _res_constr.data = NULL;
37777         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
37778         for (size_t n = 0; n < _res_constr.datalen; n++) {
37779                 int64_t _res_conv_13 = _res_vals[n];
37780                 LDKClaimedHTLC _res_conv_13_conv;
37781                 _res_conv_13_conv.inner = untag_ptr(_res_conv_13);
37782                 _res_conv_13_conv.is_owned = ptr_is_owned(_res_conv_13);
37783                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_13_conv);
37784                 _res_constr.data[n] = _res_conv_13_conv;
37785         }
37786         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
37787         CVec_ClaimedHTLCZ_free(_res_constr);
37788 }
37789
37790 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1PaymentFailureReasonZ_1some(JNIEnv *env, jclass clz, jclass o) {
37791         LDKPaymentFailureReason o_conv = LDKPaymentFailureReason_from_java(env, o);
37792         LDKCOption_PaymentFailureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_PaymentFailureReasonZ), "LDKCOption_PaymentFailureReasonZ");
37793         *ret_copy = COption_PaymentFailureReasonZ_some(o_conv);
37794         int64_t ret_ref = tag_ptr(ret_copy, true);
37795         return ret_ref;
37796 }
37797
37798 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1PaymentFailureReasonZ_1none(JNIEnv *env, jclass clz) {
37799         LDKCOption_PaymentFailureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_PaymentFailureReasonZ), "LDKCOption_PaymentFailureReasonZ");
37800         *ret_copy = COption_PaymentFailureReasonZ_none();
37801         int64_t ret_ref = tag_ptr(ret_copy, true);
37802         return ret_ref;
37803 }
37804
37805 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1PaymentFailureReasonZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
37806         if (!ptr_is_owned(_res)) return;
37807         void* _res_ptr = untag_ptr(_res);
37808         CHECK_ACCESS(_res_ptr);
37809         LDKCOption_PaymentFailureReasonZ _res_conv = *(LDKCOption_PaymentFailureReasonZ*)(_res_ptr);
37810         FREE(untag_ptr(_res));
37811         COption_PaymentFailureReasonZ_free(_res_conv);
37812 }
37813
37814 static inline uint64_t COption_PaymentFailureReasonZ_clone_ptr(LDKCOption_PaymentFailureReasonZ *NONNULL_PTR arg) {
37815         LDKCOption_PaymentFailureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_PaymentFailureReasonZ), "LDKCOption_PaymentFailureReasonZ");
37816         *ret_copy = COption_PaymentFailureReasonZ_clone(arg);
37817         int64_t ret_ref = tag_ptr(ret_copy, true);
37818         return ret_ref;
37819 }
37820 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1PaymentFailureReasonZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
37821         LDKCOption_PaymentFailureReasonZ* arg_conv = (LDKCOption_PaymentFailureReasonZ*)untag_ptr(arg);
37822         int64_t ret_conv = COption_PaymentFailureReasonZ_clone_ptr(arg_conv);
37823         return ret_conv;
37824 }
37825
37826 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1PaymentFailureReasonZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
37827         LDKCOption_PaymentFailureReasonZ* orig_conv = (LDKCOption_PaymentFailureReasonZ*)untag_ptr(orig);
37828         LDKCOption_PaymentFailureReasonZ *ret_copy = MALLOC(sizeof(LDKCOption_PaymentFailureReasonZ), "LDKCOption_PaymentFailureReasonZ");
37829         *ret_copy = COption_PaymentFailureReasonZ_clone(orig_conv);
37830         int64_t ret_ref = tag_ptr(ret_copy, true);
37831         return ret_ref;
37832 }
37833
37834 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1EventZ_1some(JNIEnv *env, jclass clz, int64_t o) {
37835         void* o_ptr = untag_ptr(o);
37836         CHECK_ACCESS(o_ptr);
37837         LDKEvent o_conv = *(LDKEvent*)(o_ptr);
37838         o_conv = Event_clone((LDKEvent*)untag_ptr(o));
37839         LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
37840         *ret_copy = COption_EventZ_some(o_conv);
37841         int64_t ret_ref = tag_ptr(ret_copy, true);
37842         return ret_ref;
37843 }
37844
37845 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1EventZ_1none(JNIEnv *env, jclass clz) {
37846         LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
37847         *ret_copy = COption_EventZ_none();
37848         int64_t ret_ref = tag_ptr(ret_copy, true);
37849         return ret_ref;
37850 }
37851
37852 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1EventZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
37853         if (!ptr_is_owned(_res)) return;
37854         void* _res_ptr = untag_ptr(_res);
37855         CHECK_ACCESS(_res_ptr);
37856         LDKCOption_EventZ _res_conv = *(LDKCOption_EventZ*)(_res_ptr);
37857         FREE(untag_ptr(_res));
37858         COption_EventZ_free(_res_conv);
37859 }
37860
37861 static inline uint64_t COption_EventZ_clone_ptr(LDKCOption_EventZ *NONNULL_PTR arg) {
37862         LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
37863         *ret_copy = COption_EventZ_clone(arg);
37864         int64_t ret_ref = tag_ptr(ret_copy, true);
37865         return ret_ref;
37866 }
37867 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1EventZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
37868         LDKCOption_EventZ* arg_conv = (LDKCOption_EventZ*)untag_ptr(arg);
37869         int64_t ret_conv = COption_EventZ_clone_ptr(arg_conv);
37870         return ret_conv;
37871 }
37872
37873 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1EventZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
37874         LDKCOption_EventZ* orig_conv = (LDKCOption_EventZ*)untag_ptr(orig);
37875         LDKCOption_EventZ *ret_copy = MALLOC(sizeof(LDKCOption_EventZ), "LDKCOption_EventZ");
37876         *ret_copy = COption_EventZ_clone(orig_conv);
37877         int64_t ret_ref = tag_ptr(ret_copy, true);
37878         return ret_ref;
37879 }
37880
37881 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1EventZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
37882         void* o_ptr = untag_ptr(o);
37883         CHECK_ACCESS(o_ptr);
37884         LDKCOption_EventZ o_conv = *(LDKCOption_EventZ*)(o_ptr);
37885         o_conv = COption_EventZ_clone((LDKCOption_EventZ*)untag_ptr(o));
37886         LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
37887         *ret_conv = CResult_COption_EventZDecodeErrorZ_ok(o_conv);
37888         return tag_ptr(ret_conv, true);
37889 }
37890
37891 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1EventZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
37892         void* e_ptr = untag_ptr(e);
37893         CHECK_ACCESS(e_ptr);
37894         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
37895         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
37896         LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
37897         *ret_conv = CResult_COption_EventZDecodeErrorZ_err(e_conv);
37898         return tag_ptr(ret_conv, true);
37899 }
37900
37901 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1EventZDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
37902         LDKCResult_COption_EventZDecodeErrorZ* o_conv = (LDKCResult_COption_EventZDecodeErrorZ*)untag_ptr(o);
37903         jboolean ret_conv = CResult_COption_EventZDecodeErrorZ_is_ok(o_conv);
37904         return ret_conv;
37905 }
37906
37907 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1EventZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
37908         if (!ptr_is_owned(_res)) return;
37909         void* _res_ptr = untag_ptr(_res);
37910         CHECK_ACCESS(_res_ptr);
37911         LDKCResult_COption_EventZDecodeErrorZ _res_conv = *(LDKCResult_COption_EventZDecodeErrorZ*)(_res_ptr);
37912         FREE(untag_ptr(_res));
37913         CResult_COption_EventZDecodeErrorZ_free(_res_conv);
37914 }
37915
37916 static inline uint64_t CResult_COption_EventZDecodeErrorZ_clone_ptr(LDKCResult_COption_EventZDecodeErrorZ *NONNULL_PTR arg) {
37917         LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
37918         *ret_conv = CResult_COption_EventZDecodeErrorZ_clone(arg);
37919         return tag_ptr(ret_conv, true);
37920 }
37921 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1EventZDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
37922         LDKCResult_COption_EventZDecodeErrorZ* arg_conv = (LDKCResult_COption_EventZDecodeErrorZ*)untag_ptr(arg);
37923         int64_t ret_conv = CResult_COption_EventZDecodeErrorZ_clone_ptr(arg_conv);
37924         return ret_conv;
37925 }
37926
37927 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1EventZDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
37928         LDKCResult_COption_EventZDecodeErrorZ* orig_conv = (LDKCResult_COption_EventZDecodeErrorZ*)untag_ptr(orig);
37929         LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
37930         *ret_conv = CResult_COption_EventZDecodeErrorZ_clone(orig_conv);
37931         return tag_ptr(ret_conv, true);
37932 }
37933
37934 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixBolt11ParseErrorZ_1ok(JNIEnv *env, jclass clz, jclass o) {
37935         LDKSiPrefix o_conv = LDKSiPrefix_from_java(env, o);
37936         LDKCResult_SiPrefixBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixBolt11ParseErrorZ), "LDKCResult_SiPrefixBolt11ParseErrorZ");
37937         *ret_conv = CResult_SiPrefixBolt11ParseErrorZ_ok(o_conv);
37938         return tag_ptr(ret_conv, true);
37939 }
37940
37941 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixBolt11ParseErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
37942         void* e_ptr = untag_ptr(e);
37943         CHECK_ACCESS(e_ptr);
37944         LDKBolt11ParseError e_conv = *(LDKBolt11ParseError*)(e_ptr);
37945         e_conv = Bolt11ParseError_clone((LDKBolt11ParseError*)untag_ptr(e));
37946         LDKCResult_SiPrefixBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixBolt11ParseErrorZ), "LDKCResult_SiPrefixBolt11ParseErrorZ");
37947         *ret_conv = CResult_SiPrefixBolt11ParseErrorZ_err(e_conv);
37948         return tag_ptr(ret_conv, true);
37949 }
37950
37951 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixBolt11ParseErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
37952         LDKCResult_SiPrefixBolt11ParseErrorZ* o_conv = (LDKCResult_SiPrefixBolt11ParseErrorZ*)untag_ptr(o);
37953         jboolean ret_conv = CResult_SiPrefixBolt11ParseErrorZ_is_ok(o_conv);
37954         return ret_conv;
37955 }
37956
37957 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixBolt11ParseErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
37958         if (!ptr_is_owned(_res)) return;
37959         void* _res_ptr = untag_ptr(_res);
37960         CHECK_ACCESS(_res_ptr);
37961         LDKCResult_SiPrefixBolt11ParseErrorZ _res_conv = *(LDKCResult_SiPrefixBolt11ParseErrorZ*)(_res_ptr);
37962         FREE(untag_ptr(_res));
37963         CResult_SiPrefixBolt11ParseErrorZ_free(_res_conv);
37964 }
37965
37966 static inline uint64_t CResult_SiPrefixBolt11ParseErrorZ_clone_ptr(LDKCResult_SiPrefixBolt11ParseErrorZ *NONNULL_PTR arg) {
37967         LDKCResult_SiPrefixBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixBolt11ParseErrorZ), "LDKCResult_SiPrefixBolt11ParseErrorZ");
37968         *ret_conv = CResult_SiPrefixBolt11ParseErrorZ_clone(arg);
37969         return tag_ptr(ret_conv, true);
37970 }
37971 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixBolt11ParseErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
37972         LDKCResult_SiPrefixBolt11ParseErrorZ* arg_conv = (LDKCResult_SiPrefixBolt11ParseErrorZ*)untag_ptr(arg);
37973         int64_t ret_conv = CResult_SiPrefixBolt11ParseErrorZ_clone_ptr(arg_conv);
37974         return ret_conv;
37975 }
37976
37977 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixBolt11ParseErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
37978         LDKCResult_SiPrefixBolt11ParseErrorZ* orig_conv = (LDKCResult_SiPrefixBolt11ParseErrorZ*)untag_ptr(orig);
37979         LDKCResult_SiPrefixBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixBolt11ParseErrorZ), "LDKCResult_SiPrefixBolt11ParseErrorZ");
37980         *ret_conv = CResult_SiPrefixBolt11ParseErrorZ_clone(orig_conv);
37981         return tag_ptr(ret_conv, true);
37982 }
37983
37984 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceParseOrSemanticErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
37985         LDKBolt11Invoice o_conv;
37986         o_conv.inner = untag_ptr(o);
37987         o_conv.is_owned = ptr_is_owned(o);
37988         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
37989         o_conv = Bolt11Invoice_clone(&o_conv);
37990         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ), "LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ");
37991         *ret_conv = CResult_Bolt11InvoiceParseOrSemanticErrorZ_ok(o_conv);
37992         return tag_ptr(ret_conv, true);
37993 }
37994
37995 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceParseOrSemanticErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
37996         void* e_ptr = untag_ptr(e);
37997         CHECK_ACCESS(e_ptr);
37998         LDKParseOrSemanticError e_conv = *(LDKParseOrSemanticError*)(e_ptr);
37999         e_conv = ParseOrSemanticError_clone((LDKParseOrSemanticError*)untag_ptr(e));
38000         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ), "LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ");
38001         *ret_conv = CResult_Bolt11InvoiceParseOrSemanticErrorZ_err(e_conv);
38002         return tag_ptr(ret_conv, true);
38003 }
38004
38005 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceParseOrSemanticErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
38006         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* o_conv = (LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ*)untag_ptr(o);
38007         jboolean ret_conv = CResult_Bolt11InvoiceParseOrSemanticErrorZ_is_ok(o_conv);
38008         return ret_conv;
38009 }
38010
38011 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceParseOrSemanticErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
38012         if (!ptr_is_owned(_res)) return;
38013         void* _res_ptr = untag_ptr(_res);
38014         CHECK_ACCESS(_res_ptr);
38015         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ _res_conv = *(LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ*)(_res_ptr);
38016         FREE(untag_ptr(_res));
38017         CResult_Bolt11InvoiceParseOrSemanticErrorZ_free(_res_conv);
38018 }
38019
38020 static inline uint64_t CResult_Bolt11InvoiceParseOrSemanticErrorZ_clone_ptr(LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ *NONNULL_PTR arg) {
38021         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ), "LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ");
38022         *ret_conv = CResult_Bolt11InvoiceParseOrSemanticErrorZ_clone(arg);
38023         return tag_ptr(ret_conv, true);
38024 }
38025 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceParseOrSemanticErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
38026         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* arg_conv = (LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ*)untag_ptr(arg);
38027         int64_t ret_conv = CResult_Bolt11InvoiceParseOrSemanticErrorZ_clone_ptr(arg_conv);
38028         return ret_conv;
38029 }
38030
38031 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceParseOrSemanticErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
38032         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* orig_conv = (LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ*)untag_ptr(orig);
38033         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ), "LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ");
38034         *ret_conv = CResult_Bolt11InvoiceParseOrSemanticErrorZ_clone(orig_conv);
38035         return tag_ptr(ret_conv, true);
38036 }
38037
38038 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawBolt11InvoiceBolt11ParseErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
38039         LDKSignedRawBolt11Invoice o_conv;
38040         o_conv.inner = untag_ptr(o);
38041         o_conv.is_owned = ptr_is_owned(o);
38042         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
38043         o_conv = SignedRawBolt11Invoice_clone(&o_conv);
38044         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ), "LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ");
38045         *ret_conv = CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_ok(o_conv);
38046         return tag_ptr(ret_conv, true);
38047 }
38048
38049 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawBolt11InvoiceBolt11ParseErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
38050         void* e_ptr = untag_ptr(e);
38051         CHECK_ACCESS(e_ptr);
38052         LDKBolt11ParseError e_conv = *(LDKBolt11ParseError*)(e_ptr);
38053         e_conv = Bolt11ParseError_clone((LDKBolt11ParseError*)untag_ptr(e));
38054         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ), "LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ");
38055         *ret_conv = CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_err(e_conv);
38056         return tag_ptr(ret_conv, true);
38057 }
38058
38059 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawBolt11InvoiceBolt11ParseErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
38060         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* o_conv = (LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ*)untag_ptr(o);
38061         jboolean ret_conv = CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_is_ok(o_conv);
38062         return ret_conv;
38063 }
38064
38065 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawBolt11InvoiceBolt11ParseErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
38066         if (!ptr_is_owned(_res)) return;
38067         void* _res_ptr = untag_ptr(_res);
38068         CHECK_ACCESS(_res_ptr);
38069         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ _res_conv = *(LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ*)(_res_ptr);
38070         FREE(untag_ptr(_res));
38071         CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_free(_res_conv);
38072 }
38073
38074 static inline uint64_t CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_clone_ptr(LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ *NONNULL_PTR arg) {
38075         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ), "LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ");
38076         *ret_conv = CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_clone(arg);
38077         return tag_ptr(ret_conv, true);
38078 }
38079 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawBolt11InvoiceBolt11ParseErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
38080         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* arg_conv = (LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ*)untag_ptr(arg);
38081         int64_t ret_conv = CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_clone_ptr(arg_conv);
38082         return ret_conv;
38083 }
38084
38085 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawBolt11InvoiceBolt11ParseErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
38086         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* orig_conv = (LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ*)untag_ptr(orig);
38087         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ), "LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ");
38088         *ret_conv = CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_clone(orig_conv);
38089         return tag_ptr(ret_conv, true);
38090 }
38091
38092 static inline uint64_t C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_clone_ptr(LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ *NONNULL_PTR arg) {
38093         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ), "LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ");
38094         *ret_conv = C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_clone(arg);
38095         return tag_ptr(ret_conv, true);
38096 }
38097 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1RawBolt11Invoice_1u832Bolt11InvoiceSignatureZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
38098         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ* arg_conv = (LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ*)untag_ptr(arg);
38099         int64_t ret_conv = C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_clone_ptr(arg_conv);
38100         return ret_conv;
38101 }
38102
38103 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1RawBolt11Invoice_1u832Bolt11InvoiceSignatureZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
38104         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ* orig_conv = (LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ*)untag_ptr(orig);
38105         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ), "LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ");
38106         *ret_conv = C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_clone(orig_conv);
38107         return tag_ptr(ret_conv, true);
38108 }
38109
38110 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) {
38111         LDKRawBolt11Invoice a_conv;
38112         a_conv.inner = untag_ptr(a);
38113         a_conv.is_owned = ptr_is_owned(a);
38114         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
38115         a_conv = RawBolt11Invoice_clone(&a_conv);
38116         LDKThirtyTwoBytes b_ref;
38117         CHECK((*env)->GetArrayLength(env, b) == 32);
38118         (*env)->GetByteArrayRegion(env, b, 0, 32, b_ref.data);
38119         LDKBolt11InvoiceSignature c_conv;
38120         c_conv.inner = untag_ptr(c);
38121         c_conv.is_owned = ptr_is_owned(c);
38122         CHECK_INNER_FIELD_ACCESS_OR_NULL(c_conv);
38123         c_conv = Bolt11InvoiceSignature_clone(&c_conv);
38124         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ), "LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ");
38125         *ret_conv = C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_new(a_conv, b_ref, c_conv);
38126         return tag_ptr(ret_conv, true);
38127 }
38128
38129 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C3Tuple_1RawBolt11Invoice_1u832Bolt11InvoiceSignatureZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
38130         if (!ptr_is_owned(_res)) return;
38131         void* _res_ptr = untag_ptr(_res);
38132         CHECK_ACCESS(_res_ptr);
38133         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ _res_conv = *(LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ*)(_res_ptr);
38134         FREE(untag_ptr(_res));
38135         C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_free(_res_conv);
38136 }
38137
38138 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeySecp256k1ErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
38139         LDKPayeePubKey o_conv;
38140         o_conv.inner = untag_ptr(o);
38141         o_conv.is_owned = ptr_is_owned(o);
38142         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
38143         o_conv = PayeePubKey_clone(&o_conv);
38144         LDKCResult_PayeePubKeySecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeySecp256k1ErrorZ), "LDKCResult_PayeePubKeySecp256k1ErrorZ");
38145         *ret_conv = CResult_PayeePubKeySecp256k1ErrorZ_ok(o_conv);
38146         return tag_ptr(ret_conv, true);
38147 }
38148
38149 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeySecp256k1ErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
38150         LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_java(env, e);
38151         LDKCResult_PayeePubKeySecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeySecp256k1ErrorZ), "LDKCResult_PayeePubKeySecp256k1ErrorZ");
38152         *ret_conv = CResult_PayeePubKeySecp256k1ErrorZ_err(e_conv);
38153         return tag_ptr(ret_conv, true);
38154 }
38155
38156 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeySecp256k1ErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
38157         LDKCResult_PayeePubKeySecp256k1ErrorZ* o_conv = (LDKCResult_PayeePubKeySecp256k1ErrorZ*)untag_ptr(o);
38158         jboolean ret_conv = CResult_PayeePubKeySecp256k1ErrorZ_is_ok(o_conv);
38159         return ret_conv;
38160 }
38161
38162 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeySecp256k1ErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
38163         if (!ptr_is_owned(_res)) return;
38164         void* _res_ptr = untag_ptr(_res);
38165         CHECK_ACCESS(_res_ptr);
38166         LDKCResult_PayeePubKeySecp256k1ErrorZ _res_conv = *(LDKCResult_PayeePubKeySecp256k1ErrorZ*)(_res_ptr);
38167         FREE(untag_ptr(_res));
38168         CResult_PayeePubKeySecp256k1ErrorZ_free(_res_conv);
38169 }
38170
38171 static inline uint64_t CResult_PayeePubKeySecp256k1ErrorZ_clone_ptr(LDKCResult_PayeePubKeySecp256k1ErrorZ *NONNULL_PTR arg) {
38172         LDKCResult_PayeePubKeySecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeySecp256k1ErrorZ), "LDKCResult_PayeePubKeySecp256k1ErrorZ");
38173         *ret_conv = CResult_PayeePubKeySecp256k1ErrorZ_clone(arg);
38174         return tag_ptr(ret_conv, true);
38175 }
38176 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeySecp256k1ErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
38177         LDKCResult_PayeePubKeySecp256k1ErrorZ* arg_conv = (LDKCResult_PayeePubKeySecp256k1ErrorZ*)untag_ptr(arg);
38178         int64_t ret_conv = CResult_PayeePubKeySecp256k1ErrorZ_clone_ptr(arg_conv);
38179         return ret_conv;
38180 }
38181
38182 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeySecp256k1ErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
38183         LDKCResult_PayeePubKeySecp256k1ErrorZ* orig_conv = (LDKCResult_PayeePubKeySecp256k1ErrorZ*)untag_ptr(orig);
38184         LDKCResult_PayeePubKeySecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeySecp256k1ErrorZ), "LDKCResult_PayeePubKeySecp256k1ErrorZ");
38185         *ret_conv = CResult_PayeePubKeySecp256k1ErrorZ_clone(orig_conv);
38186         return tag_ptr(ret_conv, true);
38187 }
38188
38189 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1PrivateRouteZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
38190         LDKCVec_PrivateRouteZ _res_constr;
38191         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
38192         if (_res_constr.datalen > 0)
38193                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPrivateRoute), "LDKCVec_PrivateRouteZ Elements");
38194         else
38195                 _res_constr.data = NULL;
38196         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
38197         for (size_t o = 0; o < _res_constr.datalen; o++) {
38198                 int64_t _res_conv_14 = _res_vals[o];
38199                 LDKPrivateRoute _res_conv_14_conv;
38200                 _res_conv_14_conv.inner = untag_ptr(_res_conv_14);
38201                 _res_conv_14_conv.is_owned = ptr_is_owned(_res_conv_14);
38202                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_14_conv);
38203                 _res_constr.data[o] = _res_conv_14_conv;
38204         }
38205         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
38206         CVec_PrivateRouteZ_free(_res_constr);
38207 }
38208
38209 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
38210         LDKPositiveTimestamp o_conv;
38211         o_conv.inner = untag_ptr(o);
38212         o_conv.is_owned = ptr_is_owned(o);
38213         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
38214         o_conv = PositiveTimestamp_clone(&o_conv);
38215         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
38216         *ret_conv = CResult_PositiveTimestampCreationErrorZ_ok(o_conv);
38217         return tag_ptr(ret_conv, true);
38218 }
38219
38220 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
38221         LDKCreationError e_conv = LDKCreationError_from_java(env, e);
38222         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
38223         *ret_conv = CResult_PositiveTimestampCreationErrorZ_err(e_conv);
38224         return tag_ptr(ret_conv, true);
38225 }
38226
38227 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
38228         LDKCResult_PositiveTimestampCreationErrorZ* o_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)untag_ptr(o);
38229         jboolean ret_conv = CResult_PositiveTimestampCreationErrorZ_is_ok(o_conv);
38230         return ret_conv;
38231 }
38232
38233 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
38234         if (!ptr_is_owned(_res)) return;
38235         void* _res_ptr = untag_ptr(_res);
38236         CHECK_ACCESS(_res_ptr);
38237         LDKCResult_PositiveTimestampCreationErrorZ _res_conv = *(LDKCResult_PositiveTimestampCreationErrorZ*)(_res_ptr);
38238         FREE(untag_ptr(_res));
38239         CResult_PositiveTimestampCreationErrorZ_free(_res_conv);
38240 }
38241
38242 static inline uint64_t CResult_PositiveTimestampCreationErrorZ_clone_ptr(LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR arg) {
38243         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
38244         *ret_conv = CResult_PositiveTimestampCreationErrorZ_clone(arg);
38245         return tag_ptr(ret_conv, true);
38246 }
38247 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
38248         LDKCResult_PositiveTimestampCreationErrorZ* arg_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)untag_ptr(arg);
38249         int64_t ret_conv = CResult_PositiveTimestampCreationErrorZ_clone_ptr(arg_conv);
38250         return ret_conv;
38251 }
38252
38253 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
38254         LDKCResult_PositiveTimestampCreationErrorZ* orig_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)untag_ptr(orig);
38255         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
38256         *ret_conv = CResult_PositiveTimestampCreationErrorZ_clone(orig_conv);
38257         return tag_ptr(ret_conv, true);
38258 }
38259
38260 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneBolt11SemanticErrorZ_1ok(JNIEnv *env, jclass clz) {
38261         LDKCResult_NoneBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt11SemanticErrorZ), "LDKCResult_NoneBolt11SemanticErrorZ");
38262         *ret_conv = CResult_NoneBolt11SemanticErrorZ_ok();
38263         return tag_ptr(ret_conv, true);
38264 }
38265
38266 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneBolt11SemanticErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
38267         LDKBolt11SemanticError e_conv = LDKBolt11SemanticError_from_java(env, e);
38268         LDKCResult_NoneBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt11SemanticErrorZ), "LDKCResult_NoneBolt11SemanticErrorZ");
38269         *ret_conv = CResult_NoneBolt11SemanticErrorZ_err(e_conv);
38270         return tag_ptr(ret_conv, true);
38271 }
38272
38273 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NoneBolt11SemanticErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
38274         LDKCResult_NoneBolt11SemanticErrorZ* o_conv = (LDKCResult_NoneBolt11SemanticErrorZ*)untag_ptr(o);
38275         jboolean ret_conv = CResult_NoneBolt11SemanticErrorZ_is_ok(o_conv);
38276         return ret_conv;
38277 }
38278
38279 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneBolt11SemanticErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
38280         if (!ptr_is_owned(_res)) return;
38281         void* _res_ptr = untag_ptr(_res);
38282         CHECK_ACCESS(_res_ptr);
38283         LDKCResult_NoneBolt11SemanticErrorZ _res_conv = *(LDKCResult_NoneBolt11SemanticErrorZ*)(_res_ptr);
38284         FREE(untag_ptr(_res));
38285         CResult_NoneBolt11SemanticErrorZ_free(_res_conv);
38286 }
38287
38288 static inline uint64_t CResult_NoneBolt11SemanticErrorZ_clone_ptr(LDKCResult_NoneBolt11SemanticErrorZ *NONNULL_PTR arg) {
38289         LDKCResult_NoneBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt11SemanticErrorZ), "LDKCResult_NoneBolt11SemanticErrorZ");
38290         *ret_conv = CResult_NoneBolt11SemanticErrorZ_clone(arg);
38291         return tag_ptr(ret_conv, true);
38292 }
38293 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneBolt11SemanticErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
38294         LDKCResult_NoneBolt11SemanticErrorZ* arg_conv = (LDKCResult_NoneBolt11SemanticErrorZ*)untag_ptr(arg);
38295         int64_t ret_conv = CResult_NoneBolt11SemanticErrorZ_clone_ptr(arg_conv);
38296         return ret_conv;
38297 }
38298
38299 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneBolt11SemanticErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
38300         LDKCResult_NoneBolt11SemanticErrorZ* orig_conv = (LDKCResult_NoneBolt11SemanticErrorZ*)untag_ptr(orig);
38301         LDKCResult_NoneBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt11SemanticErrorZ), "LDKCResult_NoneBolt11SemanticErrorZ");
38302         *ret_conv = CResult_NoneBolt11SemanticErrorZ_clone(orig_conv);
38303         return tag_ptr(ret_conv, true);
38304 }
38305
38306 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceBolt11SemanticErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
38307         LDKBolt11Invoice o_conv;
38308         o_conv.inner = untag_ptr(o);
38309         o_conv.is_owned = ptr_is_owned(o);
38310         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
38311         o_conv = Bolt11Invoice_clone(&o_conv);
38312         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ), "LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ");
38313         *ret_conv = CResult_Bolt11InvoiceBolt11SemanticErrorZ_ok(o_conv);
38314         return tag_ptr(ret_conv, true);
38315 }
38316
38317 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceBolt11SemanticErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
38318         LDKBolt11SemanticError e_conv = LDKBolt11SemanticError_from_java(env, e);
38319         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ), "LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ");
38320         *ret_conv = CResult_Bolt11InvoiceBolt11SemanticErrorZ_err(e_conv);
38321         return tag_ptr(ret_conv, true);
38322 }
38323
38324 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceBolt11SemanticErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
38325         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* o_conv = (LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ*)untag_ptr(o);
38326         jboolean ret_conv = CResult_Bolt11InvoiceBolt11SemanticErrorZ_is_ok(o_conv);
38327         return ret_conv;
38328 }
38329
38330 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceBolt11SemanticErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
38331         if (!ptr_is_owned(_res)) return;
38332         void* _res_ptr = untag_ptr(_res);
38333         CHECK_ACCESS(_res_ptr);
38334         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ _res_conv = *(LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ*)(_res_ptr);
38335         FREE(untag_ptr(_res));
38336         CResult_Bolt11InvoiceBolt11SemanticErrorZ_free(_res_conv);
38337 }
38338
38339 static inline uint64_t CResult_Bolt11InvoiceBolt11SemanticErrorZ_clone_ptr(LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ *NONNULL_PTR arg) {
38340         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ), "LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ");
38341         *ret_conv = CResult_Bolt11InvoiceBolt11SemanticErrorZ_clone(arg);
38342         return tag_ptr(ret_conv, true);
38343 }
38344 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceBolt11SemanticErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
38345         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* arg_conv = (LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ*)untag_ptr(arg);
38346         int64_t ret_conv = CResult_Bolt11InvoiceBolt11SemanticErrorZ_clone_ptr(arg_conv);
38347         return ret_conv;
38348 }
38349
38350 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt11InvoiceBolt11SemanticErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
38351         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* orig_conv = (LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ*)untag_ptr(orig);
38352         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ), "LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ");
38353         *ret_conv = CResult_Bolt11InvoiceBolt11SemanticErrorZ_clone(orig_conv);
38354         return tag_ptr(ret_conv, true);
38355 }
38356
38357 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
38358         LDKDescription o_conv;
38359         o_conv.inner = untag_ptr(o);
38360         o_conv.is_owned = ptr_is_owned(o);
38361         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
38362         o_conv = Description_clone(&o_conv);
38363         LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
38364         *ret_conv = CResult_DescriptionCreationErrorZ_ok(o_conv);
38365         return tag_ptr(ret_conv, true);
38366 }
38367
38368 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
38369         LDKCreationError e_conv = LDKCreationError_from_java(env, e);
38370         LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
38371         *ret_conv = CResult_DescriptionCreationErrorZ_err(e_conv);
38372         return tag_ptr(ret_conv, true);
38373 }
38374
38375 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
38376         LDKCResult_DescriptionCreationErrorZ* o_conv = (LDKCResult_DescriptionCreationErrorZ*)untag_ptr(o);
38377         jboolean ret_conv = CResult_DescriptionCreationErrorZ_is_ok(o_conv);
38378         return ret_conv;
38379 }
38380
38381 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
38382         if (!ptr_is_owned(_res)) return;
38383         void* _res_ptr = untag_ptr(_res);
38384         CHECK_ACCESS(_res_ptr);
38385         LDKCResult_DescriptionCreationErrorZ _res_conv = *(LDKCResult_DescriptionCreationErrorZ*)(_res_ptr);
38386         FREE(untag_ptr(_res));
38387         CResult_DescriptionCreationErrorZ_free(_res_conv);
38388 }
38389
38390 static inline uint64_t CResult_DescriptionCreationErrorZ_clone_ptr(LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR arg) {
38391         LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
38392         *ret_conv = CResult_DescriptionCreationErrorZ_clone(arg);
38393         return tag_ptr(ret_conv, true);
38394 }
38395 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
38396         LDKCResult_DescriptionCreationErrorZ* arg_conv = (LDKCResult_DescriptionCreationErrorZ*)untag_ptr(arg);
38397         int64_t ret_conv = CResult_DescriptionCreationErrorZ_clone_ptr(arg_conv);
38398         return ret_conv;
38399 }
38400
38401 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
38402         LDKCResult_DescriptionCreationErrorZ* orig_conv = (LDKCResult_DescriptionCreationErrorZ*)untag_ptr(orig);
38403         LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
38404         *ret_conv = CResult_DescriptionCreationErrorZ_clone(orig_conv);
38405         return tag_ptr(ret_conv, true);
38406 }
38407
38408 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
38409         LDKPrivateRoute o_conv;
38410         o_conv.inner = untag_ptr(o);
38411         o_conv.is_owned = ptr_is_owned(o);
38412         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
38413         o_conv = PrivateRoute_clone(&o_conv);
38414         LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
38415         *ret_conv = CResult_PrivateRouteCreationErrorZ_ok(o_conv);
38416         return tag_ptr(ret_conv, true);
38417 }
38418
38419 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
38420         LDKCreationError e_conv = LDKCreationError_from_java(env, e);
38421         LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
38422         *ret_conv = CResult_PrivateRouteCreationErrorZ_err(e_conv);
38423         return tag_ptr(ret_conv, true);
38424 }
38425
38426 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
38427         LDKCResult_PrivateRouteCreationErrorZ* o_conv = (LDKCResult_PrivateRouteCreationErrorZ*)untag_ptr(o);
38428         jboolean ret_conv = CResult_PrivateRouteCreationErrorZ_is_ok(o_conv);
38429         return ret_conv;
38430 }
38431
38432 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
38433         if (!ptr_is_owned(_res)) return;
38434         void* _res_ptr = untag_ptr(_res);
38435         CHECK_ACCESS(_res_ptr);
38436         LDKCResult_PrivateRouteCreationErrorZ _res_conv = *(LDKCResult_PrivateRouteCreationErrorZ*)(_res_ptr);
38437         FREE(untag_ptr(_res));
38438         CResult_PrivateRouteCreationErrorZ_free(_res_conv);
38439 }
38440
38441 static inline uint64_t CResult_PrivateRouteCreationErrorZ_clone_ptr(LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR arg) {
38442         LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
38443         *ret_conv = CResult_PrivateRouteCreationErrorZ_clone(arg);
38444         return tag_ptr(ret_conv, true);
38445 }
38446 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
38447         LDKCResult_PrivateRouteCreationErrorZ* arg_conv = (LDKCResult_PrivateRouteCreationErrorZ*)untag_ptr(arg);
38448         int64_t ret_conv = CResult_PrivateRouteCreationErrorZ_clone_ptr(arg_conv);
38449         return ret_conv;
38450 }
38451
38452 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
38453         LDKCResult_PrivateRouteCreationErrorZ* orig_conv = (LDKCResult_PrivateRouteCreationErrorZ*)untag_ptr(orig);
38454         LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
38455         *ret_conv = CResult_PrivateRouteCreationErrorZ_clone(orig_conv);
38456         return tag_ptr(ret_conv, true);
38457 }
38458
38459 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
38460         LDKOutPoint o_conv;
38461         o_conv.inner = untag_ptr(o);
38462         o_conv.is_owned = ptr_is_owned(o);
38463         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
38464         o_conv = OutPoint_clone(&o_conv);
38465         LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
38466         *ret_conv = CResult_OutPointDecodeErrorZ_ok(o_conv);
38467         return tag_ptr(ret_conv, true);
38468 }
38469
38470 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
38471         void* e_ptr = untag_ptr(e);
38472         CHECK_ACCESS(e_ptr);
38473         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
38474         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
38475         LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
38476         *ret_conv = CResult_OutPointDecodeErrorZ_err(e_conv);
38477         return tag_ptr(ret_conv, true);
38478 }
38479
38480 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
38481         LDKCResult_OutPointDecodeErrorZ* o_conv = (LDKCResult_OutPointDecodeErrorZ*)untag_ptr(o);
38482         jboolean ret_conv = CResult_OutPointDecodeErrorZ_is_ok(o_conv);
38483         return ret_conv;
38484 }
38485
38486 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
38487         if (!ptr_is_owned(_res)) return;
38488         void* _res_ptr = untag_ptr(_res);
38489         CHECK_ACCESS(_res_ptr);
38490         LDKCResult_OutPointDecodeErrorZ _res_conv = *(LDKCResult_OutPointDecodeErrorZ*)(_res_ptr);
38491         FREE(untag_ptr(_res));
38492         CResult_OutPointDecodeErrorZ_free(_res_conv);
38493 }
38494
38495 static inline uint64_t CResult_OutPointDecodeErrorZ_clone_ptr(LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR arg) {
38496         LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
38497         *ret_conv = CResult_OutPointDecodeErrorZ_clone(arg);
38498         return tag_ptr(ret_conv, true);
38499 }
38500 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
38501         LDKCResult_OutPointDecodeErrorZ* arg_conv = (LDKCResult_OutPointDecodeErrorZ*)untag_ptr(arg);
38502         int64_t ret_conv = CResult_OutPointDecodeErrorZ_clone_ptr(arg_conv);
38503         return ret_conv;
38504 }
38505
38506 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
38507         LDKCResult_OutPointDecodeErrorZ* orig_conv = (LDKCResult_OutPointDecodeErrorZ*)untag_ptr(orig);
38508         LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
38509         *ret_conv = CResult_OutPointDecodeErrorZ_clone(orig_conv);
38510         return tag_ptr(ret_conv, true);
38511 }
38512
38513 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BigSizeDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
38514         LDKBigSize o_conv;
38515         o_conv.inner = untag_ptr(o);
38516         o_conv.is_owned = ptr_is_owned(o);
38517         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
38518         o_conv = BigSize_clone(&o_conv);
38519         LDKCResult_BigSizeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BigSizeDecodeErrorZ), "LDKCResult_BigSizeDecodeErrorZ");
38520         *ret_conv = CResult_BigSizeDecodeErrorZ_ok(o_conv);
38521         return tag_ptr(ret_conv, true);
38522 }
38523
38524 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BigSizeDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
38525         void* e_ptr = untag_ptr(e);
38526         CHECK_ACCESS(e_ptr);
38527         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
38528         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
38529         LDKCResult_BigSizeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BigSizeDecodeErrorZ), "LDKCResult_BigSizeDecodeErrorZ");
38530         *ret_conv = CResult_BigSizeDecodeErrorZ_err(e_conv);
38531         return tag_ptr(ret_conv, true);
38532 }
38533
38534 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1BigSizeDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
38535         LDKCResult_BigSizeDecodeErrorZ* o_conv = (LDKCResult_BigSizeDecodeErrorZ*)untag_ptr(o);
38536         jboolean ret_conv = CResult_BigSizeDecodeErrorZ_is_ok(o_conv);
38537         return ret_conv;
38538 }
38539
38540 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1BigSizeDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
38541         if (!ptr_is_owned(_res)) return;
38542         void* _res_ptr = untag_ptr(_res);
38543         CHECK_ACCESS(_res_ptr);
38544         LDKCResult_BigSizeDecodeErrorZ _res_conv = *(LDKCResult_BigSizeDecodeErrorZ*)(_res_ptr);
38545         FREE(untag_ptr(_res));
38546         CResult_BigSizeDecodeErrorZ_free(_res_conv);
38547 }
38548
38549 static inline uint64_t CResult_BigSizeDecodeErrorZ_clone_ptr(LDKCResult_BigSizeDecodeErrorZ *NONNULL_PTR arg) {
38550         LDKCResult_BigSizeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BigSizeDecodeErrorZ), "LDKCResult_BigSizeDecodeErrorZ");
38551         *ret_conv = CResult_BigSizeDecodeErrorZ_clone(arg);
38552         return tag_ptr(ret_conv, true);
38553 }
38554 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BigSizeDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
38555         LDKCResult_BigSizeDecodeErrorZ* arg_conv = (LDKCResult_BigSizeDecodeErrorZ*)untag_ptr(arg);
38556         int64_t ret_conv = CResult_BigSizeDecodeErrorZ_clone_ptr(arg_conv);
38557         return ret_conv;
38558 }
38559
38560 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BigSizeDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
38561         LDKCResult_BigSizeDecodeErrorZ* orig_conv = (LDKCResult_BigSizeDecodeErrorZ*)untag_ptr(orig);
38562         LDKCResult_BigSizeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BigSizeDecodeErrorZ), "LDKCResult_BigSizeDecodeErrorZ");
38563         *ret_conv = CResult_BigSizeDecodeErrorZ_clone(orig_conv);
38564         return tag_ptr(ret_conv, true);
38565 }
38566
38567 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HostnameDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
38568         LDKHostname o_conv;
38569         o_conv.inner = untag_ptr(o);
38570         o_conv.is_owned = ptr_is_owned(o);
38571         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
38572         o_conv = Hostname_clone(&o_conv);
38573         LDKCResult_HostnameDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HostnameDecodeErrorZ), "LDKCResult_HostnameDecodeErrorZ");
38574         *ret_conv = CResult_HostnameDecodeErrorZ_ok(o_conv);
38575         return tag_ptr(ret_conv, true);
38576 }
38577
38578 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HostnameDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
38579         void* e_ptr = untag_ptr(e);
38580         CHECK_ACCESS(e_ptr);
38581         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
38582         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
38583         LDKCResult_HostnameDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HostnameDecodeErrorZ), "LDKCResult_HostnameDecodeErrorZ");
38584         *ret_conv = CResult_HostnameDecodeErrorZ_err(e_conv);
38585         return tag_ptr(ret_conv, true);
38586 }
38587
38588 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1HostnameDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
38589         LDKCResult_HostnameDecodeErrorZ* o_conv = (LDKCResult_HostnameDecodeErrorZ*)untag_ptr(o);
38590         jboolean ret_conv = CResult_HostnameDecodeErrorZ_is_ok(o_conv);
38591         return ret_conv;
38592 }
38593
38594 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1HostnameDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
38595         if (!ptr_is_owned(_res)) return;
38596         void* _res_ptr = untag_ptr(_res);
38597         CHECK_ACCESS(_res_ptr);
38598         LDKCResult_HostnameDecodeErrorZ _res_conv = *(LDKCResult_HostnameDecodeErrorZ*)(_res_ptr);
38599         FREE(untag_ptr(_res));
38600         CResult_HostnameDecodeErrorZ_free(_res_conv);
38601 }
38602
38603 static inline uint64_t CResult_HostnameDecodeErrorZ_clone_ptr(LDKCResult_HostnameDecodeErrorZ *NONNULL_PTR arg) {
38604         LDKCResult_HostnameDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HostnameDecodeErrorZ), "LDKCResult_HostnameDecodeErrorZ");
38605         *ret_conv = CResult_HostnameDecodeErrorZ_clone(arg);
38606         return tag_ptr(ret_conv, true);
38607 }
38608 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HostnameDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
38609         LDKCResult_HostnameDecodeErrorZ* arg_conv = (LDKCResult_HostnameDecodeErrorZ*)untag_ptr(arg);
38610         int64_t ret_conv = CResult_HostnameDecodeErrorZ_clone_ptr(arg_conv);
38611         return ret_conv;
38612 }
38613
38614 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HostnameDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
38615         LDKCResult_HostnameDecodeErrorZ* orig_conv = (LDKCResult_HostnameDecodeErrorZ*)untag_ptr(orig);
38616         LDKCResult_HostnameDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HostnameDecodeErrorZ), "LDKCResult_HostnameDecodeErrorZ");
38617         *ret_conv = CResult_HostnameDecodeErrorZ_clone(orig_conv);
38618         return tag_ptr(ret_conv, true);
38619 }
38620
38621 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionU16LenLimitedNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
38622         LDKTransactionU16LenLimited o_conv;
38623         o_conv.inner = untag_ptr(o);
38624         o_conv.is_owned = ptr_is_owned(o);
38625         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
38626         o_conv = TransactionU16LenLimited_clone(&o_conv);
38627         LDKCResult_TransactionU16LenLimitedNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedNoneZ), "LDKCResult_TransactionU16LenLimitedNoneZ");
38628         *ret_conv = CResult_TransactionU16LenLimitedNoneZ_ok(o_conv);
38629         return tag_ptr(ret_conv, true);
38630 }
38631
38632 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionU16LenLimitedNoneZ_1err(JNIEnv *env, jclass clz) {
38633         LDKCResult_TransactionU16LenLimitedNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedNoneZ), "LDKCResult_TransactionU16LenLimitedNoneZ");
38634         *ret_conv = CResult_TransactionU16LenLimitedNoneZ_err();
38635         return tag_ptr(ret_conv, true);
38636 }
38637
38638 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionU16LenLimitedNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
38639         LDKCResult_TransactionU16LenLimitedNoneZ* o_conv = (LDKCResult_TransactionU16LenLimitedNoneZ*)untag_ptr(o);
38640         jboolean ret_conv = CResult_TransactionU16LenLimitedNoneZ_is_ok(o_conv);
38641         return ret_conv;
38642 }
38643
38644 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionU16LenLimitedNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
38645         if (!ptr_is_owned(_res)) return;
38646         void* _res_ptr = untag_ptr(_res);
38647         CHECK_ACCESS(_res_ptr);
38648         LDKCResult_TransactionU16LenLimitedNoneZ _res_conv = *(LDKCResult_TransactionU16LenLimitedNoneZ*)(_res_ptr);
38649         FREE(untag_ptr(_res));
38650         CResult_TransactionU16LenLimitedNoneZ_free(_res_conv);
38651 }
38652
38653 static inline uint64_t CResult_TransactionU16LenLimitedNoneZ_clone_ptr(LDKCResult_TransactionU16LenLimitedNoneZ *NONNULL_PTR arg) {
38654         LDKCResult_TransactionU16LenLimitedNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedNoneZ), "LDKCResult_TransactionU16LenLimitedNoneZ");
38655         *ret_conv = CResult_TransactionU16LenLimitedNoneZ_clone(arg);
38656         return tag_ptr(ret_conv, true);
38657 }
38658 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionU16LenLimitedNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
38659         LDKCResult_TransactionU16LenLimitedNoneZ* arg_conv = (LDKCResult_TransactionU16LenLimitedNoneZ*)untag_ptr(arg);
38660         int64_t ret_conv = CResult_TransactionU16LenLimitedNoneZ_clone_ptr(arg_conv);
38661         return ret_conv;
38662 }
38663
38664 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionU16LenLimitedNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
38665         LDKCResult_TransactionU16LenLimitedNoneZ* orig_conv = (LDKCResult_TransactionU16LenLimitedNoneZ*)untag_ptr(orig);
38666         LDKCResult_TransactionU16LenLimitedNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedNoneZ), "LDKCResult_TransactionU16LenLimitedNoneZ");
38667         *ret_conv = CResult_TransactionU16LenLimitedNoneZ_clone(orig_conv);
38668         return tag_ptr(ret_conv, true);
38669 }
38670
38671 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionU16LenLimitedDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
38672         LDKTransactionU16LenLimited o_conv;
38673         o_conv.inner = untag_ptr(o);
38674         o_conv.is_owned = ptr_is_owned(o);
38675         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
38676         o_conv = TransactionU16LenLimited_clone(&o_conv);
38677         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedDecodeErrorZ), "LDKCResult_TransactionU16LenLimitedDecodeErrorZ");
38678         *ret_conv = CResult_TransactionU16LenLimitedDecodeErrorZ_ok(o_conv);
38679         return tag_ptr(ret_conv, true);
38680 }
38681
38682 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionU16LenLimitedDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
38683         void* e_ptr = untag_ptr(e);
38684         CHECK_ACCESS(e_ptr);
38685         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
38686         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
38687         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedDecodeErrorZ), "LDKCResult_TransactionU16LenLimitedDecodeErrorZ");
38688         *ret_conv = CResult_TransactionU16LenLimitedDecodeErrorZ_err(e_conv);
38689         return tag_ptr(ret_conv, true);
38690 }
38691
38692 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionU16LenLimitedDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
38693         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* o_conv = (LDKCResult_TransactionU16LenLimitedDecodeErrorZ*)untag_ptr(o);
38694         jboolean ret_conv = CResult_TransactionU16LenLimitedDecodeErrorZ_is_ok(o_conv);
38695         return ret_conv;
38696 }
38697
38698 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionU16LenLimitedDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
38699         if (!ptr_is_owned(_res)) return;
38700         void* _res_ptr = untag_ptr(_res);
38701         CHECK_ACCESS(_res_ptr);
38702         LDKCResult_TransactionU16LenLimitedDecodeErrorZ _res_conv = *(LDKCResult_TransactionU16LenLimitedDecodeErrorZ*)(_res_ptr);
38703         FREE(untag_ptr(_res));
38704         CResult_TransactionU16LenLimitedDecodeErrorZ_free(_res_conv);
38705 }
38706
38707 static inline uint64_t CResult_TransactionU16LenLimitedDecodeErrorZ_clone_ptr(LDKCResult_TransactionU16LenLimitedDecodeErrorZ *NONNULL_PTR arg) {
38708         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedDecodeErrorZ), "LDKCResult_TransactionU16LenLimitedDecodeErrorZ");
38709         *ret_conv = CResult_TransactionU16LenLimitedDecodeErrorZ_clone(arg);
38710         return tag_ptr(ret_conv, true);
38711 }
38712 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionU16LenLimitedDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
38713         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* arg_conv = (LDKCResult_TransactionU16LenLimitedDecodeErrorZ*)untag_ptr(arg);
38714         int64_t ret_conv = CResult_TransactionU16LenLimitedDecodeErrorZ_clone_ptr(arg_conv);
38715         return ret_conv;
38716 }
38717
38718 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionU16LenLimitedDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
38719         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* orig_conv = (LDKCResult_TransactionU16LenLimitedDecodeErrorZ*)untag_ptr(orig);
38720         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedDecodeErrorZ), "LDKCResult_TransactionU16LenLimitedDecodeErrorZ");
38721         *ret_conv = CResult_TransactionU16LenLimitedDecodeErrorZ_clone(orig_conv);
38722         return tag_ptr(ret_conv, true);
38723 }
38724
38725 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UntrustedStringDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
38726         LDKUntrustedString o_conv;
38727         o_conv.inner = untag_ptr(o);
38728         o_conv.is_owned = ptr_is_owned(o);
38729         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
38730         o_conv = UntrustedString_clone(&o_conv);
38731         LDKCResult_UntrustedStringDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UntrustedStringDecodeErrorZ), "LDKCResult_UntrustedStringDecodeErrorZ");
38732         *ret_conv = CResult_UntrustedStringDecodeErrorZ_ok(o_conv);
38733         return tag_ptr(ret_conv, true);
38734 }
38735
38736 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UntrustedStringDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
38737         void* e_ptr = untag_ptr(e);
38738         CHECK_ACCESS(e_ptr);
38739         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
38740         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
38741         LDKCResult_UntrustedStringDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UntrustedStringDecodeErrorZ), "LDKCResult_UntrustedStringDecodeErrorZ");
38742         *ret_conv = CResult_UntrustedStringDecodeErrorZ_err(e_conv);
38743         return tag_ptr(ret_conv, true);
38744 }
38745
38746 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1UntrustedStringDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
38747         LDKCResult_UntrustedStringDecodeErrorZ* o_conv = (LDKCResult_UntrustedStringDecodeErrorZ*)untag_ptr(o);
38748         jboolean ret_conv = CResult_UntrustedStringDecodeErrorZ_is_ok(o_conv);
38749         return ret_conv;
38750 }
38751
38752 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UntrustedStringDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
38753         if (!ptr_is_owned(_res)) return;
38754         void* _res_ptr = untag_ptr(_res);
38755         CHECK_ACCESS(_res_ptr);
38756         LDKCResult_UntrustedStringDecodeErrorZ _res_conv = *(LDKCResult_UntrustedStringDecodeErrorZ*)(_res_ptr);
38757         FREE(untag_ptr(_res));
38758         CResult_UntrustedStringDecodeErrorZ_free(_res_conv);
38759 }
38760
38761 static inline uint64_t CResult_UntrustedStringDecodeErrorZ_clone_ptr(LDKCResult_UntrustedStringDecodeErrorZ *NONNULL_PTR arg) {
38762         LDKCResult_UntrustedStringDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UntrustedStringDecodeErrorZ), "LDKCResult_UntrustedStringDecodeErrorZ");
38763         *ret_conv = CResult_UntrustedStringDecodeErrorZ_clone(arg);
38764         return tag_ptr(ret_conv, true);
38765 }
38766 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UntrustedStringDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
38767         LDKCResult_UntrustedStringDecodeErrorZ* arg_conv = (LDKCResult_UntrustedStringDecodeErrorZ*)untag_ptr(arg);
38768         int64_t ret_conv = CResult_UntrustedStringDecodeErrorZ_clone_ptr(arg_conv);
38769         return ret_conv;
38770 }
38771
38772 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UntrustedStringDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
38773         LDKCResult_UntrustedStringDecodeErrorZ* orig_conv = (LDKCResult_UntrustedStringDecodeErrorZ*)untag_ptr(orig);
38774         LDKCResult_UntrustedStringDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UntrustedStringDecodeErrorZ), "LDKCResult_UntrustedStringDecodeErrorZ");
38775         *ret_conv = CResult_UntrustedStringDecodeErrorZ_clone(orig_conv);
38776         return tag_ptr(ret_conv, true);
38777 }
38778
38779 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelIdDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
38780         LDKChannelId o_conv;
38781         o_conv.inner = untag_ptr(o);
38782         o_conv.is_owned = ptr_is_owned(o);
38783         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
38784         o_conv = ChannelId_clone(&o_conv);
38785         LDKCResult_ChannelIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelIdDecodeErrorZ), "LDKCResult_ChannelIdDecodeErrorZ");
38786         *ret_conv = CResult_ChannelIdDecodeErrorZ_ok(o_conv);
38787         return tag_ptr(ret_conv, true);
38788 }
38789
38790 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelIdDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
38791         void* e_ptr = untag_ptr(e);
38792         CHECK_ACCESS(e_ptr);
38793         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
38794         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
38795         LDKCResult_ChannelIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelIdDecodeErrorZ), "LDKCResult_ChannelIdDecodeErrorZ");
38796         *ret_conv = CResult_ChannelIdDecodeErrorZ_err(e_conv);
38797         return tag_ptr(ret_conv, true);
38798 }
38799
38800 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelIdDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
38801         LDKCResult_ChannelIdDecodeErrorZ* o_conv = (LDKCResult_ChannelIdDecodeErrorZ*)untag_ptr(o);
38802         jboolean ret_conv = CResult_ChannelIdDecodeErrorZ_is_ok(o_conv);
38803         return ret_conv;
38804 }
38805
38806 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelIdDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
38807         if (!ptr_is_owned(_res)) return;
38808         void* _res_ptr = untag_ptr(_res);
38809         CHECK_ACCESS(_res_ptr);
38810         LDKCResult_ChannelIdDecodeErrorZ _res_conv = *(LDKCResult_ChannelIdDecodeErrorZ*)(_res_ptr);
38811         FREE(untag_ptr(_res));
38812         CResult_ChannelIdDecodeErrorZ_free(_res_conv);
38813 }
38814
38815 static inline uint64_t CResult_ChannelIdDecodeErrorZ_clone_ptr(LDKCResult_ChannelIdDecodeErrorZ *NONNULL_PTR arg) {
38816         LDKCResult_ChannelIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelIdDecodeErrorZ), "LDKCResult_ChannelIdDecodeErrorZ");
38817         *ret_conv = CResult_ChannelIdDecodeErrorZ_clone(arg);
38818         return tag_ptr(ret_conv, true);
38819 }
38820 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelIdDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
38821         LDKCResult_ChannelIdDecodeErrorZ* arg_conv = (LDKCResult_ChannelIdDecodeErrorZ*)untag_ptr(arg);
38822         int64_t ret_conv = CResult_ChannelIdDecodeErrorZ_clone_ptr(arg_conv);
38823         return ret_conv;
38824 }
38825
38826 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelIdDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
38827         LDKCResult_ChannelIdDecodeErrorZ* orig_conv = (LDKCResult_ChannelIdDecodeErrorZ*)untag_ptr(orig);
38828         LDKCResult_ChannelIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelIdDecodeErrorZ), "LDKCResult_ChannelIdDecodeErrorZ");
38829         *ret_conv = CResult_ChannelIdDecodeErrorZ_clone(orig_conv);
38830         return tag_ptr(ret_conv, true);
38831 }
38832
38833 static inline uint64_t C2Tuple__u832u16Z_clone_ptr(LDKC2Tuple__u832u16Z *NONNULL_PTR arg) {
38834         LDKC2Tuple__u832u16Z* ret_conv = MALLOC(sizeof(LDKC2Tuple__u832u16Z), "LDKC2Tuple__u832u16Z");
38835         *ret_conv = C2Tuple__u832u16Z_clone(arg);
38836         return tag_ptr(ret_conv, true);
38837 }
38838 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1_1u832u16Z_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
38839         LDKC2Tuple__u832u16Z* arg_conv = (LDKC2Tuple__u832u16Z*)untag_ptr(arg);
38840         int64_t ret_conv = C2Tuple__u832u16Z_clone_ptr(arg_conv);
38841         return ret_conv;
38842 }
38843
38844 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1_1u832u16Z_1clone(JNIEnv *env, jclass clz, int64_t orig) {
38845         LDKC2Tuple__u832u16Z* orig_conv = (LDKC2Tuple__u832u16Z*)untag_ptr(orig);
38846         LDKC2Tuple__u832u16Z* ret_conv = MALLOC(sizeof(LDKC2Tuple__u832u16Z), "LDKC2Tuple__u832u16Z");
38847         *ret_conv = C2Tuple__u832u16Z_clone(orig_conv);
38848         return tag_ptr(ret_conv, true);
38849 }
38850
38851 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1_1u832u16Z_1new(JNIEnv *env, jclass clz, int8_tArray a, int16_t b) {
38852         LDKThirtyTwoBytes a_ref;
38853         CHECK((*env)->GetArrayLength(env, a) == 32);
38854         (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
38855         LDKC2Tuple__u832u16Z* ret_conv = MALLOC(sizeof(LDKC2Tuple__u832u16Z), "LDKC2Tuple__u832u16Z");
38856         *ret_conv = C2Tuple__u832u16Z_new(a_ref, b);
38857         return tag_ptr(ret_conv, true);
38858 }
38859
38860 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1_1u832u16Z_1free(JNIEnv *env, jclass clz, int64_t _res) {
38861         if (!ptr_is_owned(_res)) return;
38862         void* _res_ptr = untag_ptr(_res);
38863         CHECK_ACCESS(_res_ptr);
38864         LDKC2Tuple__u832u16Z _res_conv = *(LDKC2Tuple__u832u16Z*)(_res_ptr);
38865         FREE(untag_ptr(_res));
38866         C2Tuple__u832u16Z_free(_res_conv);
38867 }
38868
38869 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentRelayDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
38870         LDKPaymentRelay o_conv;
38871         o_conv.inner = untag_ptr(o);
38872         o_conv.is_owned = ptr_is_owned(o);
38873         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
38874         o_conv = PaymentRelay_clone(&o_conv);
38875         LDKCResult_PaymentRelayDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentRelayDecodeErrorZ), "LDKCResult_PaymentRelayDecodeErrorZ");
38876         *ret_conv = CResult_PaymentRelayDecodeErrorZ_ok(o_conv);
38877         return tag_ptr(ret_conv, true);
38878 }
38879
38880 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentRelayDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
38881         void* e_ptr = untag_ptr(e);
38882         CHECK_ACCESS(e_ptr);
38883         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
38884         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
38885         LDKCResult_PaymentRelayDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentRelayDecodeErrorZ), "LDKCResult_PaymentRelayDecodeErrorZ");
38886         *ret_conv = CResult_PaymentRelayDecodeErrorZ_err(e_conv);
38887         return tag_ptr(ret_conv, true);
38888 }
38889
38890 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentRelayDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
38891         LDKCResult_PaymentRelayDecodeErrorZ* o_conv = (LDKCResult_PaymentRelayDecodeErrorZ*)untag_ptr(o);
38892         jboolean ret_conv = CResult_PaymentRelayDecodeErrorZ_is_ok(o_conv);
38893         return ret_conv;
38894 }
38895
38896 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentRelayDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
38897         if (!ptr_is_owned(_res)) return;
38898         void* _res_ptr = untag_ptr(_res);
38899         CHECK_ACCESS(_res_ptr);
38900         LDKCResult_PaymentRelayDecodeErrorZ _res_conv = *(LDKCResult_PaymentRelayDecodeErrorZ*)(_res_ptr);
38901         FREE(untag_ptr(_res));
38902         CResult_PaymentRelayDecodeErrorZ_free(_res_conv);
38903 }
38904
38905 static inline uint64_t CResult_PaymentRelayDecodeErrorZ_clone_ptr(LDKCResult_PaymentRelayDecodeErrorZ *NONNULL_PTR arg) {
38906         LDKCResult_PaymentRelayDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentRelayDecodeErrorZ), "LDKCResult_PaymentRelayDecodeErrorZ");
38907         *ret_conv = CResult_PaymentRelayDecodeErrorZ_clone(arg);
38908         return tag_ptr(ret_conv, true);
38909 }
38910 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentRelayDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
38911         LDKCResult_PaymentRelayDecodeErrorZ* arg_conv = (LDKCResult_PaymentRelayDecodeErrorZ*)untag_ptr(arg);
38912         int64_t ret_conv = CResult_PaymentRelayDecodeErrorZ_clone_ptr(arg_conv);
38913         return ret_conv;
38914 }
38915
38916 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentRelayDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
38917         LDKCResult_PaymentRelayDecodeErrorZ* orig_conv = (LDKCResult_PaymentRelayDecodeErrorZ*)untag_ptr(orig);
38918         LDKCResult_PaymentRelayDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentRelayDecodeErrorZ), "LDKCResult_PaymentRelayDecodeErrorZ");
38919         *ret_conv = CResult_PaymentRelayDecodeErrorZ_clone(orig_conv);
38920         return tag_ptr(ret_conv, true);
38921 }
38922
38923 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentConstraintsDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
38924         LDKPaymentConstraints o_conv;
38925         o_conv.inner = untag_ptr(o);
38926         o_conv.is_owned = ptr_is_owned(o);
38927         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
38928         o_conv = PaymentConstraints_clone(&o_conv);
38929         LDKCResult_PaymentConstraintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentConstraintsDecodeErrorZ), "LDKCResult_PaymentConstraintsDecodeErrorZ");
38930         *ret_conv = CResult_PaymentConstraintsDecodeErrorZ_ok(o_conv);
38931         return tag_ptr(ret_conv, true);
38932 }
38933
38934 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentConstraintsDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
38935         void* e_ptr = untag_ptr(e);
38936         CHECK_ACCESS(e_ptr);
38937         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
38938         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
38939         LDKCResult_PaymentConstraintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentConstraintsDecodeErrorZ), "LDKCResult_PaymentConstraintsDecodeErrorZ");
38940         *ret_conv = CResult_PaymentConstraintsDecodeErrorZ_err(e_conv);
38941         return tag_ptr(ret_conv, true);
38942 }
38943
38944 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentConstraintsDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
38945         LDKCResult_PaymentConstraintsDecodeErrorZ* o_conv = (LDKCResult_PaymentConstraintsDecodeErrorZ*)untag_ptr(o);
38946         jboolean ret_conv = CResult_PaymentConstraintsDecodeErrorZ_is_ok(o_conv);
38947         return ret_conv;
38948 }
38949
38950 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentConstraintsDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
38951         if (!ptr_is_owned(_res)) return;
38952         void* _res_ptr = untag_ptr(_res);
38953         CHECK_ACCESS(_res_ptr);
38954         LDKCResult_PaymentConstraintsDecodeErrorZ _res_conv = *(LDKCResult_PaymentConstraintsDecodeErrorZ*)(_res_ptr);
38955         FREE(untag_ptr(_res));
38956         CResult_PaymentConstraintsDecodeErrorZ_free(_res_conv);
38957 }
38958
38959 static inline uint64_t CResult_PaymentConstraintsDecodeErrorZ_clone_ptr(LDKCResult_PaymentConstraintsDecodeErrorZ *NONNULL_PTR arg) {
38960         LDKCResult_PaymentConstraintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentConstraintsDecodeErrorZ), "LDKCResult_PaymentConstraintsDecodeErrorZ");
38961         *ret_conv = CResult_PaymentConstraintsDecodeErrorZ_clone(arg);
38962         return tag_ptr(ret_conv, true);
38963 }
38964 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentConstraintsDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
38965         LDKCResult_PaymentConstraintsDecodeErrorZ* arg_conv = (LDKCResult_PaymentConstraintsDecodeErrorZ*)untag_ptr(arg);
38966         int64_t ret_conv = CResult_PaymentConstraintsDecodeErrorZ_clone_ptr(arg_conv);
38967         return ret_conv;
38968 }
38969
38970 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentConstraintsDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
38971         LDKCResult_PaymentConstraintsDecodeErrorZ* orig_conv = (LDKCResult_PaymentConstraintsDecodeErrorZ*)untag_ptr(orig);
38972         LDKCResult_PaymentConstraintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentConstraintsDecodeErrorZ), "LDKCResult_PaymentConstraintsDecodeErrorZ");
38973         *ret_conv = CResult_PaymentConstraintsDecodeErrorZ_clone(orig_conv);
38974         return tag_ptr(ret_conv, true);
38975 }
38976
38977 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentContextDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
38978         void* o_ptr = untag_ptr(o);
38979         CHECK_ACCESS(o_ptr);
38980         LDKPaymentContext o_conv = *(LDKPaymentContext*)(o_ptr);
38981         o_conv = PaymentContext_clone((LDKPaymentContext*)untag_ptr(o));
38982         LDKCResult_PaymentContextDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentContextDecodeErrorZ), "LDKCResult_PaymentContextDecodeErrorZ");
38983         *ret_conv = CResult_PaymentContextDecodeErrorZ_ok(o_conv);
38984         return tag_ptr(ret_conv, true);
38985 }
38986
38987 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentContextDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
38988         void* e_ptr = untag_ptr(e);
38989         CHECK_ACCESS(e_ptr);
38990         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
38991         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
38992         LDKCResult_PaymentContextDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentContextDecodeErrorZ), "LDKCResult_PaymentContextDecodeErrorZ");
38993         *ret_conv = CResult_PaymentContextDecodeErrorZ_err(e_conv);
38994         return tag_ptr(ret_conv, true);
38995 }
38996
38997 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentContextDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
38998         LDKCResult_PaymentContextDecodeErrorZ* o_conv = (LDKCResult_PaymentContextDecodeErrorZ*)untag_ptr(o);
38999         jboolean ret_conv = CResult_PaymentContextDecodeErrorZ_is_ok(o_conv);
39000         return ret_conv;
39001 }
39002
39003 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentContextDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
39004         if (!ptr_is_owned(_res)) return;
39005         void* _res_ptr = untag_ptr(_res);
39006         CHECK_ACCESS(_res_ptr);
39007         LDKCResult_PaymentContextDecodeErrorZ _res_conv = *(LDKCResult_PaymentContextDecodeErrorZ*)(_res_ptr);
39008         FREE(untag_ptr(_res));
39009         CResult_PaymentContextDecodeErrorZ_free(_res_conv);
39010 }
39011
39012 static inline uint64_t CResult_PaymentContextDecodeErrorZ_clone_ptr(LDKCResult_PaymentContextDecodeErrorZ *NONNULL_PTR arg) {
39013         LDKCResult_PaymentContextDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentContextDecodeErrorZ), "LDKCResult_PaymentContextDecodeErrorZ");
39014         *ret_conv = CResult_PaymentContextDecodeErrorZ_clone(arg);
39015         return tag_ptr(ret_conv, true);
39016 }
39017 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentContextDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
39018         LDKCResult_PaymentContextDecodeErrorZ* arg_conv = (LDKCResult_PaymentContextDecodeErrorZ*)untag_ptr(arg);
39019         int64_t ret_conv = CResult_PaymentContextDecodeErrorZ_clone_ptr(arg_conv);
39020         return ret_conv;
39021 }
39022
39023 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentContextDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
39024         LDKCResult_PaymentContextDecodeErrorZ* orig_conv = (LDKCResult_PaymentContextDecodeErrorZ*)untag_ptr(orig);
39025         LDKCResult_PaymentContextDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentContextDecodeErrorZ), "LDKCResult_PaymentContextDecodeErrorZ");
39026         *ret_conv = CResult_PaymentContextDecodeErrorZ_clone(orig_conv);
39027         return tag_ptr(ret_conv, true);
39028 }
39029
39030 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnknownPaymentContextDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
39031         LDKUnknownPaymentContext o_conv;
39032         o_conv.inner = untag_ptr(o);
39033         o_conv.is_owned = ptr_is_owned(o);
39034         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
39035         o_conv = UnknownPaymentContext_clone(&o_conv);
39036         LDKCResult_UnknownPaymentContextDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnknownPaymentContextDecodeErrorZ), "LDKCResult_UnknownPaymentContextDecodeErrorZ");
39037         *ret_conv = CResult_UnknownPaymentContextDecodeErrorZ_ok(o_conv);
39038         return tag_ptr(ret_conv, true);
39039 }
39040
39041 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnknownPaymentContextDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
39042         void* e_ptr = untag_ptr(e);
39043         CHECK_ACCESS(e_ptr);
39044         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
39045         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
39046         LDKCResult_UnknownPaymentContextDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnknownPaymentContextDecodeErrorZ), "LDKCResult_UnknownPaymentContextDecodeErrorZ");
39047         *ret_conv = CResult_UnknownPaymentContextDecodeErrorZ_err(e_conv);
39048         return tag_ptr(ret_conv, true);
39049 }
39050
39051 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1UnknownPaymentContextDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
39052         LDKCResult_UnknownPaymentContextDecodeErrorZ* o_conv = (LDKCResult_UnknownPaymentContextDecodeErrorZ*)untag_ptr(o);
39053         jboolean ret_conv = CResult_UnknownPaymentContextDecodeErrorZ_is_ok(o_conv);
39054         return ret_conv;
39055 }
39056
39057 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UnknownPaymentContextDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
39058         if (!ptr_is_owned(_res)) return;
39059         void* _res_ptr = untag_ptr(_res);
39060         CHECK_ACCESS(_res_ptr);
39061         LDKCResult_UnknownPaymentContextDecodeErrorZ _res_conv = *(LDKCResult_UnknownPaymentContextDecodeErrorZ*)(_res_ptr);
39062         FREE(untag_ptr(_res));
39063         CResult_UnknownPaymentContextDecodeErrorZ_free(_res_conv);
39064 }
39065
39066 static inline uint64_t CResult_UnknownPaymentContextDecodeErrorZ_clone_ptr(LDKCResult_UnknownPaymentContextDecodeErrorZ *NONNULL_PTR arg) {
39067         LDKCResult_UnknownPaymentContextDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnknownPaymentContextDecodeErrorZ), "LDKCResult_UnknownPaymentContextDecodeErrorZ");
39068         *ret_conv = CResult_UnknownPaymentContextDecodeErrorZ_clone(arg);
39069         return tag_ptr(ret_conv, true);
39070 }
39071 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnknownPaymentContextDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
39072         LDKCResult_UnknownPaymentContextDecodeErrorZ* arg_conv = (LDKCResult_UnknownPaymentContextDecodeErrorZ*)untag_ptr(arg);
39073         int64_t ret_conv = CResult_UnknownPaymentContextDecodeErrorZ_clone_ptr(arg_conv);
39074         return ret_conv;
39075 }
39076
39077 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnknownPaymentContextDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
39078         LDKCResult_UnknownPaymentContextDecodeErrorZ* orig_conv = (LDKCResult_UnknownPaymentContextDecodeErrorZ*)untag_ptr(orig);
39079         LDKCResult_UnknownPaymentContextDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnknownPaymentContextDecodeErrorZ), "LDKCResult_UnknownPaymentContextDecodeErrorZ");
39080         *ret_conv = CResult_UnknownPaymentContextDecodeErrorZ_clone(orig_conv);
39081         return tag_ptr(ret_conv, true);
39082 }
39083
39084 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt12OfferContextDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
39085         LDKBolt12OfferContext o_conv;
39086         o_conv.inner = untag_ptr(o);
39087         o_conv.is_owned = ptr_is_owned(o);
39088         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
39089         o_conv = Bolt12OfferContext_clone(&o_conv);
39090         LDKCResult_Bolt12OfferContextDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt12OfferContextDecodeErrorZ), "LDKCResult_Bolt12OfferContextDecodeErrorZ");
39091         *ret_conv = CResult_Bolt12OfferContextDecodeErrorZ_ok(o_conv);
39092         return tag_ptr(ret_conv, true);
39093 }
39094
39095 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt12OfferContextDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
39096         void* e_ptr = untag_ptr(e);
39097         CHECK_ACCESS(e_ptr);
39098         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
39099         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
39100         LDKCResult_Bolt12OfferContextDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt12OfferContextDecodeErrorZ), "LDKCResult_Bolt12OfferContextDecodeErrorZ");
39101         *ret_conv = CResult_Bolt12OfferContextDecodeErrorZ_err(e_conv);
39102         return tag_ptr(ret_conv, true);
39103 }
39104
39105 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt12OfferContextDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
39106         LDKCResult_Bolt12OfferContextDecodeErrorZ* o_conv = (LDKCResult_Bolt12OfferContextDecodeErrorZ*)untag_ptr(o);
39107         jboolean ret_conv = CResult_Bolt12OfferContextDecodeErrorZ_is_ok(o_conv);
39108         return ret_conv;
39109 }
39110
39111 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt12OfferContextDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
39112         if (!ptr_is_owned(_res)) return;
39113         void* _res_ptr = untag_ptr(_res);
39114         CHECK_ACCESS(_res_ptr);
39115         LDKCResult_Bolt12OfferContextDecodeErrorZ _res_conv = *(LDKCResult_Bolt12OfferContextDecodeErrorZ*)(_res_ptr);
39116         FREE(untag_ptr(_res));
39117         CResult_Bolt12OfferContextDecodeErrorZ_free(_res_conv);
39118 }
39119
39120 static inline uint64_t CResult_Bolt12OfferContextDecodeErrorZ_clone_ptr(LDKCResult_Bolt12OfferContextDecodeErrorZ *NONNULL_PTR arg) {
39121         LDKCResult_Bolt12OfferContextDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt12OfferContextDecodeErrorZ), "LDKCResult_Bolt12OfferContextDecodeErrorZ");
39122         *ret_conv = CResult_Bolt12OfferContextDecodeErrorZ_clone(arg);
39123         return tag_ptr(ret_conv, true);
39124 }
39125 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt12OfferContextDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
39126         LDKCResult_Bolt12OfferContextDecodeErrorZ* arg_conv = (LDKCResult_Bolt12OfferContextDecodeErrorZ*)untag_ptr(arg);
39127         int64_t ret_conv = CResult_Bolt12OfferContextDecodeErrorZ_clone_ptr(arg_conv);
39128         return ret_conv;
39129 }
39130
39131 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt12OfferContextDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
39132         LDKCResult_Bolt12OfferContextDecodeErrorZ* orig_conv = (LDKCResult_Bolt12OfferContextDecodeErrorZ*)untag_ptr(orig);
39133         LDKCResult_Bolt12OfferContextDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt12OfferContextDecodeErrorZ), "LDKCResult_Bolt12OfferContextDecodeErrorZ");
39134         *ret_conv = CResult_Bolt12OfferContextDecodeErrorZ_clone(orig_conv);
39135         return tag_ptr(ret_conv, true);
39136 }
39137
39138 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt12RefundContextDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
39139         LDKBolt12RefundContext o_conv;
39140         o_conv.inner = untag_ptr(o);
39141         o_conv.is_owned = ptr_is_owned(o);
39142         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
39143         o_conv = Bolt12RefundContext_clone(&o_conv);
39144         LDKCResult_Bolt12RefundContextDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt12RefundContextDecodeErrorZ), "LDKCResult_Bolt12RefundContextDecodeErrorZ");
39145         *ret_conv = CResult_Bolt12RefundContextDecodeErrorZ_ok(o_conv);
39146         return tag_ptr(ret_conv, true);
39147 }
39148
39149 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt12RefundContextDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
39150         void* e_ptr = untag_ptr(e);
39151         CHECK_ACCESS(e_ptr);
39152         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
39153         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
39154         LDKCResult_Bolt12RefundContextDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt12RefundContextDecodeErrorZ), "LDKCResult_Bolt12RefundContextDecodeErrorZ");
39155         *ret_conv = CResult_Bolt12RefundContextDecodeErrorZ_err(e_conv);
39156         return tag_ptr(ret_conv, true);
39157 }
39158
39159 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt12RefundContextDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
39160         LDKCResult_Bolt12RefundContextDecodeErrorZ* o_conv = (LDKCResult_Bolt12RefundContextDecodeErrorZ*)untag_ptr(o);
39161         jboolean ret_conv = CResult_Bolt12RefundContextDecodeErrorZ_is_ok(o_conv);
39162         return ret_conv;
39163 }
39164
39165 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt12RefundContextDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
39166         if (!ptr_is_owned(_res)) return;
39167         void* _res_ptr = untag_ptr(_res);
39168         CHECK_ACCESS(_res_ptr);
39169         LDKCResult_Bolt12RefundContextDecodeErrorZ _res_conv = *(LDKCResult_Bolt12RefundContextDecodeErrorZ*)(_res_ptr);
39170         FREE(untag_ptr(_res));
39171         CResult_Bolt12RefundContextDecodeErrorZ_free(_res_conv);
39172 }
39173
39174 static inline uint64_t CResult_Bolt12RefundContextDecodeErrorZ_clone_ptr(LDKCResult_Bolt12RefundContextDecodeErrorZ *NONNULL_PTR arg) {
39175         LDKCResult_Bolt12RefundContextDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt12RefundContextDecodeErrorZ), "LDKCResult_Bolt12RefundContextDecodeErrorZ");
39176         *ret_conv = CResult_Bolt12RefundContextDecodeErrorZ_clone(arg);
39177         return tag_ptr(ret_conv, true);
39178 }
39179 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt12RefundContextDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
39180         LDKCResult_Bolt12RefundContextDecodeErrorZ* arg_conv = (LDKCResult_Bolt12RefundContextDecodeErrorZ*)untag_ptr(arg);
39181         int64_t ret_conv = CResult_Bolt12RefundContextDecodeErrorZ_clone_ptr(arg_conv);
39182         return ret_conv;
39183 }
39184
39185 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1Bolt12RefundContextDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
39186         LDKCResult_Bolt12RefundContextDecodeErrorZ* orig_conv = (LDKCResult_Bolt12RefundContextDecodeErrorZ*)untag_ptr(orig);
39187         LDKCResult_Bolt12RefundContextDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt12RefundContextDecodeErrorZ), "LDKCResult_Bolt12RefundContextDecodeErrorZ");
39188         *ret_conv = CResult_Bolt12RefundContextDecodeErrorZ_clone(orig_conv);
39189         return tag_ptr(ret_conv, true);
39190 }
39191
39192 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StrSecp256k1ErrorZ_1ok(JNIEnv *env, jclass clz, jstring o) {
39193         LDKStr o_conv = java_to_owned_str(env, o);
39194         LDKCResult_StrSecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StrSecp256k1ErrorZ), "LDKCResult_StrSecp256k1ErrorZ");
39195         *ret_conv = CResult_StrSecp256k1ErrorZ_ok(o_conv);
39196         return tag_ptr(ret_conv, true);
39197 }
39198
39199 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StrSecp256k1ErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
39200         LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_java(env, e);
39201         LDKCResult_StrSecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StrSecp256k1ErrorZ), "LDKCResult_StrSecp256k1ErrorZ");
39202         *ret_conv = CResult_StrSecp256k1ErrorZ_err(e_conv);
39203         return tag_ptr(ret_conv, true);
39204 }
39205
39206 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1StrSecp256k1ErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
39207         LDKCResult_StrSecp256k1ErrorZ* o_conv = (LDKCResult_StrSecp256k1ErrorZ*)untag_ptr(o);
39208         jboolean ret_conv = CResult_StrSecp256k1ErrorZ_is_ok(o_conv);
39209         return ret_conv;
39210 }
39211
39212 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1StrSecp256k1ErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
39213         if (!ptr_is_owned(_res)) return;
39214         void* _res_ptr = untag_ptr(_res);
39215         CHECK_ACCESS(_res_ptr);
39216         LDKCResult_StrSecp256k1ErrorZ _res_conv = *(LDKCResult_StrSecp256k1ErrorZ*)(_res_ptr);
39217         FREE(untag_ptr(_res));
39218         CResult_StrSecp256k1ErrorZ_free(_res_conv);
39219 }
39220
39221 static inline uint64_t CResult_StrSecp256k1ErrorZ_clone_ptr(LDKCResult_StrSecp256k1ErrorZ *NONNULL_PTR arg) {
39222         LDKCResult_StrSecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StrSecp256k1ErrorZ), "LDKCResult_StrSecp256k1ErrorZ");
39223         *ret_conv = CResult_StrSecp256k1ErrorZ_clone(arg);
39224         return tag_ptr(ret_conv, true);
39225 }
39226 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StrSecp256k1ErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
39227         LDKCResult_StrSecp256k1ErrorZ* arg_conv = (LDKCResult_StrSecp256k1ErrorZ*)untag_ptr(arg);
39228         int64_t ret_conv = CResult_StrSecp256k1ErrorZ_clone_ptr(arg_conv);
39229         return ret_conv;
39230 }
39231
39232 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StrSecp256k1ErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
39233         LDKCResult_StrSecp256k1ErrorZ* orig_conv = (LDKCResult_StrSecp256k1ErrorZ*)untag_ptr(orig);
39234         LDKCResult_StrSecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StrSecp256k1ErrorZ), "LDKCResult_StrSecp256k1ErrorZ");
39235         *ret_conv = CResult_StrSecp256k1ErrorZ_clone(orig_conv);
39236         return tag_ptr(ret_conv, true);
39237 }
39238
39239 static inline uint64_t C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_clone_ptr(LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ *NONNULL_PTR arg) {
39240         LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ), "LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ");
39241         *ret_conv = C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_clone(arg);
39242         return tag_ptr(ret_conv, true);
39243 }
39244 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
39245         LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ* arg_conv = (LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ*)untag_ptr(arg);
39246         int64_t ret_conv = C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_clone_ptr(arg_conv);
39247         return ret_conv;
39248 }
39249
39250 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
39251         LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ* orig_conv = (LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ*)untag_ptr(orig);
39252         LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ), "LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ");
39253         *ret_conv = C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_clone(orig_conv);
39254         return tag_ptr(ret_conv, true);
39255 }
39256
39257 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) {
39258         LDKThirtyTwoBytes a_ref;
39259         CHECK((*env)->GetArrayLength(env, a) == 32);
39260         (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
39261         LDKRecipientOnionFields b_conv;
39262         b_conv.inner = untag_ptr(b);
39263         b_conv.is_owned = ptr_is_owned(b);
39264         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
39265         b_conv = RecipientOnionFields_clone(&b_conv);
39266         LDKRouteParameters c_conv;
39267         c_conv.inner = untag_ptr(c);
39268         c_conv.is_owned = ptr_is_owned(c);
39269         CHECK_INNER_FIELD_ACCESS_OR_NULL(c_conv);
39270         c_conv = RouteParameters_clone(&c_conv);
39271         LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ), "LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ");
39272         *ret_conv = C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_new(a_ref, b_conv, c_conv);
39273         return tag_ptr(ret_conv, true);
39274 }
39275
39276 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
39277         if (!ptr_is_owned(_res)) return;
39278         void* _res_ptr = untag_ptr(_res);
39279         CHECK_ACCESS(_res_ptr);
39280         LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ _res_conv = *(LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ*)(_res_ptr);
39281         FREE(untag_ptr(_res));
39282         C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_free(_res_conv);
39283 }
39284
39285 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C3Tuple_1ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
39286         void* o_ptr = untag_ptr(o);
39287         CHECK_ACCESS(o_ptr);
39288         LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ o_conv = *(LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ*)(o_ptr);
39289         o_conv = C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_clone((LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ*)untag_ptr(o));
39290         LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ), "LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ");
39291         *ret_conv = CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_ok(o_conv);
39292         return tag_ptr(ret_conv, true);
39293 }
39294
39295 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C3Tuple_1ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_1err(JNIEnv *env, jclass clz) {
39296         LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ), "LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ");
39297         *ret_conv = CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_err();
39298         return tag_ptr(ret_conv, true);
39299 }
39300
39301 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1C3Tuple_1ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
39302         LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ* o_conv = (LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ*)untag_ptr(o);
39303         jboolean ret_conv = CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_is_ok(o_conv);
39304         return ret_conv;
39305 }
39306
39307 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C3Tuple_1ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
39308         if (!ptr_is_owned(_res)) return;
39309         void* _res_ptr = untag_ptr(_res);
39310         CHECK_ACCESS(_res_ptr);
39311         LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ _res_conv = *(LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ*)(_res_ptr);
39312         FREE(untag_ptr(_res));
39313         CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_free(_res_conv);
39314 }
39315
39316 static inline uint64_t CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_clone_ptr(LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ *NONNULL_PTR arg) {
39317         LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ), "LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ");
39318         *ret_conv = CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_clone(arg);
39319         return tag_ptr(ret_conv, true);
39320 }
39321 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C3Tuple_1ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
39322         LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ* arg_conv = (LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ*)untag_ptr(arg);
39323         int64_t ret_conv = CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_clone_ptr(arg_conv);
39324         return ret_conv;
39325 }
39326
39327 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C3Tuple_1ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
39328         LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ* orig_conv = (LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ*)untag_ptr(orig);
39329         LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ), "LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ");
39330         *ret_conv = CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_clone(orig_conv);
39331         return tag_ptr(ret_conv, true);
39332 }
39333
39334 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutUtxoLookupErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
39335         void* o_ptr = untag_ptr(o);
39336         CHECK_ACCESS(o_ptr);
39337         LDKTxOut o_conv = *(LDKTxOut*)(o_ptr);
39338         o_conv = TxOut_clone((LDKTxOut*)untag_ptr(o));
39339         LDKCResult_TxOutUtxoLookupErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutUtxoLookupErrorZ), "LDKCResult_TxOutUtxoLookupErrorZ");
39340         *ret_conv = CResult_TxOutUtxoLookupErrorZ_ok(o_conv);
39341         return tag_ptr(ret_conv, true);
39342 }
39343
39344 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutUtxoLookupErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
39345         LDKUtxoLookupError e_conv = LDKUtxoLookupError_from_java(env, e);
39346         LDKCResult_TxOutUtxoLookupErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutUtxoLookupErrorZ), "LDKCResult_TxOutUtxoLookupErrorZ");
39347         *ret_conv = CResult_TxOutUtxoLookupErrorZ_err(e_conv);
39348         return tag_ptr(ret_conv, true);
39349 }
39350
39351 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutUtxoLookupErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
39352         LDKCResult_TxOutUtxoLookupErrorZ* o_conv = (LDKCResult_TxOutUtxoLookupErrorZ*)untag_ptr(o);
39353         jboolean ret_conv = CResult_TxOutUtxoLookupErrorZ_is_ok(o_conv);
39354         return ret_conv;
39355 }
39356
39357 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutUtxoLookupErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
39358         if (!ptr_is_owned(_res)) return;
39359         void* _res_ptr = untag_ptr(_res);
39360         CHECK_ACCESS(_res_ptr);
39361         LDKCResult_TxOutUtxoLookupErrorZ _res_conv = *(LDKCResult_TxOutUtxoLookupErrorZ*)(_res_ptr);
39362         FREE(untag_ptr(_res));
39363         CResult_TxOutUtxoLookupErrorZ_free(_res_conv);
39364 }
39365
39366 static inline uint64_t CResult_TxOutUtxoLookupErrorZ_clone_ptr(LDKCResult_TxOutUtxoLookupErrorZ *NONNULL_PTR arg) {
39367         LDKCResult_TxOutUtxoLookupErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutUtxoLookupErrorZ), "LDKCResult_TxOutUtxoLookupErrorZ");
39368         *ret_conv = CResult_TxOutUtxoLookupErrorZ_clone(arg);
39369         return tag_ptr(ret_conv, true);
39370 }
39371 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutUtxoLookupErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
39372         LDKCResult_TxOutUtxoLookupErrorZ* arg_conv = (LDKCResult_TxOutUtxoLookupErrorZ*)untag_ptr(arg);
39373         int64_t ret_conv = CResult_TxOutUtxoLookupErrorZ_clone_ptr(arg_conv);
39374         return ret_conv;
39375 }
39376
39377 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutUtxoLookupErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
39378         LDKCResult_TxOutUtxoLookupErrorZ* orig_conv = (LDKCResult_TxOutUtxoLookupErrorZ*)untag_ptr(orig);
39379         LDKCResult_TxOutUtxoLookupErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutUtxoLookupErrorZ), "LDKCResult_TxOutUtxoLookupErrorZ");
39380         *ret_conv = CResult_TxOutUtxoLookupErrorZ_clone(orig_conv);
39381         return tag_ptr(ret_conv, true);
39382 }
39383
39384 static inline uint64_t C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_clone_ptr(LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ *NONNULL_PTR arg) {
39385         LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ), "LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ");
39386         *ret_conv = C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_clone(arg);
39387         return tag_ptr(ret_conv, true);
39388 }
39389 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1PublicKeyOnionMessageCOption_1CVec_1SocketAddressZZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
39390         LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ* arg_conv = (LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ*)untag_ptr(arg);
39391         int64_t ret_conv = C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_clone_ptr(arg_conv);
39392         return ret_conv;
39393 }
39394
39395 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1PublicKeyOnionMessageCOption_1CVec_1SocketAddressZZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
39396         LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ* orig_conv = (LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ*)untag_ptr(orig);
39397         LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ), "LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ");
39398         *ret_conv = C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_clone(orig_conv);
39399         return tag_ptr(ret_conv, true);
39400 }
39401
39402 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) {
39403         LDKPublicKey a_ref;
39404         CHECK((*env)->GetArrayLength(env, a) == 33);
39405         (*env)->GetByteArrayRegion(env, a, 0, 33, a_ref.compressed_form);
39406         LDKOnionMessage b_conv;
39407         b_conv.inner = untag_ptr(b);
39408         b_conv.is_owned = ptr_is_owned(b);
39409         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
39410         b_conv = OnionMessage_clone(&b_conv);
39411         void* c_ptr = untag_ptr(c);
39412         CHECK_ACCESS(c_ptr);
39413         LDKCOption_CVec_SocketAddressZZ c_conv = *(LDKCOption_CVec_SocketAddressZZ*)(c_ptr);
39414         c_conv = COption_CVec_SocketAddressZZ_clone((LDKCOption_CVec_SocketAddressZZ*)untag_ptr(c));
39415         LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ), "LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ");
39416         *ret_conv = C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_new(a_ref, b_conv, c_conv);
39417         return tag_ptr(ret_conv, true);
39418 }
39419
39420 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C3Tuple_1PublicKeyOnionMessageCOption_1CVec_1SocketAddressZZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
39421         if (!ptr_is_owned(_res)) return;
39422         void* _res_ptr = untag_ptr(_res);
39423         CHECK_ACCESS(_res_ptr);
39424         LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ _res_conv = *(LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ*)(_res_ptr);
39425         FREE(untag_ptr(_res));
39426         C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_free(_res_conv);
39427 }
39428
39429 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C3Tuple_1PublicKeyOnionMessageCOption_1CVec_1SocketAddressZZZSendErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
39430         void* o_ptr = untag_ptr(o);
39431         CHECK_ACCESS(o_ptr);
39432         LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ o_conv = *(LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ*)(o_ptr);
39433         o_conv = C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_clone((LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ*)untag_ptr(o));
39434         LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ), "LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ");
39435         *ret_conv = CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_ok(o_conv);
39436         return tag_ptr(ret_conv, true);
39437 }
39438
39439 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C3Tuple_1PublicKeyOnionMessageCOption_1CVec_1SocketAddressZZZSendErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
39440         void* e_ptr = untag_ptr(e);
39441         CHECK_ACCESS(e_ptr);
39442         LDKSendError e_conv = *(LDKSendError*)(e_ptr);
39443         e_conv = SendError_clone((LDKSendError*)untag_ptr(e));
39444         LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ), "LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ");
39445         *ret_conv = CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_err(e_conv);
39446         return tag_ptr(ret_conv, true);
39447 }
39448
39449 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1C3Tuple_1PublicKeyOnionMessageCOption_1CVec_1SocketAddressZZZSendErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
39450         LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ* o_conv = (LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ*)untag_ptr(o);
39451         jboolean ret_conv = CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_is_ok(o_conv);
39452         return ret_conv;
39453 }
39454
39455 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C3Tuple_1PublicKeyOnionMessageCOption_1CVec_1SocketAddressZZZSendErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
39456         if (!ptr_is_owned(_res)) return;
39457         void* _res_ptr = untag_ptr(_res);
39458         CHECK_ACCESS(_res_ptr);
39459         LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ _res_conv = *(LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ*)(_res_ptr);
39460         FREE(untag_ptr(_res));
39461         CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_free(_res_conv);
39462 }
39463
39464 static inline uint64_t CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_clone_ptr(LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ *NONNULL_PTR arg) {
39465         LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ), "LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ");
39466         *ret_conv = CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_clone(arg);
39467         return tag_ptr(ret_conv, true);
39468 }
39469 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C3Tuple_1PublicKeyOnionMessageCOption_1CVec_1SocketAddressZZZSendErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
39470         LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ* arg_conv = (LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ*)untag_ptr(arg);
39471         int64_t ret_conv = CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_clone_ptr(arg_conv);
39472         return ret_conv;
39473 }
39474
39475 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C3Tuple_1PublicKeyOnionMessageCOption_1CVec_1SocketAddressZZZSendErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
39476         LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ* orig_conv = (LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ*)untag_ptr(orig);
39477         LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ), "LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ");
39478         *ret_conv = CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_clone(orig_conv);
39479         return tag_ptr(ret_conv, true);
39480 }
39481
39482 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PeeledOnionNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
39483         void* o_ptr = untag_ptr(o);
39484         CHECK_ACCESS(o_ptr);
39485         LDKPeeledOnion o_conv = *(LDKPeeledOnion*)(o_ptr);
39486         o_conv = PeeledOnion_clone((LDKPeeledOnion*)untag_ptr(o));
39487         LDKCResult_PeeledOnionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PeeledOnionNoneZ), "LDKCResult_PeeledOnionNoneZ");
39488         *ret_conv = CResult_PeeledOnionNoneZ_ok(o_conv);
39489         return tag_ptr(ret_conv, true);
39490 }
39491
39492 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PeeledOnionNoneZ_1err(JNIEnv *env, jclass clz) {
39493         LDKCResult_PeeledOnionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PeeledOnionNoneZ), "LDKCResult_PeeledOnionNoneZ");
39494         *ret_conv = CResult_PeeledOnionNoneZ_err();
39495         return tag_ptr(ret_conv, true);
39496 }
39497
39498 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PeeledOnionNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
39499         LDKCResult_PeeledOnionNoneZ* o_conv = (LDKCResult_PeeledOnionNoneZ*)untag_ptr(o);
39500         jboolean ret_conv = CResult_PeeledOnionNoneZ_is_ok(o_conv);
39501         return ret_conv;
39502 }
39503
39504 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PeeledOnionNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
39505         if (!ptr_is_owned(_res)) return;
39506         void* _res_ptr = untag_ptr(_res);
39507         CHECK_ACCESS(_res_ptr);
39508         LDKCResult_PeeledOnionNoneZ _res_conv = *(LDKCResult_PeeledOnionNoneZ*)(_res_ptr);
39509         FREE(untag_ptr(_res));
39510         CResult_PeeledOnionNoneZ_free(_res_conv);
39511 }
39512
39513 static inline uint64_t CResult_PeeledOnionNoneZ_clone_ptr(LDKCResult_PeeledOnionNoneZ *NONNULL_PTR arg) {
39514         LDKCResult_PeeledOnionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PeeledOnionNoneZ), "LDKCResult_PeeledOnionNoneZ");
39515         *ret_conv = CResult_PeeledOnionNoneZ_clone(arg);
39516         return tag_ptr(ret_conv, true);
39517 }
39518 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PeeledOnionNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
39519         LDKCResult_PeeledOnionNoneZ* arg_conv = (LDKCResult_PeeledOnionNoneZ*)untag_ptr(arg);
39520         int64_t ret_conv = CResult_PeeledOnionNoneZ_clone_ptr(arg_conv);
39521         return ret_conv;
39522 }
39523
39524 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PeeledOnionNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
39525         LDKCResult_PeeledOnionNoneZ* orig_conv = (LDKCResult_PeeledOnionNoneZ*)untag_ptr(orig);
39526         LDKCResult_PeeledOnionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PeeledOnionNoneZ), "LDKCResult_PeeledOnionNoneZ");
39527         *ret_conv = CResult_PeeledOnionNoneZ_clone(orig_conv);
39528         return tag_ptr(ret_conv, true);
39529 }
39530
39531 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SendSuccessSendErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
39532         void* o_ptr = untag_ptr(o);
39533         CHECK_ACCESS(o_ptr);
39534         LDKSendSuccess o_conv = *(LDKSendSuccess*)(o_ptr);
39535         o_conv = SendSuccess_clone((LDKSendSuccess*)untag_ptr(o));
39536         LDKCResult_SendSuccessSendErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SendSuccessSendErrorZ), "LDKCResult_SendSuccessSendErrorZ");
39537         *ret_conv = CResult_SendSuccessSendErrorZ_ok(o_conv);
39538         return tag_ptr(ret_conv, true);
39539 }
39540
39541 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SendSuccessSendErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
39542         void* e_ptr = untag_ptr(e);
39543         CHECK_ACCESS(e_ptr);
39544         LDKSendError e_conv = *(LDKSendError*)(e_ptr);
39545         e_conv = SendError_clone((LDKSendError*)untag_ptr(e));
39546         LDKCResult_SendSuccessSendErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SendSuccessSendErrorZ), "LDKCResult_SendSuccessSendErrorZ");
39547         *ret_conv = CResult_SendSuccessSendErrorZ_err(e_conv);
39548         return tag_ptr(ret_conv, true);
39549 }
39550
39551 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1SendSuccessSendErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
39552         LDKCResult_SendSuccessSendErrorZ* o_conv = (LDKCResult_SendSuccessSendErrorZ*)untag_ptr(o);
39553         jboolean ret_conv = CResult_SendSuccessSendErrorZ_is_ok(o_conv);
39554         return ret_conv;
39555 }
39556
39557 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SendSuccessSendErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
39558         if (!ptr_is_owned(_res)) return;
39559         void* _res_ptr = untag_ptr(_res);
39560         CHECK_ACCESS(_res_ptr);
39561         LDKCResult_SendSuccessSendErrorZ _res_conv = *(LDKCResult_SendSuccessSendErrorZ*)(_res_ptr);
39562         FREE(untag_ptr(_res));
39563         CResult_SendSuccessSendErrorZ_free(_res_conv);
39564 }
39565
39566 static inline uint64_t CResult_SendSuccessSendErrorZ_clone_ptr(LDKCResult_SendSuccessSendErrorZ *NONNULL_PTR arg) {
39567         LDKCResult_SendSuccessSendErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SendSuccessSendErrorZ), "LDKCResult_SendSuccessSendErrorZ");
39568         *ret_conv = CResult_SendSuccessSendErrorZ_clone(arg);
39569         return tag_ptr(ret_conv, true);
39570 }
39571 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SendSuccessSendErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
39572         LDKCResult_SendSuccessSendErrorZ* arg_conv = (LDKCResult_SendSuccessSendErrorZ*)untag_ptr(arg);
39573         int64_t ret_conv = CResult_SendSuccessSendErrorZ_clone_ptr(arg_conv);
39574         return ret_conv;
39575 }
39576
39577 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SendSuccessSendErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
39578         LDKCResult_SendSuccessSendErrorZ* orig_conv = (LDKCResult_SendSuccessSendErrorZ*)untag_ptr(orig);
39579         LDKCResult_SendSuccessSendErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SendSuccessSendErrorZ), "LDKCResult_SendSuccessSendErrorZ");
39580         *ret_conv = CResult_SendSuccessSendErrorZ_clone(orig_conv);
39581         return tag_ptr(ret_conv, true);
39582 }
39583
39584 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPathNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
39585         LDKBlindedPath o_conv;
39586         o_conv.inner = untag_ptr(o);
39587         o_conv.is_owned = ptr_is_owned(o);
39588         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
39589         o_conv = BlindedPath_clone(&o_conv);
39590         LDKCResult_BlindedPathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathNoneZ), "LDKCResult_BlindedPathNoneZ");
39591         *ret_conv = CResult_BlindedPathNoneZ_ok(o_conv);
39592         return tag_ptr(ret_conv, true);
39593 }
39594
39595 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPathNoneZ_1err(JNIEnv *env, jclass clz) {
39596         LDKCResult_BlindedPathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathNoneZ), "LDKCResult_BlindedPathNoneZ");
39597         *ret_conv = CResult_BlindedPathNoneZ_err();
39598         return tag_ptr(ret_conv, true);
39599 }
39600
39601 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPathNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
39602         LDKCResult_BlindedPathNoneZ* o_conv = (LDKCResult_BlindedPathNoneZ*)untag_ptr(o);
39603         jboolean ret_conv = CResult_BlindedPathNoneZ_is_ok(o_conv);
39604         return ret_conv;
39605 }
39606
39607 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPathNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
39608         if (!ptr_is_owned(_res)) return;
39609         void* _res_ptr = untag_ptr(_res);
39610         CHECK_ACCESS(_res_ptr);
39611         LDKCResult_BlindedPathNoneZ _res_conv = *(LDKCResult_BlindedPathNoneZ*)(_res_ptr);
39612         FREE(untag_ptr(_res));
39613         CResult_BlindedPathNoneZ_free(_res_conv);
39614 }
39615
39616 static inline uint64_t CResult_BlindedPathNoneZ_clone_ptr(LDKCResult_BlindedPathNoneZ *NONNULL_PTR arg) {
39617         LDKCResult_BlindedPathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathNoneZ), "LDKCResult_BlindedPathNoneZ");
39618         *ret_conv = CResult_BlindedPathNoneZ_clone(arg);
39619         return tag_ptr(ret_conv, true);
39620 }
39621 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPathNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
39622         LDKCResult_BlindedPathNoneZ* arg_conv = (LDKCResult_BlindedPathNoneZ*)untag_ptr(arg);
39623         int64_t ret_conv = CResult_BlindedPathNoneZ_clone_ptr(arg_conv);
39624         return ret_conv;
39625 }
39626
39627 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPathNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
39628         LDKCResult_BlindedPathNoneZ* orig_conv = (LDKCResult_BlindedPathNoneZ*)untag_ptr(orig);
39629         LDKCResult_BlindedPathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathNoneZ), "LDKCResult_BlindedPathNoneZ");
39630         *ret_conv = CResult_BlindedPathNoneZ_clone(orig_conv);
39631         return tag_ptr(ret_conv, true);
39632 }
39633
39634 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlindedPayInfoBlindedPathZNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
39635         void* o_ptr = untag_ptr(o);
39636         CHECK_ACCESS(o_ptr);
39637         LDKC2Tuple_BlindedPayInfoBlindedPathZ o_conv = *(LDKC2Tuple_BlindedPayInfoBlindedPathZ*)(o_ptr);
39638         o_conv = C2Tuple_BlindedPayInfoBlindedPathZ_clone((LDKC2Tuple_BlindedPayInfoBlindedPathZ*)untag_ptr(o));
39639         LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ), "LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ");
39640         *ret_conv = CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_ok(o_conv);
39641         return tag_ptr(ret_conv, true);
39642 }
39643
39644 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlindedPayInfoBlindedPathZNoneZ_1err(JNIEnv *env, jclass clz) {
39645         LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ), "LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ");
39646         *ret_conv = CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_err();
39647         return tag_ptr(ret_conv, true);
39648 }
39649
39650 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlindedPayInfoBlindedPathZNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
39651         LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ* o_conv = (LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ*)untag_ptr(o);
39652         jboolean ret_conv = CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_is_ok(o_conv);
39653         return ret_conv;
39654 }
39655
39656 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlindedPayInfoBlindedPathZNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
39657         if (!ptr_is_owned(_res)) return;
39658         void* _res_ptr = untag_ptr(_res);
39659         CHECK_ACCESS(_res_ptr);
39660         LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ _res_conv = *(LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ*)(_res_ptr);
39661         FREE(untag_ptr(_res));
39662         CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_free(_res_conv);
39663 }
39664
39665 static inline uint64_t CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_clone_ptr(LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ *NONNULL_PTR arg) {
39666         LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ), "LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ");
39667         *ret_conv = CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_clone(arg);
39668         return tag_ptr(ret_conv, true);
39669 }
39670 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlindedPayInfoBlindedPathZNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
39671         LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ* arg_conv = (LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ*)untag_ptr(arg);
39672         int64_t ret_conv = CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_clone_ptr(arg_conv);
39673         return ret_conv;
39674 }
39675
39676 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlindedPayInfoBlindedPathZNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
39677         LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ* orig_conv = (LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ*)untag_ptr(orig);
39678         LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ), "LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ");
39679         *ret_conv = CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ_clone(orig_conv);
39680         return tag_ptr(ret_conv, true);
39681 }
39682
39683 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1ForwardNodeZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
39684         LDKCVec_ForwardNodeZ _res_constr;
39685         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
39686         if (_res_constr.datalen > 0)
39687                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKForwardNode), "LDKCVec_ForwardNodeZ Elements");
39688         else
39689                 _res_constr.data = NULL;
39690         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
39691         for (size_t n = 0; n < _res_constr.datalen; n++) {
39692                 int64_t _res_conv_13 = _res_vals[n];
39693                 LDKForwardNode _res_conv_13_conv;
39694                 _res_conv_13_conv.inner = untag_ptr(_res_conv_13);
39695                 _res_conv_13_conv.is_owned = ptr_is_owned(_res_conv_13);
39696                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_13_conv);
39697                 _res_constr.data[n] = _res_conv_13_conv;
39698         }
39699         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
39700         CVec_ForwardNodeZ_free(_res_constr);
39701 }
39702
39703 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPathDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
39704         LDKBlindedPath o_conv;
39705         o_conv.inner = untag_ptr(o);
39706         o_conv.is_owned = ptr_is_owned(o);
39707         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
39708         o_conv = BlindedPath_clone(&o_conv);
39709         LDKCResult_BlindedPathDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathDecodeErrorZ), "LDKCResult_BlindedPathDecodeErrorZ");
39710         *ret_conv = CResult_BlindedPathDecodeErrorZ_ok(o_conv);
39711         return tag_ptr(ret_conv, true);
39712 }
39713
39714 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPathDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
39715         void* e_ptr = untag_ptr(e);
39716         CHECK_ACCESS(e_ptr);
39717         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
39718         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
39719         LDKCResult_BlindedPathDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathDecodeErrorZ), "LDKCResult_BlindedPathDecodeErrorZ");
39720         *ret_conv = CResult_BlindedPathDecodeErrorZ_err(e_conv);
39721         return tag_ptr(ret_conv, true);
39722 }
39723
39724 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPathDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
39725         LDKCResult_BlindedPathDecodeErrorZ* o_conv = (LDKCResult_BlindedPathDecodeErrorZ*)untag_ptr(o);
39726         jboolean ret_conv = CResult_BlindedPathDecodeErrorZ_is_ok(o_conv);
39727         return ret_conv;
39728 }
39729
39730 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPathDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
39731         if (!ptr_is_owned(_res)) return;
39732         void* _res_ptr = untag_ptr(_res);
39733         CHECK_ACCESS(_res_ptr);
39734         LDKCResult_BlindedPathDecodeErrorZ _res_conv = *(LDKCResult_BlindedPathDecodeErrorZ*)(_res_ptr);
39735         FREE(untag_ptr(_res));
39736         CResult_BlindedPathDecodeErrorZ_free(_res_conv);
39737 }
39738
39739 static inline uint64_t CResult_BlindedPathDecodeErrorZ_clone_ptr(LDKCResult_BlindedPathDecodeErrorZ *NONNULL_PTR arg) {
39740         LDKCResult_BlindedPathDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathDecodeErrorZ), "LDKCResult_BlindedPathDecodeErrorZ");
39741         *ret_conv = CResult_BlindedPathDecodeErrorZ_clone(arg);
39742         return tag_ptr(ret_conv, true);
39743 }
39744 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPathDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
39745         LDKCResult_BlindedPathDecodeErrorZ* arg_conv = (LDKCResult_BlindedPathDecodeErrorZ*)untag_ptr(arg);
39746         int64_t ret_conv = CResult_BlindedPathDecodeErrorZ_clone_ptr(arg_conv);
39747         return ret_conv;
39748 }
39749
39750 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedPathDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
39751         LDKCResult_BlindedPathDecodeErrorZ* orig_conv = (LDKCResult_BlindedPathDecodeErrorZ*)untag_ptr(orig);
39752         LDKCResult_BlindedPathDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathDecodeErrorZ), "LDKCResult_BlindedPathDecodeErrorZ");
39753         *ret_conv = CResult_BlindedPathDecodeErrorZ_clone(orig_conv);
39754         return tag_ptr(ret_conv, true);
39755 }
39756
39757 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedHopDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
39758         LDKBlindedHop o_conv;
39759         o_conv.inner = untag_ptr(o);
39760         o_conv.is_owned = ptr_is_owned(o);
39761         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
39762         o_conv = BlindedHop_clone(&o_conv);
39763         LDKCResult_BlindedHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopDecodeErrorZ), "LDKCResult_BlindedHopDecodeErrorZ");
39764         *ret_conv = CResult_BlindedHopDecodeErrorZ_ok(o_conv);
39765         return tag_ptr(ret_conv, true);
39766 }
39767
39768 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedHopDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
39769         void* e_ptr = untag_ptr(e);
39770         CHECK_ACCESS(e_ptr);
39771         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
39772         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
39773         LDKCResult_BlindedHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopDecodeErrorZ), "LDKCResult_BlindedHopDecodeErrorZ");
39774         *ret_conv = CResult_BlindedHopDecodeErrorZ_err(e_conv);
39775         return tag_ptr(ret_conv, true);
39776 }
39777
39778 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedHopDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
39779         LDKCResult_BlindedHopDecodeErrorZ* o_conv = (LDKCResult_BlindedHopDecodeErrorZ*)untag_ptr(o);
39780         jboolean ret_conv = CResult_BlindedHopDecodeErrorZ_is_ok(o_conv);
39781         return ret_conv;
39782 }
39783
39784 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedHopDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
39785         if (!ptr_is_owned(_res)) return;
39786         void* _res_ptr = untag_ptr(_res);
39787         CHECK_ACCESS(_res_ptr);
39788         LDKCResult_BlindedHopDecodeErrorZ _res_conv = *(LDKCResult_BlindedHopDecodeErrorZ*)(_res_ptr);
39789         FREE(untag_ptr(_res));
39790         CResult_BlindedHopDecodeErrorZ_free(_res_conv);
39791 }
39792
39793 static inline uint64_t CResult_BlindedHopDecodeErrorZ_clone_ptr(LDKCResult_BlindedHopDecodeErrorZ *NONNULL_PTR arg) {
39794         LDKCResult_BlindedHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopDecodeErrorZ), "LDKCResult_BlindedHopDecodeErrorZ");
39795         *ret_conv = CResult_BlindedHopDecodeErrorZ_clone(arg);
39796         return tag_ptr(ret_conv, true);
39797 }
39798 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedHopDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
39799         LDKCResult_BlindedHopDecodeErrorZ* arg_conv = (LDKCResult_BlindedHopDecodeErrorZ*)untag_ptr(arg);
39800         int64_t ret_conv = CResult_BlindedHopDecodeErrorZ_clone_ptr(arg_conv);
39801         return ret_conv;
39802 }
39803
39804 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BlindedHopDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
39805         LDKCResult_BlindedHopDecodeErrorZ* orig_conv = (LDKCResult_BlindedHopDecodeErrorZ*)untag_ptr(orig);
39806         LDKCResult_BlindedHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopDecodeErrorZ), "LDKCResult_BlindedHopDecodeErrorZ");
39807         *ret_conv = CResult_BlindedHopDecodeErrorZ_clone(orig_conv);
39808         return tag_ptr(ret_conv, true);
39809 }
39810
39811 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceErrorDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
39812         LDKInvoiceError o_conv;
39813         o_conv.inner = untag_ptr(o);
39814         o_conv.is_owned = ptr_is_owned(o);
39815         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
39816         o_conv = InvoiceError_clone(&o_conv);
39817         LDKCResult_InvoiceErrorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceErrorDecodeErrorZ), "LDKCResult_InvoiceErrorDecodeErrorZ");
39818         *ret_conv = CResult_InvoiceErrorDecodeErrorZ_ok(o_conv);
39819         return tag_ptr(ret_conv, true);
39820 }
39821
39822 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceErrorDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
39823         void* e_ptr = untag_ptr(e);
39824         CHECK_ACCESS(e_ptr);
39825         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
39826         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
39827         LDKCResult_InvoiceErrorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceErrorDecodeErrorZ), "LDKCResult_InvoiceErrorDecodeErrorZ");
39828         *ret_conv = CResult_InvoiceErrorDecodeErrorZ_err(e_conv);
39829         return tag_ptr(ret_conv, true);
39830 }
39831
39832 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceErrorDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
39833         LDKCResult_InvoiceErrorDecodeErrorZ* o_conv = (LDKCResult_InvoiceErrorDecodeErrorZ*)untag_ptr(o);
39834         jboolean ret_conv = CResult_InvoiceErrorDecodeErrorZ_is_ok(o_conv);
39835         return ret_conv;
39836 }
39837
39838 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceErrorDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
39839         if (!ptr_is_owned(_res)) return;
39840         void* _res_ptr = untag_ptr(_res);
39841         CHECK_ACCESS(_res_ptr);
39842         LDKCResult_InvoiceErrorDecodeErrorZ _res_conv = *(LDKCResult_InvoiceErrorDecodeErrorZ*)(_res_ptr);
39843         FREE(untag_ptr(_res));
39844         CResult_InvoiceErrorDecodeErrorZ_free(_res_conv);
39845 }
39846
39847 static inline uint64_t CResult_InvoiceErrorDecodeErrorZ_clone_ptr(LDKCResult_InvoiceErrorDecodeErrorZ *NONNULL_PTR arg) {
39848         LDKCResult_InvoiceErrorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceErrorDecodeErrorZ), "LDKCResult_InvoiceErrorDecodeErrorZ");
39849         *ret_conv = CResult_InvoiceErrorDecodeErrorZ_clone(arg);
39850         return tag_ptr(ret_conv, true);
39851 }
39852 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceErrorDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
39853         LDKCResult_InvoiceErrorDecodeErrorZ* arg_conv = (LDKCResult_InvoiceErrorDecodeErrorZ*)untag_ptr(arg);
39854         int64_t ret_conv = CResult_InvoiceErrorDecodeErrorZ_clone_ptr(arg_conv);
39855         return ret_conv;
39856 }
39857
39858 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceErrorDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
39859         LDKCResult_InvoiceErrorDecodeErrorZ* orig_conv = (LDKCResult_InvoiceErrorDecodeErrorZ*)untag_ptr(orig);
39860         LDKCResult_InvoiceErrorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceErrorDecodeErrorZ), "LDKCResult_InvoiceErrorDecodeErrorZ");
39861         *ret_conv = CResult_InvoiceErrorDecodeErrorZ_clone(orig_conv);
39862         return tag_ptr(ret_conv, true);
39863 }
39864
39865 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TrackedSpendableOutputDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
39866         LDKTrackedSpendableOutput o_conv;
39867         o_conv.inner = untag_ptr(o);
39868         o_conv.is_owned = ptr_is_owned(o);
39869         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
39870         o_conv = TrackedSpendableOutput_clone(&o_conv);
39871         LDKCResult_TrackedSpendableOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TrackedSpendableOutputDecodeErrorZ), "LDKCResult_TrackedSpendableOutputDecodeErrorZ");
39872         *ret_conv = CResult_TrackedSpendableOutputDecodeErrorZ_ok(o_conv);
39873         return tag_ptr(ret_conv, true);
39874 }
39875
39876 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TrackedSpendableOutputDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
39877         void* e_ptr = untag_ptr(e);
39878         CHECK_ACCESS(e_ptr);
39879         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
39880         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
39881         LDKCResult_TrackedSpendableOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TrackedSpendableOutputDecodeErrorZ), "LDKCResult_TrackedSpendableOutputDecodeErrorZ");
39882         *ret_conv = CResult_TrackedSpendableOutputDecodeErrorZ_err(e_conv);
39883         return tag_ptr(ret_conv, true);
39884 }
39885
39886 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1TrackedSpendableOutputDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
39887         LDKCResult_TrackedSpendableOutputDecodeErrorZ* o_conv = (LDKCResult_TrackedSpendableOutputDecodeErrorZ*)untag_ptr(o);
39888         jboolean ret_conv = CResult_TrackedSpendableOutputDecodeErrorZ_is_ok(o_conv);
39889         return ret_conv;
39890 }
39891
39892 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TrackedSpendableOutputDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
39893         if (!ptr_is_owned(_res)) return;
39894         void* _res_ptr = untag_ptr(_res);
39895         CHECK_ACCESS(_res_ptr);
39896         LDKCResult_TrackedSpendableOutputDecodeErrorZ _res_conv = *(LDKCResult_TrackedSpendableOutputDecodeErrorZ*)(_res_ptr);
39897         FREE(untag_ptr(_res));
39898         CResult_TrackedSpendableOutputDecodeErrorZ_free(_res_conv);
39899 }
39900
39901 static inline uint64_t CResult_TrackedSpendableOutputDecodeErrorZ_clone_ptr(LDKCResult_TrackedSpendableOutputDecodeErrorZ *NONNULL_PTR arg) {
39902         LDKCResult_TrackedSpendableOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TrackedSpendableOutputDecodeErrorZ), "LDKCResult_TrackedSpendableOutputDecodeErrorZ");
39903         *ret_conv = CResult_TrackedSpendableOutputDecodeErrorZ_clone(arg);
39904         return tag_ptr(ret_conv, true);
39905 }
39906 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TrackedSpendableOutputDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
39907         LDKCResult_TrackedSpendableOutputDecodeErrorZ* arg_conv = (LDKCResult_TrackedSpendableOutputDecodeErrorZ*)untag_ptr(arg);
39908         int64_t ret_conv = CResult_TrackedSpendableOutputDecodeErrorZ_clone_ptr(arg_conv);
39909         return ret_conv;
39910 }
39911
39912 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TrackedSpendableOutputDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
39913         LDKCResult_TrackedSpendableOutputDecodeErrorZ* orig_conv = (LDKCResult_TrackedSpendableOutputDecodeErrorZ*)untag_ptr(orig);
39914         LDKCResult_TrackedSpendableOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TrackedSpendableOutputDecodeErrorZ), "LDKCResult_TrackedSpendableOutputDecodeErrorZ");
39915         *ret_conv = CResult_TrackedSpendableOutputDecodeErrorZ_clone(orig_conv);
39916         return tag_ptr(ret_conv, true);
39917 }
39918
39919 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OutputSpendStatusDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
39920         void* o_ptr = untag_ptr(o);
39921         CHECK_ACCESS(o_ptr);
39922         LDKOutputSpendStatus o_conv = *(LDKOutputSpendStatus*)(o_ptr);
39923         o_conv = OutputSpendStatus_clone((LDKOutputSpendStatus*)untag_ptr(o));
39924         LDKCResult_OutputSpendStatusDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutputSpendStatusDecodeErrorZ), "LDKCResult_OutputSpendStatusDecodeErrorZ");
39925         *ret_conv = CResult_OutputSpendStatusDecodeErrorZ_ok(o_conv);
39926         return tag_ptr(ret_conv, true);
39927 }
39928
39929 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OutputSpendStatusDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
39930         void* e_ptr = untag_ptr(e);
39931         CHECK_ACCESS(e_ptr);
39932         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
39933         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
39934         LDKCResult_OutputSpendStatusDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutputSpendStatusDecodeErrorZ), "LDKCResult_OutputSpendStatusDecodeErrorZ");
39935         *ret_conv = CResult_OutputSpendStatusDecodeErrorZ_err(e_conv);
39936         return tag_ptr(ret_conv, true);
39937 }
39938
39939 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1OutputSpendStatusDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
39940         LDKCResult_OutputSpendStatusDecodeErrorZ* o_conv = (LDKCResult_OutputSpendStatusDecodeErrorZ*)untag_ptr(o);
39941         jboolean ret_conv = CResult_OutputSpendStatusDecodeErrorZ_is_ok(o_conv);
39942         return ret_conv;
39943 }
39944
39945 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1OutputSpendStatusDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
39946         if (!ptr_is_owned(_res)) return;
39947         void* _res_ptr = untag_ptr(_res);
39948         CHECK_ACCESS(_res_ptr);
39949         LDKCResult_OutputSpendStatusDecodeErrorZ _res_conv = *(LDKCResult_OutputSpendStatusDecodeErrorZ*)(_res_ptr);
39950         FREE(untag_ptr(_res));
39951         CResult_OutputSpendStatusDecodeErrorZ_free(_res_conv);
39952 }
39953
39954 static inline uint64_t CResult_OutputSpendStatusDecodeErrorZ_clone_ptr(LDKCResult_OutputSpendStatusDecodeErrorZ *NONNULL_PTR arg) {
39955         LDKCResult_OutputSpendStatusDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutputSpendStatusDecodeErrorZ), "LDKCResult_OutputSpendStatusDecodeErrorZ");
39956         *ret_conv = CResult_OutputSpendStatusDecodeErrorZ_clone(arg);
39957         return tag_ptr(ret_conv, true);
39958 }
39959 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OutputSpendStatusDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
39960         LDKCResult_OutputSpendStatusDecodeErrorZ* arg_conv = (LDKCResult_OutputSpendStatusDecodeErrorZ*)untag_ptr(arg);
39961         int64_t ret_conv = CResult_OutputSpendStatusDecodeErrorZ_clone_ptr(arg_conv);
39962         return ret_conv;
39963 }
39964
39965 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OutputSpendStatusDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
39966         LDKCResult_OutputSpendStatusDecodeErrorZ* orig_conv = (LDKCResult_OutputSpendStatusDecodeErrorZ*)untag_ptr(orig);
39967         LDKCResult_OutputSpendStatusDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutputSpendStatusDecodeErrorZ), "LDKCResult_OutputSpendStatusDecodeErrorZ");
39968         *ret_conv = CResult_OutputSpendStatusDecodeErrorZ_clone(orig_conv);
39969         return tag_ptr(ret_conv, true);
39970 }
39971
39972 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1FilterZ_1some(JNIEnv *env, jclass clz, int64_t o) {
39973         void* o_ptr = untag_ptr(o);
39974         CHECK_ACCESS(o_ptr);
39975         LDKFilter o_conv = *(LDKFilter*)(o_ptr);
39976         if (o_conv.free == LDKFilter_JCalls_free) {
39977                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
39978                 LDKFilter_JCalls_cloned(&o_conv);
39979         }
39980         LDKCOption_FilterZ *ret_copy = MALLOC(sizeof(LDKCOption_FilterZ), "LDKCOption_FilterZ");
39981         *ret_copy = COption_FilterZ_some(o_conv);
39982         int64_t ret_ref = tag_ptr(ret_copy, true);
39983         return ret_ref;
39984 }
39985
39986 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1FilterZ_1none(JNIEnv *env, jclass clz) {
39987         LDKCOption_FilterZ *ret_copy = MALLOC(sizeof(LDKCOption_FilterZ), "LDKCOption_FilterZ");
39988         *ret_copy = COption_FilterZ_none();
39989         int64_t ret_ref = tag_ptr(ret_copy, true);
39990         return ret_ref;
39991 }
39992
39993 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1FilterZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
39994         if (!ptr_is_owned(_res)) return;
39995         void* _res_ptr = untag_ptr(_res);
39996         CHECK_ACCESS(_res_ptr);
39997         LDKCOption_FilterZ _res_conv = *(LDKCOption_FilterZ*)(_res_ptr);
39998         FREE(untag_ptr(_res));
39999         COption_FilterZ_free(_res_conv);
40000 }
40001
40002 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1TrackedSpendableOutputZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
40003         LDKCVec_TrackedSpendableOutputZ _res_constr;
40004         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
40005         if (_res_constr.datalen > 0)
40006                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKTrackedSpendableOutput), "LDKCVec_TrackedSpendableOutputZ Elements");
40007         else
40008                 _res_constr.data = NULL;
40009         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
40010         for (size_t y = 0; y < _res_constr.datalen; y++) {
40011                 int64_t _res_conv_24 = _res_vals[y];
40012                 LDKTrackedSpendableOutput _res_conv_24_conv;
40013                 _res_conv_24_conv.inner = untag_ptr(_res_conv_24);
40014                 _res_conv_24_conv.is_owned = ptr_is_owned(_res_conv_24);
40015                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_24_conv);
40016                 _res_constr.data[y] = _res_conv_24_conv;
40017         }
40018         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
40019         CVec_TrackedSpendableOutputZ_free(_res_constr);
40020 }
40021
40022 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OutputSweeperDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
40023         LDKOutputSweeper o_conv;
40024         o_conv.inner = untag_ptr(o);
40025         o_conv.is_owned = ptr_is_owned(o);
40026         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
40027         // WARNING: we need a move here but no clone is available for LDKOutputSweeper
40028         
40029         LDKCResult_OutputSweeperDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutputSweeperDecodeErrorZ), "LDKCResult_OutputSweeperDecodeErrorZ");
40030         *ret_conv = CResult_OutputSweeperDecodeErrorZ_ok(o_conv);
40031         return tag_ptr(ret_conv, true);
40032 }
40033
40034 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OutputSweeperDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
40035         void* e_ptr = untag_ptr(e);
40036         CHECK_ACCESS(e_ptr);
40037         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
40038         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
40039         LDKCResult_OutputSweeperDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutputSweeperDecodeErrorZ), "LDKCResult_OutputSweeperDecodeErrorZ");
40040         *ret_conv = CResult_OutputSweeperDecodeErrorZ_err(e_conv);
40041         return tag_ptr(ret_conv, true);
40042 }
40043
40044 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1OutputSweeperDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
40045         LDKCResult_OutputSweeperDecodeErrorZ* o_conv = (LDKCResult_OutputSweeperDecodeErrorZ*)untag_ptr(o);
40046         jboolean ret_conv = CResult_OutputSweeperDecodeErrorZ_is_ok(o_conv);
40047         return ret_conv;
40048 }
40049
40050 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1OutputSweeperDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
40051         if (!ptr_is_owned(_res)) return;
40052         void* _res_ptr = untag_ptr(_res);
40053         CHECK_ACCESS(_res_ptr);
40054         LDKCResult_OutputSweeperDecodeErrorZ _res_conv = *(LDKCResult_OutputSweeperDecodeErrorZ*)(_res_ptr);
40055         FREE(untag_ptr(_res));
40056         CResult_OutputSweeperDecodeErrorZ_free(_res_conv);
40057 }
40058
40059 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BestBlockOutputSweeperZ_1new(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
40060         LDKBestBlock a_conv;
40061         a_conv.inner = untag_ptr(a);
40062         a_conv.is_owned = ptr_is_owned(a);
40063         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
40064         a_conv = BestBlock_clone(&a_conv);
40065         LDKOutputSweeper b_conv;
40066         b_conv.inner = untag_ptr(b);
40067         b_conv.is_owned = ptr_is_owned(b);
40068         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
40069         // WARNING: we need a move here but no clone is available for LDKOutputSweeper
40070         
40071         LDKC2Tuple_BestBlockOutputSweeperZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_BestBlockOutputSweeperZ), "LDKC2Tuple_BestBlockOutputSweeperZ");
40072         *ret_conv = C2Tuple_BestBlockOutputSweeperZ_new(a_conv, b_conv);
40073         return tag_ptr(ret_conv, true);
40074 }
40075
40076 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BestBlockOutputSweeperZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
40077         if (!ptr_is_owned(_res)) return;
40078         void* _res_ptr = untag_ptr(_res);
40079         CHECK_ACCESS(_res_ptr);
40080         LDKC2Tuple_BestBlockOutputSweeperZ _res_conv = *(LDKC2Tuple_BestBlockOutputSweeperZ*)(_res_ptr);
40081         FREE(untag_ptr(_res));
40082         C2Tuple_BestBlockOutputSweeperZ_free(_res_conv);
40083 }
40084
40085 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BestBlockOutputSweeperZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
40086         void* o_ptr = untag_ptr(o);
40087         CHECK_ACCESS(o_ptr);
40088         LDKC2Tuple_BestBlockOutputSweeperZ o_conv = *(LDKC2Tuple_BestBlockOutputSweeperZ*)(o_ptr);
40089         // WARNING: we may need a move here but no clone is available for LDKC2Tuple_BestBlockOutputSweeperZ
40090         LDKCResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ), "LDKCResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ");
40091         *ret_conv = CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ_ok(o_conv);
40092         return tag_ptr(ret_conv, true);
40093 }
40094
40095 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BestBlockOutputSweeperZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
40096         void* e_ptr = untag_ptr(e);
40097         CHECK_ACCESS(e_ptr);
40098         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
40099         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
40100         LDKCResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ), "LDKCResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ");
40101         *ret_conv = CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ_err(e_conv);
40102         return tag_ptr(ret_conv, true);
40103 }
40104
40105 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BestBlockOutputSweeperZDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
40106         LDKCResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ* o_conv = (LDKCResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ*)untag_ptr(o);
40107         jboolean ret_conv = CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ_is_ok(o_conv);
40108         return ret_conv;
40109 }
40110
40111 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BestBlockOutputSweeperZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
40112         if (!ptr_is_owned(_res)) return;
40113         void* _res_ptr = untag_ptr(_res);
40114         CHECK_ACCESS(_res_ptr);
40115         LDKCResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ _res_conv = *(LDKCResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ*)(_res_ptr);
40116         FREE(untag_ptr(_res));
40117         CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ_free(_res_conv);
40118 }
40119
40120 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentBasepointDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
40121         LDKDelayedPaymentBasepoint o_conv;
40122         o_conv.inner = untag_ptr(o);
40123         o_conv.is_owned = ptr_is_owned(o);
40124         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
40125         o_conv = DelayedPaymentBasepoint_clone(&o_conv);
40126         LDKCResult_DelayedPaymentBasepointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentBasepointDecodeErrorZ), "LDKCResult_DelayedPaymentBasepointDecodeErrorZ");
40127         *ret_conv = CResult_DelayedPaymentBasepointDecodeErrorZ_ok(o_conv);
40128         return tag_ptr(ret_conv, true);
40129 }
40130
40131 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentBasepointDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
40132         void* e_ptr = untag_ptr(e);
40133         CHECK_ACCESS(e_ptr);
40134         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
40135         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
40136         LDKCResult_DelayedPaymentBasepointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentBasepointDecodeErrorZ), "LDKCResult_DelayedPaymentBasepointDecodeErrorZ");
40137         *ret_conv = CResult_DelayedPaymentBasepointDecodeErrorZ_err(e_conv);
40138         return tag_ptr(ret_conv, true);
40139 }
40140
40141 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentBasepointDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
40142         LDKCResult_DelayedPaymentBasepointDecodeErrorZ* o_conv = (LDKCResult_DelayedPaymentBasepointDecodeErrorZ*)untag_ptr(o);
40143         jboolean ret_conv = CResult_DelayedPaymentBasepointDecodeErrorZ_is_ok(o_conv);
40144         return ret_conv;
40145 }
40146
40147 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentBasepointDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
40148         if (!ptr_is_owned(_res)) return;
40149         void* _res_ptr = untag_ptr(_res);
40150         CHECK_ACCESS(_res_ptr);
40151         LDKCResult_DelayedPaymentBasepointDecodeErrorZ _res_conv = *(LDKCResult_DelayedPaymentBasepointDecodeErrorZ*)(_res_ptr);
40152         FREE(untag_ptr(_res));
40153         CResult_DelayedPaymentBasepointDecodeErrorZ_free(_res_conv);
40154 }
40155
40156 static inline uint64_t CResult_DelayedPaymentBasepointDecodeErrorZ_clone_ptr(LDKCResult_DelayedPaymentBasepointDecodeErrorZ *NONNULL_PTR arg) {
40157         LDKCResult_DelayedPaymentBasepointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentBasepointDecodeErrorZ), "LDKCResult_DelayedPaymentBasepointDecodeErrorZ");
40158         *ret_conv = CResult_DelayedPaymentBasepointDecodeErrorZ_clone(arg);
40159         return tag_ptr(ret_conv, true);
40160 }
40161 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentBasepointDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
40162         LDKCResult_DelayedPaymentBasepointDecodeErrorZ* arg_conv = (LDKCResult_DelayedPaymentBasepointDecodeErrorZ*)untag_ptr(arg);
40163         int64_t ret_conv = CResult_DelayedPaymentBasepointDecodeErrorZ_clone_ptr(arg_conv);
40164         return ret_conv;
40165 }
40166
40167 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentBasepointDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
40168         LDKCResult_DelayedPaymentBasepointDecodeErrorZ* orig_conv = (LDKCResult_DelayedPaymentBasepointDecodeErrorZ*)untag_ptr(orig);
40169         LDKCResult_DelayedPaymentBasepointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentBasepointDecodeErrorZ), "LDKCResult_DelayedPaymentBasepointDecodeErrorZ");
40170         *ret_conv = CResult_DelayedPaymentBasepointDecodeErrorZ_clone(orig_conv);
40171         return tag_ptr(ret_conv, true);
40172 }
40173
40174 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentKeyDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
40175         LDKDelayedPaymentKey o_conv;
40176         o_conv.inner = untag_ptr(o);
40177         o_conv.is_owned = ptr_is_owned(o);
40178         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
40179         o_conv = DelayedPaymentKey_clone(&o_conv);
40180         LDKCResult_DelayedPaymentKeyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentKeyDecodeErrorZ), "LDKCResult_DelayedPaymentKeyDecodeErrorZ");
40181         *ret_conv = CResult_DelayedPaymentKeyDecodeErrorZ_ok(o_conv);
40182         return tag_ptr(ret_conv, true);
40183 }
40184
40185 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentKeyDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
40186         void* e_ptr = untag_ptr(e);
40187         CHECK_ACCESS(e_ptr);
40188         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
40189         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
40190         LDKCResult_DelayedPaymentKeyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentKeyDecodeErrorZ), "LDKCResult_DelayedPaymentKeyDecodeErrorZ");
40191         *ret_conv = CResult_DelayedPaymentKeyDecodeErrorZ_err(e_conv);
40192         return tag_ptr(ret_conv, true);
40193 }
40194
40195 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentKeyDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
40196         LDKCResult_DelayedPaymentKeyDecodeErrorZ* o_conv = (LDKCResult_DelayedPaymentKeyDecodeErrorZ*)untag_ptr(o);
40197         jboolean ret_conv = CResult_DelayedPaymentKeyDecodeErrorZ_is_ok(o_conv);
40198         return ret_conv;
40199 }
40200
40201 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentKeyDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
40202         if (!ptr_is_owned(_res)) return;
40203         void* _res_ptr = untag_ptr(_res);
40204         CHECK_ACCESS(_res_ptr);
40205         LDKCResult_DelayedPaymentKeyDecodeErrorZ _res_conv = *(LDKCResult_DelayedPaymentKeyDecodeErrorZ*)(_res_ptr);
40206         FREE(untag_ptr(_res));
40207         CResult_DelayedPaymentKeyDecodeErrorZ_free(_res_conv);
40208 }
40209
40210 static inline uint64_t CResult_DelayedPaymentKeyDecodeErrorZ_clone_ptr(LDKCResult_DelayedPaymentKeyDecodeErrorZ *NONNULL_PTR arg) {
40211         LDKCResult_DelayedPaymentKeyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentKeyDecodeErrorZ), "LDKCResult_DelayedPaymentKeyDecodeErrorZ");
40212         *ret_conv = CResult_DelayedPaymentKeyDecodeErrorZ_clone(arg);
40213         return tag_ptr(ret_conv, true);
40214 }
40215 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentKeyDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
40216         LDKCResult_DelayedPaymentKeyDecodeErrorZ* arg_conv = (LDKCResult_DelayedPaymentKeyDecodeErrorZ*)untag_ptr(arg);
40217         int64_t ret_conv = CResult_DelayedPaymentKeyDecodeErrorZ_clone_ptr(arg_conv);
40218         return ret_conv;
40219 }
40220
40221 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentKeyDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
40222         LDKCResult_DelayedPaymentKeyDecodeErrorZ* orig_conv = (LDKCResult_DelayedPaymentKeyDecodeErrorZ*)untag_ptr(orig);
40223         LDKCResult_DelayedPaymentKeyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentKeyDecodeErrorZ), "LDKCResult_DelayedPaymentKeyDecodeErrorZ");
40224         *ret_conv = CResult_DelayedPaymentKeyDecodeErrorZ_clone(orig_conv);
40225         return tag_ptr(ret_conv, true);
40226 }
40227
40228 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HtlcBasepointDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
40229         LDKHtlcBasepoint o_conv;
40230         o_conv.inner = untag_ptr(o);
40231         o_conv.is_owned = ptr_is_owned(o);
40232         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
40233         o_conv = HtlcBasepoint_clone(&o_conv);
40234         LDKCResult_HtlcBasepointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HtlcBasepointDecodeErrorZ), "LDKCResult_HtlcBasepointDecodeErrorZ");
40235         *ret_conv = CResult_HtlcBasepointDecodeErrorZ_ok(o_conv);
40236         return tag_ptr(ret_conv, true);
40237 }
40238
40239 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HtlcBasepointDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
40240         void* e_ptr = untag_ptr(e);
40241         CHECK_ACCESS(e_ptr);
40242         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
40243         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
40244         LDKCResult_HtlcBasepointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HtlcBasepointDecodeErrorZ), "LDKCResult_HtlcBasepointDecodeErrorZ");
40245         *ret_conv = CResult_HtlcBasepointDecodeErrorZ_err(e_conv);
40246         return tag_ptr(ret_conv, true);
40247 }
40248
40249 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1HtlcBasepointDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
40250         LDKCResult_HtlcBasepointDecodeErrorZ* o_conv = (LDKCResult_HtlcBasepointDecodeErrorZ*)untag_ptr(o);
40251         jboolean ret_conv = CResult_HtlcBasepointDecodeErrorZ_is_ok(o_conv);
40252         return ret_conv;
40253 }
40254
40255 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1HtlcBasepointDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
40256         if (!ptr_is_owned(_res)) return;
40257         void* _res_ptr = untag_ptr(_res);
40258         CHECK_ACCESS(_res_ptr);
40259         LDKCResult_HtlcBasepointDecodeErrorZ _res_conv = *(LDKCResult_HtlcBasepointDecodeErrorZ*)(_res_ptr);
40260         FREE(untag_ptr(_res));
40261         CResult_HtlcBasepointDecodeErrorZ_free(_res_conv);
40262 }
40263
40264 static inline uint64_t CResult_HtlcBasepointDecodeErrorZ_clone_ptr(LDKCResult_HtlcBasepointDecodeErrorZ *NONNULL_PTR arg) {
40265         LDKCResult_HtlcBasepointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HtlcBasepointDecodeErrorZ), "LDKCResult_HtlcBasepointDecodeErrorZ");
40266         *ret_conv = CResult_HtlcBasepointDecodeErrorZ_clone(arg);
40267         return tag_ptr(ret_conv, true);
40268 }
40269 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HtlcBasepointDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
40270         LDKCResult_HtlcBasepointDecodeErrorZ* arg_conv = (LDKCResult_HtlcBasepointDecodeErrorZ*)untag_ptr(arg);
40271         int64_t ret_conv = CResult_HtlcBasepointDecodeErrorZ_clone_ptr(arg_conv);
40272         return ret_conv;
40273 }
40274
40275 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HtlcBasepointDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
40276         LDKCResult_HtlcBasepointDecodeErrorZ* orig_conv = (LDKCResult_HtlcBasepointDecodeErrorZ*)untag_ptr(orig);
40277         LDKCResult_HtlcBasepointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HtlcBasepointDecodeErrorZ), "LDKCResult_HtlcBasepointDecodeErrorZ");
40278         *ret_conv = CResult_HtlcBasepointDecodeErrorZ_clone(orig_conv);
40279         return tag_ptr(ret_conv, true);
40280 }
40281
40282 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HtlcKeyDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
40283         LDKHtlcKey o_conv;
40284         o_conv.inner = untag_ptr(o);
40285         o_conv.is_owned = ptr_is_owned(o);
40286         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
40287         o_conv = HtlcKey_clone(&o_conv);
40288         LDKCResult_HtlcKeyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HtlcKeyDecodeErrorZ), "LDKCResult_HtlcKeyDecodeErrorZ");
40289         *ret_conv = CResult_HtlcKeyDecodeErrorZ_ok(o_conv);
40290         return tag_ptr(ret_conv, true);
40291 }
40292
40293 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HtlcKeyDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
40294         void* e_ptr = untag_ptr(e);
40295         CHECK_ACCESS(e_ptr);
40296         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
40297         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
40298         LDKCResult_HtlcKeyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HtlcKeyDecodeErrorZ), "LDKCResult_HtlcKeyDecodeErrorZ");
40299         *ret_conv = CResult_HtlcKeyDecodeErrorZ_err(e_conv);
40300         return tag_ptr(ret_conv, true);
40301 }
40302
40303 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1HtlcKeyDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
40304         LDKCResult_HtlcKeyDecodeErrorZ* o_conv = (LDKCResult_HtlcKeyDecodeErrorZ*)untag_ptr(o);
40305         jboolean ret_conv = CResult_HtlcKeyDecodeErrorZ_is_ok(o_conv);
40306         return ret_conv;
40307 }
40308
40309 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1HtlcKeyDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
40310         if (!ptr_is_owned(_res)) return;
40311         void* _res_ptr = untag_ptr(_res);
40312         CHECK_ACCESS(_res_ptr);
40313         LDKCResult_HtlcKeyDecodeErrorZ _res_conv = *(LDKCResult_HtlcKeyDecodeErrorZ*)(_res_ptr);
40314         FREE(untag_ptr(_res));
40315         CResult_HtlcKeyDecodeErrorZ_free(_res_conv);
40316 }
40317
40318 static inline uint64_t CResult_HtlcKeyDecodeErrorZ_clone_ptr(LDKCResult_HtlcKeyDecodeErrorZ *NONNULL_PTR arg) {
40319         LDKCResult_HtlcKeyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HtlcKeyDecodeErrorZ), "LDKCResult_HtlcKeyDecodeErrorZ");
40320         *ret_conv = CResult_HtlcKeyDecodeErrorZ_clone(arg);
40321         return tag_ptr(ret_conv, true);
40322 }
40323 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HtlcKeyDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
40324         LDKCResult_HtlcKeyDecodeErrorZ* arg_conv = (LDKCResult_HtlcKeyDecodeErrorZ*)untag_ptr(arg);
40325         int64_t ret_conv = CResult_HtlcKeyDecodeErrorZ_clone_ptr(arg_conv);
40326         return ret_conv;
40327 }
40328
40329 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HtlcKeyDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
40330         LDKCResult_HtlcKeyDecodeErrorZ* orig_conv = (LDKCResult_HtlcKeyDecodeErrorZ*)untag_ptr(orig);
40331         LDKCResult_HtlcKeyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HtlcKeyDecodeErrorZ), "LDKCResult_HtlcKeyDecodeErrorZ");
40332         *ret_conv = CResult_HtlcKeyDecodeErrorZ_clone(orig_conv);
40333         return tag_ptr(ret_conv, true);
40334 }
40335
40336 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevocationBasepointDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
40337         LDKRevocationBasepoint o_conv;
40338         o_conv.inner = untag_ptr(o);
40339         o_conv.is_owned = ptr_is_owned(o);
40340         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
40341         o_conv = RevocationBasepoint_clone(&o_conv);
40342         LDKCResult_RevocationBasepointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevocationBasepointDecodeErrorZ), "LDKCResult_RevocationBasepointDecodeErrorZ");
40343         *ret_conv = CResult_RevocationBasepointDecodeErrorZ_ok(o_conv);
40344         return tag_ptr(ret_conv, true);
40345 }
40346
40347 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevocationBasepointDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
40348         void* e_ptr = untag_ptr(e);
40349         CHECK_ACCESS(e_ptr);
40350         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
40351         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
40352         LDKCResult_RevocationBasepointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevocationBasepointDecodeErrorZ), "LDKCResult_RevocationBasepointDecodeErrorZ");
40353         *ret_conv = CResult_RevocationBasepointDecodeErrorZ_err(e_conv);
40354         return tag_ptr(ret_conv, true);
40355 }
40356
40357 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RevocationBasepointDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
40358         LDKCResult_RevocationBasepointDecodeErrorZ* o_conv = (LDKCResult_RevocationBasepointDecodeErrorZ*)untag_ptr(o);
40359         jboolean ret_conv = CResult_RevocationBasepointDecodeErrorZ_is_ok(o_conv);
40360         return ret_conv;
40361 }
40362
40363 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RevocationBasepointDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
40364         if (!ptr_is_owned(_res)) return;
40365         void* _res_ptr = untag_ptr(_res);
40366         CHECK_ACCESS(_res_ptr);
40367         LDKCResult_RevocationBasepointDecodeErrorZ _res_conv = *(LDKCResult_RevocationBasepointDecodeErrorZ*)(_res_ptr);
40368         FREE(untag_ptr(_res));
40369         CResult_RevocationBasepointDecodeErrorZ_free(_res_conv);
40370 }
40371
40372 static inline uint64_t CResult_RevocationBasepointDecodeErrorZ_clone_ptr(LDKCResult_RevocationBasepointDecodeErrorZ *NONNULL_PTR arg) {
40373         LDKCResult_RevocationBasepointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevocationBasepointDecodeErrorZ), "LDKCResult_RevocationBasepointDecodeErrorZ");
40374         *ret_conv = CResult_RevocationBasepointDecodeErrorZ_clone(arg);
40375         return tag_ptr(ret_conv, true);
40376 }
40377 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevocationBasepointDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
40378         LDKCResult_RevocationBasepointDecodeErrorZ* arg_conv = (LDKCResult_RevocationBasepointDecodeErrorZ*)untag_ptr(arg);
40379         int64_t ret_conv = CResult_RevocationBasepointDecodeErrorZ_clone_ptr(arg_conv);
40380         return ret_conv;
40381 }
40382
40383 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevocationBasepointDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
40384         LDKCResult_RevocationBasepointDecodeErrorZ* orig_conv = (LDKCResult_RevocationBasepointDecodeErrorZ*)untag_ptr(orig);
40385         LDKCResult_RevocationBasepointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevocationBasepointDecodeErrorZ), "LDKCResult_RevocationBasepointDecodeErrorZ");
40386         *ret_conv = CResult_RevocationBasepointDecodeErrorZ_clone(orig_conv);
40387         return tag_ptr(ret_conv, true);
40388 }
40389
40390 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevocationKeyDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
40391         LDKRevocationKey o_conv;
40392         o_conv.inner = untag_ptr(o);
40393         o_conv.is_owned = ptr_is_owned(o);
40394         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
40395         o_conv = RevocationKey_clone(&o_conv);
40396         LDKCResult_RevocationKeyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevocationKeyDecodeErrorZ), "LDKCResult_RevocationKeyDecodeErrorZ");
40397         *ret_conv = CResult_RevocationKeyDecodeErrorZ_ok(o_conv);
40398         return tag_ptr(ret_conv, true);
40399 }
40400
40401 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevocationKeyDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
40402         void* e_ptr = untag_ptr(e);
40403         CHECK_ACCESS(e_ptr);
40404         LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr);
40405         e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e));
40406         LDKCResult_RevocationKeyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevocationKeyDecodeErrorZ), "LDKCResult_RevocationKeyDecodeErrorZ");
40407         *ret_conv = CResult_RevocationKeyDecodeErrorZ_err(e_conv);
40408         return tag_ptr(ret_conv, true);
40409 }
40410
40411 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1RevocationKeyDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
40412         LDKCResult_RevocationKeyDecodeErrorZ* o_conv = (LDKCResult_RevocationKeyDecodeErrorZ*)untag_ptr(o);
40413         jboolean ret_conv = CResult_RevocationKeyDecodeErrorZ_is_ok(o_conv);
40414         return ret_conv;
40415 }
40416
40417 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RevocationKeyDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
40418         if (!ptr_is_owned(_res)) return;
40419         void* _res_ptr = untag_ptr(_res);
40420         CHECK_ACCESS(_res_ptr);
40421         LDKCResult_RevocationKeyDecodeErrorZ _res_conv = *(LDKCResult_RevocationKeyDecodeErrorZ*)(_res_ptr);
40422         FREE(untag_ptr(_res));
40423         CResult_RevocationKeyDecodeErrorZ_free(_res_conv);
40424 }
40425
40426 static inline uint64_t CResult_RevocationKeyDecodeErrorZ_clone_ptr(LDKCResult_RevocationKeyDecodeErrorZ *NONNULL_PTR arg) {
40427         LDKCResult_RevocationKeyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevocationKeyDecodeErrorZ), "LDKCResult_RevocationKeyDecodeErrorZ");
40428         *ret_conv = CResult_RevocationKeyDecodeErrorZ_clone(arg);
40429         return tag_ptr(ret_conv, true);
40430 }
40431 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevocationKeyDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
40432         LDKCResult_RevocationKeyDecodeErrorZ* arg_conv = (LDKCResult_RevocationKeyDecodeErrorZ*)untag_ptr(arg);
40433         int64_t ret_conv = CResult_RevocationKeyDecodeErrorZ_clone_ptr(arg_conv);
40434         return ret_conv;
40435 }
40436
40437 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevocationKeyDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
40438         LDKCResult_RevocationKeyDecodeErrorZ* orig_conv = (LDKCResult_RevocationKeyDecodeErrorZ*)untag_ptr(orig);
40439         LDKCResult_RevocationKeyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevocationKeyDecodeErrorZ), "LDKCResult_RevocationKeyDecodeErrorZ");
40440         *ret_conv = CResult_RevocationKeyDecodeErrorZ_clone(orig_conv);
40441         return tag_ptr(ret_conv, true);
40442 }
40443
40444 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1LockedChannelMonitorNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
40445         LDKLockedChannelMonitor o_conv;
40446         o_conv.inner = untag_ptr(o);
40447         o_conv.is_owned = ptr_is_owned(o);
40448         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
40449         // WARNING: we need a move here but no clone is available for LDKLockedChannelMonitor
40450         
40451         LDKCResult_LockedChannelMonitorNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_LockedChannelMonitorNoneZ), "LDKCResult_LockedChannelMonitorNoneZ");
40452         *ret_conv = CResult_LockedChannelMonitorNoneZ_ok(o_conv);
40453         return tag_ptr(ret_conv, true);
40454 }
40455
40456 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1LockedChannelMonitorNoneZ_1err(JNIEnv *env, jclass clz) {
40457         LDKCResult_LockedChannelMonitorNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_LockedChannelMonitorNoneZ), "LDKCResult_LockedChannelMonitorNoneZ");
40458         *ret_conv = CResult_LockedChannelMonitorNoneZ_err();
40459         return tag_ptr(ret_conv, true);
40460 }
40461
40462 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1LockedChannelMonitorNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) {
40463         LDKCResult_LockedChannelMonitorNoneZ* o_conv = (LDKCResult_LockedChannelMonitorNoneZ*)untag_ptr(o);
40464         jboolean ret_conv = CResult_LockedChannelMonitorNoneZ_is_ok(o_conv);
40465         return ret_conv;
40466 }
40467
40468 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1LockedChannelMonitorNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
40469         if (!ptr_is_owned(_res)) return;
40470         void* _res_ptr = untag_ptr(_res);
40471         CHECK_ACCESS(_res_ptr);
40472         LDKCResult_LockedChannelMonitorNoneZ _res_conv = *(LDKCResult_LockedChannelMonitorNoneZ*)(_res_ptr);
40473         FREE(untag_ptr(_res));
40474         CResult_LockedChannelMonitorNoneZ_free(_res_conv);
40475 }
40476
40477 static inline uint64_t C2Tuple_OutPointChannelIdZ_clone_ptr(LDKC2Tuple_OutPointChannelIdZ *NONNULL_PTR arg) {
40478         LDKC2Tuple_OutPointChannelIdZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointChannelIdZ), "LDKC2Tuple_OutPointChannelIdZ");
40479         *ret_conv = C2Tuple_OutPointChannelIdZ_clone(arg);
40480         return tag_ptr(ret_conv, true);
40481 }
40482 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointChannelIdZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
40483         LDKC2Tuple_OutPointChannelIdZ* arg_conv = (LDKC2Tuple_OutPointChannelIdZ*)untag_ptr(arg);
40484         int64_t ret_conv = C2Tuple_OutPointChannelIdZ_clone_ptr(arg_conv);
40485         return ret_conv;
40486 }
40487
40488 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointChannelIdZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
40489         LDKC2Tuple_OutPointChannelIdZ* orig_conv = (LDKC2Tuple_OutPointChannelIdZ*)untag_ptr(orig);
40490         LDKC2Tuple_OutPointChannelIdZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointChannelIdZ), "LDKC2Tuple_OutPointChannelIdZ");
40491         *ret_conv = C2Tuple_OutPointChannelIdZ_clone(orig_conv);
40492         return tag_ptr(ret_conv, true);
40493 }
40494
40495 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointChannelIdZ_1new(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
40496         LDKOutPoint a_conv;
40497         a_conv.inner = untag_ptr(a);
40498         a_conv.is_owned = ptr_is_owned(a);
40499         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
40500         a_conv = OutPoint_clone(&a_conv);
40501         LDKChannelId b_conv;
40502         b_conv.inner = untag_ptr(b);
40503         b_conv.is_owned = ptr_is_owned(b);
40504         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
40505         b_conv = ChannelId_clone(&b_conv);
40506         LDKC2Tuple_OutPointChannelIdZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointChannelIdZ), "LDKC2Tuple_OutPointChannelIdZ");
40507         *ret_conv = C2Tuple_OutPointChannelIdZ_new(a_conv, b_conv);
40508         return tag_ptr(ret_conv, true);
40509 }
40510
40511 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointChannelIdZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
40512         if (!ptr_is_owned(_res)) return;
40513         void* _res_ptr = untag_ptr(_res);
40514         CHECK_ACCESS(_res_ptr);
40515         LDKC2Tuple_OutPointChannelIdZ _res_conv = *(LDKC2Tuple_OutPointChannelIdZ*)(_res_ptr);
40516         FREE(untag_ptr(_res));
40517         C2Tuple_OutPointChannelIdZ_free(_res_conv);
40518 }
40519
40520 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1OutPointChannelIdZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
40521         LDKCVec_C2Tuple_OutPointChannelIdZZ _res_constr;
40522         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
40523         if (_res_constr.datalen > 0)
40524                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_OutPointChannelIdZ), "LDKCVec_C2Tuple_OutPointChannelIdZZ Elements");
40525         else
40526                 _res_constr.data = NULL;
40527         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
40528         for (size_t d = 0; d < _res_constr.datalen; d++) {
40529                 int64_t _res_conv_29 = _res_vals[d];
40530                 void* _res_conv_29_ptr = untag_ptr(_res_conv_29);
40531                 CHECK_ACCESS(_res_conv_29_ptr);
40532                 LDKC2Tuple_OutPointChannelIdZ _res_conv_29_conv = *(LDKC2Tuple_OutPointChannelIdZ*)(_res_conv_29_ptr);
40533                 FREE(untag_ptr(_res_conv_29));
40534                 _res_constr.data[d] = _res_conv_29_conv;
40535         }
40536         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
40537         CVec_C2Tuple_OutPointChannelIdZZ_free(_res_constr);
40538 }
40539
40540 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1MonitorUpdateIdZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
40541         LDKCVec_MonitorUpdateIdZ _res_constr;
40542         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
40543         if (_res_constr.datalen > 0)
40544                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKMonitorUpdateId), "LDKCVec_MonitorUpdateIdZ Elements");
40545         else
40546                 _res_constr.data = NULL;
40547         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
40548         for (size_t r = 0; r < _res_constr.datalen; r++) {
40549                 int64_t _res_conv_17 = _res_vals[r];
40550                 LDKMonitorUpdateId _res_conv_17_conv;
40551                 _res_conv_17_conv.inner = untag_ptr(_res_conv_17);
40552                 _res_conv_17_conv.is_owned = ptr_is_owned(_res_conv_17);
40553                 CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_17_conv);
40554                 _res_constr.data[r] = _res_conv_17_conv;
40555         }
40556         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
40557         CVec_MonitorUpdateIdZ_free(_res_constr);
40558 }
40559
40560 static inline uint64_t C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone_ptr(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ *NONNULL_PTR arg) {
40561         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ), "LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ");
40562         *ret_conv = C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone(arg);
40563         return tag_ptr(ret_conv, true);
40564 }
40565 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointCVec_1MonitorUpdateIdZZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
40566         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* arg_conv = (LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ*)untag_ptr(arg);
40567         int64_t ret_conv = C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone_ptr(arg_conv);
40568         return ret_conv;
40569 }
40570
40571 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointCVec_1MonitorUpdateIdZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
40572         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* orig_conv = (LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ*)untag_ptr(orig);
40573         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ), "LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ");
40574         *ret_conv = C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone(orig_conv);
40575         return tag_ptr(ret_conv, true);
40576 }
40577
40578 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointCVec_1MonitorUpdateIdZZ_1new(JNIEnv *env, jclass clz, int64_t a, int64_tArray b) {
40579         LDKOutPoint a_conv;
40580         a_conv.inner = untag_ptr(a);
40581         a_conv.is_owned = ptr_is_owned(a);
40582         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
40583         a_conv = OutPoint_clone(&a_conv);
40584         LDKCVec_MonitorUpdateIdZ b_constr;
40585         b_constr.datalen = (*env)->GetArrayLength(env, b);
40586         if (b_constr.datalen > 0)
40587                 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKMonitorUpdateId), "LDKCVec_MonitorUpdateIdZ Elements");
40588         else
40589                 b_constr.data = NULL;
40590         int64_t* b_vals = (*env)->GetLongArrayElements (env, b, NULL);
40591         for (size_t r = 0; r < b_constr.datalen; r++) {
40592                 int64_t b_conv_17 = b_vals[r];
40593                 LDKMonitorUpdateId b_conv_17_conv;
40594                 b_conv_17_conv.inner = untag_ptr(b_conv_17);
40595                 b_conv_17_conv.is_owned = ptr_is_owned(b_conv_17);
40596                 CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv_17_conv);
40597                 b_conv_17_conv = MonitorUpdateId_clone(&b_conv_17_conv);
40598                 b_constr.data[r] = b_conv_17_conv;
40599         }
40600         (*env)->ReleaseLongArrayElements(env, b, b_vals, 0);
40601         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ), "LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ");
40602         *ret_conv = C2Tuple_OutPointCVec_MonitorUpdateIdZZ_new(a_conv, b_constr);
40603         return tag_ptr(ret_conv, true);
40604 }
40605
40606 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointCVec_1MonitorUpdateIdZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
40607         if (!ptr_is_owned(_res)) return;
40608         void* _res_ptr = untag_ptr(_res);
40609         CHECK_ACCESS(_res_ptr);
40610         LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ _res_conv = *(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ*)(_res_ptr);
40611         FREE(untag_ptr(_res));
40612         C2Tuple_OutPointCVec_MonitorUpdateIdZZ_free(_res_conv);
40613 }
40614
40615 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1OutPointCVec_1MonitorUpdateIdZZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
40616         LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ _res_constr;
40617         _res_constr.datalen = (*env)->GetArrayLength(env, _res);
40618         if (_res_constr.datalen > 0)
40619                 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ), "LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ Elements");
40620         else
40621                 _res_constr.data = NULL;
40622         int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
40623         for (size_t p = 0; p < _res_constr.datalen; p++) {
40624                 int64_t _res_conv_41 = _res_vals[p];
40625                 void* _res_conv_41_ptr = untag_ptr(_res_conv_41);
40626                 CHECK_ACCESS(_res_conv_41_ptr);
40627                 LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ _res_conv_41_conv = *(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ*)(_res_conv_41_ptr);
40628                 FREE(untag_ptr(_res_conv_41));
40629                 _res_constr.data[p] = _res_conv_41_conv;
40630         }
40631         (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
40632         CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ_free(_res_constr);
40633 }
40634
40635 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_APIError_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
40636         if (!ptr_is_owned(this_ptr)) return;
40637         void* this_ptr_ptr = untag_ptr(this_ptr);
40638         CHECK_ACCESS(this_ptr_ptr);
40639         LDKAPIError this_ptr_conv = *(LDKAPIError*)(this_ptr_ptr);
40640         FREE(untag_ptr(this_ptr));
40641         APIError_free(this_ptr_conv);
40642 }
40643
40644 static inline uint64_t APIError_clone_ptr(LDKAPIError *NONNULL_PTR arg) {
40645         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
40646         *ret_copy = APIError_clone(arg);
40647         int64_t ret_ref = tag_ptr(ret_copy, true);
40648         return ret_ref;
40649 }
40650 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
40651         LDKAPIError* arg_conv = (LDKAPIError*)untag_ptr(arg);
40652         int64_t ret_conv = APIError_clone_ptr(arg_conv);
40653         return ret_conv;
40654 }
40655
40656 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
40657         LDKAPIError* orig_conv = (LDKAPIError*)untag_ptr(orig);
40658         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
40659         *ret_copy = APIError_clone(orig_conv);
40660         int64_t ret_ref = tag_ptr(ret_copy, true);
40661         return ret_ref;
40662 }
40663
40664 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1apimisuse_1error(JNIEnv *env, jclass clz, jstring err) {
40665         LDKStr err_conv = java_to_owned_str(env, err);
40666         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
40667         *ret_copy = APIError_apimisuse_error(err_conv);
40668         int64_t ret_ref = tag_ptr(ret_copy, true);
40669         return ret_ref;
40670 }
40671
40672 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1fee_1rate_1too_1high(JNIEnv *env, jclass clz, jstring err, int32_t feerate) {
40673         LDKStr err_conv = java_to_owned_str(env, err);
40674         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
40675         *ret_copy = APIError_fee_rate_too_high(err_conv, feerate);
40676         int64_t ret_ref = tag_ptr(ret_copy, true);
40677         return ret_ref;
40678 }
40679
40680 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1invalid_1route(JNIEnv *env, jclass clz, jstring err) {
40681         LDKStr err_conv = java_to_owned_str(env, err);
40682         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
40683         *ret_copy = APIError_invalid_route(err_conv);
40684         int64_t ret_ref = tag_ptr(ret_copy, true);
40685         return ret_ref;
40686 }
40687
40688 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1channel_1unavailable(JNIEnv *env, jclass clz, jstring err) {
40689         LDKStr err_conv = java_to_owned_str(env, err);
40690         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
40691         *ret_copy = APIError_channel_unavailable(err_conv);
40692         int64_t ret_ref = tag_ptr(ret_copy, true);
40693         return ret_ref;
40694 }
40695
40696 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1monitor_1update_1in_1progress(JNIEnv *env, jclass clz) {
40697         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
40698         *ret_copy = APIError_monitor_update_in_progress();
40699         int64_t ret_ref = tag_ptr(ret_copy, true);
40700         return ret_ref;
40701 }
40702
40703 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1incompatible_1shutdown_1script(JNIEnv *env, jclass clz, int64_t script) {
40704         LDKShutdownScript script_conv;
40705         script_conv.inner = untag_ptr(script);
40706         script_conv.is_owned = ptr_is_owned(script);
40707         CHECK_INNER_FIELD_ACCESS_OR_NULL(script_conv);
40708         script_conv = ShutdownScript_clone(&script_conv);
40709         LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
40710         *ret_copy = APIError_incompatible_shutdown_script(script_conv);
40711         int64_t ret_ref = tag_ptr(ret_copy, true);
40712         return ret_ref;
40713 }
40714
40715 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_APIError_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
40716         LDKAPIError* a_conv = (LDKAPIError*)untag_ptr(a);
40717         LDKAPIError* b_conv = (LDKAPIError*)untag_ptr(b);
40718         jboolean ret_conv = APIError_eq(a_conv, b_conv);
40719         return ret_conv;
40720 }
40721
40722 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_APIError_1write(JNIEnv *env, jclass clz, int64_t obj) {
40723         LDKAPIError* obj_conv = (LDKAPIError*)untag_ptr(obj);
40724         LDKCVec_u8Z ret_var = APIError_write(obj_conv);
40725         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
40726         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
40727         CVec_u8Z_free(ret_var);
40728         return ret_arr;
40729 }
40730
40731 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
40732         LDKu8slice ser_ref;
40733         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
40734         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
40735         LDKCResult_COption_APIErrorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_APIErrorZDecodeErrorZ), "LDKCResult_COption_APIErrorZDecodeErrorZ");
40736         *ret_conv = APIError_read(ser_ref);
40737         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
40738         return tag_ptr(ret_conv, true);
40739 }
40740
40741 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BigSize_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
40742         LDKBigSize this_obj_conv;
40743         this_obj_conv.inner = untag_ptr(this_obj);
40744         this_obj_conv.is_owned = ptr_is_owned(this_obj);
40745         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40746         BigSize_free(this_obj_conv);
40747 }
40748
40749 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BigSize_1get_1a(JNIEnv *env, jclass clz, int64_t this_ptr) {
40750         LDKBigSize this_ptr_conv;
40751         this_ptr_conv.inner = untag_ptr(this_ptr);
40752         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40753         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40754         this_ptr_conv.is_owned = false;
40755         int64_t ret_conv = BigSize_get_a(&this_ptr_conv);
40756         return ret_conv;
40757 }
40758
40759 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BigSize_1set_1a(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
40760         LDKBigSize this_ptr_conv;
40761         this_ptr_conv.inner = untag_ptr(this_ptr);
40762         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
40763         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
40764         this_ptr_conv.is_owned = false;
40765         BigSize_set_a(&this_ptr_conv, val);
40766 }
40767
40768 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BigSize_1new(JNIEnv *env, jclass clz, int64_t a_arg) {
40769         LDKBigSize ret_var = BigSize_new(a_arg);
40770         int64_t ret_ref = 0;
40771         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40772         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40773         return ret_ref;
40774 }
40775
40776 static inline uint64_t BigSize_clone_ptr(LDKBigSize *NONNULL_PTR arg) {
40777         LDKBigSize ret_var = BigSize_clone(arg);
40778         int64_t ret_ref = 0;
40779         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40780         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40781         return ret_ref;
40782 }
40783 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BigSize_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
40784         LDKBigSize arg_conv;
40785         arg_conv.inner = untag_ptr(arg);
40786         arg_conv.is_owned = ptr_is_owned(arg);
40787         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40788         arg_conv.is_owned = false;
40789         int64_t ret_conv = BigSize_clone_ptr(&arg_conv);
40790         return ret_conv;
40791 }
40792
40793 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BigSize_1clone(JNIEnv *env, jclass clz, int64_t orig) {
40794         LDKBigSize orig_conv;
40795         orig_conv.inner = untag_ptr(orig);
40796         orig_conv.is_owned = ptr_is_owned(orig);
40797         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40798         orig_conv.is_owned = false;
40799         LDKBigSize ret_var = BigSize_clone(&orig_conv);
40800         int64_t ret_ref = 0;
40801         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40802         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40803         return ret_ref;
40804 }
40805
40806 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BigSize_1hash(JNIEnv *env, jclass clz, int64_t o) {
40807         LDKBigSize o_conv;
40808         o_conv.inner = untag_ptr(o);
40809         o_conv.is_owned = ptr_is_owned(o);
40810         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
40811         o_conv.is_owned = false;
40812         int64_t ret_conv = BigSize_hash(&o_conv);
40813         return ret_conv;
40814 }
40815
40816 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_BigSize_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
40817         LDKBigSize a_conv;
40818         a_conv.inner = untag_ptr(a);
40819         a_conv.is_owned = ptr_is_owned(a);
40820         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
40821         a_conv.is_owned = false;
40822         LDKBigSize b_conv;
40823         b_conv.inner = untag_ptr(b);
40824         b_conv.is_owned = ptr_is_owned(b);
40825         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
40826         b_conv.is_owned = false;
40827         jboolean ret_conv = BigSize_eq(&a_conv, &b_conv);
40828         return ret_conv;
40829 }
40830
40831 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BigSize_1write(JNIEnv *env, jclass clz, int64_t obj) {
40832         LDKBigSize obj_conv;
40833         obj_conv.inner = untag_ptr(obj);
40834         obj_conv.is_owned = ptr_is_owned(obj);
40835         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
40836         obj_conv.is_owned = false;
40837         LDKCVec_u8Z ret_var = BigSize_write(&obj_conv);
40838         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
40839         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
40840         CVec_u8Z_free(ret_var);
40841         return ret_arr;
40842 }
40843
40844 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BigSize_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
40845         LDKu8slice ser_ref;
40846         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
40847         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
40848         LDKCResult_BigSizeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BigSizeDecodeErrorZ), "LDKCResult_BigSizeDecodeErrorZ");
40849         *ret_conv = BigSize_read(ser_ref);
40850         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
40851         return tag_ptr(ret_conv, true);
40852 }
40853
40854 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Hostname_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
40855         LDKHostname this_obj_conv;
40856         this_obj_conv.inner = untag_ptr(this_obj);
40857         this_obj_conv.is_owned = ptr_is_owned(this_obj);
40858         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40859         Hostname_free(this_obj_conv);
40860 }
40861
40862 static inline uint64_t Hostname_clone_ptr(LDKHostname *NONNULL_PTR arg) {
40863         LDKHostname ret_var = Hostname_clone(arg);
40864         int64_t ret_ref = 0;
40865         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40866         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40867         return ret_ref;
40868 }
40869 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Hostname_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
40870         LDKHostname arg_conv;
40871         arg_conv.inner = untag_ptr(arg);
40872         arg_conv.is_owned = ptr_is_owned(arg);
40873         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40874         arg_conv.is_owned = false;
40875         int64_t ret_conv = Hostname_clone_ptr(&arg_conv);
40876         return ret_conv;
40877 }
40878
40879 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Hostname_1clone(JNIEnv *env, jclass clz, int64_t orig) {
40880         LDKHostname orig_conv;
40881         orig_conv.inner = untag_ptr(orig);
40882         orig_conv.is_owned = ptr_is_owned(orig);
40883         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40884         orig_conv.is_owned = false;
40885         LDKHostname ret_var = Hostname_clone(&orig_conv);
40886         int64_t ret_ref = 0;
40887         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40888         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40889         return ret_ref;
40890 }
40891
40892 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Hostname_1hash(JNIEnv *env, jclass clz, int64_t o) {
40893         LDKHostname o_conv;
40894         o_conv.inner = untag_ptr(o);
40895         o_conv.is_owned = ptr_is_owned(o);
40896         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
40897         o_conv.is_owned = false;
40898         int64_t ret_conv = Hostname_hash(&o_conv);
40899         return ret_conv;
40900 }
40901
40902 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Hostname_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
40903         LDKHostname a_conv;
40904         a_conv.inner = untag_ptr(a);
40905         a_conv.is_owned = ptr_is_owned(a);
40906         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
40907         a_conv.is_owned = false;
40908         LDKHostname b_conv;
40909         b_conv.inner = untag_ptr(b);
40910         b_conv.is_owned = ptr_is_owned(b);
40911         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
40912         b_conv.is_owned = false;
40913         jboolean ret_conv = Hostname_eq(&a_conv, &b_conv);
40914         return ret_conv;
40915 }
40916
40917 JNIEXPORT int8_t JNICALL Java_org_ldk_impl_bindings_Hostname_1len(JNIEnv *env, jclass clz, int64_t this_arg) {
40918         LDKHostname this_arg_conv;
40919         this_arg_conv.inner = untag_ptr(this_arg);
40920         this_arg_conv.is_owned = ptr_is_owned(this_arg);
40921         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
40922         this_arg_conv.is_owned = false;
40923         int8_t ret_conv = Hostname_len(&this_arg_conv);
40924         return ret_conv;
40925 }
40926
40927 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Hostname_1write(JNIEnv *env, jclass clz, int64_t obj) {
40928         LDKHostname obj_conv;
40929         obj_conv.inner = untag_ptr(obj);
40930         obj_conv.is_owned = ptr_is_owned(obj);
40931         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
40932         obj_conv.is_owned = false;
40933         LDKCVec_u8Z ret_var = Hostname_write(&obj_conv);
40934         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
40935         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
40936         CVec_u8Z_free(ret_var);
40937         return ret_arr;
40938 }
40939
40940 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Hostname_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
40941         LDKu8slice ser_ref;
40942         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
40943         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
40944         LDKCResult_HostnameDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HostnameDecodeErrorZ), "LDKCResult_HostnameDecodeErrorZ");
40945         *ret_conv = Hostname_read(ser_ref);
40946         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
40947         return tag_ptr(ret_conv, true);
40948 }
40949
40950 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TransactionU16LenLimited_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
40951         LDKTransactionU16LenLimited this_obj_conv;
40952         this_obj_conv.inner = untag_ptr(this_obj);
40953         this_obj_conv.is_owned = ptr_is_owned(this_obj);
40954         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
40955         TransactionU16LenLimited_free(this_obj_conv);
40956 }
40957
40958 static inline uint64_t TransactionU16LenLimited_clone_ptr(LDKTransactionU16LenLimited *NONNULL_PTR arg) {
40959         LDKTransactionU16LenLimited ret_var = TransactionU16LenLimited_clone(arg);
40960         int64_t ret_ref = 0;
40961         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40962         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40963         return ret_ref;
40964 }
40965 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TransactionU16LenLimited_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
40966         LDKTransactionU16LenLimited arg_conv;
40967         arg_conv.inner = untag_ptr(arg);
40968         arg_conv.is_owned = ptr_is_owned(arg);
40969         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
40970         arg_conv.is_owned = false;
40971         int64_t ret_conv = TransactionU16LenLimited_clone_ptr(&arg_conv);
40972         return ret_conv;
40973 }
40974
40975 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TransactionU16LenLimited_1clone(JNIEnv *env, jclass clz, int64_t orig) {
40976         LDKTransactionU16LenLimited orig_conv;
40977         orig_conv.inner = untag_ptr(orig);
40978         orig_conv.is_owned = ptr_is_owned(orig);
40979         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
40980         orig_conv.is_owned = false;
40981         LDKTransactionU16LenLimited ret_var = TransactionU16LenLimited_clone(&orig_conv);
40982         int64_t ret_ref = 0;
40983         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
40984         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
40985         return ret_ref;
40986 }
40987
40988 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TransactionU16LenLimited_1hash(JNIEnv *env, jclass clz, int64_t o) {
40989         LDKTransactionU16LenLimited o_conv;
40990         o_conv.inner = untag_ptr(o);
40991         o_conv.is_owned = ptr_is_owned(o);
40992         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
40993         o_conv.is_owned = false;
40994         int64_t ret_conv = TransactionU16LenLimited_hash(&o_conv);
40995         return ret_conv;
40996 }
40997
40998 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_TransactionU16LenLimited_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
40999         LDKTransactionU16LenLimited a_conv;
41000         a_conv.inner = untag_ptr(a);
41001         a_conv.is_owned = ptr_is_owned(a);
41002         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
41003         a_conv.is_owned = false;
41004         LDKTransactionU16LenLimited b_conv;
41005         b_conv.inner = untag_ptr(b);
41006         b_conv.is_owned = ptr_is_owned(b);
41007         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
41008         b_conv.is_owned = false;
41009         jboolean ret_conv = TransactionU16LenLimited_eq(&a_conv, &b_conv);
41010         return ret_conv;
41011 }
41012
41013 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TransactionU16LenLimited_1new(JNIEnv *env, jclass clz, int8_tArray transaction) {
41014         LDKTransaction transaction_ref;
41015         transaction_ref.datalen = (*env)->GetArrayLength(env, transaction);
41016         transaction_ref.data = MALLOC(transaction_ref.datalen, "LDKTransaction Bytes");
41017         (*env)->GetByteArrayRegion(env, transaction, 0, transaction_ref.datalen, transaction_ref.data);
41018         transaction_ref.data_is_owned = true;
41019         LDKCResult_TransactionU16LenLimitedNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedNoneZ), "LDKCResult_TransactionU16LenLimitedNoneZ");
41020         *ret_conv = TransactionU16LenLimited_new(transaction_ref);
41021         return tag_ptr(ret_conv, true);
41022 }
41023
41024 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TransactionU16LenLimited_1into_1transaction(JNIEnv *env, jclass clz, int64_t this_arg) {
41025         LDKTransactionU16LenLimited this_arg_conv;
41026         this_arg_conv.inner = untag_ptr(this_arg);
41027         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41028         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41029         this_arg_conv = TransactionU16LenLimited_clone(&this_arg_conv);
41030         LDKTransaction ret_var = TransactionU16LenLimited_into_transaction(this_arg_conv);
41031         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
41032         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
41033         Transaction_free(ret_var);
41034         return ret_arr;
41035 }
41036
41037 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TransactionU16LenLimited_1as_1transaction(JNIEnv *env, jclass clz, int64_t this_arg) {
41038         LDKTransactionU16LenLimited this_arg_conv;
41039         this_arg_conv.inner = untag_ptr(this_arg);
41040         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41041         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41042         this_arg_conv.is_owned = false;
41043         LDKTransaction ret_var = TransactionU16LenLimited_as_transaction(&this_arg_conv);
41044         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
41045         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
41046         Transaction_free(ret_var);
41047         return ret_arr;
41048 }
41049
41050 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TransactionU16LenLimited_1write(JNIEnv *env, jclass clz, int64_t obj) {
41051         LDKTransactionU16LenLimited obj_conv;
41052         obj_conv.inner = untag_ptr(obj);
41053         obj_conv.is_owned = ptr_is_owned(obj);
41054         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
41055         obj_conv.is_owned = false;
41056         LDKCVec_u8Z ret_var = TransactionU16LenLimited_write(&obj_conv);
41057         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
41058         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
41059         CVec_u8Z_free(ret_var);
41060         return ret_arr;
41061 }
41062
41063 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TransactionU16LenLimited_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
41064         LDKu8slice ser_ref;
41065         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
41066         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
41067         LDKCResult_TransactionU16LenLimitedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionU16LenLimitedDecodeErrorZ), "LDKCResult_TransactionU16LenLimitedDecodeErrorZ");
41068         *ret_conv = TransactionU16LenLimited_read(ser_ref);
41069         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
41070         return tag_ptr(ret_conv, true);
41071 }
41072
41073 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_sign(JNIEnv *env, jclass clz, int8_tArray msg, int8_tArray sk) {
41074         LDKu8slice msg_ref;
41075         msg_ref.datalen = (*env)->GetArrayLength(env, msg);
41076         msg_ref.data = (*env)->GetByteArrayElements (env, msg, NULL);
41077         uint8_t sk_arr[32];
41078         CHECK((*env)->GetArrayLength(env, sk) == 32);
41079         (*env)->GetByteArrayRegion(env, sk, 0, 32, sk_arr);
41080         uint8_t (*sk_ref)[32] = &sk_arr;
41081         LDKCResult_StrSecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StrSecp256k1ErrorZ), "LDKCResult_StrSecp256k1ErrorZ");
41082         *ret_conv = sign(msg_ref, sk_ref);
41083         (*env)->ReleaseByteArrayElements(env, msg, (int8_t*)msg_ref.data, 0);
41084         return tag_ptr(ret_conv, true);
41085 }
41086
41087 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_recover_1pk(JNIEnv *env, jclass clz, int8_tArray msg, jstring sig) {
41088         LDKu8slice msg_ref;
41089         msg_ref.datalen = (*env)->GetArrayLength(env, msg);
41090         msg_ref.data = (*env)->GetByteArrayElements (env, msg, NULL);
41091         LDKStr sig_conv = java_to_owned_str(env, sig);
41092         LDKCResult_PublicKeySecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeySecp256k1ErrorZ), "LDKCResult_PublicKeySecp256k1ErrorZ");
41093         *ret_conv = recover_pk(msg_ref, sig_conv);
41094         (*env)->ReleaseByteArrayElements(env, msg, (int8_t*)msg_ref.data, 0);
41095         return tag_ptr(ret_conv, true);
41096 }
41097
41098 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_verify(JNIEnv *env, jclass clz, int8_tArray msg, jstring sig, int8_tArray pk) {
41099         LDKu8slice msg_ref;
41100         msg_ref.datalen = (*env)->GetArrayLength(env, msg);
41101         msg_ref.data = (*env)->GetByteArrayElements (env, msg, NULL);
41102         LDKStr sig_conv = java_to_owned_str(env, sig);
41103         LDKPublicKey pk_ref;
41104         CHECK((*env)->GetArrayLength(env, pk) == 33);
41105         (*env)->GetByteArrayRegion(env, pk, 0, 33, pk_ref.compressed_form);
41106         jboolean ret_conv = verify(msg_ref, sig_conv, pk_ref);
41107         (*env)->ReleaseByteArrayElements(env, msg, (int8_t*)msg_ref.data, 0);
41108         return ret_conv;
41109 }
41110
41111 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_construct_1invoice_1preimage(JNIEnv *env, jclass clz, int8_tArray hrp_bytes, jobjectArray data_without_signature) {
41112         LDKu8slice hrp_bytes_ref;
41113         hrp_bytes_ref.datalen = (*env)->GetArrayLength(env, hrp_bytes);
41114         hrp_bytes_ref.data = (*env)->GetByteArrayElements (env, hrp_bytes, NULL);
41115         LDKCVec_U5Z data_without_signature_constr;
41116         data_without_signature_constr.datalen = (*env)->GetArrayLength(env, data_without_signature);
41117         if (data_without_signature_constr.datalen > 0)
41118                 data_without_signature_constr.data = MALLOC(data_without_signature_constr.datalen * sizeof(LDKU5), "LDKCVec_U5Z Elements");
41119         else
41120                 data_without_signature_constr.data = NULL;
41121         int8_t* data_without_signature_vals = (*env)->GetByteArrayElements (env, data_without_signature, NULL);
41122         for (size_t h = 0; h < data_without_signature_constr.datalen; h++) {
41123                 int8_t data_without_signature_conv_7 = data_without_signature_vals[h];
41124                 
41125                 data_without_signature_constr.data[h] = (LDKU5){ ._0 = data_without_signature_conv_7 };
41126         }
41127         (*env)->ReleaseByteArrayElements(env, data_without_signature, data_without_signature_vals, 0);
41128         LDKCVec_u8Z ret_var = construct_invoice_preimage(hrp_bytes_ref, data_without_signature_constr);
41129         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
41130         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
41131         CVec_u8Z_free(ret_var);
41132         (*env)->ReleaseByteArrayElements(env, hrp_bytes, (int8_t*)hrp_bytes_ref.data, 0);
41133         return ret_arr;
41134 }
41135
41136 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_KVStore_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
41137         if (!ptr_is_owned(this_ptr)) return;
41138         void* this_ptr_ptr = untag_ptr(this_ptr);
41139         CHECK_ACCESS(this_ptr_ptr);
41140         LDKKVStore this_ptr_conv = *(LDKKVStore*)(this_ptr_ptr);
41141         FREE(untag_ptr(this_ptr));
41142         KVStore_free(this_ptr_conv);
41143 }
41144
41145 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Persister_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
41146         if (!ptr_is_owned(this_ptr)) return;
41147         void* this_ptr_ptr = untag_ptr(this_ptr);
41148         CHECK_ACCESS(this_ptr_ptr);
41149         LDKPersister this_ptr_conv = *(LDKPersister*)(this_ptr_ptr);
41150         FREE(untag_ptr(this_ptr));
41151         Persister_free(this_ptr_conv);
41152 }
41153
41154 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) {
41155         void* kv_store_ptr = untag_ptr(kv_store);
41156         CHECK_ACCESS(kv_store_ptr);
41157         LDKKVStore kv_store_conv = *(LDKKVStore*)(kv_store_ptr);
41158         if (kv_store_conv.free == LDKKVStore_JCalls_free) {
41159                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
41160                 LDKKVStore_JCalls_cloned(&kv_store_conv);
41161         }
41162         void* entropy_source_ptr = untag_ptr(entropy_source);
41163         CHECK_ACCESS(entropy_source_ptr);
41164         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
41165         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
41166                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
41167                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
41168         }
41169         void* signer_provider_ptr = untag_ptr(signer_provider);
41170         CHECK_ACCESS(signer_provider_ptr);
41171         LDKSignerProvider signer_provider_conv = *(LDKSignerProvider*)(signer_provider_ptr);
41172         if (signer_provider_conv.free == LDKSignerProvider_JCalls_free) {
41173                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
41174                 LDKSignerProvider_JCalls_cloned(&signer_provider_conv);
41175         }
41176         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ");
41177         *ret_conv = read_channel_monitors(kv_store_conv, entropy_source_conv, signer_provider_conv);
41178         return tag_ptr(ret_conv, true);
41179 }
41180
41181 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MonitorUpdatingPersister_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
41182         LDKMonitorUpdatingPersister this_obj_conv;
41183         this_obj_conv.inner = untag_ptr(this_obj);
41184         this_obj_conv.is_owned = ptr_is_owned(this_obj);
41185         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41186         MonitorUpdatingPersister_free(this_obj_conv);
41187 }
41188
41189 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) {
41190         void* kv_store_ptr = untag_ptr(kv_store);
41191         CHECK_ACCESS(kv_store_ptr);
41192         LDKKVStore kv_store_conv = *(LDKKVStore*)(kv_store_ptr);
41193         if (kv_store_conv.free == LDKKVStore_JCalls_free) {
41194                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
41195                 LDKKVStore_JCalls_cloned(&kv_store_conv);
41196         }
41197         void* logger_ptr = untag_ptr(logger);
41198         CHECK_ACCESS(logger_ptr);
41199         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
41200         if (logger_conv.free == LDKLogger_JCalls_free) {
41201                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
41202                 LDKLogger_JCalls_cloned(&logger_conv);
41203         }
41204         void* entropy_source_ptr = untag_ptr(entropy_source);
41205         CHECK_ACCESS(entropy_source_ptr);
41206         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
41207         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
41208                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
41209                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
41210         }
41211         void* signer_provider_ptr = untag_ptr(signer_provider);
41212         CHECK_ACCESS(signer_provider_ptr);
41213         LDKSignerProvider signer_provider_conv = *(LDKSignerProvider*)(signer_provider_ptr);
41214         if (signer_provider_conv.free == LDKSignerProvider_JCalls_free) {
41215                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
41216                 LDKSignerProvider_JCalls_cloned(&signer_provider_conv);
41217         }
41218         LDKMonitorUpdatingPersister ret_var = MonitorUpdatingPersister_new(kv_store_conv, logger_conv, maximum_pending_updates, entropy_source_conv, signer_provider_conv);
41219         int64_t ret_ref = 0;
41220         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41221         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41222         return ret_ref;
41223 }
41224
41225 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) {
41226         LDKMonitorUpdatingPersister this_arg_conv;
41227         this_arg_conv.inner = untag_ptr(this_arg);
41228         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41229         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41230         this_arg_conv.is_owned = false;
41231         void* broadcaster_ptr = untag_ptr(broadcaster);
41232         if (ptr_is_owned(broadcaster)) { CHECK_ACCESS(broadcaster_ptr); }
41233         LDKBroadcasterInterface* broadcaster_conv = (LDKBroadcasterInterface*)broadcaster_ptr;
41234         void* fee_estimator_ptr = untag_ptr(fee_estimator);
41235         if (ptr_is_owned(fee_estimator)) { CHECK_ACCESS(fee_estimator_ptr); }
41236         LDKFeeEstimator* fee_estimator_conv = (LDKFeeEstimator*)fee_estimator_ptr;
41237         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ");
41238         *ret_conv = MonitorUpdatingPersister_read_all_channel_monitors_with_updates(&this_arg_conv, broadcaster_conv, fee_estimator_conv);
41239         return tag_ptr(ret_conv, true);
41240 }
41241
41242 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) {
41243         LDKMonitorUpdatingPersister this_arg_conv;
41244         this_arg_conv.inner = untag_ptr(this_arg);
41245         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41246         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41247         this_arg_conv.is_owned = false;
41248         void* broadcaster_ptr = untag_ptr(broadcaster);
41249         if (ptr_is_owned(broadcaster)) { CHECK_ACCESS(broadcaster_ptr); }
41250         LDKBroadcasterInterface* broadcaster_conv = (LDKBroadcasterInterface*)broadcaster_ptr;
41251         void* fee_estimator_ptr = untag_ptr(fee_estimator);
41252         if (ptr_is_owned(fee_estimator)) { CHECK_ACCESS(fee_estimator_ptr); }
41253         LDKFeeEstimator* fee_estimator_conv = (LDKFeeEstimator*)fee_estimator_ptr;
41254         LDKStr monitor_key_conv = java_to_owned_str(env, monitor_key);
41255         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ");
41256         *ret_conv = MonitorUpdatingPersister_read_channel_monitor_with_updates(&this_arg_conv, broadcaster_conv, fee_estimator_conv, monitor_key_conv);
41257         return tag_ptr(ret_conv, true);
41258 }
41259
41260 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorUpdatingPersister_1cleanup_1stale_1updates(JNIEnv *env, jclass clz, int64_t this_arg, jboolean lazy) {
41261         LDKMonitorUpdatingPersister this_arg_conv;
41262         this_arg_conv.inner = untag_ptr(this_arg);
41263         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41264         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41265         this_arg_conv.is_owned = false;
41266         LDKCResult_NoneIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneIOErrorZ), "LDKCResult_NoneIOErrorZ");
41267         *ret_conv = MonitorUpdatingPersister_cleanup_stale_updates(&this_arg_conv, lazy);
41268         return tag_ptr(ret_conv, true);
41269 }
41270
41271 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorUpdatingPersister_1as_1Persist(JNIEnv *env, jclass clz, int64_t this_arg) {
41272         LDKMonitorUpdatingPersister this_arg_conv;
41273         this_arg_conv.inner = untag_ptr(this_arg);
41274         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41275         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41276         this_arg_conv.is_owned = false;
41277         LDKPersist* ret_ret = MALLOC(sizeof(LDKPersist), "LDKPersist");
41278         *ret_ret = MonitorUpdatingPersister_as_Persist(&this_arg_conv);
41279         return tag_ptr(ret_ret, true);
41280 }
41281
41282 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ShortChannelIdError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
41283         LDKShortChannelIdError* orig_conv = (LDKShortChannelIdError*)untag_ptr(orig);
41284         jclass ret_conv = LDKShortChannelIdError_to_java(env, ShortChannelIdError_clone(orig_conv));
41285         return ret_conv;
41286 }
41287
41288 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ShortChannelIdError_1block_1overflow(JNIEnv *env, jclass clz) {
41289         jclass ret_conv = LDKShortChannelIdError_to_java(env, ShortChannelIdError_block_overflow());
41290         return ret_conv;
41291 }
41292
41293 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ShortChannelIdError_1tx_1index_1overflow(JNIEnv *env, jclass clz) {
41294         jclass ret_conv = LDKShortChannelIdError_to_java(env, ShortChannelIdError_tx_index_overflow());
41295         return ret_conv;
41296 }
41297
41298 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ShortChannelIdError_1vout_1index_1overflow(JNIEnv *env, jclass clz) {
41299         jclass ret_conv = LDKShortChannelIdError_to_java(env, ShortChannelIdError_vout_index_overflow());
41300         return ret_conv;
41301 }
41302
41303 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ShortChannelIdError_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
41304         LDKShortChannelIdError* a_conv = (LDKShortChannelIdError*)untag_ptr(a);
41305         LDKShortChannelIdError* b_conv = (LDKShortChannelIdError*)untag_ptr(b);
41306         jboolean ret_conv = ShortChannelIdError_eq(a_conv, b_conv);
41307         return ret_conv;
41308 }
41309
41310 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_block_1from_1scid(JNIEnv *env, jclass clz, int64_t short_channel_id) {
41311         int32_t ret_conv = block_from_scid(short_channel_id);
41312         return ret_conv;
41313 }
41314
41315 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_tx_1index_1from_1scid(JNIEnv *env, jclass clz, int64_t short_channel_id) {
41316         int32_t ret_conv = tx_index_from_scid(short_channel_id);
41317         return ret_conv;
41318 }
41319
41320 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_vout_1from_1scid(JNIEnv *env, jclass clz, int64_t short_channel_id) {
41321         int16_t ret_conv = vout_from_scid(short_channel_id);
41322         return ret_conv;
41323 }
41324
41325 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_scid_1from_1parts(JNIEnv *env, jclass clz, int64_t block, int64_t tx_index, int64_t vout_index) {
41326         LDKCResult_u64ShortChannelIdErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_u64ShortChannelIdErrorZ), "LDKCResult_u64ShortChannelIdErrorZ");
41327         *ret_conv = scid_from_parts(block, tx_index, vout_index);
41328         return tag_ptr(ret_conv, true);
41329 }
41330
41331 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UntrustedString_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
41332         LDKUntrustedString this_obj_conv;
41333         this_obj_conv.inner = untag_ptr(this_obj);
41334         this_obj_conv.is_owned = ptr_is_owned(this_obj);
41335         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41336         UntrustedString_free(this_obj_conv);
41337 }
41338
41339 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_UntrustedString_1get_1a(JNIEnv *env, jclass clz, int64_t this_ptr) {
41340         LDKUntrustedString this_ptr_conv;
41341         this_ptr_conv.inner = untag_ptr(this_ptr);
41342         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41343         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41344         this_ptr_conv.is_owned = false;
41345         LDKStr ret_str = UntrustedString_get_a(&this_ptr_conv);
41346         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
41347         Str_free(ret_str);
41348         return ret_conv;
41349 }
41350
41351 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UntrustedString_1set_1a(JNIEnv *env, jclass clz, int64_t this_ptr, jstring val) {
41352         LDKUntrustedString this_ptr_conv;
41353         this_ptr_conv.inner = untag_ptr(this_ptr);
41354         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41355         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41356         this_ptr_conv.is_owned = false;
41357         LDKStr val_conv = java_to_owned_str(env, val);
41358         UntrustedString_set_a(&this_ptr_conv, val_conv);
41359 }
41360
41361 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UntrustedString_1new(JNIEnv *env, jclass clz, jstring a_arg) {
41362         LDKStr a_arg_conv = java_to_owned_str(env, a_arg);
41363         LDKUntrustedString ret_var = UntrustedString_new(a_arg_conv);
41364         int64_t ret_ref = 0;
41365         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41366         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41367         return ret_ref;
41368 }
41369
41370 static inline uint64_t UntrustedString_clone_ptr(LDKUntrustedString *NONNULL_PTR arg) {
41371         LDKUntrustedString ret_var = UntrustedString_clone(arg);
41372         int64_t ret_ref = 0;
41373         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41374         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41375         return ret_ref;
41376 }
41377 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UntrustedString_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
41378         LDKUntrustedString arg_conv;
41379         arg_conv.inner = untag_ptr(arg);
41380         arg_conv.is_owned = ptr_is_owned(arg);
41381         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
41382         arg_conv.is_owned = false;
41383         int64_t ret_conv = UntrustedString_clone_ptr(&arg_conv);
41384         return ret_conv;
41385 }
41386
41387 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UntrustedString_1clone(JNIEnv *env, jclass clz, int64_t orig) {
41388         LDKUntrustedString orig_conv;
41389         orig_conv.inner = untag_ptr(orig);
41390         orig_conv.is_owned = ptr_is_owned(orig);
41391         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
41392         orig_conv.is_owned = false;
41393         LDKUntrustedString ret_var = UntrustedString_clone(&orig_conv);
41394         int64_t ret_ref = 0;
41395         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41396         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41397         return ret_ref;
41398 }
41399
41400 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_UntrustedString_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
41401         LDKUntrustedString a_conv;
41402         a_conv.inner = untag_ptr(a);
41403         a_conv.is_owned = ptr_is_owned(a);
41404         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
41405         a_conv.is_owned = false;
41406         LDKUntrustedString b_conv;
41407         b_conv.inner = untag_ptr(b);
41408         b_conv.is_owned = ptr_is_owned(b);
41409         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
41410         b_conv.is_owned = false;
41411         jboolean ret_conv = UntrustedString_eq(&a_conv, &b_conv);
41412         return ret_conv;
41413 }
41414
41415 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UntrustedString_1hash(JNIEnv *env, jclass clz, int64_t o) {
41416         LDKUntrustedString o_conv;
41417         o_conv.inner = untag_ptr(o);
41418         o_conv.is_owned = ptr_is_owned(o);
41419         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
41420         o_conv.is_owned = false;
41421         int64_t ret_conv = UntrustedString_hash(&o_conv);
41422         return ret_conv;
41423 }
41424
41425 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UntrustedString_1write(JNIEnv *env, jclass clz, int64_t obj) {
41426         LDKUntrustedString obj_conv;
41427         obj_conv.inner = untag_ptr(obj);
41428         obj_conv.is_owned = ptr_is_owned(obj);
41429         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
41430         obj_conv.is_owned = false;
41431         LDKCVec_u8Z ret_var = UntrustedString_write(&obj_conv);
41432         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
41433         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
41434         CVec_u8Z_free(ret_var);
41435         return ret_arr;
41436 }
41437
41438 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UntrustedString_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
41439         LDKu8slice ser_ref;
41440         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
41441         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
41442         LDKCResult_UntrustedStringDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UntrustedStringDecodeErrorZ), "LDKCResult_UntrustedStringDecodeErrorZ");
41443         *ret_conv = UntrustedString_read(ser_ref);
41444         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
41445         return tag_ptr(ret_conv, true);
41446 }
41447
41448 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PrintableString_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
41449         LDKPrintableString this_obj_conv;
41450         this_obj_conv.inner = untag_ptr(this_obj);
41451         this_obj_conv.is_owned = ptr_is_owned(this_obj);
41452         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41453         PrintableString_free(this_obj_conv);
41454 }
41455
41456 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_PrintableString_1get_1a(JNIEnv *env, jclass clz, int64_t this_ptr) {
41457         LDKPrintableString this_ptr_conv;
41458         this_ptr_conv.inner = untag_ptr(this_ptr);
41459         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41460         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41461         this_ptr_conv.is_owned = false;
41462         LDKStr ret_str = PrintableString_get_a(&this_ptr_conv);
41463         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
41464         Str_free(ret_str);
41465         return ret_conv;
41466 }
41467
41468 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PrintableString_1set_1a(JNIEnv *env, jclass clz, int64_t this_ptr, jstring val) {
41469         LDKPrintableString this_ptr_conv;
41470         this_ptr_conv.inner = untag_ptr(this_ptr);
41471         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41472         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41473         this_ptr_conv.is_owned = false;
41474         LDKStr val_conv = java_to_owned_str(env, val);
41475         PrintableString_set_a(&this_ptr_conv, val_conv);
41476 }
41477
41478 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PrintableString_1new(JNIEnv *env, jclass clz, jstring a_arg) {
41479         LDKStr a_arg_conv = java_to_owned_str(env, a_arg);
41480         LDKPrintableString ret_var = PrintableString_new(a_arg_conv);
41481         int64_t ret_ref = 0;
41482         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41483         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41484         return ret_ref;
41485 }
41486
41487 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TrackedSpendableOutput_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
41488         LDKTrackedSpendableOutput this_obj_conv;
41489         this_obj_conv.inner = untag_ptr(this_obj);
41490         this_obj_conv.is_owned = ptr_is_owned(this_obj);
41491         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41492         TrackedSpendableOutput_free(this_obj_conv);
41493 }
41494
41495 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TrackedSpendableOutput_1get_1descriptor(JNIEnv *env, jclass clz, int64_t this_ptr) {
41496         LDKTrackedSpendableOutput this_ptr_conv;
41497         this_ptr_conv.inner = untag_ptr(this_ptr);
41498         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41499         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41500         this_ptr_conv.is_owned = false;
41501         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
41502         *ret_copy = TrackedSpendableOutput_get_descriptor(&this_ptr_conv);
41503         int64_t ret_ref = tag_ptr(ret_copy, true);
41504         return ret_ref;
41505 }
41506
41507 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TrackedSpendableOutput_1set_1descriptor(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
41508         LDKTrackedSpendableOutput this_ptr_conv;
41509         this_ptr_conv.inner = untag_ptr(this_ptr);
41510         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41511         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41512         this_ptr_conv.is_owned = false;
41513         void* val_ptr = untag_ptr(val);
41514         CHECK_ACCESS(val_ptr);
41515         LDKSpendableOutputDescriptor val_conv = *(LDKSpendableOutputDescriptor*)(val_ptr);
41516         val_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)untag_ptr(val));
41517         TrackedSpendableOutput_set_descriptor(&this_ptr_conv, val_conv);
41518 }
41519
41520 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TrackedSpendableOutput_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
41521         LDKTrackedSpendableOutput this_ptr_conv;
41522         this_ptr_conv.inner = untag_ptr(this_ptr);
41523         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41524         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41525         this_ptr_conv.is_owned = false;
41526         LDKChannelId ret_var = TrackedSpendableOutput_get_channel_id(&this_ptr_conv);
41527         int64_t ret_ref = 0;
41528         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41529         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41530         return ret_ref;
41531 }
41532
41533 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TrackedSpendableOutput_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
41534         LDKTrackedSpendableOutput this_ptr_conv;
41535         this_ptr_conv.inner = untag_ptr(this_ptr);
41536         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41537         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41538         this_ptr_conv.is_owned = false;
41539         LDKChannelId val_conv;
41540         val_conv.inner = untag_ptr(val);
41541         val_conv.is_owned = ptr_is_owned(val);
41542         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
41543         val_conv = ChannelId_clone(&val_conv);
41544         TrackedSpendableOutput_set_channel_id(&this_ptr_conv, val_conv);
41545 }
41546
41547 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TrackedSpendableOutput_1get_1status(JNIEnv *env, jclass clz, int64_t this_ptr) {
41548         LDKTrackedSpendableOutput this_ptr_conv;
41549         this_ptr_conv.inner = untag_ptr(this_ptr);
41550         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41551         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41552         this_ptr_conv.is_owned = false;
41553         LDKOutputSpendStatus *ret_copy = MALLOC(sizeof(LDKOutputSpendStatus), "LDKOutputSpendStatus");
41554         *ret_copy = TrackedSpendableOutput_get_status(&this_ptr_conv);
41555         int64_t ret_ref = tag_ptr(ret_copy, true);
41556         return ret_ref;
41557 }
41558
41559 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TrackedSpendableOutput_1set_1status(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
41560         LDKTrackedSpendableOutput this_ptr_conv;
41561         this_ptr_conv.inner = untag_ptr(this_ptr);
41562         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
41563         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
41564         this_ptr_conv.is_owned = false;
41565         void* val_ptr = untag_ptr(val);
41566         CHECK_ACCESS(val_ptr);
41567         LDKOutputSpendStatus val_conv = *(LDKOutputSpendStatus*)(val_ptr);
41568         val_conv = OutputSpendStatus_clone((LDKOutputSpendStatus*)untag_ptr(val));
41569         TrackedSpendableOutput_set_status(&this_ptr_conv, val_conv);
41570 }
41571
41572 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TrackedSpendableOutput_1new(JNIEnv *env, jclass clz, int64_t descriptor_arg, int64_t channel_id_arg, int64_t status_arg) {
41573         void* descriptor_arg_ptr = untag_ptr(descriptor_arg);
41574         CHECK_ACCESS(descriptor_arg_ptr);
41575         LDKSpendableOutputDescriptor descriptor_arg_conv = *(LDKSpendableOutputDescriptor*)(descriptor_arg_ptr);
41576         descriptor_arg_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)untag_ptr(descriptor_arg));
41577         LDKChannelId channel_id_arg_conv;
41578         channel_id_arg_conv.inner = untag_ptr(channel_id_arg);
41579         channel_id_arg_conv.is_owned = ptr_is_owned(channel_id_arg);
41580         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_arg_conv);
41581         channel_id_arg_conv = ChannelId_clone(&channel_id_arg_conv);
41582         void* status_arg_ptr = untag_ptr(status_arg);
41583         CHECK_ACCESS(status_arg_ptr);
41584         LDKOutputSpendStatus status_arg_conv = *(LDKOutputSpendStatus*)(status_arg_ptr);
41585         status_arg_conv = OutputSpendStatus_clone((LDKOutputSpendStatus*)untag_ptr(status_arg));
41586         LDKTrackedSpendableOutput ret_var = TrackedSpendableOutput_new(descriptor_arg_conv, channel_id_arg_conv, status_arg_conv);
41587         int64_t ret_ref = 0;
41588         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41589         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41590         return ret_ref;
41591 }
41592
41593 static inline uint64_t TrackedSpendableOutput_clone_ptr(LDKTrackedSpendableOutput *NONNULL_PTR arg) {
41594         LDKTrackedSpendableOutput ret_var = TrackedSpendableOutput_clone(arg);
41595         int64_t ret_ref = 0;
41596         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41597         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41598         return ret_ref;
41599 }
41600 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TrackedSpendableOutput_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
41601         LDKTrackedSpendableOutput arg_conv;
41602         arg_conv.inner = untag_ptr(arg);
41603         arg_conv.is_owned = ptr_is_owned(arg);
41604         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
41605         arg_conv.is_owned = false;
41606         int64_t ret_conv = TrackedSpendableOutput_clone_ptr(&arg_conv);
41607         return ret_conv;
41608 }
41609
41610 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TrackedSpendableOutput_1clone(JNIEnv *env, jclass clz, int64_t orig) {
41611         LDKTrackedSpendableOutput orig_conv;
41612         orig_conv.inner = untag_ptr(orig);
41613         orig_conv.is_owned = ptr_is_owned(orig);
41614         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
41615         orig_conv.is_owned = false;
41616         LDKTrackedSpendableOutput ret_var = TrackedSpendableOutput_clone(&orig_conv);
41617         int64_t ret_ref = 0;
41618         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41619         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41620         return ret_ref;
41621 }
41622
41623 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_TrackedSpendableOutput_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
41624         LDKTrackedSpendableOutput a_conv;
41625         a_conv.inner = untag_ptr(a);
41626         a_conv.is_owned = ptr_is_owned(a);
41627         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
41628         a_conv.is_owned = false;
41629         LDKTrackedSpendableOutput b_conv;
41630         b_conv.inner = untag_ptr(b);
41631         b_conv.is_owned = ptr_is_owned(b);
41632         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
41633         b_conv.is_owned = false;
41634         jboolean ret_conv = TrackedSpendableOutput_eq(&a_conv, &b_conv);
41635         return ret_conv;
41636 }
41637
41638 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_TrackedSpendableOutput_1is_1spent_1in(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray tx) {
41639         LDKTrackedSpendableOutput this_arg_conv;
41640         this_arg_conv.inner = untag_ptr(this_arg);
41641         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41642         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41643         this_arg_conv.is_owned = false;
41644         LDKTransaction tx_ref;
41645         tx_ref.datalen = (*env)->GetArrayLength(env, tx);
41646         tx_ref.data = MALLOC(tx_ref.datalen, "LDKTransaction Bytes");
41647         (*env)->GetByteArrayRegion(env, tx, 0, tx_ref.datalen, tx_ref.data);
41648         tx_ref.data_is_owned = true;
41649         jboolean ret_conv = TrackedSpendableOutput_is_spent_in(&this_arg_conv, tx_ref);
41650         return ret_conv;
41651 }
41652
41653 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TrackedSpendableOutput_1write(JNIEnv *env, jclass clz, int64_t obj) {
41654         LDKTrackedSpendableOutput obj_conv;
41655         obj_conv.inner = untag_ptr(obj);
41656         obj_conv.is_owned = ptr_is_owned(obj);
41657         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
41658         obj_conv.is_owned = false;
41659         LDKCVec_u8Z ret_var = TrackedSpendableOutput_write(&obj_conv);
41660         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
41661         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
41662         CVec_u8Z_free(ret_var);
41663         return ret_arr;
41664 }
41665
41666 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TrackedSpendableOutput_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
41667         LDKu8slice ser_ref;
41668         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
41669         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
41670         LDKCResult_TrackedSpendableOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TrackedSpendableOutputDecodeErrorZ), "LDKCResult_TrackedSpendableOutputDecodeErrorZ");
41671         *ret_conv = TrackedSpendableOutput_read(ser_ref);
41672         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
41673         return tag_ptr(ret_conv, true);
41674 }
41675
41676 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OutputSpendStatus_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
41677         if (!ptr_is_owned(this_ptr)) return;
41678         void* this_ptr_ptr = untag_ptr(this_ptr);
41679         CHECK_ACCESS(this_ptr_ptr);
41680         LDKOutputSpendStatus this_ptr_conv = *(LDKOutputSpendStatus*)(this_ptr_ptr);
41681         FREE(untag_ptr(this_ptr));
41682         OutputSpendStatus_free(this_ptr_conv);
41683 }
41684
41685 static inline uint64_t OutputSpendStatus_clone_ptr(LDKOutputSpendStatus *NONNULL_PTR arg) {
41686         LDKOutputSpendStatus *ret_copy = MALLOC(sizeof(LDKOutputSpendStatus), "LDKOutputSpendStatus");
41687         *ret_copy = OutputSpendStatus_clone(arg);
41688         int64_t ret_ref = tag_ptr(ret_copy, true);
41689         return ret_ref;
41690 }
41691 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutputSpendStatus_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
41692         LDKOutputSpendStatus* arg_conv = (LDKOutputSpendStatus*)untag_ptr(arg);
41693         int64_t ret_conv = OutputSpendStatus_clone_ptr(arg_conv);
41694         return ret_conv;
41695 }
41696
41697 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutputSpendStatus_1clone(JNIEnv *env, jclass clz, int64_t orig) {
41698         LDKOutputSpendStatus* orig_conv = (LDKOutputSpendStatus*)untag_ptr(orig);
41699         LDKOutputSpendStatus *ret_copy = MALLOC(sizeof(LDKOutputSpendStatus), "LDKOutputSpendStatus");
41700         *ret_copy = OutputSpendStatus_clone(orig_conv);
41701         int64_t ret_ref = tag_ptr(ret_copy, true);
41702         return ret_ref;
41703 }
41704
41705 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutputSpendStatus_1pending_1initial_1broadcast(JNIEnv *env, jclass clz, int64_t delayed_until_height) {
41706         void* delayed_until_height_ptr = untag_ptr(delayed_until_height);
41707         CHECK_ACCESS(delayed_until_height_ptr);
41708         LDKCOption_u32Z delayed_until_height_conv = *(LDKCOption_u32Z*)(delayed_until_height_ptr);
41709         delayed_until_height_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(delayed_until_height));
41710         LDKOutputSpendStatus *ret_copy = MALLOC(sizeof(LDKOutputSpendStatus), "LDKOutputSpendStatus");
41711         *ret_copy = OutputSpendStatus_pending_initial_broadcast(delayed_until_height_conv);
41712         int64_t ret_ref = tag_ptr(ret_copy, true);
41713         return ret_ref;
41714 }
41715
41716 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutputSpendStatus_1pending_1first_1confirmation(JNIEnv *env, jclass clz, int8_tArray first_broadcast_hash, int32_t latest_broadcast_height, int8_tArray latest_spending_tx) {
41717         LDKThirtyTwoBytes first_broadcast_hash_ref;
41718         CHECK((*env)->GetArrayLength(env, first_broadcast_hash) == 32);
41719         (*env)->GetByteArrayRegion(env, first_broadcast_hash, 0, 32, first_broadcast_hash_ref.data);
41720         LDKTransaction latest_spending_tx_ref;
41721         latest_spending_tx_ref.datalen = (*env)->GetArrayLength(env, latest_spending_tx);
41722         latest_spending_tx_ref.data = MALLOC(latest_spending_tx_ref.datalen, "LDKTransaction Bytes");
41723         (*env)->GetByteArrayRegion(env, latest_spending_tx, 0, latest_spending_tx_ref.datalen, latest_spending_tx_ref.data);
41724         latest_spending_tx_ref.data_is_owned = true;
41725         LDKOutputSpendStatus *ret_copy = MALLOC(sizeof(LDKOutputSpendStatus), "LDKOutputSpendStatus");
41726         *ret_copy = OutputSpendStatus_pending_first_confirmation(first_broadcast_hash_ref, latest_broadcast_height, latest_spending_tx_ref);
41727         int64_t ret_ref = tag_ptr(ret_copy, true);
41728         return ret_ref;
41729 }
41730
41731 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutputSpendStatus_1pending_1threshold_1confirmations(JNIEnv *env, jclass clz, int8_tArray first_broadcast_hash, int32_t latest_broadcast_height, int8_tArray latest_spending_tx, int32_t confirmation_height, int8_tArray confirmation_hash) {
41732         LDKThirtyTwoBytes first_broadcast_hash_ref;
41733         CHECK((*env)->GetArrayLength(env, first_broadcast_hash) == 32);
41734         (*env)->GetByteArrayRegion(env, first_broadcast_hash, 0, 32, first_broadcast_hash_ref.data);
41735         LDKTransaction latest_spending_tx_ref;
41736         latest_spending_tx_ref.datalen = (*env)->GetArrayLength(env, latest_spending_tx);
41737         latest_spending_tx_ref.data = MALLOC(latest_spending_tx_ref.datalen, "LDKTransaction Bytes");
41738         (*env)->GetByteArrayRegion(env, latest_spending_tx, 0, latest_spending_tx_ref.datalen, latest_spending_tx_ref.data);
41739         latest_spending_tx_ref.data_is_owned = true;
41740         LDKThirtyTwoBytes confirmation_hash_ref;
41741         CHECK((*env)->GetArrayLength(env, confirmation_hash) == 32);
41742         (*env)->GetByteArrayRegion(env, confirmation_hash, 0, 32, confirmation_hash_ref.data);
41743         LDKOutputSpendStatus *ret_copy = MALLOC(sizeof(LDKOutputSpendStatus), "LDKOutputSpendStatus");
41744         *ret_copy = OutputSpendStatus_pending_threshold_confirmations(first_broadcast_hash_ref, latest_broadcast_height, latest_spending_tx_ref, confirmation_height, confirmation_hash_ref);
41745         int64_t ret_ref = tag_ptr(ret_copy, true);
41746         return ret_ref;
41747 }
41748
41749 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_OutputSpendStatus_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
41750         LDKOutputSpendStatus* a_conv = (LDKOutputSpendStatus*)untag_ptr(a);
41751         LDKOutputSpendStatus* b_conv = (LDKOutputSpendStatus*)untag_ptr(b);
41752         jboolean ret_conv = OutputSpendStatus_eq(a_conv, b_conv);
41753         return ret_conv;
41754 }
41755
41756 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OutputSpendStatus_1write(JNIEnv *env, jclass clz, int64_t obj) {
41757         LDKOutputSpendStatus* obj_conv = (LDKOutputSpendStatus*)untag_ptr(obj);
41758         LDKCVec_u8Z ret_var = OutputSpendStatus_write(obj_conv);
41759         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
41760         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
41761         CVec_u8Z_free(ret_var);
41762         return ret_arr;
41763 }
41764
41765 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutputSpendStatus_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
41766         LDKu8slice ser_ref;
41767         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
41768         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
41769         LDKCResult_OutputSpendStatusDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutputSpendStatusDecodeErrorZ), "LDKCResult_OutputSpendStatusDecodeErrorZ");
41770         *ret_conv = OutputSpendStatus_read(ser_ref);
41771         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
41772         return tag_ptr(ret_conv, true);
41773 }
41774
41775 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OutputSweeper_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
41776         LDKOutputSweeper this_obj_conv;
41777         this_obj_conv.inner = untag_ptr(this_obj);
41778         this_obj_conv.is_owned = ptr_is_owned(this_obj);
41779         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
41780         OutputSweeper_free(this_obj_conv);
41781 }
41782
41783 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutputSweeper_1new(JNIEnv *env, jclass clz, int64_t best_block, int64_t broadcaster, int64_t fee_estimator, int64_t chain_data_source, int64_t output_spender, int64_t change_destination_source, int64_t kv_store, int64_t logger) {
41784         LDKBestBlock best_block_conv;
41785         best_block_conv.inner = untag_ptr(best_block);
41786         best_block_conv.is_owned = ptr_is_owned(best_block);
41787         CHECK_INNER_FIELD_ACCESS_OR_NULL(best_block_conv);
41788         best_block_conv = BestBlock_clone(&best_block_conv);
41789         void* broadcaster_ptr = untag_ptr(broadcaster);
41790         CHECK_ACCESS(broadcaster_ptr);
41791         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
41792         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
41793                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
41794                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
41795         }
41796         void* fee_estimator_ptr = untag_ptr(fee_estimator);
41797         CHECK_ACCESS(fee_estimator_ptr);
41798         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
41799         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
41800                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
41801                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
41802         }
41803         void* chain_data_source_ptr = untag_ptr(chain_data_source);
41804         CHECK_ACCESS(chain_data_source_ptr);
41805         LDKCOption_FilterZ chain_data_source_conv = *(LDKCOption_FilterZ*)(chain_data_source_ptr);
41806         // WARNING: we may need a move here but no clone is available for LDKCOption_FilterZ
41807         if (chain_data_source_conv.tag == LDKCOption_FilterZ_Some) {
41808                 // Manually implement clone for Java trait instances
41809                 if (chain_data_source_conv.some.free == LDKFilter_JCalls_free) {
41810                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
41811                         LDKFilter_JCalls_cloned(&chain_data_source_conv.some);
41812                 }
41813         }
41814         void* output_spender_ptr = untag_ptr(output_spender);
41815         CHECK_ACCESS(output_spender_ptr);
41816         LDKOutputSpender output_spender_conv = *(LDKOutputSpender*)(output_spender_ptr);
41817         if (output_spender_conv.free == LDKOutputSpender_JCalls_free) {
41818                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
41819                 LDKOutputSpender_JCalls_cloned(&output_spender_conv);
41820         }
41821         void* change_destination_source_ptr = untag_ptr(change_destination_source);
41822         CHECK_ACCESS(change_destination_source_ptr);
41823         LDKChangeDestinationSource change_destination_source_conv = *(LDKChangeDestinationSource*)(change_destination_source_ptr);
41824         if (change_destination_source_conv.free == LDKChangeDestinationSource_JCalls_free) {
41825                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
41826                 LDKChangeDestinationSource_JCalls_cloned(&change_destination_source_conv);
41827         }
41828         void* kv_store_ptr = untag_ptr(kv_store);
41829         CHECK_ACCESS(kv_store_ptr);
41830         LDKKVStore kv_store_conv = *(LDKKVStore*)(kv_store_ptr);
41831         if (kv_store_conv.free == LDKKVStore_JCalls_free) {
41832                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
41833                 LDKKVStore_JCalls_cloned(&kv_store_conv);
41834         }
41835         void* logger_ptr = untag_ptr(logger);
41836         CHECK_ACCESS(logger_ptr);
41837         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
41838         if (logger_conv.free == LDKLogger_JCalls_free) {
41839                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
41840                 LDKLogger_JCalls_cloned(&logger_conv);
41841         }
41842         LDKOutputSweeper ret_var = OutputSweeper_new(best_block_conv, broadcaster_conv, fee_estimator_conv, chain_data_source_conv, output_spender_conv, change_destination_source_conv, kv_store_conv, logger_conv);
41843         int64_t ret_ref = 0;
41844         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41845         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41846         return ret_ref;
41847 }
41848
41849 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutputSweeper_1track_1spendable_1outputs(JNIEnv *env, jclass clz, int64_t this_arg, int64_tArray output_descriptors, int64_t channel_id, jboolean exclude_static_outputs, int64_t delay_until_height) {
41850         LDKOutputSweeper this_arg_conv;
41851         this_arg_conv.inner = untag_ptr(this_arg);
41852         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41853         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41854         this_arg_conv.is_owned = false;
41855         LDKCVec_SpendableOutputDescriptorZ output_descriptors_constr;
41856         output_descriptors_constr.datalen = (*env)->GetArrayLength(env, output_descriptors);
41857         if (output_descriptors_constr.datalen > 0)
41858                 output_descriptors_constr.data = MALLOC(output_descriptors_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
41859         else
41860                 output_descriptors_constr.data = NULL;
41861         int64_t* output_descriptors_vals = (*env)->GetLongArrayElements (env, output_descriptors, NULL);
41862         for (size_t b = 0; b < output_descriptors_constr.datalen; b++) {
41863                 int64_t output_descriptors_conv_27 = output_descriptors_vals[b];
41864                 void* output_descriptors_conv_27_ptr = untag_ptr(output_descriptors_conv_27);
41865                 CHECK_ACCESS(output_descriptors_conv_27_ptr);
41866                 LDKSpendableOutputDescriptor output_descriptors_conv_27_conv = *(LDKSpendableOutputDescriptor*)(output_descriptors_conv_27_ptr);
41867                 output_descriptors_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)untag_ptr(output_descriptors_conv_27));
41868                 output_descriptors_constr.data[b] = output_descriptors_conv_27_conv;
41869         }
41870         (*env)->ReleaseLongArrayElements(env, output_descriptors, output_descriptors_vals, 0);
41871         LDKChannelId channel_id_conv;
41872         channel_id_conv.inner = untag_ptr(channel_id);
41873         channel_id_conv.is_owned = ptr_is_owned(channel_id);
41874         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_conv);
41875         channel_id_conv = ChannelId_clone(&channel_id_conv);
41876         void* delay_until_height_ptr = untag_ptr(delay_until_height);
41877         CHECK_ACCESS(delay_until_height_ptr);
41878         LDKCOption_u32Z delay_until_height_conv = *(LDKCOption_u32Z*)(delay_until_height_ptr);
41879         delay_until_height_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(delay_until_height));
41880         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
41881         *ret_conv = OutputSweeper_track_spendable_outputs(&this_arg_conv, output_descriptors_constr, channel_id_conv, exclude_static_outputs, delay_until_height_conv);
41882         return tag_ptr(ret_conv, true);
41883 }
41884
41885 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_OutputSweeper_1tracked_1spendable_1outputs(JNIEnv *env, jclass clz, int64_t this_arg) {
41886         LDKOutputSweeper this_arg_conv;
41887         this_arg_conv.inner = untag_ptr(this_arg);
41888         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41889         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41890         this_arg_conv.is_owned = false;
41891         LDKCVec_TrackedSpendableOutputZ ret_var = OutputSweeper_tracked_spendable_outputs(&this_arg_conv);
41892         int64_tArray ret_arr = NULL;
41893         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
41894         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
41895         for (size_t y = 0; y < ret_var.datalen; y++) {
41896                 LDKTrackedSpendableOutput ret_conv_24_var = ret_var.data[y];
41897                 int64_t ret_conv_24_ref = 0;
41898                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_24_var);
41899                 ret_conv_24_ref = tag_ptr(ret_conv_24_var.inner, ret_conv_24_var.is_owned);
41900                 ret_arr_ptr[y] = ret_conv_24_ref;
41901         }
41902         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
41903         FREE(ret_var.data);
41904         return ret_arr;
41905 }
41906
41907 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutputSweeper_1current_1best_1block(JNIEnv *env, jclass clz, int64_t this_arg) {
41908         LDKOutputSweeper this_arg_conv;
41909         this_arg_conv.inner = untag_ptr(this_arg);
41910         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41911         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41912         this_arg_conv.is_owned = false;
41913         LDKBestBlock ret_var = OutputSweeper_current_best_block(&this_arg_conv);
41914         int64_t ret_ref = 0;
41915         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
41916         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
41917         return ret_ref;
41918 }
41919
41920 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutputSweeper_1as_1Listen(JNIEnv *env, jclass clz, int64_t this_arg) {
41921         LDKOutputSweeper this_arg_conv;
41922         this_arg_conv.inner = untag_ptr(this_arg);
41923         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41924         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41925         this_arg_conv.is_owned = false;
41926         LDKListen* ret_ret = MALLOC(sizeof(LDKListen), "LDKListen");
41927         *ret_ret = OutputSweeper_as_Listen(&this_arg_conv);
41928         return tag_ptr(ret_ret, true);
41929 }
41930
41931 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutputSweeper_1as_1Confirm(JNIEnv *env, jclass clz, int64_t this_arg) {
41932         LDKOutputSweeper this_arg_conv;
41933         this_arg_conv.inner = untag_ptr(this_arg);
41934         this_arg_conv.is_owned = ptr_is_owned(this_arg);
41935         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
41936         this_arg_conv.is_owned = false;
41937         LDKConfirm* ret_ret = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
41938         *ret_ret = OutputSweeper_as_Confirm(&this_arg_conv);
41939         return tag_ptr(ret_ret, true);
41940 }
41941
41942 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SpendingDelay_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
41943         if (!ptr_is_owned(this_ptr)) return;
41944         void* this_ptr_ptr = untag_ptr(this_ptr);
41945         CHECK_ACCESS(this_ptr_ptr);
41946         LDKSpendingDelay this_ptr_conv = *(LDKSpendingDelay*)(this_ptr_ptr);
41947         FREE(untag_ptr(this_ptr));
41948         SpendingDelay_free(this_ptr_conv);
41949 }
41950
41951 static inline uint64_t SpendingDelay_clone_ptr(LDKSpendingDelay *NONNULL_PTR arg) {
41952         LDKSpendingDelay *ret_copy = MALLOC(sizeof(LDKSpendingDelay), "LDKSpendingDelay");
41953         *ret_copy = SpendingDelay_clone(arg);
41954         int64_t ret_ref = tag_ptr(ret_copy, true);
41955         return ret_ref;
41956 }
41957 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpendingDelay_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
41958         LDKSpendingDelay* arg_conv = (LDKSpendingDelay*)untag_ptr(arg);
41959         int64_t ret_conv = SpendingDelay_clone_ptr(arg_conv);
41960         return ret_conv;
41961 }
41962
41963 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpendingDelay_1clone(JNIEnv *env, jclass clz, int64_t orig) {
41964         LDKSpendingDelay* orig_conv = (LDKSpendingDelay*)untag_ptr(orig);
41965         LDKSpendingDelay *ret_copy = MALLOC(sizeof(LDKSpendingDelay), "LDKSpendingDelay");
41966         *ret_copy = SpendingDelay_clone(orig_conv);
41967         int64_t ret_ref = tag_ptr(ret_copy, true);
41968         return ret_ref;
41969 }
41970
41971 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpendingDelay_1relative(JNIEnv *env, jclass clz, int32_t num_blocks) {
41972         LDKSpendingDelay *ret_copy = MALLOC(sizeof(LDKSpendingDelay), "LDKSpendingDelay");
41973         *ret_copy = SpendingDelay_relative(num_blocks);
41974         int64_t ret_ref = tag_ptr(ret_copy, true);
41975         return ret_ref;
41976 }
41977
41978 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpendingDelay_1absolute(JNIEnv *env, jclass clz, int32_t height) {
41979         LDKSpendingDelay *ret_copy = MALLOC(sizeof(LDKSpendingDelay), "LDKSpendingDelay");
41980         *ret_copy = SpendingDelay_absolute(height);
41981         int64_t ret_ref = tag_ptr(ret_copy, true);
41982         return ret_ref;
41983 }
41984
41985 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutputSweeper_1read(JNIEnv *env, jclass clz, int8_tArray ser, int64_t arg_a, int64_t arg_b, int64_t arg_c, int64_t arg_d, int64_t arg_e, int64_t arg_f, int64_t arg_g) {
41986         LDKu8slice ser_ref;
41987         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
41988         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
41989         void* arg_a_ptr = untag_ptr(arg_a);
41990         CHECK_ACCESS(arg_a_ptr);
41991         LDKBroadcasterInterface arg_a_conv = *(LDKBroadcasterInterface*)(arg_a_ptr);
41992         if (arg_a_conv.free == LDKBroadcasterInterface_JCalls_free) {
41993                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
41994                 LDKBroadcasterInterface_JCalls_cloned(&arg_a_conv);
41995         }
41996         void* arg_b_ptr = untag_ptr(arg_b);
41997         CHECK_ACCESS(arg_b_ptr);
41998         LDKFeeEstimator arg_b_conv = *(LDKFeeEstimator*)(arg_b_ptr);
41999         if (arg_b_conv.free == LDKFeeEstimator_JCalls_free) {
42000                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
42001                 LDKFeeEstimator_JCalls_cloned(&arg_b_conv);
42002         }
42003         void* arg_c_ptr = untag_ptr(arg_c);
42004         CHECK_ACCESS(arg_c_ptr);
42005         LDKCOption_FilterZ arg_c_conv = *(LDKCOption_FilterZ*)(arg_c_ptr);
42006         // WARNING: we may need a move here but no clone is available for LDKCOption_FilterZ
42007         if (arg_c_conv.tag == LDKCOption_FilterZ_Some) {
42008                 // Manually implement clone for Java trait instances
42009                 if (arg_c_conv.some.free == LDKFilter_JCalls_free) {
42010                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
42011                         LDKFilter_JCalls_cloned(&arg_c_conv.some);
42012                 }
42013         }
42014         void* arg_d_ptr = untag_ptr(arg_d);
42015         CHECK_ACCESS(arg_d_ptr);
42016         LDKOutputSpender arg_d_conv = *(LDKOutputSpender*)(arg_d_ptr);
42017         if (arg_d_conv.free == LDKOutputSpender_JCalls_free) {
42018                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
42019                 LDKOutputSpender_JCalls_cloned(&arg_d_conv);
42020         }
42021         void* arg_e_ptr = untag_ptr(arg_e);
42022         CHECK_ACCESS(arg_e_ptr);
42023         LDKChangeDestinationSource arg_e_conv = *(LDKChangeDestinationSource*)(arg_e_ptr);
42024         if (arg_e_conv.free == LDKChangeDestinationSource_JCalls_free) {
42025                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
42026                 LDKChangeDestinationSource_JCalls_cloned(&arg_e_conv);
42027         }
42028         void* arg_f_ptr = untag_ptr(arg_f);
42029         CHECK_ACCESS(arg_f_ptr);
42030         LDKKVStore arg_f_conv = *(LDKKVStore*)(arg_f_ptr);
42031         if (arg_f_conv.free == LDKKVStore_JCalls_free) {
42032                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
42033                 LDKKVStore_JCalls_cloned(&arg_f_conv);
42034         }
42035         void* arg_g_ptr = untag_ptr(arg_g);
42036         CHECK_ACCESS(arg_g_ptr);
42037         LDKLogger arg_g_conv = *(LDKLogger*)(arg_g_ptr);
42038         if (arg_g_conv.free == LDKLogger_JCalls_free) {
42039                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
42040                 LDKLogger_JCalls_cloned(&arg_g_conv);
42041         }
42042         LDKCResult_OutputSweeperDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutputSweeperDecodeErrorZ), "LDKCResult_OutputSweeperDecodeErrorZ");
42043         *ret_conv = OutputSweeper_read(ser_ref, arg_a_conv, arg_b_conv, arg_c_conv, arg_d_conv, arg_e_conv, arg_f_conv, arg_g_conv);
42044         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
42045         return tag_ptr(ret_conv, true);
42046 }
42047
42048 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BestBlockOutputSweeperZ_1read(JNIEnv *env, jclass clz, int8_tArray ser, int64_t arg_a, int64_t arg_b, int64_t arg_c, int64_t arg_d, int64_t arg_e, int64_t arg_f, int64_t arg_g) {
42049         LDKu8slice ser_ref;
42050         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
42051         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
42052         void* arg_a_ptr = untag_ptr(arg_a);
42053         CHECK_ACCESS(arg_a_ptr);
42054         LDKBroadcasterInterface arg_a_conv = *(LDKBroadcasterInterface*)(arg_a_ptr);
42055         if (arg_a_conv.free == LDKBroadcasterInterface_JCalls_free) {
42056                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
42057                 LDKBroadcasterInterface_JCalls_cloned(&arg_a_conv);
42058         }
42059         void* arg_b_ptr = untag_ptr(arg_b);
42060         CHECK_ACCESS(arg_b_ptr);
42061         LDKFeeEstimator arg_b_conv = *(LDKFeeEstimator*)(arg_b_ptr);
42062         if (arg_b_conv.free == LDKFeeEstimator_JCalls_free) {
42063                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
42064                 LDKFeeEstimator_JCalls_cloned(&arg_b_conv);
42065         }
42066         void* arg_c_ptr = untag_ptr(arg_c);
42067         CHECK_ACCESS(arg_c_ptr);
42068         LDKCOption_FilterZ arg_c_conv = *(LDKCOption_FilterZ*)(arg_c_ptr);
42069         // WARNING: we may need a move here but no clone is available for LDKCOption_FilterZ
42070         if (arg_c_conv.tag == LDKCOption_FilterZ_Some) {
42071                 // Manually implement clone for Java trait instances
42072                 if (arg_c_conv.some.free == LDKFilter_JCalls_free) {
42073                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
42074                         LDKFilter_JCalls_cloned(&arg_c_conv.some);
42075                 }
42076         }
42077         void* arg_d_ptr = untag_ptr(arg_d);
42078         CHECK_ACCESS(arg_d_ptr);
42079         LDKOutputSpender arg_d_conv = *(LDKOutputSpender*)(arg_d_ptr);
42080         if (arg_d_conv.free == LDKOutputSpender_JCalls_free) {
42081                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
42082                 LDKOutputSpender_JCalls_cloned(&arg_d_conv);
42083         }
42084         void* arg_e_ptr = untag_ptr(arg_e);
42085         CHECK_ACCESS(arg_e_ptr);
42086         LDKChangeDestinationSource arg_e_conv = *(LDKChangeDestinationSource*)(arg_e_ptr);
42087         if (arg_e_conv.free == LDKChangeDestinationSource_JCalls_free) {
42088                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
42089                 LDKChangeDestinationSource_JCalls_cloned(&arg_e_conv);
42090         }
42091         void* arg_f_ptr = untag_ptr(arg_f);
42092         CHECK_ACCESS(arg_f_ptr);
42093         LDKKVStore arg_f_conv = *(LDKKVStore*)(arg_f_ptr);
42094         if (arg_f_conv.free == LDKKVStore_JCalls_free) {
42095                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
42096                 LDKKVStore_JCalls_cloned(&arg_f_conv);
42097         }
42098         void* arg_g_ptr = untag_ptr(arg_g);
42099         CHECK_ACCESS(arg_g_ptr);
42100         LDKLogger arg_g_conv = *(LDKLogger*)(arg_g_ptr);
42101         if (arg_g_conv.free == LDKLogger_JCalls_free) {
42102                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
42103                 LDKLogger_JCalls_cloned(&arg_g_conv);
42104         }
42105         LDKCResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ), "LDKCResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ");
42106         *ret_conv = C2Tuple_BestBlockOutputSweeperZ_read(ser_ref, arg_a_conv, arg_b_conv, arg_c_conv, arg_d_conv, arg_e_conv, arg_f_conv, arg_g_conv);
42107         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
42108         return tag_ptr(ret_conv, true);
42109 }
42110
42111 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FutureCallback_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
42112         if (!ptr_is_owned(this_ptr)) return;
42113         void* this_ptr_ptr = untag_ptr(this_ptr);
42114         CHECK_ACCESS(this_ptr_ptr);
42115         LDKFutureCallback this_ptr_conv = *(LDKFutureCallback*)(this_ptr_ptr);
42116         FREE(untag_ptr(this_ptr));
42117         FutureCallback_free(this_ptr_conv);
42118 }
42119
42120 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Future_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
42121         LDKFuture this_obj_conv;
42122         this_obj_conv.inner = untag_ptr(this_obj);
42123         this_obj_conv.is_owned = ptr_is_owned(this_obj);
42124         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42125         Future_free(this_obj_conv);
42126 }
42127
42128 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Future_1register_1callback_1fn(JNIEnv *env, jclass clz, int64_t this_arg, int64_t callback) {
42129         LDKFuture this_arg_conv;
42130         this_arg_conv.inner = untag_ptr(this_arg);
42131         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42132         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42133         this_arg_conv.is_owned = false;
42134         void* callback_ptr = untag_ptr(callback);
42135         CHECK_ACCESS(callback_ptr);
42136         LDKFutureCallback callback_conv = *(LDKFutureCallback*)(callback_ptr);
42137         if (callback_conv.free == LDKFutureCallback_JCalls_free) {
42138                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
42139                 LDKFutureCallback_JCalls_cloned(&callback_conv);
42140         }
42141         Future_register_callback_fn(&this_arg_conv, callback_conv);
42142 }
42143
42144 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Future_1wait(JNIEnv *env, jclass clz, int64_t this_arg) {
42145         LDKFuture this_arg_conv;
42146         this_arg_conv.inner = untag_ptr(this_arg);
42147         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42148         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42149         this_arg_conv.is_owned = false;
42150         Future_wait(&this_arg_conv);
42151 }
42152
42153 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Future_1wait_1timeout(JNIEnv *env, jclass clz, int64_t this_arg, int64_t max_wait) {
42154         LDKFuture this_arg_conv;
42155         this_arg_conv.inner = untag_ptr(this_arg);
42156         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42157         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42158         this_arg_conv.is_owned = false;
42159         jboolean ret_conv = Future_wait_timeout(&this_arg_conv, max_wait);
42160         return ret_conv;
42161 }
42162
42163 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Sleeper_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
42164         LDKSleeper this_obj_conv;
42165         this_obj_conv.inner = untag_ptr(this_obj);
42166         this_obj_conv.is_owned = ptr_is_owned(this_obj);
42167         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42168         Sleeper_free(this_obj_conv);
42169 }
42170
42171 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Sleeper_1from_1single_1future(JNIEnv *env, jclass clz, int64_t future) {
42172         LDKFuture future_conv;
42173         future_conv.inner = untag_ptr(future);
42174         future_conv.is_owned = ptr_is_owned(future);
42175         CHECK_INNER_FIELD_ACCESS_OR_NULL(future_conv);
42176         future_conv.is_owned = false;
42177         LDKSleeper ret_var = Sleeper_from_single_future(&future_conv);
42178         int64_t ret_ref = 0;
42179         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42180         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42181         return ret_ref;
42182 }
42183
42184 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) {
42185         LDKFuture fut_a_conv;
42186         fut_a_conv.inner = untag_ptr(fut_a);
42187         fut_a_conv.is_owned = ptr_is_owned(fut_a);
42188         CHECK_INNER_FIELD_ACCESS_OR_NULL(fut_a_conv);
42189         fut_a_conv.is_owned = false;
42190         LDKFuture fut_b_conv;
42191         fut_b_conv.inner = untag_ptr(fut_b);
42192         fut_b_conv.is_owned = ptr_is_owned(fut_b);
42193         CHECK_INNER_FIELD_ACCESS_OR_NULL(fut_b_conv);
42194         fut_b_conv.is_owned = false;
42195         LDKSleeper ret_var = Sleeper_from_two_futures(&fut_a_conv, &fut_b_conv);
42196         int64_t ret_ref = 0;
42197         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42198         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42199         return ret_ref;
42200 }
42201
42202 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Sleeper_1new(JNIEnv *env, jclass clz, int64_tArray futures) {
42203         LDKCVec_FutureZ futures_constr;
42204         futures_constr.datalen = (*env)->GetArrayLength(env, futures);
42205         if (futures_constr.datalen > 0)
42206                 futures_constr.data = MALLOC(futures_constr.datalen * sizeof(LDKFuture), "LDKCVec_FutureZ Elements");
42207         else
42208                 futures_constr.data = NULL;
42209         int64_t* futures_vals = (*env)->GetLongArrayElements (env, futures, NULL);
42210         for (size_t i = 0; i < futures_constr.datalen; i++) {
42211                 int64_t futures_conv_8 = futures_vals[i];
42212                 LDKFuture futures_conv_8_conv;
42213                 futures_conv_8_conv.inner = untag_ptr(futures_conv_8);
42214                 futures_conv_8_conv.is_owned = ptr_is_owned(futures_conv_8);
42215                 CHECK_INNER_FIELD_ACCESS_OR_NULL(futures_conv_8_conv);
42216                 // WARNING: we need a move here but no clone is available for LDKFuture
42217                 
42218                 futures_constr.data[i] = futures_conv_8_conv;
42219         }
42220         (*env)->ReleaseLongArrayElements(env, futures, futures_vals, 0);
42221         LDKSleeper ret_var = Sleeper_new(futures_constr);
42222         int64_t ret_ref = 0;
42223         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42224         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42225         return ret_ref;
42226 }
42227
42228 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Sleeper_1wait(JNIEnv *env, jclass clz, int64_t this_arg) {
42229         LDKSleeper this_arg_conv;
42230         this_arg_conv.inner = untag_ptr(this_arg);
42231         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42232         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42233         this_arg_conv.is_owned = false;
42234         Sleeper_wait(&this_arg_conv);
42235 }
42236
42237 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Sleeper_1wait_1timeout(JNIEnv *env, jclass clz, int64_t this_arg, int64_t max_wait) {
42238         LDKSleeper this_arg_conv;
42239         this_arg_conv.inner = untag_ptr(this_arg);
42240         this_arg_conv.is_owned = ptr_is_owned(this_arg);
42241         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
42242         this_arg_conv.is_owned = false;
42243         jboolean ret_conv = Sleeper_wait_timeout(&this_arg_conv, max_wait);
42244         return ret_conv;
42245 }
42246
42247 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1clone(JNIEnv *env, jclass clz, int64_t orig) {
42248         LDKLevel* orig_conv = (LDKLevel*)untag_ptr(orig);
42249         jclass ret_conv = LDKLevel_to_java(env, Level_clone(orig_conv));
42250         return ret_conv;
42251 }
42252
42253 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1gossip(JNIEnv *env, jclass clz) {
42254         jclass ret_conv = LDKLevel_to_java(env, Level_gossip());
42255         return ret_conv;
42256 }
42257
42258 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1trace(JNIEnv *env, jclass clz) {
42259         jclass ret_conv = LDKLevel_to_java(env, Level_trace());
42260         return ret_conv;
42261 }
42262
42263 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1debug(JNIEnv *env, jclass clz) {
42264         jclass ret_conv = LDKLevel_to_java(env, Level_debug());
42265         return ret_conv;
42266 }
42267
42268 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1info(JNIEnv *env, jclass clz) {
42269         jclass ret_conv = LDKLevel_to_java(env, Level_info());
42270         return ret_conv;
42271 }
42272
42273 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1warn(JNIEnv *env, jclass clz) {
42274         jclass ret_conv = LDKLevel_to_java(env, Level_warn());
42275         return ret_conv;
42276 }
42277
42278 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1error(JNIEnv *env, jclass clz) {
42279         jclass ret_conv = LDKLevel_to_java(env, Level_error());
42280         return ret_conv;
42281 }
42282
42283 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Level_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
42284         LDKLevel* a_conv = (LDKLevel*)untag_ptr(a);
42285         LDKLevel* b_conv = (LDKLevel*)untag_ptr(b);
42286         jboolean ret_conv = Level_eq(a_conv, b_conv);
42287         return ret_conv;
42288 }
42289
42290 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Level_1hash(JNIEnv *env, jclass clz, int64_t o) {
42291         LDKLevel* o_conv = (LDKLevel*)untag_ptr(o);
42292         int64_t ret_conv = Level_hash(o_conv);
42293         return ret_conv;
42294 }
42295
42296 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1max(JNIEnv *env, jclass clz) {
42297         jclass ret_conv = LDKLevel_to_java(env, Level_max());
42298         return ret_conv;
42299 }
42300
42301 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Record_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
42302         LDKRecord this_obj_conv;
42303         this_obj_conv.inner = untag_ptr(this_obj);
42304         this_obj_conv.is_owned = ptr_is_owned(this_obj);
42305         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42306         Record_free(this_obj_conv);
42307 }
42308
42309 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Record_1get_1level(JNIEnv *env, jclass clz, int64_t this_ptr) {
42310         LDKRecord this_ptr_conv;
42311         this_ptr_conv.inner = untag_ptr(this_ptr);
42312         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42313         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42314         this_ptr_conv.is_owned = false;
42315         jclass ret_conv = LDKLevel_to_java(env, Record_get_level(&this_ptr_conv));
42316         return ret_conv;
42317 }
42318
42319 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Record_1set_1level(JNIEnv *env, jclass clz, int64_t this_ptr, jclass val) {
42320         LDKRecord this_ptr_conv;
42321         this_ptr_conv.inner = untag_ptr(this_ptr);
42322         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42323         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42324         this_ptr_conv.is_owned = false;
42325         LDKLevel val_conv = LDKLevel_from_java(env, val);
42326         Record_set_level(&this_ptr_conv, val_conv);
42327 }
42328
42329 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Record_1get_1peer_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
42330         LDKRecord this_ptr_conv;
42331         this_ptr_conv.inner = untag_ptr(this_ptr);
42332         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42333         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42334         this_ptr_conv.is_owned = false;
42335         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
42336         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, Record_get_peer_id(&this_ptr_conv).compressed_form);
42337         return ret_arr;
42338 }
42339
42340 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Record_1set_1peer_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
42341         LDKRecord this_ptr_conv;
42342         this_ptr_conv.inner = untag_ptr(this_ptr);
42343         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42344         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42345         this_ptr_conv.is_owned = false;
42346         LDKPublicKey val_ref;
42347         CHECK((*env)->GetArrayLength(env, val) == 33);
42348         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
42349         Record_set_peer_id(&this_ptr_conv, val_ref);
42350 }
42351
42352 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Record_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
42353         LDKRecord this_ptr_conv;
42354         this_ptr_conv.inner = untag_ptr(this_ptr);
42355         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42356         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42357         this_ptr_conv.is_owned = false;
42358         LDKChannelId ret_var = Record_get_channel_id(&this_ptr_conv);
42359         int64_t ret_ref = 0;
42360         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42361         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42362         return ret_ref;
42363 }
42364
42365 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Record_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
42366         LDKRecord this_ptr_conv;
42367         this_ptr_conv.inner = untag_ptr(this_ptr);
42368         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42369         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42370         this_ptr_conv.is_owned = false;
42371         LDKChannelId val_conv;
42372         val_conv.inner = untag_ptr(val);
42373         val_conv.is_owned = ptr_is_owned(val);
42374         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
42375         val_conv = ChannelId_clone(&val_conv);
42376         Record_set_channel_id(&this_ptr_conv, val_conv);
42377 }
42378
42379 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Record_1get_1args(JNIEnv *env, jclass clz, int64_t this_ptr) {
42380         LDKRecord this_ptr_conv;
42381         this_ptr_conv.inner = untag_ptr(this_ptr);
42382         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42383         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42384         this_ptr_conv.is_owned = false;
42385         LDKStr ret_str = Record_get_args(&this_ptr_conv);
42386         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
42387         Str_free(ret_str);
42388         return ret_conv;
42389 }
42390
42391 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Record_1set_1args(JNIEnv *env, jclass clz, int64_t this_ptr, jstring val) {
42392         LDKRecord this_ptr_conv;
42393         this_ptr_conv.inner = untag_ptr(this_ptr);
42394         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42395         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42396         this_ptr_conv.is_owned = false;
42397         LDKStr val_conv = java_to_owned_str(env, val);
42398         Record_set_args(&this_ptr_conv, val_conv);
42399 }
42400
42401 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Record_1get_1module_1path(JNIEnv *env, jclass clz, int64_t this_ptr) {
42402         LDKRecord this_ptr_conv;
42403         this_ptr_conv.inner = untag_ptr(this_ptr);
42404         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42405         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42406         this_ptr_conv.is_owned = false;
42407         LDKStr ret_str = Record_get_module_path(&this_ptr_conv);
42408         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
42409         Str_free(ret_str);
42410         return ret_conv;
42411 }
42412
42413 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Record_1set_1module_1path(JNIEnv *env, jclass clz, int64_t this_ptr, jstring val) {
42414         LDKRecord this_ptr_conv;
42415         this_ptr_conv.inner = untag_ptr(this_ptr);
42416         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42417         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42418         this_ptr_conv.is_owned = false;
42419         LDKStr val_conv = java_to_owned_str(env, val);
42420         Record_set_module_path(&this_ptr_conv, val_conv);
42421 }
42422
42423 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Record_1get_1file(JNIEnv *env, jclass clz, int64_t this_ptr) {
42424         LDKRecord this_ptr_conv;
42425         this_ptr_conv.inner = untag_ptr(this_ptr);
42426         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42427         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42428         this_ptr_conv.is_owned = false;
42429         LDKStr ret_str = Record_get_file(&this_ptr_conv);
42430         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
42431         Str_free(ret_str);
42432         return ret_conv;
42433 }
42434
42435 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Record_1set_1file(JNIEnv *env, jclass clz, int64_t this_ptr, jstring val) {
42436         LDKRecord this_ptr_conv;
42437         this_ptr_conv.inner = untag_ptr(this_ptr);
42438         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42439         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42440         this_ptr_conv.is_owned = false;
42441         LDKStr val_conv = java_to_owned_str(env, val);
42442         Record_set_file(&this_ptr_conv, val_conv);
42443 }
42444
42445 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_Record_1get_1line(JNIEnv *env, jclass clz, int64_t this_ptr) {
42446         LDKRecord this_ptr_conv;
42447         this_ptr_conv.inner = untag_ptr(this_ptr);
42448         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42449         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42450         this_ptr_conv.is_owned = false;
42451         int32_t ret_conv = Record_get_line(&this_ptr_conv);
42452         return ret_conv;
42453 }
42454
42455 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Record_1set_1line(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
42456         LDKRecord 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         Record_set_line(&this_ptr_conv, val);
42462 }
42463
42464 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) {
42465         LDKLevel level_arg_conv = LDKLevel_from_java(env, level_arg);
42466         LDKPublicKey peer_id_arg_ref;
42467         CHECK((*env)->GetArrayLength(env, peer_id_arg) == 33);
42468         (*env)->GetByteArrayRegion(env, peer_id_arg, 0, 33, peer_id_arg_ref.compressed_form);
42469         LDKChannelId channel_id_arg_conv;
42470         channel_id_arg_conv.inner = untag_ptr(channel_id_arg);
42471         channel_id_arg_conv.is_owned = ptr_is_owned(channel_id_arg);
42472         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_arg_conv);
42473         channel_id_arg_conv = ChannelId_clone(&channel_id_arg_conv);
42474         LDKStr args_arg_conv = java_to_owned_str(env, args_arg);
42475         LDKStr module_path_arg_conv = java_to_owned_str(env, module_path_arg);
42476         LDKStr file_arg_conv = java_to_owned_str(env, file_arg);
42477         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);
42478         int64_t ret_ref = 0;
42479         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42480         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42481         return ret_ref;
42482 }
42483
42484 static inline uint64_t Record_clone_ptr(LDKRecord *NONNULL_PTR arg) {
42485         LDKRecord ret_var = Record_clone(arg);
42486         int64_t ret_ref = 0;
42487         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42488         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42489         return ret_ref;
42490 }
42491 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Record_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
42492         LDKRecord arg_conv;
42493         arg_conv.inner = untag_ptr(arg);
42494         arg_conv.is_owned = ptr_is_owned(arg);
42495         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
42496         arg_conv.is_owned = false;
42497         int64_t ret_conv = Record_clone_ptr(&arg_conv);
42498         return ret_conv;
42499 }
42500
42501 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Record_1clone(JNIEnv *env, jclass clz, int64_t orig) {
42502         LDKRecord orig_conv;
42503         orig_conv.inner = untag_ptr(orig);
42504         orig_conv.is_owned = ptr_is_owned(orig);
42505         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
42506         orig_conv.is_owned = false;
42507         LDKRecord ret_var = Record_clone(&orig_conv);
42508         int64_t ret_ref = 0;
42509         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42510         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42511         return ret_ref;
42512 }
42513
42514 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Logger_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
42515         if (!ptr_is_owned(this_ptr)) return;
42516         void* this_ptr_ptr = untag_ptr(this_ptr);
42517         CHECK_ACCESS(this_ptr_ptr);
42518         LDKLogger this_ptr_conv = *(LDKLogger*)(this_ptr_ptr);
42519         FREE(untag_ptr(this_ptr));
42520         Logger_free(this_ptr_conv);
42521 }
42522
42523 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
42524         LDKChannelHandshakeConfig this_obj_conv;
42525         this_obj_conv.inner = untag_ptr(this_obj);
42526         this_obj_conv.is_owned = ptr_is_owned(this_obj);
42527         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42528         ChannelHandshakeConfig_free(this_obj_conv);
42529 }
42530
42531 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr) {
42532         LDKChannelHandshakeConfig this_ptr_conv;
42533         this_ptr_conv.inner = untag_ptr(this_ptr);
42534         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42535         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42536         this_ptr_conv.is_owned = false;
42537         int32_t ret_conv = ChannelHandshakeConfig_get_minimum_depth(&this_ptr_conv);
42538         return ret_conv;
42539 }
42540
42541 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1set_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
42542         LDKChannelHandshakeConfig this_ptr_conv;
42543         this_ptr_conv.inner = untag_ptr(this_ptr);
42544         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42545         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42546         this_ptr_conv.is_owned = false;
42547         ChannelHandshakeConfig_set_minimum_depth(&this_ptr_conv, val);
42548 }
42549
42550 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1our_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
42551         LDKChannelHandshakeConfig this_ptr_conv;
42552         this_ptr_conv.inner = untag_ptr(this_ptr);
42553         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42554         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42555         this_ptr_conv.is_owned = false;
42556         int16_t ret_conv = ChannelHandshakeConfig_get_our_to_self_delay(&this_ptr_conv);
42557         return ret_conv;
42558 }
42559
42560 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) {
42561         LDKChannelHandshakeConfig this_ptr_conv;
42562         this_ptr_conv.inner = untag_ptr(this_ptr);
42563         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42564         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42565         this_ptr_conv.is_owned = false;
42566         ChannelHandshakeConfig_set_our_to_self_delay(&this_ptr_conv, val);
42567 }
42568
42569 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1our_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
42570         LDKChannelHandshakeConfig this_ptr_conv;
42571         this_ptr_conv.inner = untag_ptr(this_ptr);
42572         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42573         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42574         this_ptr_conv.is_owned = false;
42575         int64_t ret_conv = ChannelHandshakeConfig_get_our_htlc_minimum_msat(&this_ptr_conv);
42576         return ret_conv;
42577 }
42578
42579 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) {
42580         LDKChannelHandshakeConfig this_ptr_conv;
42581         this_ptr_conv.inner = untag_ptr(this_ptr);
42582         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42583         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42584         this_ptr_conv.is_owned = false;
42585         ChannelHandshakeConfig_set_our_htlc_minimum_msat(&this_ptr_conv, val);
42586 }
42587
42588 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) {
42589         LDKChannelHandshakeConfig this_ptr_conv;
42590         this_ptr_conv.inner = untag_ptr(this_ptr);
42591         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42592         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42593         this_ptr_conv.is_owned = false;
42594         int8_t ret_conv = ChannelHandshakeConfig_get_max_inbound_htlc_value_in_flight_percent_of_channel(&this_ptr_conv);
42595         return ret_conv;
42596 }
42597
42598 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) {
42599         LDKChannelHandshakeConfig this_ptr_conv;
42600         this_ptr_conv.inner = untag_ptr(this_ptr);
42601         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42602         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42603         this_ptr_conv.is_owned = false;
42604         ChannelHandshakeConfig_set_max_inbound_htlc_value_in_flight_percent_of_channel(&this_ptr_conv, val);
42605 }
42606
42607 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1negotiate_1scid_1privacy(JNIEnv *env, jclass clz, int64_t this_ptr) {
42608         LDKChannelHandshakeConfig this_ptr_conv;
42609         this_ptr_conv.inner = untag_ptr(this_ptr);
42610         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42611         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42612         this_ptr_conv.is_owned = false;
42613         jboolean ret_conv = ChannelHandshakeConfig_get_negotiate_scid_privacy(&this_ptr_conv);
42614         return ret_conv;
42615 }
42616
42617 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1set_1negotiate_1scid_1privacy(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
42618         LDKChannelHandshakeConfig this_ptr_conv;
42619         this_ptr_conv.inner = untag_ptr(this_ptr);
42620         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42621         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42622         this_ptr_conv.is_owned = false;
42623         ChannelHandshakeConfig_set_negotiate_scid_privacy(&this_ptr_conv, val);
42624 }
42625
42626 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1announced_1channel(JNIEnv *env, jclass clz, int64_t this_ptr) {
42627         LDKChannelHandshakeConfig this_ptr_conv;
42628         this_ptr_conv.inner = untag_ptr(this_ptr);
42629         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42630         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42631         this_ptr_conv.is_owned = false;
42632         jboolean ret_conv = ChannelHandshakeConfig_get_announced_channel(&this_ptr_conv);
42633         return ret_conv;
42634 }
42635
42636 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1set_1announced_1channel(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
42637         LDKChannelHandshakeConfig this_ptr_conv;
42638         this_ptr_conv.inner = untag_ptr(this_ptr);
42639         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42640         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42641         this_ptr_conv.is_owned = false;
42642         ChannelHandshakeConfig_set_announced_channel(&this_ptr_conv, val);
42643 }
42644
42645 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1commit_1upfront_1shutdown_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
42646         LDKChannelHandshakeConfig this_ptr_conv;
42647         this_ptr_conv.inner = untag_ptr(this_ptr);
42648         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42649         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42650         this_ptr_conv.is_owned = false;
42651         jboolean ret_conv = ChannelHandshakeConfig_get_commit_upfront_shutdown_pubkey(&this_ptr_conv);
42652         return ret_conv;
42653 }
42654
42655 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1set_1commit_1upfront_1shutdown_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
42656         LDKChannelHandshakeConfig this_ptr_conv;
42657         this_ptr_conv.inner = untag_ptr(this_ptr);
42658         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42659         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42660         this_ptr_conv.is_owned = false;
42661         ChannelHandshakeConfig_set_commit_upfront_shutdown_pubkey(&this_ptr_conv, val);
42662 }
42663
42664 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1their_1channel_1reserve_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr) {
42665         LDKChannelHandshakeConfig this_ptr_conv;
42666         this_ptr_conv.inner = untag_ptr(this_ptr);
42667         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42668         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42669         this_ptr_conv.is_owned = false;
42670         int32_t ret_conv = ChannelHandshakeConfig_get_their_channel_reserve_proportional_millionths(&this_ptr_conv);
42671         return ret_conv;
42672 }
42673
42674 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) {
42675         LDKChannelHandshakeConfig this_ptr_conv;
42676         this_ptr_conv.inner = untag_ptr(this_ptr);
42677         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42678         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42679         this_ptr_conv.is_owned = false;
42680         ChannelHandshakeConfig_set_their_channel_reserve_proportional_millionths(&this_ptr_conv, val);
42681 }
42682
42683 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1negotiate_1anchors_1zero_1fee_1htlc_1tx(JNIEnv *env, jclass clz, int64_t this_ptr) {
42684         LDKChannelHandshakeConfig this_ptr_conv;
42685         this_ptr_conv.inner = untag_ptr(this_ptr);
42686         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42687         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42688         this_ptr_conv.is_owned = false;
42689         jboolean ret_conv = ChannelHandshakeConfig_get_negotiate_anchors_zero_fee_htlc_tx(&this_ptr_conv);
42690         return ret_conv;
42691 }
42692
42693 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) {
42694         LDKChannelHandshakeConfig this_ptr_conv;
42695         this_ptr_conv.inner = untag_ptr(this_ptr);
42696         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42697         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42698         this_ptr_conv.is_owned = false;
42699         ChannelHandshakeConfig_set_negotiate_anchors_zero_fee_htlc_tx(&this_ptr_conv, val);
42700 }
42701
42702 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1our_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
42703         LDKChannelHandshakeConfig this_ptr_conv;
42704         this_ptr_conv.inner = untag_ptr(this_ptr);
42705         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42706         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42707         this_ptr_conv.is_owned = false;
42708         int16_t ret_conv = ChannelHandshakeConfig_get_our_max_accepted_htlcs(&this_ptr_conv);
42709         return ret_conv;
42710 }
42711
42712 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) {
42713         LDKChannelHandshakeConfig this_ptr_conv;
42714         this_ptr_conv.inner = untag_ptr(this_ptr);
42715         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42716         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42717         this_ptr_conv.is_owned = false;
42718         ChannelHandshakeConfig_set_our_max_accepted_htlcs(&this_ptr_conv, val);
42719 }
42720
42721 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) {
42722         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);
42723         int64_t ret_ref = 0;
42724         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42725         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42726         return ret_ref;
42727 }
42728
42729 static inline uint64_t ChannelHandshakeConfig_clone_ptr(LDKChannelHandshakeConfig *NONNULL_PTR arg) {
42730         LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_clone(arg);
42731         int64_t ret_ref = 0;
42732         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42733         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42734         return ret_ref;
42735 }
42736 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
42737         LDKChannelHandshakeConfig arg_conv;
42738         arg_conv.inner = untag_ptr(arg);
42739         arg_conv.is_owned = ptr_is_owned(arg);
42740         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
42741         arg_conv.is_owned = false;
42742         int64_t ret_conv = ChannelHandshakeConfig_clone_ptr(&arg_conv);
42743         return ret_conv;
42744 }
42745
42746 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1clone(JNIEnv *env, jclass clz, int64_t orig) {
42747         LDKChannelHandshakeConfig orig_conv;
42748         orig_conv.inner = untag_ptr(orig);
42749         orig_conv.is_owned = ptr_is_owned(orig);
42750         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
42751         orig_conv.is_owned = false;
42752         LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_clone(&orig_conv);
42753         int64_t ret_ref = 0;
42754         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42755         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42756         return ret_ref;
42757 }
42758
42759 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1default(JNIEnv *env, jclass clz) {
42760         LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_default();
42761         int64_t ret_ref = 0;
42762         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42763         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42764         return ret_ref;
42765 }
42766
42767 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
42768         LDKChannelHandshakeLimits this_obj_conv;
42769         this_obj_conv.inner = untag_ptr(this_obj);
42770         this_obj_conv.is_owned = ptr_is_owned(this_obj);
42771         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
42772         ChannelHandshakeLimits_free(this_obj_conv);
42773 }
42774
42775 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1min_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
42776         LDKChannelHandshakeLimits this_ptr_conv;
42777         this_ptr_conv.inner = untag_ptr(this_ptr);
42778         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42779         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42780         this_ptr_conv.is_owned = false;
42781         int64_t ret_conv = ChannelHandshakeLimits_get_min_funding_satoshis(&this_ptr_conv);
42782         return ret_conv;
42783 }
42784
42785 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1min_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
42786         LDKChannelHandshakeLimits this_ptr_conv;
42787         this_ptr_conv.inner = untag_ptr(this_ptr);
42788         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42789         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42790         this_ptr_conv.is_owned = false;
42791         ChannelHandshakeLimits_set_min_funding_satoshis(&this_ptr_conv, val);
42792 }
42793
42794 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
42795         LDKChannelHandshakeLimits this_ptr_conv;
42796         this_ptr_conv.inner = untag_ptr(this_ptr);
42797         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42798         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42799         this_ptr_conv.is_owned = false;
42800         int64_t ret_conv = ChannelHandshakeLimits_get_max_funding_satoshis(&this_ptr_conv);
42801         return ret_conv;
42802 }
42803
42804 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1max_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
42805         LDKChannelHandshakeLimits this_ptr_conv;
42806         this_ptr_conv.inner = untag_ptr(this_ptr);
42807         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42808         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42809         this_ptr_conv.is_owned = false;
42810         ChannelHandshakeLimits_set_max_funding_satoshis(&this_ptr_conv, val);
42811 }
42812
42813 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
42814         LDKChannelHandshakeLimits this_ptr_conv;
42815         this_ptr_conv.inner = untag_ptr(this_ptr);
42816         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42817         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42818         this_ptr_conv.is_owned = false;
42819         int64_t ret_conv = ChannelHandshakeLimits_get_max_htlc_minimum_msat(&this_ptr_conv);
42820         return ret_conv;
42821 }
42822
42823 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) {
42824         LDKChannelHandshakeLimits this_ptr_conv;
42825         this_ptr_conv.inner = untag_ptr(this_ptr);
42826         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42827         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42828         this_ptr_conv.is_owned = false;
42829         ChannelHandshakeLimits_set_max_htlc_minimum_msat(&this_ptr_conv, val);
42830 }
42831
42832 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) {
42833         LDKChannelHandshakeLimits this_ptr_conv;
42834         this_ptr_conv.inner = untag_ptr(this_ptr);
42835         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42836         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42837         this_ptr_conv.is_owned = false;
42838         int64_t ret_conv = ChannelHandshakeLimits_get_min_max_htlc_value_in_flight_msat(&this_ptr_conv);
42839         return ret_conv;
42840 }
42841
42842 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) {
42843         LDKChannelHandshakeLimits this_ptr_conv;
42844         this_ptr_conv.inner = untag_ptr(this_ptr);
42845         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42846         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42847         this_ptr_conv.is_owned = false;
42848         ChannelHandshakeLimits_set_min_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
42849 }
42850
42851 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1channel_1reserve_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
42852         LDKChannelHandshakeLimits this_ptr_conv;
42853         this_ptr_conv.inner = untag_ptr(this_ptr);
42854         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42855         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42856         this_ptr_conv.is_owned = false;
42857         int64_t ret_conv = ChannelHandshakeLimits_get_max_channel_reserve_satoshis(&this_ptr_conv);
42858         return ret_conv;
42859 }
42860
42861 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) {
42862         LDKChannelHandshakeLimits this_ptr_conv;
42863         this_ptr_conv.inner = untag_ptr(this_ptr);
42864         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
42865         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
42866         this_ptr_conv.is_owned = false;
42867         ChannelHandshakeLimits_set_max_channel_reserve_satoshis(&this_ptr_conv, val);
42868 }
42869
42870 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1min_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
42871         LDKChannelHandshakeLimits 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         int16_t ret_conv = ChannelHandshakeLimits_get_min_max_accepted_htlcs(&this_ptr_conv);
42877         return ret_conv;
42878 }
42879
42880 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) {
42881         LDKChannelHandshakeLimits 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         ChannelHandshakeLimits_set_min_max_accepted_htlcs(&this_ptr_conv, val);
42887 }
42888
42889 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr) {
42890         LDKChannelHandshakeLimits 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         int32_t ret_conv = ChannelHandshakeLimits_get_max_minimum_depth(&this_ptr_conv);
42896         return ret_conv;
42897 }
42898
42899 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1max_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
42900         LDKChannelHandshakeLimits 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         ChannelHandshakeLimits_set_max_minimum_depth(&this_ptr_conv, val);
42906 }
42907
42908 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1trust_1own_1funding_10conf(JNIEnv *env, jclass clz, int64_t this_ptr) {
42909         LDKChannelHandshakeLimits 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         jboolean ret_conv = ChannelHandshakeLimits_get_trust_own_funding_0conf(&this_ptr_conv);
42915         return ret_conv;
42916 }
42917
42918 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1trust_1own_1funding_10conf(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
42919         LDKChannelHandshakeLimits 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         ChannelHandshakeLimits_set_trust_own_funding_0conf(&this_ptr_conv, val);
42925 }
42926
42927 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1force_1announced_1channel_1preference(JNIEnv *env, jclass clz, int64_t this_ptr) {
42928         LDKChannelHandshakeLimits 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         jboolean ret_conv = ChannelHandshakeLimits_get_force_announced_channel_preference(&this_ptr_conv);
42934         return ret_conv;
42935 }
42936
42937 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1force_1announced_1channel_1preference(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
42938         LDKChannelHandshakeLimits 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         ChannelHandshakeLimits_set_force_announced_channel_preference(&this_ptr_conv, val);
42944 }
42945
42946 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1their_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
42947         LDKChannelHandshakeLimits 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         int16_t ret_conv = ChannelHandshakeLimits_get_their_to_self_delay(&this_ptr_conv);
42953         return ret_conv;
42954 }
42955
42956 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) {
42957         LDKChannelHandshakeLimits 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         ChannelHandshakeLimits_set_their_to_self_delay(&this_ptr_conv, val);
42963 }
42964
42965 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) {
42966         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);
42967         int64_t ret_ref = 0;
42968         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42969         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42970         return ret_ref;
42971 }
42972
42973 static inline uint64_t ChannelHandshakeLimits_clone_ptr(LDKChannelHandshakeLimits *NONNULL_PTR arg) {
42974         LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_clone(arg);
42975         int64_t ret_ref = 0;
42976         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42977         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
42978         return ret_ref;
42979 }
42980 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
42981         LDKChannelHandshakeLimits arg_conv;
42982         arg_conv.inner = untag_ptr(arg);
42983         arg_conv.is_owned = ptr_is_owned(arg);
42984         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
42985         arg_conv.is_owned = false;
42986         int64_t ret_conv = ChannelHandshakeLimits_clone_ptr(&arg_conv);
42987         return ret_conv;
42988 }
42989
42990 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1clone(JNIEnv *env, jclass clz, int64_t orig) {
42991         LDKChannelHandshakeLimits orig_conv;
42992         orig_conv.inner = untag_ptr(orig);
42993         orig_conv.is_owned = ptr_is_owned(orig);
42994         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
42995         orig_conv.is_owned = false;
42996         LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_clone(&orig_conv);
42997         int64_t ret_ref = 0;
42998         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
42999         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43000         return ret_ref;
43001 }
43002
43003 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1default(JNIEnv *env, jclass clz) {
43004         LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_default();
43005         int64_t ret_ref = 0;
43006         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43007         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43008         return ret_ref;
43009 }
43010
43011 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MaxDustHTLCExposure_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
43012         if (!ptr_is_owned(this_ptr)) return;
43013         void* this_ptr_ptr = untag_ptr(this_ptr);
43014         CHECK_ACCESS(this_ptr_ptr);
43015         LDKMaxDustHTLCExposure this_ptr_conv = *(LDKMaxDustHTLCExposure*)(this_ptr_ptr);
43016         FREE(untag_ptr(this_ptr));
43017         MaxDustHTLCExposure_free(this_ptr_conv);
43018 }
43019
43020 static inline uint64_t MaxDustHTLCExposure_clone_ptr(LDKMaxDustHTLCExposure *NONNULL_PTR arg) {
43021         LDKMaxDustHTLCExposure *ret_copy = MALLOC(sizeof(LDKMaxDustHTLCExposure), "LDKMaxDustHTLCExposure");
43022         *ret_copy = MaxDustHTLCExposure_clone(arg);
43023         int64_t ret_ref = tag_ptr(ret_copy, true);
43024         return ret_ref;
43025 }
43026 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MaxDustHTLCExposure_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
43027         LDKMaxDustHTLCExposure* arg_conv = (LDKMaxDustHTLCExposure*)untag_ptr(arg);
43028         int64_t ret_conv = MaxDustHTLCExposure_clone_ptr(arg_conv);
43029         return ret_conv;
43030 }
43031
43032 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MaxDustHTLCExposure_1clone(JNIEnv *env, jclass clz, int64_t orig) {
43033         LDKMaxDustHTLCExposure* orig_conv = (LDKMaxDustHTLCExposure*)untag_ptr(orig);
43034         LDKMaxDustHTLCExposure *ret_copy = MALLOC(sizeof(LDKMaxDustHTLCExposure), "LDKMaxDustHTLCExposure");
43035         *ret_copy = MaxDustHTLCExposure_clone(orig_conv);
43036         int64_t ret_ref = tag_ptr(ret_copy, true);
43037         return ret_ref;
43038 }
43039
43040 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MaxDustHTLCExposure_1fixed_1limit_1msat(JNIEnv *env, jclass clz, int64_t a) {
43041         LDKMaxDustHTLCExposure *ret_copy = MALLOC(sizeof(LDKMaxDustHTLCExposure), "LDKMaxDustHTLCExposure");
43042         *ret_copy = MaxDustHTLCExposure_fixed_limit_msat(a);
43043         int64_t ret_ref = tag_ptr(ret_copy, true);
43044         return ret_ref;
43045 }
43046
43047 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MaxDustHTLCExposure_1fee_1rate_1multiplier(JNIEnv *env, jclass clz, int64_t a) {
43048         LDKMaxDustHTLCExposure *ret_copy = MALLOC(sizeof(LDKMaxDustHTLCExposure), "LDKMaxDustHTLCExposure");
43049         *ret_copy = MaxDustHTLCExposure_fee_rate_multiplier(a);
43050         int64_t ret_ref = tag_ptr(ret_copy, true);
43051         return ret_ref;
43052 }
43053
43054 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_MaxDustHTLCExposure_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
43055         LDKMaxDustHTLCExposure* a_conv = (LDKMaxDustHTLCExposure*)untag_ptr(a);
43056         LDKMaxDustHTLCExposure* b_conv = (LDKMaxDustHTLCExposure*)untag_ptr(b);
43057         jboolean ret_conv = MaxDustHTLCExposure_eq(a_conv, b_conv);
43058         return ret_conv;
43059 }
43060
43061 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_MaxDustHTLCExposure_1write(JNIEnv *env, jclass clz, int64_t obj) {
43062         LDKMaxDustHTLCExposure* obj_conv = (LDKMaxDustHTLCExposure*)untag_ptr(obj);
43063         LDKCVec_u8Z ret_var = MaxDustHTLCExposure_write(obj_conv);
43064         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
43065         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
43066         CVec_u8Z_free(ret_var);
43067         return ret_arr;
43068 }
43069
43070 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MaxDustHTLCExposure_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
43071         LDKu8slice ser_ref;
43072         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
43073         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
43074         LDKCResult_MaxDustHTLCExposureDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_MaxDustHTLCExposureDecodeErrorZ), "LDKCResult_MaxDustHTLCExposureDecodeErrorZ");
43075         *ret_conv = MaxDustHTLCExposure_read(ser_ref);
43076         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
43077         return tag_ptr(ret_conv, true);
43078 }
43079
43080 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
43081         LDKChannelConfig this_obj_conv;
43082         this_obj_conv.inner = untag_ptr(this_obj);
43083         this_obj_conv.is_owned = ptr_is_owned(this_obj);
43084         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43085         ChannelConfig_free(this_obj_conv);
43086 }
43087
43088 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1forwarding_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr) {
43089         LDKChannelConfig this_ptr_conv;
43090         this_ptr_conv.inner = untag_ptr(this_ptr);
43091         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43092         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43093         this_ptr_conv.is_owned = false;
43094         int32_t ret_conv = ChannelConfig_get_forwarding_fee_proportional_millionths(&this_ptr_conv);
43095         return ret_conv;
43096 }
43097
43098 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) {
43099         LDKChannelConfig this_ptr_conv;
43100         this_ptr_conv.inner = untag_ptr(this_ptr);
43101         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43102         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43103         this_ptr_conv.is_owned = false;
43104         ChannelConfig_set_forwarding_fee_proportional_millionths(&this_ptr_conv, val);
43105 }
43106
43107 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1forwarding_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
43108         LDKChannelConfig this_ptr_conv;
43109         this_ptr_conv.inner = untag_ptr(this_ptr);
43110         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43111         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43112         this_ptr_conv.is_owned = false;
43113         int32_t ret_conv = ChannelConfig_get_forwarding_fee_base_msat(&this_ptr_conv);
43114         return ret_conv;
43115 }
43116
43117 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) {
43118         LDKChannelConfig this_ptr_conv;
43119         this_ptr_conv.inner = untag_ptr(this_ptr);
43120         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43121         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43122         this_ptr_conv.is_owned = false;
43123         ChannelConfig_set_forwarding_fee_base_msat(&this_ptr_conv, val);
43124 }
43125
43126 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
43127         LDKChannelConfig this_ptr_conv;
43128         this_ptr_conv.inner = untag_ptr(this_ptr);
43129         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43130         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43131         this_ptr_conv.is_owned = false;
43132         int16_t ret_conv = ChannelConfig_get_cltv_expiry_delta(&this_ptr_conv);
43133         return ret_conv;
43134 }
43135
43136 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
43137         LDKChannelConfig this_ptr_conv;
43138         this_ptr_conv.inner = untag_ptr(this_ptr);
43139         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43140         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43141         this_ptr_conv.is_owned = false;
43142         ChannelConfig_set_cltv_expiry_delta(&this_ptr_conv, val);
43143 }
43144
43145 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1max_1dust_1htlc_1exposure(JNIEnv *env, jclass clz, int64_t this_ptr) {
43146         LDKChannelConfig this_ptr_conv;
43147         this_ptr_conv.inner = untag_ptr(this_ptr);
43148         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43149         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43150         this_ptr_conv.is_owned = false;
43151         LDKMaxDustHTLCExposure *ret_copy = MALLOC(sizeof(LDKMaxDustHTLCExposure), "LDKMaxDustHTLCExposure");
43152         *ret_copy = ChannelConfig_get_max_dust_htlc_exposure(&this_ptr_conv);
43153         int64_t ret_ref = tag_ptr(ret_copy, true);
43154         return ret_ref;
43155 }
43156
43157 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) {
43158         LDKChannelConfig this_ptr_conv;
43159         this_ptr_conv.inner = untag_ptr(this_ptr);
43160         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43161         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43162         this_ptr_conv.is_owned = false;
43163         void* val_ptr = untag_ptr(val);
43164         CHECK_ACCESS(val_ptr);
43165         LDKMaxDustHTLCExposure val_conv = *(LDKMaxDustHTLCExposure*)(val_ptr);
43166         val_conv = MaxDustHTLCExposure_clone((LDKMaxDustHTLCExposure*)untag_ptr(val));
43167         ChannelConfig_set_max_dust_htlc_exposure(&this_ptr_conv, val_conv);
43168 }
43169
43170 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) {
43171         LDKChannelConfig this_ptr_conv;
43172         this_ptr_conv.inner = untag_ptr(this_ptr);
43173         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43174         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43175         this_ptr_conv.is_owned = false;
43176         int64_t ret_conv = ChannelConfig_get_force_close_avoidance_max_fee_satoshis(&this_ptr_conv);
43177         return ret_conv;
43178 }
43179
43180 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) {
43181         LDKChannelConfig this_ptr_conv;
43182         this_ptr_conv.inner = untag_ptr(this_ptr);
43183         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43184         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43185         this_ptr_conv.is_owned = false;
43186         ChannelConfig_set_force_close_avoidance_max_fee_satoshis(&this_ptr_conv, val);
43187 }
43188
43189 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1accept_1underpaying_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
43190         LDKChannelConfig this_ptr_conv;
43191         this_ptr_conv.inner = untag_ptr(this_ptr);
43192         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43193         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43194         this_ptr_conv.is_owned = false;
43195         jboolean ret_conv = ChannelConfig_get_accept_underpaying_htlcs(&this_ptr_conv);
43196         return ret_conv;
43197 }
43198
43199 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1accept_1underpaying_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
43200         LDKChannelConfig this_ptr_conv;
43201         this_ptr_conv.inner = untag_ptr(this_ptr);
43202         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43203         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43204         this_ptr_conv.is_owned = false;
43205         ChannelConfig_set_accept_underpaying_htlcs(&this_ptr_conv, val);
43206 }
43207
43208 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) {
43209         void* max_dust_htlc_exposure_arg_ptr = untag_ptr(max_dust_htlc_exposure_arg);
43210         CHECK_ACCESS(max_dust_htlc_exposure_arg_ptr);
43211         LDKMaxDustHTLCExposure max_dust_htlc_exposure_arg_conv = *(LDKMaxDustHTLCExposure*)(max_dust_htlc_exposure_arg_ptr);
43212         max_dust_htlc_exposure_arg_conv = MaxDustHTLCExposure_clone((LDKMaxDustHTLCExposure*)untag_ptr(max_dust_htlc_exposure_arg));
43213         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);
43214         int64_t ret_ref = 0;
43215         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43216         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43217         return ret_ref;
43218 }
43219
43220 static inline uint64_t ChannelConfig_clone_ptr(LDKChannelConfig *NONNULL_PTR arg) {
43221         LDKChannelConfig ret_var = ChannelConfig_clone(arg);
43222         int64_t ret_ref = 0;
43223         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43224         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43225         return ret_ref;
43226 }
43227 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
43228         LDKChannelConfig arg_conv;
43229         arg_conv.inner = untag_ptr(arg);
43230         arg_conv.is_owned = ptr_is_owned(arg);
43231         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
43232         arg_conv.is_owned = false;
43233         int64_t ret_conv = ChannelConfig_clone_ptr(&arg_conv);
43234         return ret_conv;
43235 }
43236
43237 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1clone(JNIEnv *env, jclass clz, int64_t orig) {
43238         LDKChannelConfig orig_conv;
43239         orig_conv.inner = untag_ptr(orig);
43240         orig_conv.is_owned = ptr_is_owned(orig);
43241         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
43242         orig_conv.is_owned = false;
43243         LDKChannelConfig ret_var = ChannelConfig_clone(&orig_conv);
43244         int64_t ret_ref = 0;
43245         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43246         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43247         return ret_ref;
43248 }
43249
43250 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
43251         LDKChannelConfig a_conv;
43252         a_conv.inner = untag_ptr(a);
43253         a_conv.is_owned = ptr_is_owned(a);
43254         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
43255         a_conv.is_owned = false;
43256         LDKChannelConfig b_conv;
43257         b_conv.inner = untag_ptr(b);
43258         b_conv.is_owned = ptr_is_owned(b);
43259         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
43260         b_conv.is_owned = false;
43261         jboolean ret_conv = ChannelConfig_eq(&a_conv, &b_conv);
43262         return ret_conv;
43263 }
43264
43265 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1apply(JNIEnv *env, jclass clz, int64_t this_arg, int64_t update) {
43266         LDKChannelConfig this_arg_conv;
43267         this_arg_conv.inner = untag_ptr(this_arg);
43268         this_arg_conv.is_owned = ptr_is_owned(this_arg);
43269         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
43270         this_arg_conv.is_owned = false;
43271         LDKChannelConfigUpdate update_conv;
43272         update_conv.inner = untag_ptr(update);
43273         update_conv.is_owned = ptr_is_owned(update);
43274         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_conv);
43275         update_conv.is_owned = false;
43276         ChannelConfig_apply(&this_arg_conv, &update_conv);
43277 }
43278
43279 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1default(JNIEnv *env, jclass clz) {
43280         LDKChannelConfig ret_var = ChannelConfig_default();
43281         int64_t ret_ref = 0;
43282         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43283         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43284         return ret_ref;
43285 }
43286
43287 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1write(JNIEnv *env, jclass clz, int64_t obj) {
43288         LDKChannelConfig obj_conv;
43289         obj_conv.inner = untag_ptr(obj);
43290         obj_conv.is_owned = ptr_is_owned(obj);
43291         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
43292         obj_conv.is_owned = false;
43293         LDKCVec_u8Z ret_var = ChannelConfig_write(&obj_conv);
43294         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
43295         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
43296         CVec_u8Z_free(ret_var);
43297         return ret_arr;
43298 }
43299
43300 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
43301         LDKu8slice ser_ref;
43302         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
43303         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
43304         LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
43305         *ret_conv = ChannelConfig_read(ser_ref);
43306         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
43307         return tag_ptr(ret_conv, true);
43308 }
43309
43310 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfigUpdate_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
43311         LDKChannelConfigUpdate this_obj_conv;
43312         this_obj_conv.inner = untag_ptr(this_obj);
43313         this_obj_conv.is_owned = ptr_is_owned(this_obj);
43314         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43315         ChannelConfigUpdate_free(this_obj_conv);
43316 }
43317
43318 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfigUpdate_1get_1forwarding_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr) {
43319         LDKChannelConfigUpdate this_ptr_conv;
43320         this_ptr_conv.inner = untag_ptr(this_ptr);
43321         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43322         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43323         this_ptr_conv.is_owned = false;
43324         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
43325         *ret_copy = ChannelConfigUpdate_get_forwarding_fee_proportional_millionths(&this_ptr_conv);
43326         int64_t ret_ref = tag_ptr(ret_copy, true);
43327         return ret_ref;
43328 }
43329
43330 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) {
43331         LDKChannelConfigUpdate this_ptr_conv;
43332         this_ptr_conv.inner = untag_ptr(this_ptr);
43333         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43334         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43335         this_ptr_conv.is_owned = false;
43336         void* val_ptr = untag_ptr(val);
43337         CHECK_ACCESS(val_ptr);
43338         LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
43339         val_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(val));
43340         ChannelConfigUpdate_set_forwarding_fee_proportional_millionths(&this_ptr_conv, val_conv);
43341 }
43342
43343 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfigUpdate_1get_1forwarding_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
43344         LDKChannelConfigUpdate this_ptr_conv;
43345         this_ptr_conv.inner = untag_ptr(this_ptr);
43346         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43347         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43348         this_ptr_conv.is_owned = false;
43349         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
43350         *ret_copy = ChannelConfigUpdate_get_forwarding_fee_base_msat(&this_ptr_conv);
43351         int64_t ret_ref = tag_ptr(ret_copy, true);
43352         return ret_ref;
43353 }
43354
43355 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) {
43356         LDKChannelConfigUpdate this_ptr_conv;
43357         this_ptr_conv.inner = untag_ptr(this_ptr);
43358         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43359         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43360         this_ptr_conv.is_owned = false;
43361         void* val_ptr = untag_ptr(val);
43362         CHECK_ACCESS(val_ptr);
43363         LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
43364         val_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(val));
43365         ChannelConfigUpdate_set_forwarding_fee_base_msat(&this_ptr_conv, val_conv);
43366 }
43367
43368 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfigUpdate_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
43369         LDKChannelConfigUpdate this_ptr_conv;
43370         this_ptr_conv.inner = untag_ptr(this_ptr);
43371         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43372         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43373         this_ptr_conv.is_owned = false;
43374         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
43375         *ret_copy = ChannelConfigUpdate_get_cltv_expiry_delta(&this_ptr_conv);
43376         int64_t ret_ref = tag_ptr(ret_copy, true);
43377         return ret_ref;
43378 }
43379
43380 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfigUpdate_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
43381         LDKChannelConfigUpdate this_ptr_conv;
43382         this_ptr_conv.inner = untag_ptr(this_ptr);
43383         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43384         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43385         this_ptr_conv.is_owned = false;
43386         void* val_ptr = untag_ptr(val);
43387         CHECK_ACCESS(val_ptr);
43388         LDKCOption_u16Z val_conv = *(LDKCOption_u16Z*)(val_ptr);
43389         val_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(val));
43390         ChannelConfigUpdate_set_cltv_expiry_delta(&this_ptr_conv, val_conv);
43391 }
43392
43393 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfigUpdate_1get_1max_1dust_1htlc_1exposure_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
43394         LDKChannelConfigUpdate this_ptr_conv;
43395         this_ptr_conv.inner = untag_ptr(this_ptr);
43396         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43397         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43398         this_ptr_conv.is_owned = false;
43399         LDKCOption_MaxDustHTLCExposureZ *ret_copy = MALLOC(sizeof(LDKCOption_MaxDustHTLCExposureZ), "LDKCOption_MaxDustHTLCExposureZ");
43400         *ret_copy = ChannelConfigUpdate_get_max_dust_htlc_exposure_msat(&this_ptr_conv);
43401         int64_t ret_ref = tag_ptr(ret_copy, true);
43402         return ret_ref;
43403 }
43404
43405 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) {
43406         LDKChannelConfigUpdate this_ptr_conv;
43407         this_ptr_conv.inner = untag_ptr(this_ptr);
43408         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43409         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43410         this_ptr_conv.is_owned = false;
43411         void* val_ptr = untag_ptr(val);
43412         CHECK_ACCESS(val_ptr);
43413         LDKCOption_MaxDustHTLCExposureZ val_conv = *(LDKCOption_MaxDustHTLCExposureZ*)(val_ptr);
43414         val_conv = COption_MaxDustHTLCExposureZ_clone((LDKCOption_MaxDustHTLCExposureZ*)untag_ptr(val));
43415         ChannelConfigUpdate_set_max_dust_htlc_exposure_msat(&this_ptr_conv, val_conv);
43416 }
43417
43418 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) {
43419         LDKChannelConfigUpdate this_ptr_conv;
43420         this_ptr_conv.inner = untag_ptr(this_ptr);
43421         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43422         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43423         this_ptr_conv.is_owned = false;
43424         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
43425         *ret_copy = ChannelConfigUpdate_get_force_close_avoidance_max_fee_satoshis(&this_ptr_conv);
43426         int64_t ret_ref = tag_ptr(ret_copy, true);
43427         return ret_ref;
43428 }
43429
43430 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) {
43431         LDKChannelConfigUpdate this_ptr_conv;
43432         this_ptr_conv.inner = untag_ptr(this_ptr);
43433         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43434         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43435         this_ptr_conv.is_owned = false;
43436         void* val_ptr = untag_ptr(val);
43437         CHECK_ACCESS(val_ptr);
43438         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
43439         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
43440         ChannelConfigUpdate_set_force_close_avoidance_max_fee_satoshis(&this_ptr_conv, val_conv);
43441 }
43442
43443 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) {
43444         void* forwarding_fee_proportional_millionths_arg_ptr = untag_ptr(forwarding_fee_proportional_millionths_arg);
43445         CHECK_ACCESS(forwarding_fee_proportional_millionths_arg_ptr);
43446         LDKCOption_u32Z forwarding_fee_proportional_millionths_arg_conv = *(LDKCOption_u32Z*)(forwarding_fee_proportional_millionths_arg_ptr);
43447         forwarding_fee_proportional_millionths_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(forwarding_fee_proportional_millionths_arg));
43448         void* forwarding_fee_base_msat_arg_ptr = untag_ptr(forwarding_fee_base_msat_arg);
43449         CHECK_ACCESS(forwarding_fee_base_msat_arg_ptr);
43450         LDKCOption_u32Z forwarding_fee_base_msat_arg_conv = *(LDKCOption_u32Z*)(forwarding_fee_base_msat_arg_ptr);
43451         forwarding_fee_base_msat_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(forwarding_fee_base_msat_arg));
43452         void* cltv_expiry_delta_arg_ptr = untag_ptr(cltv_expiry_delta_arg);
43453         CHECK_ACCESS(cltv_expiry_delta_arg_ptr);
43454         LDKCOption_u16Z cltv_expiry_delta_arg_conv = *(LDKCOption_u16Z*)(cltv_expiry_delta_arg_ptr);
43455         cltv_expiry_delta_arg_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(cltv_expiry_delta_arg));
43456         void* max_dust_htlc_exposure_msat_arg_ptr = untag_ptr(max_dust_htlc_exposure_msat_arg);
43457         CHECK_ACCESS(max_dust_htlc_exposure_msat_arg_ptr);
43458         LDKCOption_MaxDustHTLCExposureZ max_dust_htlc_exposure_msat_arg_conv = *(LDKCOption_MaxDustHTLCExposureZ*)(max_dust_htlc_exposure_msat_arg_ptr);
43459         max_dust_htlc_exposure_msat_arg_conv = COption_MaxDustHTLCExposureZ_clone((LDKCOption_MaxDustHTLCExposureZ*)untag_ptr(max_dust_htlc_exposure_msat_arg));
43460         void* force_close_avoidance_max_fee_satoshis_arg_ptr = untag_ptr(force_close_avoidance_max_fee_satoshis_arg);
43461         CHECK_ACCESS(force_close_avoidance_max_fee_satoshis_arg_ptr);
43462         LDKCOption_u64Z force_close_avoidance_max_fee_satoshis_arg_conv = *(LDKCOption_u64Z*)(force_close_avoidance_max_fee_satoshis_arg_ptr);
43463         force_close_avoidance_max_fee_satoshis_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(force_close_avoidance_max_fee_satoshis_arg));
43464         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);
43465         int64_t ret_ref = 0;
43466         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43467         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43468         return ret_ref;
43469 }
43470
43471 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfigUpdate_1default(JNIEnv *env, jclass clz) {
43472         LDKChannelConfigUpdate ret_var = ChannelConfigUpdate_default();
43473         int64_t ret_ref = 0;
43474         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43475         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43476         return ret_ref;
43477 }
43478
43479 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
43480         LDKUserConfig this_obj_conv;
43481         this_obj_conv.inner = untag_ptr(this_obj);
43482         this_obj_conv.is_owned = ptr_is_owned(this_obj);
43483         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43484         UserConfig_free(this_obj_conv);
43485 }
43486
43487 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1channel_1handshake_1config(JNIEnv *env, jclass clz, int64_t this_ptr) {
43488         LDKUserConfig this_ptr_conv;
43489         this_ptr_conv.inner = untag_ptr(this_ptr);
43490         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43491         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43492         this_ptr_conv.is_owned = false;
43493         LDKChannelHandshakeConfig ret_var = UserConfig_get_channel_handshake_config(&this_ptr_conv);
43494         int64_t ret_ref = 0;
43495         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43496         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43497         return ret_ref;
43498 }
43499
43500 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1channel_1handshake_1config(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
43501         LDKUserConfig this_ptr_conv;
43502         this_ptr_conv.inner = untag_ptr(this_ptr);
43503         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43504         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43505         this_ptr_conv.is_owned = false;
43506         LDKChannelHandshakeConfig val_conv;
43507         val_conv.inner = untag_ptr(val);
43508         val_conv.is_owned = ptr_is_owned(val);
43509         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
43510         val_conv = ChannelHandshakeConfig_clone(&val_conv);
43511         UserConfig_set_channel_handshake_config(&this_ptr_conv, val_conv);
43512 }
43513
43514 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1channel_1handshake_1limits(JNIEnv *env, jclass clz, int64_t this_ptr) {
43515         LDKUserConfig this_ptr_conv;
43516         this_ptr_conv.inner = untag_ptr(this_ptr);
43517         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43518         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43519         this_ptr_conv.is_owned = false;
43520         LDKChannelHandshakeLimits ret_var = UserConfig_get_channel_handshake_limits(&this_ptr_conv);
43521         int64_t ret_ref = 0;
43522         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43523         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43524         return ret_ref;
43525 }
43526
43527 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1channel_1handshake_1limits(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
43528         LDKUserConfig this_ptr_conv;
43529         this_ptr_conv.inner = untag_ptr(this_ptr);
43530         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43531         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43532         this_ptr_conv.is_owned = false;
43533         LDKChannelHandshakeLimits val_conv;
43534         val_conv.inner = untag_ptr(val);
43535         val_conv.is_owned = ptr_is_owned(val);
43536         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
43537         val_conv = ChannelHandshakeLimits_clone(&val_conv);
43538         UserConfig_set_channel_handshake_limits(&this_ptr_conv, val_conv);
43539 }
43540
43541 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1channel_1config(JNIEnv *env, jclass clz, int64_t this_ptr) {
43542         LDKUserConfig 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         LDKChannelConfig ret_var = UserConfig_get_channel_config(&this_ptr_conv);
43548         int64_t ret_ref = 0;
43549         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43550         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43551         return ret_ref;
43552 }
43553
43554 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1channel_1config(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
43555         LDKUserConfig this_ptr_conv;
43556         this_ptr_conv.inner = untag_ptr(this_ptr);
43557         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43558         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43559         this_ptr_conv.is_owned = false;
43560         LDKChannelConfig val_conv;
43561         val_conv.inner = untag_ptr(val);
43562         val_conv.is_owned = ptr_is_owned(val);
43563         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
43564         val_conv = ChannelConfig_clone(&val_conv);
43565         UserConfig_set_channel_config(&this_ptr_conv, val_conv);
43566 }
43567
43568 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1accept_1forwards_1to_1priv_1channels(JNIEnv *env, jclass clz, int64_t this_ptr) {
43569         LDKUserConfig this_ptr_conv;
43570         this_ptr_conv.inner = untag_ptr(this_ptr);
43571         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43572         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43573         this_ptr_conv.is_owned = false;
43574         jboolean ret_conv = UserConfig_get_accept_forwards_to_priv_channels(&this_ptr_conv);
43575         return ret_conv;
43576 }
43577
43578 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) {
43579         LDKUserConfig this_ptr_conv;
43580         this_ptr_conv.inner = untag_ptr(this_ptr);
43581         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43582         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43583         this_ptr_conv.is_owned = false;
43584         UserConfig_set_accept_forwards_to_priv_channels(&this_ptr_conv, val);
43585 }
43586
43587 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1accept_1inbound_1channels(JNIEnv *env, jclass clz, int64_t this_ptr) {
43588         LDKUserConfig this_ptr_conv;
43589         this_ptr_conv.inner = untag_ptr(this_ptr);
43590         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43591         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43592         this_ptr_conv.is_owned = false;
43593         jboolean ret_conv = UserConfig_get_accept_inbound_channels(&this_ptr_conv);
43594         return ret_conv;
43595 }
43596
43597 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1accept_1inbound_1channels(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
43598         LDKUserConfig this_ptr_conv;
43599         this_ptr_conv.inner = untag_ptr(this_ptr);
43600         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43601         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43602         this_ptr_conv.is_owned = false;
43603         UserConfig_set_accept_inbound_channels(&this_ptr_conv, val);
43604 }
43605
43606 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1manually_1accept_1inbound_1channels(JNIEnv *env, jclass clz, int64_t this_ptr) {
43607         LDKUserConfig this_ptr_conv;
43608         this_ptr_conv.inner = untag_ptr(this_ptr);
43609         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43610         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43611         this_ptr_conv.is_owned = false;
43612         jboolean ret_conv = UserConfig_get_manually_accept_inbound_channels(&this_ptr_conv);
43613         return ret_conv;
43614 }
43615
43616 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1manually_1accept_1inbound_1channels(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
43617         LDKUserConfig this_ptr_conv;
43618         this_ptr_conv.inner = untag_ptr(this_ptr);
43619         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43620         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43621         this_ptr_conv.is_owned = false;
43622         UserConfig_set_manually_accept_inbound_channels(&this_ptr_conv, val);
43623 }
43624
43625 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1accept_1intercept_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
43626         LDKUserConfig this_ptr_conv;
43627         this_ptr_conv.inner = untag_ptr(this_ptr);
43628         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43629         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43630         this_ptr_conv.is_owned = false;
43631         jboolean ret_conv = UserConfig_get_accept_intercept_htlcs(&this_ptr_conv);
43632         return ret_conv;
43633 }
43634
43635 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1accept_1intercept_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
43636         LDKUserConfig this_ptr_conv;
43637         this_ptr_conv.inner = untag_ptr(this_ptr);
43638         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43639         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43640         this_ptr_conv.is_owned = false;
43641         UserConfig_set_accept_intercept_htlcs(&this_ptr_conv, val);
43642 }
43643
43644 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1accept_1mpp_1keysend(JNIEnv *env, jclass clz, int64_t this_ptr) {
43645         LDKUserConfig this_ptr_conv;
43646         this_ptr_conv.inner = untag_ptr(this_ptr);
43647         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43648         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43649         this_ptr_conv.is_owned = false;
43650         jboolean ret_conv = UserConfig_get_accept_mpp_keysend(&this_ptr_conv);
43651         return ret_conv;
43652 }
43653
43654 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1accept_1mpp_1keysend(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
43655         LDKUserConfig this_ptr_conv;
43656         this_ptr_conv.inner = untag_ptr(this_ptr);
43657         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43658         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43659         this_ptr_conv.is_owned = false;
43660         UserConfig_set_accept_mpp_keysend(&this_ptr_conv, val);
43661 }
43662
43663 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) {
43664         LDKChannelHandshakeConfig channel_handshake_config_arg_conv;
43665         channel_handshake_config_arg_conv.inner = untag_ptr(channel_handshake_config_arg);
43666         channel_handshake_config_arg_conv.is_owned = ptr_is_owned(channel_handshake_config_arg);
43667         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_handshake_config_arg_conv);
43668         channel_handshake_config_arg_conv = ChannelHandshakeConfig_clone(&channel_handshake_config_arg_conv);
43669         LDKChannelHandshakeLimits channel_handshake_limits_arg_conv;
43670         channel_handshake_limits_arg_conv.inner = untag_ptr(channel_handshake_limits_arg);
43671         channel_handshake_limits_arg_conv.is_owned = ptr_is_owned(channel_handshake_limits_arg);
43672         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_handshake_limits_arg_conv);
43673         channel_handshake_limits_arg_conv = ChannelHandshakeLimits_clone(&channel_handshake_limits_arg_conv);
43674         LDKChannelConfig channel_config_arg_conv;
43675         channel_config_arg_conv.inner = untag_ptr(channel_config_arg);
43676         channel_config_arg_conv.is_owned = ptr_is_owned(channel_config_arg);
43677         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_config_arg_conv);
43678         channel_config_arg_conv = ChannelConfig_clone(&channel_config_arg_conv);
43679         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);
43680         int64_t ret_ref = 0;
43681         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43682         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43683         return ret_ref;
43684 }
43685
43686 static inline uint64_t UserConfig_clone_ptr(LDKUserConfig *NONNULL_PTR arg) {
43687         LDKUserConfig ret_var = UserConfig_clone(arg);
43688         int64_t ret_ref = 0;
43689         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43690         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43691         return ret_ref;
43692 }
43693 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
43694         LDKUserConfig arg_conv;
43695         arg_conv.inner = untag_ptr(arg);
43696         arg_conv.is_owned = ptr_is_owned(arg);
43697         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
43698         arg_conv.is_owned = false;
43699         int64_t ret_conv = UserConfig_clone_ptr(&arg_conv);
43700         return ret_conv;
43701 }
43702
43703 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1clone(JNIEnv *env, jclass clz, int64_t orig) {
43704         LDKUserConfig orig_conv;
43705         orig_conv.inner = untag_ptr(orig);
43706         orig_conv.is_owned = ptr_is_owned(orig);
43707         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
43708         orig_conv.is_owned = false;
43709         LDKUserConfig ret_var = UserConfig_clone(&orig_conv);
43710         int64_t ret_ref = 0;
43711         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43712         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43713         return ret_ref;
43714 }
43715
43716 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1default(JNIEnv *env, jclass clz) {
43717         LDKUserConfig ret_var = UserConfig_default();
43718         int64_t ret_ref = 0;
43719         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43720         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43721         return ret_ref;
43722 }
43723
43724 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BestBlock_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
43725         LDKBestBlock this_obj_conv;
43726         this_obj_conv.inner = untag_ptr(this_obj);
43727         this_obj_conv.is_owned = ptr_is_owned(this_obj);
43728         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43729         BestBlock_free(this_obj_conv);
43730 }
43731
43732 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BestBlock_1get_1block_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
43733         LDKBestBlock this_ptr_conv;
43734         this_ptr_conv.inner = untag_ptr(this_ptr);
43735         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43736         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43737         this_ptr_conv.is_owned = false;
43738         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
43739         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *BestBlock_get_block_hash(&this_ptr_conv));
43740         return ret_arr;
43741 }
43742
43743 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BestBlock_1set_1block_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
43744         LDKBestBlock this_ptr_conv;
43745         this_ptr_conv.inner = untag_ptr(this_ptr);
43746         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43747         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43748         this_ptr_conv.is_owned = false;
43749         LDKThirtyTwoBytes val_ref;
43750         CHECK((*env)->GetArrayLength(env, val) == 32);
43751         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
43752         BestBlock_set_block_hash(&this_ptr_conv, val_ref);
43753 }
43754
43755 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_BestBlock_1get_1height(JNIEnv *env, jclass clz, int64_t this_ptr) {
43756         LDKBestBlock this_ptr_conv;
43757         this_ptr_conv.inner = untag_ptr(this_ptr);
43758         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43759         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43760         this_ptr_conv.is_owned = false;
43761         int32_t ret_conv = BestBlock_get_height(&this_ptr_conv);
43762         return ret_conv;
43763 }
43764
43765 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BestBlock_1set_1height(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
43766         LDKBestBlock this_ptr_conv;
43767         this_ptr_conv.inner = untag_ptr(this_ptr);
43768         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43769         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43770         this_ptr_conv.is_owned = false;
43771         BestBlock_set_height(&this_ptr_conv, val);
43772 }
43773
43774 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BestBlock_1new(JNIEnv *env, jclass clz, int8_tArray block_hash_arg, int32_t height_arg) {
43775         LDKThirtyTwoBytes block_hash_arg_ref;
43776         CHECK((*env)->GetArrayLength(env, block_hash_arg) == 32);
43777         (*env)->GetByteArrayRegion(env, block_hash_arg, 0, 32, block_hash_arg_ref.data);
43778         LDKBestBlock ret_var = BestBlock_new(block_hash_arg_ref, height_arg);
43779         int64_t ret_ref = 0;
43780         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43781         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43782         return ret_ref;
43783 }
43784
43785 static inline uint64_t BestBlock_clone_ptr(LDKBestBlock *NONNULL_PTR arg) {
43786         LDKBestBlock ret_var = BestBlock_clone(arg);
43787         int64_t ret_ref = 0;
43788         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43789         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43790         return ret_ref;
43791 }
43792 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BestBlock_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
43793         LDKBestBlock arg_conv;
43794         arg_conv.inner = untag_ptr(arg);
43795         arg_conv.is_owned = ptr_is_owned(arg);
43796         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
43797         arg_conv.is_owned = false;
43798         int64_t ret_conv = BestBlock_clone_ptr(&arg_conv);
43799         return ret_conv;
43800 }
43801
43802 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BestBlock_1clone(JNIEnv *env, jclass clz, int64_t orig) {
43803         LDKBestBlock orig_conv;
43804         orig_conv.inner = untag_ptr(orig);
43805         orig_conv.is_owned = ptr_is_owned(orig);
43806         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
43807         orig_conv.is_owned = false;
43808         LDKBestBlock ret_var = BestBlock_clone(&orig_conv);
43809         int64_t ret_ref = 0;
43810         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43811         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43812         return ret_ref;
43813 }
43814
43815 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BestBlock_1hash(JNIEnv *env, jclass clz, int64_t o) {
43816         LDKBestBlock o_conv;
43817         o_conv.inner = untag_ptr(o);
43818         o_conv.is_owned = ptr_is_owned(o);
43819         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
43820         o_conv.is_owned = false;
43821         int64_t ret_conv = BestBlock_hash(&o_conv);
43822         return ret_conv;
43823 }
43824
43825 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_BestBlock_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
43826         LDKBestBlock a_conv;
43827         a_conv.inner = untag_ptr(a);
43828         a_conv.is_owned = ptr_is_owned(a);
43829         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
43830         a_conv.is_owned = false;
43831         LDKBestBlock b_conv;
43832         b_conv.inner = untag_ptr(b);
43833         b_conv.is_owned = ptr_is_owned(b);
43834         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
43835         b_conv.is_owned = false;
43836         jboolean ret_conv = BestBlock_eq(&a_conv, &b_conv);
43837         return ret_conv;
43838 }
43839
43840 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BestBlock_1from_1network(JNIEnv *env, jclass clz, jclass network) {
43841         LDKNetwork network_conv = LDKNetwork_from_java(env, network);
43842         LDKBestBlock ret_var = BestBlock_from_network(network_conv);
43843         int64_t ret_ref = 0;
43844         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43845         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43846         return ret_ref;
43847 }
43848
43849 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BestBlock_1write(JNIEnv *env, jclass clz, int64_t obj) {
43850         LDKBestBlock obj_conv;
43851         obj_conv.inner = untag_ptr(obj);
43852         obj_conv.is_owned = ptr_is_owned(obj);
43853         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
43854         obj_conv.is_owned = false;
43855         LDKCVec_u8Z ret_var = BestBlock_write(&obj_conv);
43856         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
43857         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
43858         CVec_u8Z_free(ret_var);
43859         return ret_arr;
43860 }
43861
43862 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BestBlock_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
43863         LDKu8slice ser_ref;
43864         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
43865         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
43866         LDKCResult_BestBlockDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BestBlockDecodeErrorZ), "LDKCResult_BestBlockDecodeErrorZ");
43867         *ret_conv = BestBlock_read(ser_ref);
43868         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
43869         return tag_ptr(ret_conv, true);
43870 }
43871
43872 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Listen_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
43873         if (!ptr_is_owned(this_ptr)) return;
43874         void* this_ptr_ptr = untag_ptr(this_ptr);
43875         CHECK_ACCESS(this_ptr_ptr);
43876         LDKListen this_ptr_conv = *(LDKListen*)(this_ptr_ptr);
43877         FREE(untag_ptr(this_ptr));
43878         Listen_free(this_ptr_conv);
43879 }
43880
43881 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Confirm_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
43882         if (!ptr_is_owned(this_ptr)) return;
43883         void* this_ptr_ptr = untag_ptr(this_ptr);
43884         CHECK_ACCESS(this_ptr_ptr);
43885         LDKConfirm this_ptr_conv = *(LDKConfirm*)(this_ptr_ptr);
43886         FREE(untag_ptr(this_ptr));
43887         Confirm_free(this_ptr_conv);
43888 }
43889
43890 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdateStatus_1clone(JNIEnv *env, jclass clz, int64_t orig) {
43891         LDKChannelMonitorUpdateStatus* orig_conv = (LDKChannelMonitorUpdateStatus*)untag_ptr(orig);
43892         jclass ret_conv = LDKChannelMonitorUpdateStatus_to_java(env, ChannelMonitorUpdateStatus_clone(orig_conv));
43893         return ret_conv;
43894 }
43895
43896 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdateStatus_1completed(JNIEnv *env, jclass clz) {
43897         jclass ret_conv = LDKChannelMonitorUpdateStatus_to_java(env, ChannelMonitorUpdateStatus_completed());
43898         return ret_conv;
43899 }
43900
43901 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdateStatus_1in_1progress(JNIEnv *env, jclass clz) {
43902         jclass ret_conv = LDKChannelMonitorUpdateStatus_to_java(env, ChannelMonitorUpdateStatus_in_progress());
43903         return ret_conv;
43904 }
43905
43906 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdateStatus_1unrecoverable_1error(JNIEnv *env, jclass clz) {
43907         jclass ret_conv = LDKChannelMonitorUpdateStatus_to_java(env, ChannelMonitorUpdateStatus_unrecoverable_error());
43908         return ret_conv;
43909 }
43910
43911 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdateStatus_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
43912         LDKChannelMonitorUpdateStatus* a_conv = (LDKChannelMonitorUpdateStatus*)untag_ptr(a);
43913         LDKChannelMonitorUpdateStatus* b_conv = (LDKChannelMonitorUpdateStatus*)untag_ptr(b);
43914         jboolean ret_conv = ChannelMonitorUpdateStatus_eq(a_conv, b_conv);
43915         return ret_conv;
43916 }
43917
43918 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Watch_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
43919         if (!ptr_is_owned(this_ptr)) return;
43920         void* this_ptr_ptr = untag_ptr(this_ptr);
43921         CHECK_ACCESS(this_ptr_ptr);
43922         LDKWatch this_ptr_conv = *(LDKWatch*)(this_ptr_ptr);
43923         FREE(untag_ptr(this_ptr));
43924         Watch_free(this_ptr_conv);
43925 }
43926
43927 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Filter_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
43928         if (!ptr_is_owned(this_ptr)) return;
43929         void* this_ptr_ptr = untag_ptr(this_ptr);
43930         CHECK_ACCESS(this_ptr_ptr);
43931         LDKFilter this_ptr_conv = *(LDKFilter*)(this_ptr_ptr);
43932         FREE(untag_ptr(this_ptr));
43933         Filter_free(this_ptr_conv);
43934 }
43935
43936 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
43937         LDKWatchedOutput this_obj_conv;
43938         this_obj_conv.inner = untag_ptr(this_obj);
43939         this_obj_conv.is_owned = ptr_is_owned(this_obj);
43940         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
43941         WatchedOutput_free(this_obj_conv);
43942 }
43943
43944 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1get_1block_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
43945         LDKWatchedOutput this_ptr_conv;
43946         this_ptr_conv.inner = untag_ptr(this_ptr);
43947         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43948         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43949         this_ptr_conv.is_owned = false;
43950         LDKCOption_ThirtyTwoBytesZ *ret_copy = MALLOC(sizeof(LDKCOption_ThirtyTwoBytesZ), "LDKCOption_ThirtyTwoBytesZ");
43951         *ret_copy = WatchedOutput_get_block_hash(&this_ptr_conv);
43952         int64_t ret_ref = tag_ptr(ret_copy, true);
43953         return ret_ref;
43954 }
43955
43956 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1set_1block_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
43957         LDKWatchedOutput this_ptr_conv;
43958         this_ptr_conv.inner = untag_ptr(this_ptr);
43959         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43960         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43961         this_ptr_conv.is_owned = false;
43962         void* val_ptr = untag_ptr(val);
43963         CHECK_ACCESS(val_ptr);
43964         LDKCOption_ThirtyTwoBytesZ val_conv = *(LDKCOption_ThirtyTwoBytesZ*)(val_ptr);
43965         val_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(val));
43966         WatchedOutput_set_block_hash(&this_ptr_conv, val_conv);
43967 }
43968
43969 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1get_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
43970         LDKWatchedOutput this_ptr_conv;
43971         this_ptr_conv.inner = untag_ptr(this_ptr);
43972         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43973         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43974         this_ptr_conv.is_owned = false;
43975         LDKOutPoint ret_var = WatchedOutput_get_outpoint(&this_ptr_conv);
43976         int64_t ret_ref = 0;
43977         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
43978         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
43979         return ret_ref;
43980 }
43981
43982 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1set_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
43983         LDKWatchedOutput this_ptr_conv;
43984         this_ptr_conv.inner = untag_ptr(this_ptr);
43985         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
43986         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
43987         this_ptr_conv.is_owned = false;
43988         LDKOutPoint val_conv;
43989         val_conv.inner = untag_ptr(val);
43990         val_conv.is_owned = ptr_is_owned(val);
43991         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
43992         val_conv = OutPoint_clone(&val_conv);
43993         WatchedOutput_set_outpoint(&this_ptr_conv, val_conv);
43994 }
43995
43996 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1get_1script_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
43997         LDKWatchedOutput this_ptr_conv;
43998         this_ptr_conv.inner = untag_ptr(this_ptr);
43999         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44000         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44001         this_ptr_conv.is_owned = false;
44002         LDKCVec_u8Z ret_var = WatchedOutput_get_script_pubkey(&this_ptr_conv);
44003         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
44004         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
44005         CVec_u8Z_free(ret_var);
44006         return ret_arr;
44007 }
44008
44009 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1set_1script_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
44010         LDKWatchedOutput this_ptr_conv;
44011         this_ptr_conv.inner = untag_ptr(this_ptr);
44012         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44013         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44014         this_ptr_conv.is_owned = false;
44015         LDKCVec_u8Z val_ref;
44016         val_ref.datalen = (*env)->GetArrayLength(env, val);
44017         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
44018         (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
44019         WatchedOutput_set_script_pubkey(&this_ptr_conv, val_ref);
44020 }
44021
44022 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) {
44023         void* block_hash_arg_ptr = untag_ptr(block_hash_arg);
44024         CHECK_ACCESS(block_hash_arg_ptr);
44025         LDKCOption_ThirtyTwoBytesZ block_hash_arg_conv = *(LDKCOption_ThirtyTwoBytesZ*)(block_hash_arg_ptr);
44026         block_hash_arg_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(block_hash_arg));
44027         LDKOutPoint outpoint_arg_conv;
44028         outpoint_arg_conv.inner = untag_ptr(outpoint_arg);
44029         outpoint_arg_conv.is_owned = ptr_is_owned(outpoint_arg);
44030         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
44031         outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
44032         LDKCVec_u8Z script_pubkey_arg_ref;
44033         script_pubkey_arg_ref.datalen = (*env)->GetArrayLength(env, script_pubkey_arg);
44034         script_pubkey_arg_ref.data = MALLOC(script_pubkey_arg_ref.datalen, "LDKCVec_u8Z Bytes");
44035         (*env)->GetByteArrayRegion(env, script_pubkey_arg, 0, script_pubkey_arg_ref.datalen, script_pubkey_arg_ref.data);
44036         LDKWatchedOutput ret_var = WatchedOutput_new(block_hash_arg_conv, outpoint_arg_conv, script_pubkey_arg_ref);
44037         int64_t ret_ref = 0;
44038         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44039         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44040         return ret_ref;
44041 }
44042
44043 static inline uint64_t WatchedOutput_clone_ptr(LDKWatchedOutput *NONNULL_PTR arg) {
44044         LDKWatchedOutput ret_var = WatchedOutput_clone(arg);
44045         int64_t ret_ref = 0;
44046         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44047         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44048         return ret_ref;
44049 }
44050 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
44051         LDKWatchedOutput arg_conv;
44052         arg_conv.inner = untag_ptr(arg);
44053         arg_conv.is_owned = ptr_is_owned(arg);
44054         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44055         arg_conv.is_owned = false;
44056         int64_t ret_conv = WatchedOutput_clone_ptr(&arg_conv);
44057         return ret_conv;
44058 }
44059
44060 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1clone(JNIEnv *env, jclass clz, int64_t orig) {
44061         LDKWatchedOutput orig_conv;
44062         orig_conv.inner = untag_ptr(orig);
44063         orig_conv.is_owned = ptr_is_owned(orig);
44064         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
44065         orig_conv.is_owned = false;
44066         LDKWatchedOutput ret_var = WatchedOutput_clone(&orig_conv);
44067         int64_t ret_ref = 0;
44068         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44069         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44070         return ret_ref;
44071 }
44072
44073 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
44074         LDKWatchedOutput a_conv;
44075         a_conv.inner = untag_ptr(a);
44076         a_conv.is_owned = ptr_is_owned(a);
44077         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
44078         a_conv.is_owned = false;
44079         LDKWatchedOutput b_conv;
44080         b_conv.inner = untag_ptr(b);
44081         b_conv.is_owned = ptr_is_owned(b);
44082         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
44083         b_conv.is_owned = false;
44084         jboolean ret_conv = WatchedOutput_eq(&a_conv, &b_conv);
44085         return ret_conv;
44086 }
44087
44088 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1hash(JNIEnv *env, jclass clz, int64_t o) {
44089         LDKWatchedOutput o_conv;
44090         o_conv.inner = untag_ptr(o);
44091         o_conv.is_owned = ptr_is_owned(o);
44092         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
44093         o_conv.is_owned = false;
44094         int64_t ret_conv = WatchedOutput_hash(&o_conv);
44095         return ret_conv;
44096 }
44097
44098 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BroadcasterInterface_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
44099         if (!ptr_is_owned(this_ptr)) return;
44100         void* this_ptr_ptr = untag_ptr(this_ptr);
44101         CHECK_ACCESS(this_ptr_ptr);
44102         LDKBroadcasterInterface this_ptr_conv = *(LDKBroadcasterInterface*)(this_ptr_ptr);
44103         FREE(untag_ptr(this_ptr));
44104         BroadcasterInterface_free(this_ptr_conv);
44105 }
44106
44107 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1clone(JNIEnv *env, jclass clz, int64_t orig) {
44108         LDKConfirmationTarget* orig_conv = (LDKConfirmationTarget*)untag_ptr(orig);
44109         jclass ret_conv = LDKConfirmationTarget_to_java(env, ConfirmationTarget_clone(orig_conv));
44110         return ret_conv;
44111 }
44112
44113 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1on_1chain_1sweep(JNIEnv *env, jclass clz) {
44114         jclass ret_conv = LDKConfirmationTarget_to_java(env, ConfirmationTarget_on_chain_sweep());
44115         return ret_conv;
44116 }
44117
44118 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1min_1allowed_1anchor_1channel_1remote_1fee(JNIEnv *env, jclass clz) {
44119         jclass ret_conv = LDKConfirmationTarget_to_java(env, ConfirmationTarget_min_allowed_anchor_channel_remote_fee());
44120         return ret_conv;
44121 }
44122
44123 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1min_1allowed_1non_1anchor_1channel_1remote_1fee(JNIEnv *env, jclass clz) {
44124         jclass ret_conv = LDKConfirmationTarget_to_java(env, ConfirmationTarget_min_allowed_non_anchor_channel_remote_fee());
44125         return ret_conv;
44126 }
44127
44128 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1anchor_1channel_1fee(JNIEnv *env, jclass clz) {
44129         jclass ret_conv = LDKConfirmationTarget_to_java(env, ConfirmationTarget_anchor_channel_fee());
44130         return ret_conv;
44131 }
44132
44133 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1non_1anchor_1channel_1fee(JNIEnv *env, jclass clz) {
44134         jclass ret_conv = LDKConfirmationTarget_to_java(env, ConfirmationTarget_non_anchor_channel_fee());
44135         return ret_conv;
44136 }
44137
44138 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1channel_1close_1minimum(JNIEnv *env, jclass clz) {
44139         jclass ret_conv = LDKConfirmationTarget_to_java(env, ConfirmationTarget_channel_close_minimum());
44140         return ret_conv;
44141 }
44142
44143 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1output_1spending_1fee(JNIEnv *env, jclass clz) {
44144         jclass ret_conv = LDKConfirmationTarget_to_java(env, ConfirmationTarget_output_spending_fee());
44145         return ret_conv;
44146 }
44147
44148 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1hash(JNIEnv *env, jclass clz, int64_t o) {
44149         LDKConfirmationTarget* o_conv = (LDKConfirmationTarget*)untag_ptr(o);
44150         int64_t ret_conv = ConfirmationTarget_hash(o_conv);
44151         return ret_conv;
44152 }
44153
44154 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
44155         LDKConfirmationTarget* a_conv = (LDKConfirmationTarget*)untag_ptr(a);
44156         LDKConfirmationTarget* b_conv = (LDKConfirmationTarget*)untag_ptr(b);
44157         jboolean ret_conv = ConfirmationTarget_eq(a_conv, b_conv);
44158         return ret_conv;
44159 }
44160
44161 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FeeEstimator_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
44162         if (!ptr_is_owned(this_ptr)) return;
44163         void* this_ptr_ptr = untag_ptr(this_ptr);
44164         CHECK_ACCESS(this_ptr_ptr);
44165         LDKFeeEstimator this_ptr_conv = *(LDKFeeEstimator*)(this_ptr_ptr);
44166         FREE(untag_ptr(this_ptr));
44167         FeeEstimator_free(this_ptr_conv);
44168 }
44169
44170 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MonitorUpdateId_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
44171         LDKMonitorUpdateId this_obj_conv;
44172         this_obj_conv.inner = untag_ptr(this_obj);
44173         this_obj_conv.is_owned = ptr_is_owned(this_obj);
44174         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44175         MonitorUpdateId_free(this_obj_conv);
44176 }
44177
44178 static inline uint64_t MonitorUpdateId_clone_ptr(LDKMonitorUpdateId *NONNULL_PTR arg) {
44179         LDKMonitorUpdateId ret_var = MonitorUpdateId_clone(arg);
44180         int64_t ret_ref = 0;
44181         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44182         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44183         return ret_ref;
44184 }
44185 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorUpdateId_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
44186         LDKMonitorUpdateId arg_conv;
44187         arg_conv.inner = untag_ptr(arg);
44188         arg_conv.is_owned = ptr_is_owned(arg);
44189         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44190         arg_conv.is_owned = false;
44191         int64_t ret_conv = MonitorUpdateId_clone_ptr(&arg_conv);
44192         return ret_conv;
44193 }
44194
44195 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorUpdateId_1clone(JNIEnv *env, jclass clz, int64_t orig) {
44196         LDKMonitorUpdateId orig_conv;
44197         orig_conv.inner = untag_ptr(orig);
44198         orig_conv.is_owned = ptr_is_owned(orig);
44199         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
44200         orig_conv.is_owned = false;
44201         LDKMonitorUpdateId ret_var = MonitorUpdateId_clone(&orig_conv);
44202         int64_t ret_ref = 0;
44203         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44204         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44205         return ret_ref;
44206 }
44207
44208 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorUpdateId_1hash(JNIEnv *env, jclass clz, int64_t o) {
44209         LDKMonitorUpdateId o_conv;
44210         o_conv.inner = untag_ptr(o);
44211         o_conv.is_owned = ptr_is_owned(o);
44212         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
44213         o_conv.is_owned = false;
44214         int64_t ret_conv = MonitorUpdateId_hash(&o_conv);
44215         return ret_conv;
44216 }
44217
44218 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_MonitorUpdateId_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
44219         LDKMonitorUpdateId a_conv;
44220         a_conv.inner = untag_ptr(a);
44221         a_conv.is_owned = ptr_is_owned(a);
44222         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
44223         a_conv.is_owned = false;
44224         LDKMonitorUpdateId b_conv;
44225         b_conv.inner = untag_ptr(b);
44226         b_conv.is_owned = ptr_is_owned(b);
44227         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
44228         b_conv.is_owned = false;
44229         jboolean ret_conv = MonitorUpdateId_eq(&a_conv, &b_conv);
44230         return ret_conv;
44231 }
44232
44233 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Persist_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
44234         if (!ptr_is_owned(this_ptr)) return;
44235         void* this_ptr_ptr = untag_ptr(this_ptr);
44236         CHECK_ACCESS(this_ptr_ptr);
44237         LDKPersist this_ptr_conv = *(LDKPersist*)(this_ptr_ptr);
44238         FREE(untag_ptr(this_ptr));
44239         Persist_free(this_ptr_conv);
44240 }
44241
44242 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LockedChannelMonitor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
44243         LDKLockedChannelMonitor this_obj_conv;
44244         this_obj_conv.inner = untag_ptr(this_obj);
44245         this_obj_conv.is_owned = ptr_is_owned(this_obj);
44246         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44247         LockedChannelMonitor_free(this_obj_conv);
44248 }
44249
44250 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
44251         LDKChainMonitor this_obj_conv;
44252         this_obj_conv.inner = untag_ptr(this_obj);
44253         this_obj_conv.is_owned = ptr_is_owned(this_obj);
44254         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44255         ChainMonitor_free(this_obj_conv);
44256 }
44257
44258 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) {
44259         void* chain_source_ptr = untag_ptr(chain_source);
44260         CHECK_ACCESS(chain_source_ptr);
44261         LDKCOption_FilterZ chain_source_conv = *(LDKCOption_FilterZ*)(chain_source_ptr);
44262         // WARNING: we may need a move here but no clone is available for LDKCOption_FilterZ
44263         if (chain_source_conv.tag == LDKCOption_FilterZ_Some) {
44264                 // Manually implement clone for Java trait instances
44265                 if (chain_source_conv.some.free == LDKFilter_JCalls_free) {
44266                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
44267                         LDKFilter_JCalls_cloned(&chain_source_conv.some);
44268                 }
44269         }
44270         void* broadcaster_ptr = untag_ptr(broadcaster);
44271         CHECK_ACCESS(broadcaster_ptr);
44272         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
44273         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
44274                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
44275                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
44276         }
44277         void* logger_ptr = untag_ptr(logger);
44278         CHECK_ACCESS(logger_ptr);
44279         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
44280         if (logger_conv.free == LDKLogger_JCalls_free) {
44281                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
44282                 LDKLogger_JCalls_cloned(&logger_conv);
44283         }
44284         void* feeest_ptr = untag_ptr(feeest);
44285         CHECK_ACCESS(feeest_ptr);
44286         LDKFeeEstimator feeest_conv = *(LDKFeeEstimator*)(feeest_ptr);
44287         if (feeest_conv.free == LDKFeeEstimator_JCalls_free) {
44288                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
44289                 LDKFeeEstimator_JCalls_cloned(&feeest_conv);
44290         }
44291         void* persister_ptr = untag_ptr(persister);
44292         CHECK_ACCESS(persister_ptr);
44293         LDKPersist persister_conv = *(LDKPersist*)(persister_ptr);
44294         if (persister_conv.free == LDKPersist_JCalls_free) {
44295                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
44296                 LDKPersist_JCalls_cloned(&persister_conv);
44297         }
44298         LDKChainMonitor ret_var = ChainMonitor_new(chain_source_conv, broadcaster_conv, logger_conv, feeest_conv, persister_conv);
44299         int64_t ret_ref = 0;
44300         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44301         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44302         return ret_ref;
44303 }
44304
44305 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) {
44306         LDKChainMonitor this_arg_conv;
44307         this_arg_conv.inner = untag_ptr(this_arg);
44308         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44309         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44310         this_arg_conv.is_owned = false;
44311         LDKCVec_ChannelDetailsZ ignored_channels_constr;
44312         ignored_channels_constr.datalen = (*env)->GetArrayLength(env, ignored_channels);
44313         if (ignored_channels_constr.datalen > 0)
44314                 ignored_channels_constr.data = MALLOC(ignored_channels_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
44315         else
44316                 ignored_channels_constr.data = NULL;
44317         int64_t* ignored_channels_vals = (*env)->GetLongArrayElements (env, ignored_channels, NULL);
44318         for (size_t q = 0; q < ignored_channels_constr.datalen; q++) {
44319                 int64_t ignored_channels_conv_16 = ignored_channels_vals[q];
44320                 LDKChannelDetails ignored_channels_conv_16_conv;
44321                 ignored_channels_conv_16_conv.inner = untag_ptr(ignored_channels_conv_16);
44322                 ignored_channels_conv_16_conv.is_owned = ptr_is_owned(ignored_channels_conv_16);
44323                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ignored_channels_conv_16_conv);
44324                 ignored_channels_conv_16_conv = ChannelDetails_clone(&ignored_channels_conv_16_conv);
44325                 ignored_channels_constr.data[q] = ignored_channels_conv_16_conv;
44326         }
44327         (*env)->ReleaseLongArrayElements(env, ignored_channels, ignored_channels_vals, 0);
44328         LDKCVec_BalanceZ ret_var = ChainMonitor_get_claimable_balances(&this_arg_conv, ignored_channels_constr);
44329         int64_tArray ret_arr = NULL;
44330         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
44331         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
44332         for (size_t j = 0; j < ret_var.datalen; j++) {
44333                 LDKBalance *ret_conv_9_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
44334                 *ret_conv_9_copy = ret_var.data[j];
44335                 int64_t ret_conv_9_ref = tag_ptr(ret_conv_9_copy, true);
44336                 ret_arr_ptr[j] = ret_conv_9_ref;
44337         }
44338         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
44339         FREE(ret_var.data);
44340         return ret_arr;
44341 }
44342
44343 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1get_1monitor(JNIEnv *env, jclass clz, int64_t this_arg, int64_t funding_txo) {
44344         LDKChainMonitor this_arg_conv;
44345         this_arg_conv.inner = untag_ptr(this_arg);
44346         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44347         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44348         this_arg_conv.is_owned = false;
44349         LDKOutPoint funding_txo_conv;
44350         funding_txo_conv.inner = untag_ptr(funding_txo);
44351         funding_txo_conv.is_owned = ptr_is_owned(funding_txo);
44352         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
44353         funding_txo_conv = OutPoint_clone(&funding_txo_conv);
44354         LDKCResult_LockedChannelMonitorNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_LockedChannelMonitorNoneZ), "LDKCResult_LockedChannelMonitorNoneZ");
44355         *ret_conv = ChainMonitor_get_monitor(&this_arg_conv, funding_txo_conv);
44356         return tag_ptr(ret_conv, true);
44357 }
44358
44359 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1list_1monitors(JNIEnv *env, jclass clz, int64_t this_arg) {
44360         LDKChainMonitor this_arg_conv;
44361         this_arg_conv.inner = untag_ptr(this_arg);
44362         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44363         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44364         this_arg_conv.is_owned = false;
44365         LDKCVec_C2Tuple_OutPointChannelIdZZ ret_var = ChainMonitor_list_monitors(&this_arg_conv);
44366         int64_tArray ret_arr = NULL;
44367         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
44368         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
44369         for (size_t d = 0; d < ret_var.datalen; d++) {
44370                 LDKC2Tuple_OutPointChannelIdZ* ret_conv_29_conv = MALLOC(sizeof(LDKC2Tuple_OutPointChannelIdZ), "LDKC2Tuple_OutPointChannelIdZ");
44371                 *ret_conv_29_conv = ret_var.data[d];
44372                 ret_arr_ptr[d] = tag_ptr(ret_conv_29_conv, true);
44373         }
44374         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
44375         FREE(ret_var.data);
44376         return ret_arr;
44377 }
44378
44379 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1list_1pending_1monitor_1updates(JNIEnv *env, jclass clz, int64_t this_arg) {
44380         LDKChainMonitor this_arg_conv;
44381         this_arg_conv.inner = untag_ptr(this_arg);
44382         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44383         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44384         this_arg_conv.is_owned = false;
44385         LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ ret_var = ChainMonitor_list_pending_monitor_updates(&this_arg_conv);
44386         int64_tArray ret_arr = NULL;
44387         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
44388         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
44389         for (size_t p = 0; p < ret_var.datalen; p++) {
44390                 LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* ret_conv_41_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ), "LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ");
44391                 *ret_conv_41_conv = ret_var.data[p];
44392                 ret_arr_ptr[p] = tag_ptr(ret_conv_41_conv, true);
44393         }
44394         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
44395         FREE(ret_var.data);
44396         return ret_arr;
44397 }
44398
44399 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) {
44400         LDKChainMonitor this_arg_conv;
44401         this_arg_conv.inner = untag_ptr(this_arg);
44402         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44403         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44404         this_arg_conv.is_owned = false;
44405         LDKOutPoint funding_txo_conv;
44406         funding_txo_conv.inner = untag_ptr(funding_txo);
44407         funding_txo_conv.is_owned = ptr_is_owned(funding_txo);
44408         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
44409         funding_txo_conv = OutPoint_clone(&funding_txo_conv);
44410         LDKMonitorUpdateId completed_update_id_conv;
44411         completed_update_id_conv.inner = untag_ptr(completed_update_id);
44412         completed_update_id_conv.is_owned = ptr_is_owned(completed_update_id);
44413         CHECK_INNER_FIELD_ACCESS_OR_NULL(completed_update_id_conv);
44414         completed_update_id_conv = MonitorUpdateId_clone(&completed_update_id_conv);
44415         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
44416         *ret_conv = ChainMonitor_channel_monitor_updated(&this_arg_conv, funding_txo_conv, completed_update_id_conv);
44417         return tag_ptr(ret_conv, true);
44418 }
44419
44420 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1get_1update_1future(JNIEnv *env, jclass clz, int64_t this_arg) {
44421         LDKChainMonitor this_arg_conv;
44422         this_arg_conv.inner = untag_ptr(this_arg);
44423         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44424         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44425         this_arg_conv.is_owned = false;
44426         LDKFuture ret_var = ChainMonitor_get_update_future(&this_arg_conv);
44427         int64_t ret_ref = 0;
44428         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44429         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44430         return ret_ref;
44431 }
44432
44433 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1rebroadcast_1pending_1claims(JNIEnv *env, jclass clz, int64_t this_arg) {
44434         LDKChainMonitor this_arg_conv;
44435         this_arg_conv.inner = untag_ptr(this_arg);
44436         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44437         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44438         this_arg_conv.is_owned = false;
44439         ChainMonitor_rebroadcast_pending_claims(&this_arg_conv);
44440 }
44441
44442 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1signer_1unblocked(JNIEnv *env, jclass clz, int64_t this_arg, int64_t monitor_opt) {
44443         LDKChainMonitor 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         LDKOutPoint monitor_opt_conv;
44449         monitor_opt_conv.inner = untag_ptr(monitor_opt);
44450         monitor_opt_conv.is_owned = ptr_is_owned(monitor_opt);
44451         CHECK_INNER_FIELD_ACCESS_OR_NULL(monitor_opt_conv);
44452         monitor_opt_conv = OutPoint_clone(&monitor_opt_conv);
44453         ChainMonitor_signer_unblocked(&this_arg_conv, monitor_opt_conv);
44454 }
44455
44456 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1archive_1fully_1resolved_1channel_1monitors(JNIEnv *env, jclass clz, int64_t this_arg) {
44457         LDKChainMonitor this_arg_conv;
44458         this_arg_conv.inner = untag_ptr(this_arg);
44459         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44460         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44461         this_arg_conv.is_owned = false;
44462         ChainMonitor_archive_fully_resolved_channel_monitors(&this_arg_conv);
44463 }
44464
44465 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1as_1Listen(JNIEnv *env, jclass clz, int64_t this_arg) {
44466         LDKChainMonitor this_arg_conv;
44467         this_arg_conv.inner = untag_ptr(this_arg);
44468         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44469         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44470         this_arg_conv.is_owned = false;
44471         LDKListen* ret_ret = MALLOC(sizeof(LDKListen), "LDKListen");
44472         *ret_ret = ChainMonitor_as_Listen(&this_arg_conv);
44473         return tag_ptr(ret_ret, true);
44474 }
44475
44476 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1as_1Confirm(JNIEnv *env, jclass clz, int64_t this_arg) {
44477         LDKChainMonitor this_arg_conv;
44478         this_arg_conv.inner = untag_ptr(this_arg);
44479         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44480         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44481         this_arg_conv.is_owned = false;
44482         LDKConfirm* ret_ret = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
44483         *ret_ret = ChainMonitor_as_Confirm(&this_arg_conv);
44484         return tag_ptr(ret_ret, true);
44485 }
44486
44487 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1as_1Watch(JNIEnv *env, jclass clz, int64_t this_arg) {
44488         LDKChainMonitor this_arg_conv;
44489         this_arg_conv.inner = untag_ptr(this_arg);
44490         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44491         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44492         this_arg_conv.is_owned = false;
44493         LDKWatch* ret_ret = MALLOC(sizeof(LDKWatch), "LDKWatch");
44494         *ret_ret = ChainMonitor_as_Watch(&this_arg_conv);
44495         return tag_ptr(ret_ret, true);
44496 }
44497
44498 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1as_1EventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
44499         LDKChainMonitor this_arg_conv;
44500         this_arg_conv.inner = untag_ptr(this_arg);
44501         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44502         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44503         this_arg_conv.is_owned = false;
44504         LDKEventsProvider* ret_ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
44505         *ret_ret = ChainMonitor_as_EventsProvider(&this_arg_conv);
44506         return tag_ptr(ret_ret, true);
44507 }
44508
44509 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
44510         LDKChannelMonitorUpdate this_obj_conv;
44511         this_obj_conv.inner = untag_ptr(this_obj);
44512         this_obj_conv.is_owned = ptr_is_owned(this_obj);
44513         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44514         ChannelMonitorUpdate_free(this_obj_conv);
44515 }
44516
44517 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1get_1update_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
44518         LDKChannelMonitorUpdate this_ptr_conv;
44519         this_ptr_conv.inner = untag_ptr(this_ptr);
44520         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44521         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44522         this_ptr_conv.is_owned = false;
44523         int64_t ret_conv = ChannelMonitorUpdate_get_update_id(&this_ptr_conv);
44524         return ret_conv;
44525 }
44526
44527 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1set_1update_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
44528         LDKChannelMonitorUpdate this_ptr_conv;
44529         this_ptr_conv.inner = untag_ptr(this_ptr);
44530         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44531         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44532         this_ptr_conv.is_owned = false;
44533         ChannelMonitorUpdate_set_update_id(&this_ptr_conv, val);
44534 }
44535
44536 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
44537         LDKChannelMonitorUpdate this_ptr_conv;
44538         this_ptr_conv.inner = untag_ptr(this_ptr);
44539         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44540         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44541         this_ptr_conv.is_owned = false;
44542         LDKChannelId ret_var = ChannelMonitorUpdate_get_channel_id(&this_ptr_conv);
44543         int64_t ret_ref = 0;
44544         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44545         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44546         return ret_ref;
44547 }
44548
44549 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
44550         LDKChannelMonitorUpdate this_ptr_conv;
44551         this_ptr_conv.inner = untag_ptr(this_ptr);
44552         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
44553         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
44554         this_ptr_conv.is_owned = false;
44555         LDKChannelId val_conv;
44556         val_conv.inner = untag_ptr(val);
44557         val_conv.is_owned = ptr_is_owned(val);
44558         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
44559         val_conv = ChannelId_clone(&val_conv);
44560         ChannelMonitorUpdate_set_channel_id(&this_ptr_conv, val_conv);
44561 }
44562
44563 static inline uint64_t ChannelMonitorUpdate_clone_ptr(LDKChannelMonitorUpdate *NONNULL_PTR arg) {
44564         LDKChannelMonitorUpdate ret_var = ChannelMonitorUpdate_clone(arg);
44565         int64_t ret_ref = 0;
44566         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44567         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44568         return ret_ref;
44569 }
44570 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
44571         LDKChannelMonitorUpdate arg_conv;
44572         arg_conv.inner = untag_ptr(arg);
44573         arg_conv.is_owned = ptr_is_owned(arg);
44574         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44575         arg_conv.is_owned = false;
44576         int64_t ret_conv = ChannelMonitorUpdate_clone_ptr(&arg_conv);
44577         return ret_conv;
44578 }
44579
44580 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
44581         LDKChannelMonitorUpdate orig_conv;
44582         orig_conv.inner = untag_ptr(orig);
44583         orig_conv.is_owned = ptr_is_owned(orig);
44584         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
44585         orig_conv.is_owned = false;
44586         LDKChannelMonitorUpdate ret_var = ChannelMonitorUpdate_clone(&orig_conv);
44587         int64_t ret_ref = 0;
44588         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44589         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44590         return ret_ref;
44591 }
44592
44593 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
44594         LDKChannelMonitorUpdate a_conv;
44595         a_conv.inner = untag_ptr(a);
44596         a_conv.is_owned = ptr_is_owned(a);
44597         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
44598         a_conv.is_owned = false;
44599         LDKChannelMonitorUpdate b_conv;
44600         b_conv.inner = untag_ptr(b);
44601         b_conv.is_owned = ptr_is_owned(b);
44602         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
44603         b_conv.is_owned = false;
44604         jboolean ret_conv = ChannelMonitorUpdate_eq(&a_conv, &b_conv);
44605         return ret_conv;
44606 }
44607
44608 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1write(JNIEnv *env, jclass clz, int64_t obj) {
44609         LDKChannelMonitorUpdate obj_conv;
44610         obj_conv.inner = untag_ptr(obj);
44611         obj_conv.is_owned = ptr_is_owned(obj);
44612         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
44613         obj_conv.is_owned = false;
44614         LDKCVec_u8Z ret_var = ChannelMonitorUpdate_write(&obj_conv);
44615         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
44616         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
44617         CVec_u8Z_free(ret_var);
44618         return ret_arr;
44619 }
44620
44621 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
44622         LDKu8slice ser_ref;
44623         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
44624         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
44625         LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
44626         *ret_conv = ChannelMonitorUpdate_read(ser_ref);
44627         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
44628         return tag_ptr(ret_conv, true);
44629 }
44630
44631 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
44632         if (!ptr_is_owned(this_ptr)) return;
44633         void* this_ptr_ptr = untag_ptr(this_ptr);
44634         CHECK_ACCESS(this_ptr_ptr);
44635         LDKMonitorEvent this_ptr_conv = *(LDKMonitorEvent*)(this_ptr_ptr);
44636         FREE(untag_ptr(this_ptr));
44637         MonitorEvent_free(this_ptr_conv);
44638 }
44639
44640 static inline uint64_t MonitorEvent_clone_ptr(LDKMonitorEvent *NONNULL_PTR arg) {
44641         LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
44642         *ret_copy = MonitorEvent_clone(arg);
44643         int64_t ret_ref = tag_ptr(ret_copy, true);
44644         return ret_ref;
44645 }
44646 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
44647         LDKMonitorEvent* arg_conv = (LDKMonitorEvent*)untag_ptr(arg);
44648         int64_t ret_conv = MonitorEvent_clone_ptr(arg_conv);
44649         return ret_conv;
44650 }
44651
44652 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1clone(JNIEnv *env, jclass clz, int64_t orig) {
44653         LDKMonitorEvent* orig_conv = (LDKMonitorEvent*)untag_ptr(orig);
44654         LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
44655         *ret_copy = MonitorEvent_clone(orig_conv);
44656         int64_t ret_ref = tag_ptr(ret_copy, true);
44657         return ret_ref;
44658 }
44659
44660 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1htlcevent(JNIEnv *env, jclass clz, int64_t a) {
44661         LDKHTLCUpdate a_conv;
44662         a_conv.inner = untag_ptr(a);
44663         a_conv.is_owned = ptr_is_owned(a);
44664         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
44665         a_conv = HTLCUpdate_clone(&a_conv);
44666         LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
44667         *ret_copy = MonitorEvent_htlcevent(a_conv);
44668         int64_t ret_ref = tag_ptr(ret_copy, true);
44669         return ret_ref;
44670 }
44671
44672 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1holder_1force_1closed_1with_1info(JNIEnv *env, jclass clz, int64_t reason, int64_t outpoint, int64_t channel_id) {
44673         void* reason_ptr = untag_ptr(reason);
44674         CHECK_ACCESS(reason_ptr);
44675         LDKClosureReason reason_conv = *(LDKClosureReason*)(reason_ptr);
44676         reason_conv = ClosureReason_clone((LDKClosureReason*)untag_ptr(reason));
44677         LDKOutPoint outpoint_conv;
44678         outpoint_conv.inner = untag_ptr(outpoint);
44679         outpoint_conv.is_owned = ptr_is_owned(outpoint);
44680         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_conv);
44681         outpoint_conv = OutPoint_clone(&outpoint_conv);
44682         LDKChannelId channel_id_conv;
44683         channel_id_conv.inner = untag_ptr(channel_id);
44684         channel_id_conv.is_owned = ptr_is_owned(channel_id);
44685         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_conv);
44686         channel_id_conv = ChannelId_clone(&channel_id_conv);
44687         LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
44688         *ret_copy = MonitorEvent_holder_force_closed_with_info(reason_conv, outpoint_conv, channel_id_conv);
44689         int64_t ret_ref = tag_ptr(ret_copy, true);
44690         return ret_ref;
44691 }
44692
44693 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1holder_1force_1closed(JNIEnv *env, jclass clz, int64_t a) {
44694         LDKOutPoint a_conv;
44695         a_conv.inner = untag_ptr(a);
44696         a_conv.is_owned = ptr_is_owned(a);
44697         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
44698         a_conv = OutPoint_clone(&a_conv);
44699         LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
44700         *ret_copy = MonitorEvent_holder_force_closed(a_conv);
44701         int64_t ret_ref = tag_ptr(ret_copy, true);
44702         return ret_ref;
44703 }
44704
44705 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1completed(JNIEnv *env, jclass clz, int64_t funding_txo, int64_t channel_id, int64_t monitor_update_id) {
44706         LDKOutPoint funding_txo_conv;
44707         funding_txo_conv.inner = untag_ptr(funding_txo);
44708         funding_txo_conv.is_owned = ptr_is_owned(funding_txo);
44709         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
44710         funding_txo_conv = OutPoint_clone(&funding_txo_conv);
44711         LDKChannelId channel_id_conv;
44712         channel_id_conv.inner = untag_ptr(channel_id);
44713         channel_id_conv.is_owned = ptr_is_owned(channel_id);
44714         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_conv);
44715         channel_id_conv = ChannelId_clone(&channel_id_conv);
44716         LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
44717         *ret_copy = MonitorEvent_completed(funding_txo_conv, channel_id_conv, monitor_update_id);
44718         int64_t ret_ref = tag_ptr(ret_copy, true);
44719         return ret_ref;
44720 }
44721
44722 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
44723         LDKMonitorEvent* a_conv = (LDKMonitorEvent*)untag_ptr(a);
44724         LDKMonitorEvent* b_conv = (LDKMonitorEvent*)untag_ptr(b);
44725         jboolean ret_conv = MonitorEvent_eq(a_conv, b_conv);
44726         return ret_conv;
44727 }
44728
44729 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1write(JNIEnv *env, jclass clz, int64_t obj) {
44730         LDKMonitorEvent* obj_conv = (LDKMonitorEvent*)untag_ptr(obj);
44731         LDKCVec_u8Z ret_var = MonitorEvent_write(obj_conv);
44732         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
44733         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
44734         CVec_u8Z_free(ret_var);
44735         return ret_arr;
44736 }
44737
44738 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
44739         LDKu8slice ser_ref;
44740         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
44741         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
44742         LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ");
44743         *ret_conv = MonitorEvent_read(ser_ref);
44744         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
44745         return tag_ptr(ret_conv, true);
44746 }
44747
44748 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
44749         LDKHTLCUpdate this_obj_conv;
44750         this_obj_conv.inner = untag_ptr(this_obj);
44751         this_obj_conv.is_owned = ptr_is_owned(this_obj);
44752         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44753         HTLCUpdate_free(this_obj_conv);
44754 }
44755
44756 static inline uint64_t HTLCUpdate_clone_ptr(LDKHTLCUpdate *NONNULL_PTR arg) {
44757         LDKHTLCUpdate ret_var = HTLCUpdate_clone(arg);
44758         int64_t ret_ref = 0;
44759         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44760         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44761         return ret_ref;
44762 }
44763 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
44764         LDKHTLCUpdate arg_conv;
44765         arg_conv.inner = untag_ptr(arg);
44766         arg_conv.is_owned = ptr_is_owned(arg);
44767         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44768         arg_conv.is_owned = false;
44769         int64_t ret_conv = HTLCUpdate_clone_ptr(&arg_conv);
44770         return ret_conv;
44771 }
44772
44773 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
44774         LDKHTLCUpdate orig_conv;
44775         orig_conv.inner = untag_ptr(orig);
44776         orig_conv.is_owned = ptr_is_owned(orig);
44777         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
44778         orig_conv.is_owned = false;
44779         LDKHTLCUpdate ret_var = HTLCUpdate_clone(&orig_conv);
44780         int64_t ret_ref = 0;
44781         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44782         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44783         return ret_ref;
44784 }
44785
44786 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
44787         LDKHTLCUpdate a_conv;
44788         a_conv.inner = untag_ptr(a);
44789         a_conv.is_owned = ptr_is_owned(a);
44790         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
44791         a_conv.is_owned = false;
44792         LDKHTLCUpdate b_conv;
44793         b_conv.inner = untag_ptr(b);
44794         b_conv.is_owned = ptr_is_owned(b);
44795         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
44796         b_conv.is_owned = false;
44797         jboolean ret_conv = HTLCUpdate_eq(&a_conv, &b_conv);
44798         return ret_conv;
44799 }
44800
44801 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1write(JNIEnv *env, jclass clz, int64_t obj) {
44802         LDKHTLCUpdate obj_conv;
44803         obj_conv.inner = untag_ptr(obj);
44804         obj_conv.is_owned = ptr_is_owned(obj);
44805         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
44806         obj_conv.is_owned = false;
44807         LDKCVec_u8Z ret_var = HTLCUpdate_write(&obj_conv);
44808         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
44809         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
44810         CVec_u8Z_free(ret_var);
44811         return ret_arr;
44812 }
44813
44814 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
44815         LDKu8slice ser_ref;
44816         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
44817         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
44818         LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
44819         *ret_conv = HTLCUpdate_read(ser_ref);
44820         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
44821         return tag_ptr(ret_conv, true);
44822 }
44823
44824 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Balance_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
44825         if (!ptr_is_owned(this_ptr)) return;
44826         void* this_ptr_ptr = untag_ptr(this_ptr);
44827         CHECK_ACCESS(this_ptr_ptr);
44828         LDKBalance this_ptr_conv = *(LDKBalance*)(this_ptr_ptr);
44829         FREE(untag_ptr(this_ptr));
44830         Balance_free(this_ptr_conv);
44831 }
44832
44833 static inline uint64_t Balance_clone_ptr(LDKBalance *NONNULL_PTR arg) {
44834         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
44835         *ret_copy = Balance_clone(arg);
44836         int64_t ret_ref = tag_ptr(ret_copy, true);
44837         return ret_ref;
44838 }
44839 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Balance_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
44840         LDKBalance* arg_conv = (LDKBalance*)untag_ptr(arg);
44841         int64_t ret_conv = Balance_clone_ptr(arg_conv);
44842         return ret_conv;
44843 }
44844
44845 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Balance_1clone(JNIEnv *env, jclass clz, int64_t orig) {
44846         LDKBalance* orig_conv = (LDKBalance*)untag_ptr(orig);
44847         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
44848         *ret_copy = Balance_clone(orig_conv);
44849         int64_t ret_ref = tag_ptr(ret_copy, true);
44850         return ret_ref;
44851 }
44852
44853 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Balance_1claimable_1on_1channel_1close(JNIEnv *env, jclass clz, int64_t amount_satoshis) {
44854         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
44855         *ret_copy = Balance_claimable_on_channel_close(amount_satoshis);
44856         int64_t ret_ref = tag_ptr(ret_copy, true);
44857         return ret_ref;
44858 }
44859
44860 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) {
44861         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
44862         *ret_copy = Balance_claimable_awaiting_confirmations(amount_satoshis, confirmation_height);
44863         int64_t ret_ref = tag_ptr(ret_copy, true);
44864         return ret_ref;
44865 }
44866
44867 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) {
44868         LDKThirtyTwoBytes payment_hash_ref;
44869         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
44870         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
44871         LDKThirtyTwoBytes payment_preimage_ref;
44872         CHECK((*env)->GetArrayLength(env, payment_preimage) == 32);
44873         (*env)->GetByteArrayRegion(env, payment_preimage, 0, 32, payment_preimage_ref.data);
44874         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
44875         *ret_copy = Balance_contentious_claimable(amount_satoshis, timeout_height, payment_hash_ref, payment_preimage_ref);
44876         int64_t ret_ref = tag_ptr(ret_copy, true);
44877         return ret_ref;
44878 }
44879
44880 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) {
44881         LDKThirtyTwoBytes payment_hash_ref;
44882         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
44883         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
44884         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
44885         *ret_copy = Balance_maybe_timeout_claimable_htlc(amount_satoshis, claimable_height, payment_hash_ref);
44886         int64_t ret_ref = tag_ptr(ret_copy, true);
44887         return ret_ref;
44888 }
44889
44890 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) {
44891         LDKThirtyTwoBytes payment_hash_ref;
44892         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
44893         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
44894         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
44895         *ret_copy = Balance_maybe_preimage_claimable_htlc(amount_satoshis, expiry_height, payment_hash_ref);
44896         int64_t ret_ref = tag_ptr(ret_copy, true);
44897         return ret_ref;
44898 }
44899
44900 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Balance_1counterparty_1revoked_1output_1claimable(JNIEnv *env, jclass clz, int64_t amount_satoshis) {
44901         LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
44902         *ret_copy = Balance_counterparty_revoked_output_claimable(amount_satoshis);
44903         int64_t ret_ref = tag_ptr(ret_copy, true);
44904         return ret_ref;
44905 }
44906
44907 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Balance_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
44908         LDKBalance* a_conv = (LDKBalance*)untag_ptr(a);
44909         LDKBalance* b_conv = (LDKBalance*)untag_ptr(b);
44910         jboolean ret_conv = Balance_eq(a_conv, b_conv);
44911         return ret_conv;
44912 }
44913
44914 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Balance_1claimable_1amount_1satoshis(JNIEnv *env, jclass clz, int64_t this_arg) {
44915         LDKBalance* this_arg_conv = (LDKBalance*)untag_ptr(this_arg);
44916         int64_t ret_conv = Balance_claimable_amount_satoshis(this_arg_conv);
44917         return ret_conv;
44918 }
44919
44920 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
44921         LDKChannelMonitor this_obj_conv;
44922         this_obj_conv.inner = untag_ptr(this_obj);
44923         this_obj_conv.is_owned = ptr_is_owned(this_obj);
44924         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
44925         ChannelMonitor_free(this_obj_conv);
44926 }
44927
44928 static inline uint64_t ChannelMonitor_clone_ptr(LDKChannelMonitor *NONNULL_PTR arg) {
44929         LDKChannelMonitor ret_var = ChannelMonitor_clone(arg);
44930         int64_t ret_ref = 0;
44931         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44932         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44933         return ret_ref;
44934 }
44935 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
44936         LDKChannelMonitor arg_conv;
44937         arg_conv.inner = untag_ptr(arg);
44938         arg_conv.is_owned = ptr_is_owned(arg);
44939         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
44940         arg_conv.is_owned = false;
44941         int64_t ret_conv = ChannelMonitor_clone_ptr(&arg_conv);
44942         return ret_conv;
44943 }
44944
44945 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
44946         LDKChannelMonitor orig_conv;
44947         orig_conv.inner = untag_ptr(orig);
44948         orig_conv.is_owned = ptr_is_owned(orig);
44949         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
44950         orig_conv.is_owned = false;
44951         LDKChannelMonitor ret_var = ChannelMonitor_clone(&orig_conv);
44952         int64_t ret_ref = 0;
44953         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
44954         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
44955         return ret_ref;
44956 }
44957
44958 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1write(JNIEnv *env, jclass clz, int64_t obj) {
44959         LDKChannelMonitor obj_conv;
44960         obj_conv.inner = untag_ptr(obj);
44961         obj_conv.is_owned = ptr_is_owned(obj);
44962         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
44963         obj_conv.is_owned = false;
44964         LDKCVec_u8Z ret_var = ChannelMonitor_write(&obj_conv);
44965         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
44966         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
44967         CVec_u8Z_free(ret_var);
44968         return ret_arr;
44969 }
44970
44971 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) {
44972         LDKChannelMonitor this_arg_conv;
44973         this_arg_conv.inner = untag_ptr(this_arg);
44974         this_arg_conv.is_owned = ptr_is_owned(this_arg);
44975         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
44976         this_arg_conv.is_owned = false;
44977         LDKChannelMonitorUpdate updates_conv;
44978         updates_conv.inner = untag_ptr(updates);
44979         updates_conv.is_owned = ptr_is_owned(updates);
44980         CHECK_INNER_FIELD_ACCESS_OR_NULL(updates_conv);
44981         updates_conv.is_owned = false;
44982         void* broadcaster_ptr = untag_ptr(broadcaster);
44983         if (ptr_is_owned(broadcaster)) { CHECK_ACCESS(broadcaster_ptr); }
44984         LDKBroadcasterInterface* broadcaster_conv = (LDKBroadcasterInterface*)broadcaster_ptr;
44985         void* fee_estimator_ptr = untag_ptr(fee_estimator);
44986         if (ptr_is_owned(fee_estimator)) { CHECK_ACCESS(fee_estimator_ptr); }
44987         LDKFeeEstimator* fee_estimator_conv = (LDKFeeEstimator*)fee_estimator_ptr;
44988         void* logger_ptr = untag_ptr(logger);
44989         if (ptr_is_owned(logger)) { CHECK_ACCESS(logger_ptr); }
44990         LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
44991         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
44992         *ret_conv = ChannelMonitor_update_monitor(&this_arg_conv, &updates_conv, broadcaster_conv, fee_estimator_conv, logger_conv);
44993         return tag_ptr(ret_conv, true);
44994 }
44995
44996 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1latest_1update_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
44997         LDKChannelMonitor this_arg_conv;
44998         this_arg_conv.inner = untag_ptr(this_arg);
44999         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45000         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45001         this_arg_conv.is_owned = false;
45002         int64_t ret_conv = ChannelMonitor_get_latest_update_id(&this_arg_conv);
45003         return ret_conv;
45004 }
45005
45006 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1funding_1txo(JNIEnv *env, jclass clz, int64_t this_arg) {
45007         LDKChannelMonitor this_arg_conv;
45008         this_arg_conv.inner = untag_ptr(this_arg);
45009         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45010         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45011         this_arg_conv.is_owned = false;
45012         LDKC2Tuple_OutPointCVec_u8ZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_u8ZZ), "LDKC2Tuple_OutPointCVec_u8ZZ");
45013         *ret_conv = ChannelMonitor_get_funding_txo(&this_arg_conv);
45014         return tag_ptr(ret_conv, true);
45015 }
45016
45017 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1channel_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
45018         LDKChannelMonitor this_arg_conv;
45019         this_arg_conv.inner = untag_ptr(this_arg);
45020         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45021         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45022         this_arg_conv.is_owned = false;
45023         LDKChannelId ret_var = ChannelMonitor_channel_id(&this_arg_conv);
45024         int64_t ret_ref = 0;
45025         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45026         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45027         return ret_ref;
45028 }
45029
45030 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1outputs_1to_1watch(JNIEnv *env, jclass clz, int64_t this_arg) {
45031         LDKChannelMonitor this_arg_conv;
45032         this_arg_conv.inner = untag_ptr(this_arg);
45033         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45034         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45035         this_arg_conv.is_owned = false;
45036         LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ ret_var = ChannelMonitor_get_outputs_to_watch(&this_arg_conv);
45037         int64_tArray ret_arr = NULL;
45038         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
45039         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
45040         for (size_t a = 0; a < ret_var.datalen; a++) {
45041                 LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ* ret_conv_52_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ), "LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ");
45042                 *ret_conv_52_conv = ret_var.data[a];
45043                 ret_arr_ptr[a] = tag_ptr(ret_conv_52_conv, true);
45044         }
45045         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
45046         FREE(ret_var.data);
45047         return ret_arr;
45048 }
45049
45050 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) {
45051         LDKChannelMonitor this_arg_conv;
45052         this_arg_conv.inner = untag_ptr(this_arg);
45053         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45054         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45055         this_arg_conv.is_owned = false;
45056         void* filter_ptr = untag_ptr(filter);
45057         if (ptr_is_owned(filter)) { CHECK_ACCESS(filter_ptr); }
45058         LDKFilter* filter_conv = (LDKFilter*)filter_ptr;
45059         void* logger_ptr = untag_ptr(logger);
45060         if (ptr_is_owned(logger)) { CHECK_ACCESS(logger_ptr); }
45061         LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
45062         ChannelMonitor_load_outputs_to_watch(&this_arg_conv, filter_conv, logger_conv);
45063 }
45064
45065 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1and_1clear_1pending_1monitor_1events(JNIEnv *env, jclass clz, int64_t this_arg) {
45066         LDKChannelMonitor this_arg_conv;
45067         this_arg_conv.inner = untag_ptr(this_arg);
45068         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45069         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45070         this_arg_conv.is_owned = false;
45071         LDKCVec_MonitorEventZ ret_var = ChannelMonitor_get_and_clear_pending_monitor_events(&this_arg_conv);
45072         int64_tArray ret_arr = NULL;
45073         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
45074         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
45075         for (size_t o = 0; o < ret_var.datalen; o++) {
45076                 LDKMonitorEvent *ret_conv_14_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
45077                 *ret_conv_14_copy = ret_var.data[o];
45078                 int64_t ret_conv_14_ref = tag_ptr(ret_conv_14_copy, true);
45079                 ret_arr_ptr[o] = ret_conv_14_ref;
45080         }
45081         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
45082         FREE(ret_var.data);
45083         return ret_arr;
45084 }
45085
45086 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1process_1pending_1events(JNIEnv *env, jclass clz, int64_t this_arg, int64_t handler) {
45087         LDKChannelMonitor this_arg_conv;
45088         this_arg_conv.inner = untag_ptr(this_arg);
45089         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45090         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45091         this_arg_conv.is_owned = false;
45092         void* handler_ptr = untag_ptr(handler);
45093         if (ptr_is_owned(handler)) { CHECK_ACCESS(handler_ptr); }
45094         LDKEventHandler* handler_conv = (LDKEventHandler*)handler_ptr;
45095         ChannelMonitor_process_pending_events(&this_arg_conv, handler_conv);
45096 }
45097
45098 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1initial_1counterparty_1commitment_1tx(JNIEnv *env, jclass clz, int64_t this_arg) {
45099         LDKChannelMonitor this_arg_conv;
45100         this_arg_conv.inner = untag_ptr(this_arg);
45101         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45102         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45103         this_arg_conv.is_owned = false;
45104         LDKCommitmentTransaction ret_var = ChannelMonitor_initial_counterparty_commitment_tx(&this_arg_conv);
45105         int64_t ret_ref = 0;
45106         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45107         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45108         return ret_ref;
45109 }
45110
45111 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) {
45112         LDKChannelMonitor this_arg_conv;
45113         this_arg_conv.inner = untag_ptr(this_arg);
45114         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45115         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45116         this_arg_conv.is_owned = false;
45117         LDKChannelMonitorUpdate update_conv;
45118         update_conv.inner = untag_ptr(update);
45119         update_conv.is_owned = ptr_is_owned(update);
45120         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_conv);
45121         update_conv.is_owned = false;
45122         LDKCVec_CommitmentTransactionZ ret_var = ChannelMonitor_counterparty_commitment_txs_from_update(&this_arg_conv, &update_conv);
45123         int64_tArray ret_arr = NULL;
45124         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
45125         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
45126         for (size_t x = 0; x < ret_var.datalen; x++) {
45127                 LDKCommitmentTransaction ret_conv_23_var = ret_var.data[x];
45128                 int64_t ret_conv_23_ref = 0;
45129                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_23_var);
45130                 ret_conv_23_ref = tag_ptr(ret_conv_23_var.inner, ret_conv_23_var.is_owned);
45131                 ret_arr_ptr[x] = ret_conv_23_ref;
45132         }
45133         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
45134         FREE(ret_var.data);
45135         return ret_arr;
45136 }
45137
45138 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) {
45139         LDKChannelMonitor this_arg_conv;
45140         this_arg_conv.inner = untag_ptr(this_arg);
45141         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45142         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45143         this_arg_conv.is_owned = false;
45144         LDKTransaction justice_tx_ref;
45145         justice_tx_ref.datalen = (*env)->GetArrayLength(env, justice_tx);
45146         justice_tx_ref.data = MALLOC(justice_tx_ref.datalen, "LDKTransaction Bytes");
45147         (*env)->GetByteArrayRegion(env, justice_tx, 0, justice_tx_ref.datalen, justice_tx_ref.data);
45148         justice_tx_ref.data_is_owned = true;
45149         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
45150         *ret_conv = ChannelMonitor_sign_to_local_justice_tx(&this_arg_conv, justice_tx_ref, input_idx, value, commitment_number);
45151         return tag_ptr(ret_conv, true);
45152 }
45153
45154 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1counterparty_1node_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
45155         LDKChannelMonitor this_arg_conv;
45156         this_arg_conv.inner = untag_ptr(this_arg);
45157         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45158         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45159         this_arg_conv.is_owned = false;
45160         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
45161         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelMonitor_get_counterparty_node_id(&this_arg_conv).compressed_form);
45162         return ret_arr;
45163 }
45164
45165 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1broadcast_1latest_1holder_1commitment_1txn(JNIEnv *env, jclass clz, int64_t this_arg, int64_t broadcaster, int64_t fee_estimator, int64_t logger) {
45166         LDKChannelMonitor this_arg_conv;
45167         this_arg_conv.inner = untag_ptr(this_arg);
45168         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45169         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45170         this_arg_conv.is_owned = false;
45171         void* broadcaster_ptr = untag_ptr(broadcaster);
45172         if (ptr_is_owned(broadcaster)) { CHECK_ACCESS(broadcaster_ptr); }
45173         LDKBroadcasterInterface* broadcaster_conv = (LDKBroadcasterInterface*)broadcaster_ptr;
45174         void* fee_estimator_ptr = untag_ptr(fee_estimator);
45175         if (ptr_is_owned(fee_estimator)) { CHECK_ACCESS(fee_estimator_ptr); }
45176         LDKFeeEstimator* fee_estimator_conv = (LDKFeeEstimator*)fee_estimator_ptr;
45177         void* logger_ptr = untag_ptr(logger);
45178         if (ptr_is_owned(logger)) { CHECK_ACCESS(logger_ptr); }
45179         LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
45180         ChannelMonitor_broadcast_latest_holder_commitment_txn(&this_arg_conv, broadcaster_conv, fee_estimator_conv, logger_conv);
45181 }
45182
45183 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) {
45184         LDKChannelMonitor this_arg_conv;
45185         this_arg_conv.inner = untag_ptr(this_arg);
45186         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45187         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45188         this_arg_conv.is_owned = false;
45189         uint8_t header_arr[80];
45190         CHECK((*env)->GetArrayLength(env, header) == 80);
45191         (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
45192         uint8_t (*header_ref)[80] = &header_arr;
45193         LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
45194         txdata_constr.datalen = (*env)->GetArrayLength(env, txdata);
45195         if (txdata_constr.datalen > 0)
45196                 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
45197         else
45198                 txdata_constr.data = NULL;
45199         int64_t* txdata_vals = (*env)->GetLongArrayElements (env, txdata, NULL);
45200         for (size_t c = 0; c < txdata_constr.datalen; c++) {
45201                 int64_t txdata_conv_28 = txdata_vals[c];
45202                 void* txdata_conv_28_ptr = untag_ptr(txdata_conv_28);
45203                 CHECK_ACCESS(txdata_conv_28_ptr);
45204                 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
45205                 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)untag_ptr(txdata_conv_28));
45206                 txdata_constr.data[c] = txdata_conv_28_conv;
45207         }
45208         (*env)->ReleaseLongArrayElements(env, txdata, txdata_vals, 0);
45209         void* broadcaster_ptr = untag_ptr(broadcaster);
45210         CHECK_ACCESS(broadcaster_ptr);
45211         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
45212         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
45213                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
45214                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
45215         }
45216         void* fee_estimator_ptr = untag_ptr(fee_estimator);
45217         CHECK_ACCESS(fee_estimator_ptr);
45218         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
45219         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
45220                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
45221                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
45222         }
45223         void* logger_ptr = untag_ptr(logger);
45224         if (ptr_is_owned(logger)) { CHECK_ACCESS(logger_ptr); }
45225         LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
45226         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);
45227         int64_tArray ret_arr = NULL;
45228         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
45229         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
45230         for (size_t x = 0; x < ret_var.datalen; x++) {
45231                 LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ* ret_conv_49_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ");
45232                 *ret_conv_49_conv = ret_var.data[x];
45233                 ret_arr_ptr[x] = tag_ptr(ret_conv_49_conv, true);
45234         }
45235         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
45236         FREE(ret_var.data);
45237         return ret_arr;
45238 }
45239
45240 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) {
45241         LDKChannelMonitor this_arg_conv;
45242         this_arg_conv.inner = untag_ptr(this_arg);
45243         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45244         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45245         this_arg_conv.is_owned = false;
45246         uint8_t header_arr[80];
45247         CHECK((*env)->GetArrayLength(env, header) == 80);
45248         (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
45249         uint8_t (*header_ref)[80] = &header_arr;
45250         void* broadcaster_ptr = untag_ptr(broadcaster);
45251         CHECK_ACCESS(broadcaster_ptr);
45252         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
45253         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
45254                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
45255                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
45256         }
45257         void* fee_estimator_ptr = untag_ptr(fee_estimator);
45258         CHECK_ACCESS(fee_estimator_ptr);
45259         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
45260         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
45261                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
45262                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
45263         }
45264         void* logger_ptr = untag_ptr(logger);
45265         if (ptr_is_owned(logger)) { CHECK_ACCESS(logger_ptr); }
45266         LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
45267         ChannelMonitor_block_disconnected(&this_arg_conv, header_ref, height, broadcaster_conv, fee_estimator_conv, logger_conv);
45268 }
45269
45270 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) {
45271         LDKChannelMonitor this_arg_conv;
45272         this_arg_conv.inner = untag_ptr(this_arg);
45273         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45274         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45275         this_arg_conv.is_owned = false;
45276         uint8_t header_arr[80];
45277         CHECK((*env)->GetArrayLength(env, header) == 80);
45278         (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
45279         uint8_t (*header_ref)[80] = &header_arr;
45280         LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
45281         txdata_constr.datalen = (*env)->GetArrayLength(env, txdata);
45282         if (txdata_constr.datalen > 0)
45283                 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
45284         else
45285                 txdata_constr.data = NULL;
45286         int64_t* txdata_vals = (*env)->GetLongArrayElements (env, txdata, NULL);
45287         for (size_t c = 0; c < txdata_constr.datalen; c++) {
45288                 int64_t txdata_conv_28 = txdata_vals[c];
45289                 void* txdata_conv_28_ptr = untag_ptr(txdata_conv_28);
45290                 CHECK_ACCESS(txdata_conv_28_ptr);
45291                 LDKC2Tuple_usizeTransactionZ txdata_conv_28_conv = *(LDKC2Tuple_usizeTransactionZ*)(txdata_conv_28_ptr);
45292                 txdata_conv_28_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)untag_ptr(txdata_conv_28));
45293                 txdata_constr.data[c] = txdata_conv_28_conv;
45294         }
45295         (*env)->ReleaseLongArrayElements(env, txdata, txdata_vals, 0);
45296         void* broadcaster_ptr = untag_ptr(broadcaster);
45297         CHECK_ACCESS(broadcaster_ptr);
45298         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
45299         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
45300                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
45301                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
45302         }
45303         void* fee_estimator_ptr = untag_ptr(fee_estimator);
45304         CHECK_ACCESS(fee_estimator_ptr);
45305         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
45306         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
45307                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
45308                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
45309         }
45310         void* logger_ptr = untag_ptr(logger);
45311         if (ptr_is_owned(logger)) { CHECK_ACCESS(logger_ptr); }
45312         LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
45313         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);
45314         int64_tArray ret_arr = NULL;
45315         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
45316         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
45317         for (size_t x = 0; x < ret_var.datalen; x++) {
45318                 LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ* ret_conv_49_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ");
45319                 *ret_conv_49_conv = ret_var.data[x];
45320                 ret_arr_ptr[x] = tag_ptr(ret_conv_49_conv, true);
45321         }
45322         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
45323         FREE(ret_var.data);
45324         return ret_arr;
45325 }
45326
45327 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) {
45328         LDKChannelMonitor this_arg_conv;
45329         this_arg_conv.inner = untag_ptr(this_arg);
45330         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45331         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45332         this_arg_conv.is_owned = false;
45333         uint8_t txid_arr[32];
45334         CHECK((*env)->GetArrayLength(env, txid) == 32);
45335         (*env)->GetByteArrayRegion(env, txid, 0, 32, txid_arr);
45336         uint8_t (*txid_ref)[32] = &txid_arr;
45337         void* broadcaster_ptr = untag_ptr(broadcaster);
45338         CHECK_ACCESS(broadcaster_ptr);
45339         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
45340         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
45341                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
45342                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
45343         }
45344         void* fee_estimator_ptr = untag_ptr(fee_estimator);
45345         CHECK_ACCESS(fee_estimator_ptr);
45346         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
45347         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
45348                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
45349                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
45350         }
45351         void* logger_ptr = untag_ptr(logger);
45352         if (ptr_is_owned(logger)) { CHECK_ACCESS(logger_ptr); }
45353         LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
45354         ChannelMonitor_transaction_unconfirmed(&this_arg_conv, txid_ref, broadcaster_conv, fee_estimator_conv, logger_conv);
45355 }
45356
45357 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) {
45358         LDKChannelMonitor this_arg_conv;
45359         this_arg_conv.inner = untag_ptr(this_arg);
45360         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45361         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45362         this_arg_conv.is_owned = false;
45363         uint8_t header_arr[80];
45364         CHECK((*env)->GetArrayLength(env, header) == 80);
45365         (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
45366         uint8_t (*header_ref)[80] = &header_arr;
45367         void* broadcaster_ptr = untag_ptr(broadcaster);
45368         CHECK_ACCESS(broadcaster_ptr);
45369         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
45370         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
45371                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
45372                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
45373         }
45374         void* fee_estimator_ptr = untag_ptr(fee_estimator);
45375         CHECK_ACCESS(fee_estimator_ptr);
45376         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
45377         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
45378                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
45379                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
45380         }
45381         void* logger_ptr = untag_ptr(logger);
45382         if (ptr_is_owned(logger)) { CHECK_ACCESS(logger_ptr); }
45383         LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
45384         LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZZ ret_var = ChannelMonitor_best_block_updated(&this_arg_conv, header_ref, height, broadcaster_conv, fee_estimator_conv, logger_conv);
45385         int64_tArray ret_arr = NULL;
45386         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
45387         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
45388         for (size_t x = 0; x < ret_var.datalen; x++) {
45389                 LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ* ret_conv_49_conv = MALLOC(sizeof(LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ");
45390                 *ret_conv_49_conv = ret_var.data[x];
45391                 ret_arr_ptr[x] = tag_ptr(ret_conv_49_conv, true);
45392         }
45393         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
45394         FREE(ret_var.data);
45395         return ret_arr;
45396 }
45397
45398 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1relevant_1txids(JNIEnv *env, jclass clz, int64_t this_arg) {
45399         LDKChannelMonitor this_arg_conv;
45400         this_arg_conv.inner = untag_ptr(this_arg);
45401         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45402         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45403         this_arg_conv.is_owned = false;
45404         LDKCVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ ret_var = ChannelMonitor_get_relevant_txids(&this_arg_conv);
45405         int64_tArray ret_arr = NULL;
45406         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
45407         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
45408         for (size_t c = 0; c < ret_var.datalen; c++) {
45409                 LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ* ret_conv_54_conv = MALLOC(sizeof(LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ), "LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ");
45410                 *ret_conv_54_conv = ret_var.data[c];
45411                 ret_arr_ptr[c] = tag_ptr(ret_conv_54_conv, true);
45412         }
45413         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
45414         FREE(ret_var.data);
45415         return ret_arr;
45416 }
45417
45418 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1current_1best_1block(JNIEnv *env, jclass clz, int64_t this_arg) {
45419         LDKChannelMonitor this_arg_conv;
45420         this_arg_conv.inner = untag_ptr(this_arg);
45421         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45422         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45423         this_arg_conv.is_owned = false;
45424         LDKBestBlock ret_var = ChannelMonitor_current_best_block(&this_arg_conv);
45425         int64_t ret_ref = 0;
45426         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45427         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45428         return ret_ref;
45429 }
45430
45431 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) {
45432         LDKChannelMonitor this_arg_conv;
45433         this_arg_conv.inner = untag_ptr(this_arg);
45434         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45435         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45436         this_arg_conv.is_owned = false;
45437         void* broadcaster_ptr = untag_ptr(broadcaster);
45438         CHECK_ACCESS(broadcaster_ptr);
45439         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
45440         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
45441                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
45442                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
45443         }
45444         void* fee_estimator_ptr = untag_ptr(fee_estimator);
45445         CHECK_ACCESS(fee_estimator_ptr);
45446         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
45447         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
45448                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
45449                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
45450         }
45451         void* logger_ptr = untag_ptr(logger);
45452         if (ptr_is_owned(logger)) { CHECK_ACCESS(logger_ptr); }
45453         LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
45454         ChannelMonitor_rebroadcast_pending_claims(&this_arg_conv, broadcaster_conv, fee_estimator_conv, logger_conv);
45455 }
45456
45457 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1signer_1unblocked(JNIEnv *env, jclass clz, int64_t this_arg, int64_t broadcaster, int64_t fee_estimator, int64_t logger) {
45458         LDKChannelMonitor this_arg_conv;
45459         this_arg_conv.inner = untag_ptr(this_arg);
45460         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45461         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45462         this_arg_conv.is_owned = false;
45463         void* broadcaster_ptr = untag_ptr(broadcaster);
45464         CHECK_ACCESS(broadcaster_ptr);
45465         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
45466         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
45467                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
45468                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
45469         }
45470         void* fee_estimator_ptr = untag_ptr(fee_estimator);
45471         CHECK_ACCESS(fee_estimator_ptr);
45472         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
45473         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
45474                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
45475                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
45476         }
45477         void* logger_ptr = untag_ptr(logger);
45478         if (ptr_is_owned(logger)) { CHECK_ACCESS(logger_ptr); }
45479         LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
45480         ChannelMonitor_signer_unblocked(&this_arg_conv, broadcaster_conv, fee_estimator_conv, logger_conv);
45481 }
45482
45483 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) {
45484         LDKChannelMonitor this_arg_conv;
45485         this_arg_conv.inner = untag_ptr(this_arg);
45486         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45487         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45488         this_arg_conv.is_owned = false;
45489         LDKTransaction tx_ref;
45490         tx_ref.datalen = (*env)->GetArrayLength(env, tx);
45491         tx_ref.data = MALLOC(tx_ref.datalen, "LDKTransaction Bytes");
45492         (*env)->GetByteArrayRegion(env, tx, 0, tx_ref.datalen, tx_ref.data);
45493         tx_ref.data_is_owned = true;
45494         LDKCVec_SpendableOutputDescriptorZ ret_var = ChannelMonitor_get_spendable_outputs(&this_arg_conv, tx_ref, confirmation_height);
45495         int64_tArray ret_arr = NULL;
45496         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
45497         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
45498         for (size_t b = 0; b < ret_var.datalen; b++) {
45499                 LDKSpendableOutputDescriptor *ret_conv_27_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
45500                 *ret_conv_27_copy = ret_var.data[b];
45501                 int64_t ret_conv_27_ref = tag_ptr(ret_conv_27_copy, true);
45502                 ret_arr_ptr[b] = ret_conv_27_ref;
45503         }
45504         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
45505         FREE(ret_var.data);
45506         return ret_arr;
45507 }
45508
45509 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1is_1fully_1resolved(JNIEnv *env, jclass clz, int64_t this_arg, int64_t logger) {
45510         LDKChannelMonitor this_arg_conv;
45511         this_arg_conv.inner = untag_ptr(this_arg);
45512         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45513         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45514         this_arg_conv.is_owned = false;
45515         void* logger_ptr = untag_ptr(logger);
45516         if (ptr_is_owned(logger)) { CHECK_ACCESS(logger_ptr); }
45517         LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
45518         jboolean ret_conv = ChannelMonitor_is_fully_resolved(&this_arg_conv, logger_conv);
45519         return ret_conv;
45520 }
45521
45522 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1claimable_1balances(JNIEnv *env, jclass clz, int64_t this_arg) {
45523         LDKChannelMonitor this_arg_conv;
45524         this_arg_conv.inner = untag_ptr(this_arg);
45525         this_arg_conv.is_owned = ptr_is_owned(this_arg);
45526         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
45527         this_arg_conv.is_owned = false;
45528         LDKCVec_BalanceZ ret_var = ChannelMonitor_get_claimable_balances(&this_arg_conv);
45529         int64_tArray ret_arr = NULL;
45530         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
45531         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
45532         for (size_t j = 0; j < ret_var.datalen; j++) {
45533                 LDKBalance *ret_conv_9_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
45534                 *ret_conv_9_copy = ret_var.data[j];
45535                 int64_t ret_conv_9_ref = tag_ptr(ret_conv_9_copy, true);
45536                 ret_arr_ptr[j] = ret_conv_9_ref;
45537         }
45538         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
45539         FREE(ret_var.data);
45540         return ret_arr;
45541 }
45542
45543 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) {
45544         LDKu8slice ser_ref;
45545         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
45546         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
45547         void* arg_a_ptr = untag_ptr(arg_a);
45548         if (ptr_is_owned(arg_a)) { CHECK_ACCESS(arg_a_ptr); }
45549         LDKEntropySource* arg_a_conv = (LDKEntropySource*)arg_a_ptr;
45550         void* arg_b_ptr = untag_ptr(arg_b);
45551         if (ptr_is_owned(arg_b)) { CHECK_ACCESS(arg_b_ptr); }
45552         LDKSignerProvider* arg_b_conv = (LDKSignerProvider*)arg_b_ptr;
45553         LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ");
45554         *ret_conv = C2Tuple_ThirtyTwoBytesChannelMonitorZ_read(ser_ref, arg_a_conv, arg_b_conv);
45555         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
45556         return tag_ptr(ret_conv, true);
45557 }
45558
45559 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OutPoint_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
45560         LDKOutPoint this_obj_conv;
45561         this_obj_conv.inner = untag_ptr(this_obj);
45562         this_obj_conv.is_owned = ptr_is_owned(this_obj);
45563         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
45564         OutPoint_free(this_obj_conv);
45565 }
45566
45567 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OutPoint_1get_1txid(JNIEnv *env, jclass clz, int64_t this_ptr) {
45568         LDKOutPoint this_ptr_conv;
45569         this_ptr_conv.inner = untag_ptr(this_ptr);
45570         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45571         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45572         this_ptr_conv.is_owned = false;
45573         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
45574         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *OutPoint_get_txid(&this_ptr_conv));
45575         return ret_arr;
45576 }
45577
45578 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OutPoint_1set_1txid(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
45579         LDKOutPoint this_ptr_conv;
45580         this_ptr_conv.inner = untag_ptr(this_ptr);
45581         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45582         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45583         this_ptr_conv.is_owned = false;
45584         LDKThirtyTwoBytes val_ref;
45585         CHECK((*env)->GetArrayLength(env, val) == 32);
45586         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
45587         OutPoint_set_txid(&this_ptr_conv, val_ref);
45588 }
45589
45590 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1get_1index(JNIEnv *env, jclass clz, int64_t this_ptr) {
45591         LDKOutPoint this_ptr_conv;
45592         this_ptr_conv.inner = untag_ptr(this_ptr);
45593         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45594         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45595         this_ptr_conv.is_owned = false;
45596         int16_t ret_conv = OutPoint_get_index(&this_ptr_conv);
45597         return ret_conv;
45598 }
45599
45600 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OutPoint_1set_1index(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
45601         LDKOutPoint this_ptr_conv;
45602         this_ptr_conv.inner = untag_ptr(this_ptr);
45603         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45604         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45605         this_ptr_conv.is_owned = false;
45606         OutPoint_set_index(&this_ptr_conv, val);
45607 }
45608
45609 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1new(JNIEnv *env, jclass clz, int8_tArray txid_arg, int16_t index_arg) {
45610         LDKThirtyTwoBytes txid_arg_ref;
45611         CHECK((*env)->GetArrayLength(env, txid_arg) == 32);
45612         (*env)->GetByteArrayRegion(env, txid_arg, 0, 32, txid_arg_ref.data);
45613         LDKOutPoint ret_var = OutPoint_new(txid_arg_ref, index_arg);
45614         int64_t ret_ref = 0;
45615         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45616         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45617         return ret_ref;
45618 }
45619
45620 static inline uint64_t OutPoint_clone_ptr(LDKOutPoint *NONNULL_PTR arg) {
45621         LDKOutPoint ret_var = OutPoint_clone(arg);
45622         int64_t ret_ref = 0;
45623         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45624         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45625         return ret_ref;
45626 }
45627 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
45628         LDKOutPoint arg_conv;
45629         arg_conv.inner = untag_ptr(arg);
45630         arg_conv.is_owned = ptr_is_owned(arg);
45631         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
45632         arg_conv.is_owned = false;
45633         int64_t ret_conv = OutPoint_clone_ptr(&arg_conv);
45634         return ret_conv;
45635 }
45636
45637 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1clone(JNIEnv *env, jclass clz, int64_t orig) {
45638         LDKOutPoint orig_conv;
45639         orig_conv.inner = untag_ptr(orig);
45640         orig_conv.is_owned = ptr_is_owned(orig);
45641         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
45642         orig_conv.is_owned = false;
45643         LDKOutPoint ret_var = OutPoint_clone(&orig_conv);
45644         int64_t ret_ref = 0;
45645         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45646         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45647         return ret_ref;
45648 }
45649
45650 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_OutPoint_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
45651         LDKOutPoint a_conv;
45652         a_conv.inner = untag_ptr(a);
45653         a_conv.is_owned = ptr_is_owned(a);
45654         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
45655         a_conv.is_owned = false;
45656         LDKOutPoint b_conv;
45657         b_conv.inner = untag_ptr(b);
45658         b_conv.is_owned = ptr_is_owned(b);
45659         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
45660         b_conv.is_owned = false;
45661         jboolean ret_conv = OutPoint_eq(&a_conv, &b_conv);
45662         return ret_conv;
45663 }
45664
45665 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1hash(JNIEnv *env, jclass clz, int64_t o) {
45666         LDKOutPoint o_conv;
45667         o_conv.inner = untag_ptr(o);
45668         o_conv.is_owned = ptr_is_owned(o);
45669         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
45670         o_conv.is_owned = false;
45671         int64_t ret_conv = OutPoint_hash(&o_conv);
45672         return ret_conv;
45673 }
45674
45675 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OutPoint_1write(JNIEnv *env, jclass clz, int64_t obj) {
45676         LDKOutPoint obj_conv;
45677         obj_conv.inner = untag_ptr(obj);
45678         obj_conv.is_owned = ptr_is_owned(obj);
45679         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
45680         obj_conv.is_owned = false;
45681         LDKCVec_u8Z ret_var = OutPoint_write(&obj_conv);
45682         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
45683         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
45684         CVec_u8Z_free(ret_var);
45685         return ret_arr;
45686 }
45687
45688 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
45689         LDKu8slice ser_ref;
45690         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
45691         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
45692         LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
45693         *ret_conv = OutPoint_read(ser_ref);
45694         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
45695         return tag_ptr(ret_conv, true);
45696 }
45697
45698 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InboundHTLCErr_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
45699         LDKInboundHTLCErr this_obj_conv;
45700         this_obj_conv.inner = untag_ptr(this_obj);
45701         this_obj_conv.is_owned = ptr_is_owned(this_obj);
45702         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
45703         InboundHTLCErr_free(this_obj_conv);
45704 }
45705
45706 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_InboundHTLCErr_1get_1err_1code(JNIEnv *env, jclass clz, int64_t this_ptr) {
45707         LDKInboundHTLCErr this_ptr_conv;
45708         this_ptr_conv.inner = untag_ptr(this_ptr);
45709         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45710         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45711         this_ptr_conv.is_owned = false;
45712         int16_t ret_conv = InboundHTLCErr_get_err_code(&this_ptr_conv);
45713         return ret_conv;
45714 }
45715
45716 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InboundHTLCErr_1set_1err_1code(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
45717         LDKInboundHTLCErr this_ptr_conv;
45718         this_ptr_conv.inner = untag_ptr(this_ptr);
45719         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45720         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45721         this_ptr_conv.is_owned = false;
45722         InboundHTLCErr_set_err_code(&this_ptr_conv, val);
45723 }
45724
45725 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InboundHTLCErr_1get_1err_1data(JNIEnv *env, jclass clz, int64_t this_ptr) {
45726         LDKInboundHTLCErr this_ptr_conv;
45727         this_ptr_conv.inner = untag_ptr(this_ptr);
45728         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45729         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45730         this_ptr_conv.is_owned = false;
45731         LDKCVec_u8Z ret_var = InboundHTLCErr_get_err_data(&this_ptr_conv);
45732         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
45733         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
45734         CVec_u8Z_free(ret_var);
45735         return ret_arr;
45736 }
45737
45738 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InboundHTLCErr_1set_1err_1data(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
45739         LDKInboundHTLCErr this_ptr_conv;
45740         this_ptr_conv.inner = untag_ptr(this_ptr);
45741         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45742         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45743         this_ptr_conv.is_owned = false;
45744         LDKCVec_u8Z val_ref;
45745         val_ref.datalen = (*env)->GetArrayLength(env, val);
45746         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
45747         (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
45748         InboundHTLCErr_set_err_data(&this_ptr_conv, val_ref);
45749 }
45750
45751 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_InboundHTLCErr_1get_1msg(JNIEnv *env, jclass clz, int64_t this_ptr) {
45752         LDKInboundHTLCErr this_ptr_conv;
45753         this_ptr_conv.inner = untag_ptr(this_ptr);
45754         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45755         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45756         this_ptr_conv.is_owned = false;
45757         LDKStr ret_str = InboundHTLCErr_get_msg(&this_ptr_conv);
45758         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
45759         Str_free(ret_str);
45760         return ret_conv;
45761 }
45762
45763 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InboundHTLCErr_1set_1msg(JNIEnv *env, jclass clz, int64_t this_ptr, jstring val) {
45764         LDKInboundHTLCErr this_ptr_conv;
45765         this_ptr_conv.inner = untag_ptr(this_ptr);
45766         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45767         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45768         this_ptr_conv.is_owned = false;
45769         LDKStr val_conv = java_to_owned_str(env, val);
45770         InboundHTLCErr_set_msg(&this_ptr_conv, val_conv);
45771 }
45772
45773 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) {
45774         LDKCVec_u8Z err_data_arg_ref;
45775         err_data_arg_ref.datalen = (*env)->GetArrayLength(env, err_data_arg);
45776         err_data_arg_ref.data = MALLOC(err_data_arg_ref.datalen, "LDKCVec_u8Z Bytes");
45777         (*env)->GetByteArrayRegion(env, err_data_arg, 0, err_data_arg_ref.datalen, err_data_arg_ref.data);
45778         LDKStr msg_arg_conv = java_to_owned_str(env, msg_arg);
45779         LDKInboundHTLCErr ret_var = InboundHTLCErr_new(err_code_arg, err_data_arg_ref, msg_arg_conv);
45780         int64_t ret_ref = 0;
45781         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45782         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45783         return ret_ref;
45784 }
45785
45786 static inline uint64_t InboundHTLCErr_clone_ptr(LDKInboundHTLCErr *NONNULL_PTR arg) {
45787         LDKInboundHTLCErr ret_var = InboundHTLCErr_clone(arg);
45788         int64_t ret_ref = 0;
45789         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45790         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45791         return ret_ref;
45792 }
45793 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InboundHTLCErr_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
45794         LDKInboundHTLCErr arg_conv;
45795         arg_conv.inner = untag_ptr(arg);
45796         arg_conv.is_owned = ptr_is_owned(arg);
45797         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
45798         arg_conv.is_owned = false;
45799         int64_t ret_conv = InboundHTLCErr_clone_ptr(&arg_conv);
45800         return ret_conv;
45801 }
45802
45803 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InboundHTLCErr_1clone(JNIEnv *env, jclass clz, int64_t orig) {
45804         LDKInboundHTLCErr orig_conv;
45805         orig_conv.inner = untag_ptr(orig);
45806         orig_conv.is_owned = ptr_is_owned(orig);
45807         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
45808         orig_conv.is_owned = false;
45809         LDKInboundHTLCErr ret_var = InboundHTLCErr_clone(&orig_conv);
45810         int64_t ret_ref = 0;
45811         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
45812         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
45813         return ret_ref;
45814 }
45815
45816 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InboundHTLCErr_1hash(JNIEnv *env, jclass clz, int64_t o) {
45817         LDKInboundHTLCErr o_conv;
45818         o_conv.inner = untag_ptr(o);
45819         o_conv.is_owned = ptr_is_owned(o);
45820         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
45821         o_conv.is_owned = false;
45822         int64_t ret_conv = InboundHTLCErr_hash(&o_conv);
45823         return ret_conv;
45824 }
45825
45826 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InboundHTLCErr_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
45827         LDKInboundHTLCErr a_conv;
45828         a_conv.inner = untag_ptr(a);
45829         a_conv.is_owned = ptr_is_owned(a);
45830         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
45831         a_conv.is_owned = false;
45832         LDKInboundHTLCErr b_conv;
45833         b_conv.inner = untag_ptr(b);
45834         b_conv.is_owned = ptr_is_owned(b);
45835         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
45836         b_conv.is_owned = false;
45837         jboolean ret_conv = InboundHTLCErr_eq(&a_conv, &b_conv);
45838         return ret_conv;
45839 }
45840
45841 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) {
45842         LDKUpdateAddHTLC msg_conv;
45843         msg_conv.inner = untag_ptr(msg);
45844         msg_conv.is_owned = ptr_is_owned(msg);
45845         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
45846         msg_conv.is_owned = false;
45847         void* node_signer_ptr = untag_ptr(node_signer);
45848         if (ptr_is_owned(node_signer)) { CHECK_ACCESS(node_signer_ptr); }
45849         LDKNodeSigner* node_signer_conv = (LDKNodeSigner*)node_signer_ptr;
45850         void* logger_ptr = untag_ptr(logger);
45851         if (ptr_is_owned(logger)) { CHECK_ACCESS(logger_ptr); }
45852         LDKLogger* logger_conv = (LDKLogger*)logger_ptr;
45853         LDKCResult_PendingHTLCInfoInboundHTLCErrZ* ret_conv = MALLOC(sizeof(LDKCResult_PendingHTLCInfoInboundHTLCErrZ), "LDKCResult_PendingHTLCInfoInboundHTLCErrZ");
45854         *ret_conv = peel_payment_onion(&msg_conv, node_signer_conv, logger_conv, cur_height, accept_mpp_keysend, allow_skimmed_fees);
45855         return tag_ptr(ret_conv, true);
45856 }
45857
45858 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PendingHTLCRouting_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
45859         if (!ptr_is_owned(this_ptr)) return;
45860         void* this_ptr_ptr = untag_ptr(this_ptr);
45861         CHECK_ACCESS(this_ptr_ptr);
45862         LDKPendingHTLCRouting this_ptr_conv = *(LDKPendingHTLCRouting*)(this_ptr_ptr);
45863         FREE(untag_ptr(this_ptr));
45864         PendingHTLCRouting_free(this_ptr_conv);
45865 }
45866
45867 static inline uint64_t PendingHTLCRouting_clone_ptr(LDKPendingHTLCRouting *NONNULL_PTR arg) {
45868         LDKPendingHTLCRouting *ret_copy = MALLOC(sizeof(LDKPendingHTLCRouting), "LDKPendingHTLCRouting");
45869         *ret_copy = PendingHTLCRouting_clone(arg);
45870         int64_t ret_ref = tag_ptr(ret_copy, true);
45871         return ret_ref;
45872 }
45873 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PendingHTLCRouting_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
45874         LDKPendingHTLCRouting* arg_conv = (LDKPendingHTLCRouting*)untag_ptr(arg);
45875         int64_t ret_conv = PendingHTLCRouting_clone_ptr(arg_conv);
45876         return ret_conv;
45877 }
45878
45879 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PendingHTLCRouting_1clone(JNIEnv *env, jclass clz, int64_t orig) {
45880         LDKPendingHTLCRouting* orig_conv = (LDKPendingHTLCRouting*)untag_ptr(orig);
45881         LDKPendingHTLCRouting *ret_copy = MALLOC(sizeof(LDKPendingHTLCRouting), "LDKPendingHTLCRouting");
45882         *ret_copy = PendingHTLCRouting_clone(orig_conv);
45883         int64_t ret_ref = tag_ptr(ret_copy, true);
45884         return ret_ref;
45885 }
45886
45887 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) {
45888         LDKOnionPacket onion_packet_conv;
45889         onion_packet_conv.inner = untag_ptr(onion_packet);
45890         onion_packet_conv.is_owned = ptr_is_owned(onion_packet);
45891         CHECK_INNER_FIELD_ACCESS_OR_NULL(onion_packet_conv);
45892         onion_packet_conv = OnionPacket_clone(&onion_packet_conv);
45893         LDKBlindedForward blinded_conv;
45894         blinded_conv.inner = untag_ptr(blinded);
45895         blinded_conv.is_owned = ptr_is_owned(blinded);
45896         CHECK_INNER_FIELD_ACCESS_OR_NULL(blinded_conv);
45897         blinded_conv = BlindedForward_clone(&blinded_conv);
45898         LDKPendingHTLCRouting *ret_copy = MALLOC(sizeof(LDKPendingHTLCRouting), "LDKPendingHTLCRouting");
45899         *ret_copy = PendingHTLCRouting_forward(onion_packet_conv, short_channel_id, blinded_conv);
45900         int64_t ret_ref = tag_ptr(ret_copy, true);
45901         return ret_ref;
45902 }
45903
45904 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PendingHTLCRouting_1receive(JNIEnv *env, jclass clz, int64_t payment_data, int64_t payment_metadata, int64_t payment_context, int32_t incoming_cltv_expiry, int8_tArray phantom_shared_secret, int64_tArray custom_tlvs, jboolean requires_blinded_error) {
45905         LDKFinalOnionHopData payment_data_conv;
45906         payment_data_conv.inner = untag_ptr(payment_data);
45907         payment_data_conv.is_owned = ptr_is_owned(payment_data);
45908         CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_data_conv);
45909         payment_data_conv = FinalOnionHopData_clone(&payment_data_conv);
45910         void* payment_metadata_ptr = untag_ptr(payment_metadata);
45911         CHECK_ACCESS(payment_metadata_ptr);
45912         LDKCOption_CVec_u8ZZ payment_metadata_conv = *(LDKCOption_CVec_u8ZZ*)(payment_metadata_ptr);
45913         payment_metadata_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(payment_metadata));
45914         void* payment_context_ptr = untag_ptr(payment_context);
45915         CHECK_ACCESS(payment_context_ptr);
45916         LDKCOption_PaymentContextZ payment_context_conv = *(LDKCOption_PaymentContextZ*)(payment_context_ptr);
45917         payment_context_conv = COption_PaymentContextZ_clone((LDKCOption_PaymentContextZ*)untag_ptr(payment_context));
45918         LDKThirtyTwoBytes phantom_shared_secret_ref;
45919         CHECK((*env)->GetArrayLength(env, phantom_shared_secret) == 32);
45920         (*env)->GetByteArrayRegion(env, phantom_shared_secret, 0, 32, phantom_shared_secret_ref.data);
45921         LDKCVec_C2Tuple_u64CVec_u8ZZZ custom_tlvs_constr;
45922         custom_tlvs_constr.datalen = (*env)->GetArrayLength(env, custom_tlvs);
45923         if (custom_tlvs_constr.datalen > 0)
45924                 custom_tlvs_constr.data = MALLOC(custom_tlvs_constr.datalen * sizeof(LDKC2Tuple_u64CVec_u8ZZ), "LDKCVec_C2Tuple_u64CVec_u8ZZZ Elements");
45925         else
45926                 custom_tlvs_constr.data = NULL;
45927         int64_t* custom_tlvs_vals = (*env)->GetLongArrayElements (env, custom_tlvs, NULL);
45928         for (size_t x = 0; x < custom_tlvs_constr.datalen; x++) {
45929                 int64_t custom_tlvs_conv_23 = custom_tlvs_vals[x];
45930                 void* custom_tlvs_conv_23_ptr = untag_ptr(custom_tlvs_conv_23);
45931                 CHECK_ACCESS(custom_tlvs_conv_23_ptr);
45932                 LDKC2Tuple_u64CVec_u8ZZ custom_tlvs_conv_23_conv = *(LDKC2Tuple_u64CVec_u8ZZ*)(custom_tlvs_conv_23_ptr);
45933                 custom_tlvs_conv_23_conv = C2Tuple_u64CVec_u8ZZ_clone((LDKC2Tuple_u64CVec_u8ZZ*)untag_ptr(custom_tlvs_conv_23));
45934                 custom_tlvs_constr.data[x] = custom_tlvs_conv_23_conv;
45935         }
45936         (*env)->ReleaseLongArrayElements(env, custom_tlvs, custom_tlvs_vals, 0);
45937         LDKPendingHTLCRouting *ret_copy = MALLOC(sizeof(LDKPendingHTLCRouting), "LDKPendingHTLCRouting");
45938         *ret_copy = PendingHTLCRouting_receive(payment_data_conv, payment_metadata_conv, payment_context_conv, incoming_cltv_expiry, phantom_shared_secret_ref, custom_tlvs_constr, requires_blinded_error);
45939         int64_t ret_ref = tag_ptr(ret_copy, true);
45940         return ret_ref;
45941 }
45942
45943 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PendingHTLCRouting_1receive_1keysend(JNIEnv *env, jclass clz, int64_t payment_data, int8_tArray payment_preimage, int64_t payment_metadata, int32_t incoming_cltv_expiry, int64_tArray custom_tlvs, jboolean requires_blinded_error) {
45944         LDKFinalOnionHopData payment_data_conv;
45945         payment_data_conv.inner = untag_ptr(payment_data);
45946         payment_data_conv.is_owned = ptr_is_owned(payment_data);
45947         CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_data_conv);
45948         payment_data_conv = FinalOnionHopData_clone(&payment_data_conv);
45949         LDKThirtyTwoBytes payment_preimage_ref;
45950         CHECK((*env)->GetArrayLength(env, payment_preimage) == 32);
45951         (*env)->GetByteArrayRegion(env, payment_preimage, 0, 32, payment_preimage_ref.data);
45952         void* payment_metadata_ptr = untag_ptr(payment_metadata);
45953         CHECK_ACCESS(payment_metadata_ptr);
45954         LDKCOption_CVec_u8ZZ payment_metadata_conv = *(LDKCOption_CVec_u8ZZ*)(payment_metadata_ptr);
45955         payment_metadata_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(payment_metadata));
45956         LDKCVec_C2Tuple_u64CVec_u8ZZZ custom_tlvs_constr;
45957         custom_tlvs_constr.datalen = (*env)->GetArrayLength(env, custom_tlvs);
45958         if (custom_tlvs_constr.datalen > 0)
45959                 custom_tlvs_constr.data = MALLOC(custom_tlvs_constr.datalen * sizeof(LDKC2Tuple_u64CVec_u8ZZ), "LDKCVec_C2Tuple_u64CVec_u8ZZZ Elements");
45960         else
45961                 custom_tlvs_constr.data = NULL;
45962         int64_t* custom_tlvs_vals = (*env)->GetLongArrayElements (env, custom_tlvs, NULL);
45963         for (size_t x = 0; x < custom_tlvs_constr.datalen; x++) {
45964                 int64_t custom_tlvs_conv_23 = custom_tlvs_vals[x];
45965                 void* custom_tlvs_conv_23_ptr = untag_ptr(custom_tlvs_conv_23);
45966                 CHECK_ACCESS(custom_tlvs_conv_23_ptr);
45967                 LDKC2Tuple_u64CVec_u8ZZ custom_tlvs_conv_23_conv = *(LDKC2Tuple_u64CVec_u8ZZ*)(custom_tlvs_conv_23_ptr);
45968                 custom_tlvs_conv_23_conv = C2Tuple_u64CVec_u8ZZ_clone((LDKC2Tuple_u64CVec_u8ZZ*)untag_ptr(custom_tlvs_conv_23));
45969                 custom_tlvs_constr.data[x] = custom_tlvs_conv_23_conv;
45970         }
45971         (*env)->ReleaseLongArrayElements(env, custom_tlvs, custom_tlvs_vals, 0);
45972         LDKPendingHTLCRouting *ret_copy = MALLOC(sizeof(LDKPendingHTLCRouting), "LDKPendingHTLCRouting");
45973         *ret_copy = PendingHTLCRouting_receive_keysend(payment_data_conv, payment_preimage_ref, payment_metadata_conv, incoming_cltv_expiry, custom_tlvs_constr, requires_blinded_error);
45974         int64_t ret_ref = tag_ptr(ret_copy, true);
45975         return ret_ref;
45976 }
45977
45978 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BlindedForward_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
45979         LDKBlindedForward this_obj_conv;
45980         this_obj_conv.inner = untag_ptr(this_obj);
45981         this_obj_conv.is_owned = ptr_is_owned(this_obj);
45982         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
45983         BlindedForward_free(this_obj_conv);
45984 }
45985
45986 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BlindedForward_1get_1inbound_1blinding_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
45987         LDKBlindedForward this_ptr_conv;
45988         this_ptr_conv.inner = untag_ptr(this_ptr);
45989         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
45990         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
45991         this_ptr_conv.is_owned = false;
45992         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
45993         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, BlindedForward_get_inbound_blinding_point(&this_ptr_conv).compressed_form);
45994         return ret_arr;
45995 }
45996
45997 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BlindedForward_1set_1inbound_1blinding_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
45998         LDKBlindedForward this_ptr_conv;
45999         this_ptr_conv.inner = untag_ptr(this_ptr);
46000         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46001         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46002         this_ptr_conv.is_owned = false;
46003         LDKPublicKey val_ref;
46004         CHECK((*env)->GetArrayLength(env, val) == 33);
46005         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
46006         BlindedForward_set_inbound_blinding_point(&this_ptr_conv, val_ref);
46007 }
46008
46009 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_BlindedForward_1get_1failure(JNIEnv *env, jclass clz, int64_t this_ptr) {
46010         LDKBlindedForward this_ptr_conv;
46011         this_ptr_conv.inner = untag_ptr(this_ptr);
46012         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46013         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46014         this_ptr_conv.is_owned = false;
46015         jclass ret_conv = LDKBlindedFailure_to_java(env, BlindedForward_get_failure(&this_ptr_conv));
46016         return ret_conv;
46017 }
46018
46019 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BlindedForward_1set_1failure(JNIEnv *env, jclass clz, int64_t this_ptr, jclass val) {
46020         LDKBlindedForward this_ptr_conv;
46021         this_ptr_conv.inner = untag_ptr(this_ptr);
46022         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46023         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46024         this_ptr_conv.is_owned = false;
46025         LDKBlindedFailure val_conv = LDKBlindedFailure_from_java(env, val);
46026         BlindedForward_set_failure(&this_ptr_conv, val_conv);
46027 }
46028
46029 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedForward_1new(JNIEnv *env, jclass clz, int8_tArray inbound_blinding_point_arg, jclass failure_arg) {
46030         LDKPublicKey inbound_blinding_point_arg_ref;
46031         CHECK((*env)->GetArrayLength(env, inbound_blinding_point_arg) == 33);
46032         (*env)->GetByteArrayRegion(env, inbound_blinding_point_arg, 0, 33, inbound_blinding_point_arg_ref.compressed_form);
46033         LDKBlindedFailure failure_arg_conv = LDKBlindedFailure_from_java(env, failure_arg);
46034         LDKBlindedForward ret_var = BlindedForward_new(inbound_blinding_point_arg_ref, failure_arg_conv);
46035         int64_t ret_ref = 0;
46036         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46037         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46038         return ret_ref;
46039 }
46040
46041 static inline uint64_t BlindedForward_clone_ptr(LDKBlindedForward *NONNULL_PTR arg) {
46042         LDKBlindedForward ret_var = BlindedForward_clone(arg);
46043         int64_t ret_ref = 0;
46044         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46045         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46046         return ret_ref;
46047 }
46048 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedForward_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
46049         LDKBlindedForward arg_conv;
46050         arg_conv.inner = untag_ptr(arg);
46051         arg_conv.is_owned = ptr_is_owned(arg);
46052         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
46053         arg_conv.is_owned = false;
46054         int64_t ret_conv = BlindedForward_clone_ptr(&arg_conv);
46055         return ret_conv;
46056 }
46057
46058 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedForward_1clone(JNIEnv *env, jclass clz, int64_t orig) {
46059         LDKBlindedForward orig_conv;
46060         orig_conv.inner = untag_ptr(orig);
46061         orig_conv.is_owned = ptr_is_owned(orig);
46062         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
46063         orig_conv.is_owned = false;
46064         LDKBlindedForward ret_var = BlindedForward_clone(&orig_conv);
46065         int64_t ret_ref = 0;
46066         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46067         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46068         return ret_ref;
46069 }
46070
46071 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedForward_1hash(JNIEnv *env, jclass clz, int64_t o) {
46072         LDKBlindedForward o_conv;
46073         o_conv.inner = untag_ptr(o);
46074         o_conv.is_owned = ptr_is_owned(o);
46075         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
46076         o_conv.is_owned = false;
46077         int64_t ret_conv = BlindedForward_hash(&o_conv);
46078         return ret_conv;
46079 }
46080
46081 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_BlindedForward_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
46082         LDKBlindedForward a_conv;
46083         a_conv.inner = untag_ptr(a);
46084         a_conv.is_owned = ptr_is_owned(a);
46085         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
46086         a_conv.is_owned = false;
46087         LDKBlindedForward b_conv;
46088         b_conv.inner = untag_ptr(b);
46089         b_conv.is_owned = ptr_is_owned(b);
46090         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
46091         b_conv.is_owned = false;
46092         jboolean ret_conv = BlindedForward_eq(&a_conv, &b_conv);
46093         return ret_conv;
46094 }
46095
46096 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PendingHTLCInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
46097         LDKPendingHTLCInfo this_obj_conv;
46098         this_obj_conv.inner = untag_ptr(this_obj);
46099         this_obj_conv.is_owned = ptr_is_owned(this_obj);
46100         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46101         PendingHTLCInfo_free(this_obj_conv);
46102 }
46103
46104 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PendingHTLCInfo_1get_1routing(JNIEnv *env, jclass clz, int64_t this_ptr) {
46105         LDKPendingHTLCInfo this_ptr_conv;
46106         this_ptr_conv.inner = untag_ptr(this_ptr);
46107         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46108         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46109         this_ptr_conv.is_owned = false;
46110         LDKPendingHTLCRouting *ret_copy = MALLOC(sizeof(LDKPendingHTLCRouting), "LDKPendingHTLCRouting");
46111         *ret_copy = PendingHTLCInfo_get_routing(&this_ptr_conv);
46112         int64_t ret_ref = tag_ptr(ret_copy, true);
46113         return ret_ref;
46114 }
46115
46116 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PendingHTLCInfo_1set_1routing(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
46117         LDKPendingHTLCInfo this_ptr_conv;
46118         this_ptr_conv.inner = untag_ptr(this_ptr);
46119         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46120         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46121         this_ptr_conv.is_owned = false;
46122         void* val_ptr = untag_ptr(val);
46123         CHECK_ACCESS(val_ptr);
46124         LDKPendingHTLCRouting val_conv = *(LDKPendingHTLCRouting*)(val_ptr);
46125         val_conv = PendingHTLCRouting_clone((LDKPendingHTLCRouting*)untag_ptr(val));
46126         PendingHTLCInfo_set_routing(&this_ptr_conv, val_conv);
46127 }
46128
46129 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_PendingHTLCInfo_1get_1incoming_1shared_1secret(JNIEnv *env, jclass clz, int64_t this_ptr) {
46130         LDKPendingHTLCInfo this_ptr_conv;
46131         this_ptr_conv.inner = untag_ptr(this_ptr);
46132         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46133         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46134         this_ptr_conv.is_owned = false;
46135         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
46136         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *PendingHTLCInfo_get_incoming_shared_secret(&this_ptr_conv));
46137         return ret_arr;
46138 }
46139
46140 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PendingHTLCInfo_1set_1incoming_1shared_1secret(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
46141         LDKPendingHTLCInfo this_ptr_conv;
46142         this_ptr_conv.inner = untag_ptr(this_ptr);
46143         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46144         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46145         this_ptr_conv.is_owned = false;
46146         LDKThirtyTwoBytes val_ref;
46147         CHECK((*env)->GetArrayLength(env, val) == 32);
46148         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
46149         PendingHTLCInfo_set_incoming_shared_secret(&this_ptr_conv, val_ref);
46150 }
46151
46152 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_PendingHTLCInfo_1get_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
46153         LDKPendingHTLCInfo this_ptr_conv;
46154         this_ptr_conv.inner = untag_ptr(this_ptr);
46155         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46156         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46157         this_ptr_conv.is_owned = false;
46158         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
46159         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *PendingHTLCInfo_get_payment_hash(&this_ptr_conv));
46160         return ret_arr;
46161 }
46162
46163 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PendingHTLCInfo_1set_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
46164         LDKPendingHTLCInfo this_ptr_conv;
46165         this_ptr_conv.inner = untag_ptr(this_ptr);
46166         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46167         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46168         this_ptr_conv.is_owned = false;
46169         LDKThirtyTwoBytes val_ref;
46170         CHECK((*env)->GetArrayLength(env, val) == 32);
46171         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
46172         PendingHTLCInfo_set_payment_hash(&this_ptr_conv, val_ref);
46173 }
46174
46175 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PendingHTLCInfo_1get_1incoming_1amt_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
46176         LDKPendingHTLCInfo this_ptr_conv;
46177         this_ptr_conv.inner = untag_ptr(this_ptr);
46178         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46179         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46180         this_ptr_conv.is_owned = false;
46181         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
46182         *ret_copy = PendingHTLCInfo_get_incoming_amt_msat(&this_ptr_conv);
46183         int64_t ret_ref = tag_ptr(ret_copy, true);
46184         return ret_ref;
46185 }
46186
46187 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PendingHTLCInfo_1set_1incoming_1amt_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
46188         LDKPendingHTLCInfo this_ptr_conv;
46189         this_ptr_conv.inner = untag_ptr(this_ptr);
46190         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46191         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46192         this_ptr_conv.is_owned = false;
46193         void* val_ptr = untag_ptr(val);
46194         CHECK_ACCESS(val_ptr);
46195         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
46196         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
46197         PendingHTLCInfo_set_incoming_amt_msat(&this_ptr_conv, val_conv);
46198 }
46199
46200 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PendingHTLCInfo_1get_1outgoing_1amt_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
46201         LDKPendingHTLCInfo this_ptr_conv;
46202         this_ptr_conv.inner = untag_ptr(this_ptr);
46203         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46204         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46205         this_ptr_conv.is_owned = false;
46206         int64_t ret_conv = PendingHTLCInfo_get_outgoing_amt_msat(&this_ptr_conv);
46207         return ret_conv;
46208 }
46209
46210 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PendingHTLCInfo_1set_1outgoing_1amt_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
46211         LDKPendingHTLCInfo this_ptr_conv;
46212         this_ptr_conv.inner = untag_ptr(this_ptr);
46213         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46214         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46215         this_ptr_conv.is_owned = false;
46216         PendingHTLCInfo_set_outgoing_amt_msat(&this_ptr_conv, val);
46217 }
46218
46219 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_PendingHTLCInfo_1get_1outgoing_1cltv_1value(JNIEnv *env, jclass clz, int64_t this_ptr) {
46220         LDKPendingHTLCInfo this_ptr_conv;
46221         this_ptr_conv.inner = untag_ptr(this_ptr);
46222         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46223         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46224         this_ptr_conv.is_owned = false;
46225         int32_t ret_conv = PendingHTLCInfo_get_outgoing_cltv_value(&this_ptr_conv);
46226         return ret_conv;
46227 }
46228
46229 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PendingHTLCInfo_1set_1outgoing_1cltv_1value(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
46230         LDKPendingHTLCInfo this_ptr_conv;
46231         this_ptr_conv.inner = untag_ptr(this_ptr);
46232         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46233         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46234         this_ptr_conv.is_owned = false;
46235         PendingHTLCInfo_set_outgoing_cltv_value(&this_ptr_conv, val);
46236 }
46237
46238 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PendingHTLCInfo_1get_1skimmed_1fee_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
46239         LDKPendingHTLCInfo this_ptr_conv;
46240         this_ptr_conv.inner = untag_ptr(this_ptr);
46241         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46242         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46243         this_ptr_conv.is_owned = false;
46244         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
46245         *ret_copy = PendingHTLCInfo_get_skimmed_fee_msat(&this_ptr_conv);
46246         int64_t ret_ref = tag_ptr(ret_copy, true);
46247         return ret_ref;
46248 }
46249
46250 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PendingHTLCInfo_1set_1skimmed_1fee_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
46251         LDKPendingHTLCInfo this_ptr_conv;
46252         this_ptr_conv.inner = untag_ptr(this_ptr);
46253         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46254         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46255         this_ptr_conv.is_owned = false;
46256         void* val_ptr = untag_ptr(val);
46257         CHECK_ACCESS(val_ptr);
46258         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
46259         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
46260         PendingHTLCInfo_set_skimmed_fee_msat(&this_ptr_conv, val_conv);
46261 }
46262
46263 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) {
46264         void* routing_arg_ptr = untag_ptr(routing_arg);
46265         CHECK_ACCESS(routing_arg_ptr);
46266         LDKPendingHTLCRouting routing_arg_conv = *(LDKPendingHTLCRouting*)(routing_arg_ptr);
46267         routing_arg_conv = PendingHTLCRouting_clone((LDKPendingHTLCRouting*)untag_ptr(routing_arg));
46268         LDKThirtyTwoBytes incoming_shared_secret_arg_ref;
46269         CHECK((*env)->GetArrayLength(env, incoming_shared_secret_arg) == 32);
46270         (*env)->GetByteArrayRegion(env, incoming_shared_secret_arg, 0, 32, incoming_shared_secret_arg_ref.data);
46271         LDKThirtyTwoBytes payment_hash_arg_ref;
46272         CHECK((*env)->GetArrayLength(env, payment_hash_arg) == 32);
46273         (*env)->GetByteArrayRegion(env, payment_hash_arg, 0, 32, payment_hash_arg_ref.data);
46274         void* incoming_amt_msat_arg_ptr = untag_ptr(incoming_amt_msat_arg);
46275         CHECK_ACCESS(incoming_amt_msat_arg_ptr);
46276         LDKCOption_u64Z incoming_amt_msat_arg_conv = *(LDKCOption_u64Z*)(incoming_amt_msat_arg_ptr);
46277         incoming_amt_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(incoming_amt_msat_arg));
46278         void* skimmed_fee_msat_arg_ptr = untag_ptr(skimmed_fee_msat_arg);
46279         CHECK_ACCESS(skimmed_fee_msat_arg_ptr);
46280         LDKCOption_u64Z skimmed_fee_msat_arg_conv = *(LDKCOption_u64Z*)(skimmed_fee_msat_arg_ptr);
46281         skimmed_fee_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(skimmed_fee_msat_arg));
46282         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);
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 static inline uint64_t PendingHTLCInfo_clone_ptr(LDKPendingHTLCInfo *NONNULL_PTR arg) {
46290         LDKPendingHTLCInfo ret_var = PendingHTLCInfo_clone(arg);
46291         int64_t ret_ref = 0;
46292         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46293         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46294         return ret_ref;
46295 }
46296 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PendingHTLCInfo_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
46297         LDKPendingHTLCInfo arg_conv;
46298         arg_conv.inner = untag_ptr(arg);
46299         arg_conv.is_owned = ptr_is_owned(arg);
46300         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
46301         arg_conv.is_owned = false;
46302         int64_t ret_conv = PendingHTLCInfo_clone_ptr(&arg_conv);
46303         return ret_conv;
46304 }
46305
46306 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PendingHTLCInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
46307         LDKPendingHTLCInfo orig_conv;
46308         orig_conv.inner = untag_ptr(orig);
46309         orig_conv.is_owned = ptr_is_owned(orig);
46310         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
46311         orig_conv.is_owned = false;
46312         LDKPendingHTLCInfo ret_var = PendingHTLCInfo_clone(&orig_conv);
46313         int64_t ret_ref = 0;
46314         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46315         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46316         return ret_ref;
46317 }
46318
46319 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_BlindedFailure_1clone(JNIEnv *env, jclass clz, int64_t orig) {
46320         LDKBlindedFailure* orig_conv = (LDKBlindedFailure*)untag_ptr(orig);
46321         jclass ret_conv = LDKBlindedFailure_to_java(env, BlindedFailure_clone(orig_conv));
46322         return ret_conv;
46323 }
46324
46325 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_BlindedFailure_1from_1introduction_1node(JNIEnv *env, jclass clz) {
46326         jclass ret_conv = LDKBlindedFailure_to_java(env, BlindedFailure_from_introduction_node());
46327         return ret_conv;
46328 }
46329
46330 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_BlindedFailure_1from_1blinded_1node(JNIEnv *env, jclass clz) {
46331         jclass ret_conv = LDKBlindedFailure_to_java(env, BlindedFailure_from_blinded_node());
46332         return ret_conv;
46333 }
46334
46335 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedFailure_1hash(JNIEnv *env, jclass clz, int64_t o) {
46336         LDKBlindedFailure* o_conv = (LDKBlindedFailure*)untag_ptr(o);
46337         int64_t ret_conv = BlindedFailure_hash(o_conv);
46338         return ret_conv;
46339 }
46340
46341 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_BlindedFailure_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
46342         LDKBlindedFailure* a_conv = (LDKBlindedFailure*)untag_ptr(a);
46343         LDKBlindedFailure* b_conv = (LDKBlindedFailure*)untag_ptr(b);
46344         jboolean ret_conv = BlindedFailure_eq(a_conv, b_conv);
46345         return ret_conv;
46346 }
46347
46348 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FailureCode_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
46349         if (!ptr_is_owned(this_ptr)) return;
46350         void* this_ptr_ptr = untag_ptr(this_ptr);
46351         CHECK_ACCESS(this_ptr_ptr);
46352         LDKFailureCode this_ptr_conv = *(LDKFailureCode*)(this_ptr_ptr);
46353         FREE(untag_ptr(this_ptr));
46354         FailureCode_free(this_ptr_conv);
46355 }
46356
46357 static inline uint64_t FailureCode_clone_ptr(LDKFailureCode *NONNULL_PTR arg) {
46358         LDKFailureCode *ret_copy = MALLOC(sizeof(LDKFailureCode), "LDKFailureCode");
46359         *ret_copy = FailureCode_clone(arg);
46360         int64_t ret_ref = tag_ptr(ret_copy, true);
46361         return ret_ref;
46362 }
46363 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FailureCode_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
46364         LDKFailureCode* arg_conv = (LDKFailureCode*)untag_ptr(arg);
46365         int64_t ret_conv = FailureCode_clone_ptr(arg_conv);
46366         return ret_conv;
46367 }
46368
46369 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FailureCode_1clone(JNIEnv *env, jclass clz, int64_t orig) {
46370         LDKFailureCode* orig_conv = (LDKFailureCode*)untag_ptr(orig);
46371         LDKFailureCode *ret_copy = MALLOC(sizeof(LDKFailureCode), "LDKFailureCode");
46372         *ret_copy = FailureCode_clone(orig_conv);
46373         int64_t ret_ref = tag_ptr(ret_copy, true);
46374         return ret_ref;
46375 }
46376
46377 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FailureCode_1temporary_1node_1failure(JNIEnv *env, jclass clz) {
46378         LDKFailureCode *ret_copy = MALLOC(sizeof(LDKFailureCode), "LDKFailureCode");
46379         *ret_copy = FailureCode_temporary_node_failure();
46380         int64_t ret_ref = tag_ptr(ret_copy, true);
46381         return ret_ref;
46382 }
46383
46384 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FailureCode_1required_1node_1feature_1missing(JNIEnv *env, jclass clz) {
46385         LDKFailureCode *ret_copy = MALLOC(sizeof(LDKFailureCode), "LDKFailureCode");
46386         *ret_copy = FailureCode_required_node_feature_missing();
46387         int64_t ret_ref = tag_ptr(ret_copy, true);
46388         return ret_ref;
46389 }
46390
46391 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FailureCode_1incorrect_1or_1unknown_1payment_1details(JNIEnv *env, jclass clz) {
46392         LDKFailureCode *ret_copy = MALLOC(sizeof(LDKFailureCode), "LDKFailureCode");
46393         *ret_copy = FailureCode_incorrect_or_unknown_payment_details();
46394         int64_t ret_ref = tag_ptr(ret_copy, true);
46395         return ret_ref;
46396 }
46397
46398 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FailureCode_1invalid_1onion_1payload(JNIEnv *env, jclass clz, int64_t a) {
46399         void* a_ptr = untag_ptr(a);
46400         CHECK_ACCESS(a_ptr);
46401         LDKCOption_C2Tuple_u64u16ZZ a_conv = *(LDKCOption_C2Tuple_u64u16ZZ*)(a_ptr);
46402         a_conv = COption_C2Tuple_u64u16ZZ_clone((LDKCOption_C2Tuple_u64u16ZZ*)untag_ptr(a));
46403         LDKFailureCode *ret_copy = MALLOC(sizeof(LDKFailureCode), "LDKFailureCode");
46404         *ret_copy = FailureCode_invalid_onion_payload(a_conv);
46405         int64_t ret_ref = tag_ptr(ret_copy, true);
46406         return ret_ref;
46407 }
46408
46409 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
46410         LDKChannelManager this_obj_conv;
46411         this_obj_conv.inner = untag_ptr(this_obj);
46412         this_obj_conv.is_owned = ptr_is_owned(this_obj);
46413         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46414         ChannelManager_free(this_obj_conv);
46415 }
46416
46417 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
46418         LDKChainParameters this_obj_conv;
46419         this_obj_conv.inner = untag_ptr(this_obj);
46420         this_obj_conv.is_owned = ptr_is_owned(this_obj);
46421         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46422         ChainParameters_free(this_obj_conv);
46423 }
46424
46425 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChainParameters_1get_1network(JNIEnv *env, jclass clz, int64_t this_ptr) {
46426         LDKChainParameters this_ptr_conv;
46427         this_ptr_conv.inner = untag_ptr(this_ptr);
46428         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46429         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46430         this_ptr_conv.is_owned = false;
46431         jclass ret_conv = LDKNetwork_to_java(env, ChainParameters_get_network(&this_ptr_conv));
46432         return ret_conv;
46433 }
46434
46435 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainParameters_1set_1network(JNIEnv *env, jclass clz, int64_t this_ptr, jclass val) {
46436         LDKChainParameters this_ptr_conv;
46437         this_ptr_conv.inner = untag_ptr(this_ptr);
46438         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46439         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46440         this_ptr_conv.is_owned = false;
46441         LDKNetwork val_conv = LDKNetwork_from_java(env, val);
46442         ChainParameters_set_network(&this_ptr_conv, val_conv);
46443 }
46444
46445 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainParameters_1get_1best_1block(JNIEnv *env, jclass clz, int64_t this_ptr) {
46446         LDKChainParameters this_ptr_conv;
46447         this_ptr_conv.inner = untag_ptr(this_ptr);
46448         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46449         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46450         this_ptr_conv.is_owned = false;
46451         LDKBestBlock ret_var = ChainParameters_get_best_block(&this_ptr_conv);
46452         int64_t ret_ref = 0;
46453         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46454         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46455         return ret_ref;
46456 }
46457
46458 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainParameters_1set_1best_1block(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
46459         LDKChainParameters this_ptr_conv;
46460         this_ptr_conv.inner = untag_ptr(this_ptr);
46461         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46462         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46463         this_ptr_conv.is_owned = false;
46464         LDKBestBlock val_conv;
46465         val_conv.inner = untag_ptr(val);
46466         val_conv.is_owned = ptr_is_owned(val);
46467         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
46468         val_conv = BestBlock_clone(&val_conv);
46469         ChainParameters_set_best_block(&this_ptr_conv, val_conv);
46470 }
46471
46472 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainParameters_1new(JNIEnv *env, jclass clz, jclass network_arg, int64_t best_block_arg) {
46473         LDKNetwork network_arg_conv = LDKNetwork_from_java(env, network_arg);
46474         LDKBestBlock best_block_arg_conv;
46475         best_block_arg_conv.inner = untag_ptr(best_block_arg);
46476         best_block_arg_conv.is_owned = ptr_is_owned(best_block_arg);
46477         CHECK_INNER_FIELD_ACCESS_OR_NULL(best_block_arg_conv);
46478         best_block_arg_conv = BestBlock_clone(&best_block_arg_conv);
46479         LDKChainParameters ret_var = ChainParameters_new(network_arg_conv, best_block_arg_conv);
46480         int64_t ret_ref = 0;
46481         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46482         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46483         return ret_ref;
46484 }
46485
46486 static inline uint64_t ChainParameters_clone_ptr(LDKChainParameters *NONNULL_PTR arg) {
46487         LDKChainParameters ret_var = ChainParameters_clone(arg);
46488         int64_t ret_ref = 0;
46489         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46490         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46491         return ret_ref;
46492 }
46493 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainParameters_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
46494         LDKChainParameters arg_conv;
46495         arg_conv.inner = untag_ptr(arg);
46496         arg_conv.is_owned = ptr_is_owned(arg);
46497         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
46498         arg_conv.is_owned = false;
46499         int64_t ret_conv = ChainParameters_clone_ptr(&arg_conv);
46500         return ret_conv;
46501 }
46502
46503 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainParameters_1clone(JNIEnv *env, jclass clz, int64_t orig) {
46504         LDKChainParameters orig_conv;
46505         orig_conv.inner = untag_ptr(orig);
46506         orig_conv.is_owned = ptr_is_owned(orig);
46507         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
46508         orig_conv.is_owned = false;
46509         LDKChainParameters ret_var = ChainParameters_clone(&orig_conv);
46510         int64_t ret_ref = 0;
46511         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46512         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46513         return ret_ref;
46514 }
46515
46516 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
46517         LDKCounterpartyForwardingInfo this_obj_conv;
46518         this_obj_conv.inner = untag_ptr(this_obj);
46519         this_obj_conv.is_owned = ptr_is_owned(this_obj);
46520         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46521         CounterpartyForwardingInfo_free(this_obj_conv);
46522 }
46523
46524 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1get_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
46525         LDKCounterpartyForwardingInfo this_ptr_conv;
46526         this_ptr_conv.inner = untag_ptr(this_ptr);
46527         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46528         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46529         this_ptr_conv.is_owned = false;
46530         int32_t ret_conv = CounterpartyForwardingInfo_get_fee_base_msat(&this_ptr_conv);
46531         return ret_conv;
46532 }
46533
46534 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1set_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
46535         LDKCounterpartyForwardingInfo this_ptr_conv;
46536         this_ptr_conv.inner = untag_ptr(this_ptr);
46537         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46538         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46539         this_ptr_conv.is_owned = false;
46540         CounterpartyForwardingInfo_set_fee_base_msat(&this_ptr_conv, val);
46541 }
46542
46543 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1get_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr) {
46544         LDKCounterpartyForwardingInfo this_ptr_conv;
46545         this_ptr_conv.inner = untag_ptr(this_ptr);
46546         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46547         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46548         this_ptr_conv.is_owned = false;
46549         int32_t ret_conv = CounterpartyForwardingInfo_get_fee_proportional_millionths(&this_ptr_conv);
46550         return ret_conv;
46551 }
46552
46553 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1set_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
46554         LDKCounterpartyForwardingInfo this_ptr_conv;
46555         this_ptr_conv.inner = untag_ptr(this_ptr);
46556         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46557         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46558         this_ptr_conv.is_owned = false;
46559         CounterpartyForwardingInfo_set_fee_proportional_millionths(&this_ptr_conv, val);
46560 }
46561
46562 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
46563         LDKCounterpartyForwardingInfo this_ptr_conv;
46564         this_ptr_conv.inner = untag_ptr(this_ptr);
46565         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46566         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46567         this_ptr_conv.is_owned = false;
46568         int16_t ret_conv = CounterpartyForwardingInfo_get_cltv_expiry_delta(&this_ptr_conv);
46569         return ret_conv;
46570 }
46571
46572 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
46573         LDKCounterpartyForwardingInfo this_ptr_conv;
46574         this_ptr_conv.inner = untag_ptr(this_ptr);
46575         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46576         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46577         this_ptr_conv.is_owned = false;
46578         CounterpartyForwardingInfo_set_cltv_expiry_delta(&this_ptr_conv, val);
46579 }
46580
46581 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) {
46582         LDKCounterpartyForwardingInfo ret_var = CounterpartyForwardingInfo_new(fee_base_msat_arg, fee_proportional_millionths_arg, cltv_expiry_delta_arg);
46583         int64_t ret_ref = 0;
46584         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46585         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46586         return ret_ref;
46587 }
46588
46589 static inline uint64_t CounterpartyForwardingInfo_clone_ptr(LDKCounterpartyForwardingInfo *NONNULL_PTR arg) {
46590         LDKCounterpartyForwardingInfo ret_var = CounterpartyForwardingInfo_clone(arg);
46591         int64_t ret_ref = 0;
46592         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46593         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46594         return ret_ref;
46595 }
46596 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
46597         LDKCounterpartyForwardingInfo arg_conv;
46598         arg_conv.inner = untag_ptr(arg);
46599         arg_conv.is_owned = ptr_is_owned(arg);
46600         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
46601         arg_conv.is_owned = false;
46602         int64_t ret_conv = CounterpartyForwardingInfo_clone_ptr(&arg_conv);
46603         return ret_conv;
46604 }
46605
46606 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
46607         LDKCounterpartyForwardingInfo orig_conv;
46608         orig_conv.inner = untag_ptr(orig);
46609         orig_conv.is_owned = ptr_is_owned(orig);
46610         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
46611         orig_conv.is_owned = false;
46612         LDKCounterpartyForwardingInfo ret_var = CounterpartyForwardingInfo_clone(&orig_conv);
46613         int64_t ret_ref = 0;
46614         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46615         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46616         return ret_ref;
46617 }
46618
46619 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
46620         LDKChannelCounterparty this_obj_conv;
46621         this_obj_conv.inner = untag_ptr(this_obj);
46622         this_obj_conv.is_owned = ptr_is_owned(this_obj);
46623         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46624         ChannelCounterparty_free(this_obj_conv);
46625 }
46626
46627 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1get_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
46628         LDKChannelCounterparty this_ptr_conv;
46629         this_ptr_conv.inner = untag_ptr(this_ptr);
46630         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46631         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46632         this_ptr_conv.is_owned = false;
46633         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
46634         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelCounterparty_get_node_id(&this_ptr_conv).compressed_form);
46635         return ret_arr;
46636 }
46637
46638 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1set_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
46639         LDKChannelCounterparty this_ptr_conv;
46640         this_ptr_conv.inner = untag_ptr(this_ptr);
46641         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46642         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46643         this_ptr_conv.is_owned = false;
46644         LDKPublicKey val_ref;
46645         CHECK((*env)->GetArrayLength(env, val) == 33);
46646         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
46647         ChannelCounterparty_set_node_id(&this_ptr_conv, val_ref);
46648 }
46649
46650 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
46651         LDKChannelCounterparty this_ptr_conv;
46652         this_ptr_conv.inner = untag_ptr(this_ptr);
46653         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46654         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46655         this_ptr_conv.is_owned = false;
46656         LDKInitFeatures ret_var = ChannelCounterparty_get_features(&this_ptr_conv);
46657         int64_t ret_ref = 0;
46658         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46659         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46660         return ret_ref;
46661 }
46662
46663 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
46664         LDKChannelCounterparty this_ptr_conv;
46665         this_ptr_conv.inner = untag_ptr(this_ptr);
46666         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46667         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46668         this_ptr_conv.is_owned = false;
46669         LDKInitFeatures val_conv;
46670         val_conv.inner = untag_ptr(val);
46671         val_conv.is_owned = ptr_is_owned(val);
46672         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
46673         val_conv = InitFeatures_clone(&val_conv);
46674         ChannelCounterparty_set_features(&this_ptr_conv, val_conv);
46675 }
46676
46677 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1get_1unspendable_1punishment_1reserve(JNIEnv *env, jclass clz, int64_t this_ptr) {
46678         LDKChannelCounterparty this_ptr_conv;
46679         this_ptr_conv.inner = untag_ptr(this_ptr);
46680         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46681         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46682         this_ptr_conv.is_owned = false;
46683         int64_t ret_conv = ChannelCounterparty_get_unspendable_punishment_reserve(&this_ptr_conv);
46684         return ret_conv;
46685 }
46686
46687 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1set_1unspendable_1punishment_1reserve(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
46688         LDKChannelCounterparty this_ptr_conv;
46689         this_ptr_conv.inner = untag_ptr(this_ptr);
46690         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46691         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46692         this_ptr_conv.is_owned = false;
46693         ChannelCounterparty_set_unspendable_punishment_reserve(&this_ptr_conv, val);
46694 }
46695
46696 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1get_1forwarding_1info(JNIEnv *env, jclass clz, int64_t this_ptr) {
46697         LDKChannelCounterparty this_ptr_conv;
46698         this_ptr_conv.inner = untag_ptr(this_ptr);
46699         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46700         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46701         this_ptr_conv.is_owned = false;
46702         LDKCounterpartyForwardingInfo ret_var = ChannelCounterparty_get_forwarding_info(&this_ptr_conv);
46703         int64_t ret_ref = 0;
46704         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46705         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46706         return ret_ref;
46707 }
46708
46709 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1set_1forwarding_1info(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
46710         LDKChannelCounterparty this_ptr_conv;
46711         this_ptr_conv.inner = untag_ptr(this_ptr);
46712         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46713         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46714         this_ptr_conv.is_owned = false;
46715         LDKCounterpartyForwardingInfo val_conv;
46716         val_conv.inner = untag_ptr(val);
46717         val_conv.is_owned = ptr_is_owned(val);
46718         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
46719         val_conv = CounterpartyForwardingInfo_clone(&val_conv);
46720         ChannelCounterparty_set_forwarding_info(&this_ptr_conv, val_conv);
46721 }
46722
46723 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1get_1outbound_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
46724         LDKChannelCounterparty this_ptr_conv;
46725         this_ptr_conv.inner = untag_ptr(this_ptr);
46726         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46727         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46728         this_ptr_conv.is_owned = false;
46729         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
46730         *ret_copy = ChannelCounterparty_get_outbound_htlc_minimum_msat(&this_ptr_conv);
46731         int64_t ret_ref = tag_ptr(ret_copy, true);
46732         return ret_ref;
46733 }
46734
46735 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) {
46736         LDKChannelCounterparty this_ptr_conv;
46737         this_ptr_conv.inner = untag_ptr(this_ptr);
46738         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46739         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46740         this_ptr_conv.is_owned = false;
46741         void* val_ptr = untag_ptr(val);
46742         CHECK_ACCESS(val_ptr);
46743         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
46744         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
46745         ChannelCounterparty_set_outbound_htlc_minimum_msat(&this_ptr_conv, val_conv);
46746 }
46747
46748 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1get_1outbound_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
46749         LDKChannelCounterparty this_ptr_conv;
46750         this_ptr_conv.inner = untag_ptr(this_ptr);
46751         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46752         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46753         this_ptr_conv.is_owned = false;
46754         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
46755         *ret_copy = ChannelCounterparty_get_outbound_htlc_maximum_msat(&this_ptr_conv);
46756         int64_t ret_ref = tag_ptr(ret_copy, true);
46757         return ret_ref;
46758 }
46759
46760 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) {
46761         LDKChannelCounterparty this_ptr_conv;
46762         this_ptr_conv.inner = untag_ptr(this_ptr);
46763         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46764         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46765         this_ptr_conv.is_owned = false;
46766         void* val_ptr = untag_ptr(val);
46767         CHECK_ACCESS(val_ptr);
46768         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
46769         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
46770         ChannelCounterparty_set_outbound_htlc_maximum_msat(&this_ptr_conv, val_conv);
46771 }
46772
46773 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) {
46774         LDKPublicKey node_id_arg_ref;
46775         CHECK((*env)->GetArrayLength(env, node_id_arg) == 33);
46776         (*env)->GetByteArrayRegion(env, node_id_arg, 0, 33, node_id_arg_ref.compressed_form);
46777         LDKInitFeatures features_arg_conv;
46778         features_arg_conv.inner = untag_ptr(features_arg);
46779         features_arg_conv.is_owned = ptr_is_owned(features_arg);
46780         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
46781         features_arg_conv = InitFeatures_clone(&features_arg_conv);
46782         LDKCounterpartyForwardingInfo forwarding_info_arg_conv;
46783         forwarding_info_arg_conv.inner = untag_ptr(forwarding_info_arg);
46784         forwarding_info_arg_conv.is_owned = ptr_is_owned(forwarding_info_arg);
46785         CHECK_INNER_FIELD_ACCESS_OR_NULL(forwarding_info_arg_conv);
46786         forwarding_info_arg_conv = CounterpartyForwardingInfo_clone(&forwarding_info_arg_conv);
46787         void* outbound_htlc_minimum_msat_arg_ptr = untag_ptr(outbound_htlc_minimum_msat_arg);
46788         CHECK_ACCESS(outbound_htlc_minimum_msat_arg_ptr);
46789         LDKCOption_u64Z outbound_htlc_minimum_msat_arg_conv = *(LDKCOption_u64Z*)(outbound_htlc_minimum_msat_arg_ptr);
46790         outbound_htlc_minimum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(outbound_htlc_minimum_msat_arg));
46791         void* outbound_htlc_maximum_msat_arg_ptr = untag_ptr(outbound_htlc_maximum_msat_arg);
46792         CHECK_ACCESS(outbound_htlc_maximum_msat_arg_ptr);
46793         LDKCOption_u64Z outbound_htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(outbound_htlc_maximum_msat_arg_ptr);
46794         outbound_htlc_maximum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(outbound_htlc_maximum_msat_arg));
46795         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);
46796         int64_t ret_ref = 0;
46797         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46798         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46799         return ret_ref;
46800 }
46801
46802 static inline uint64_t ChannelCounterparty_clone_ptr(LDKChannelCounterparty *NONNULL_PTR arg) {
46803         LDKChannelCounterparty ret_var = ChannelCounterparty_clone(arg);
46804         int64_t ret_ref = 0;
46805         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46806         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46807         return ret_ref;
46808 }
46809 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
46810         LDKChannelCounterparty arg_conv;
46811         arg_conv.inner = untag_ptr(arg);
46812         arg_conv.is_owned = ptr_is_owned(arg);
46813         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
46814         arg_conv.is_owned = false;
46815         int64_t ret_conv = ChannelCounterparty_clone_ptr(&arg_conv);
46816         return ret_conv;
46817 }
46818
46819 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1clone(JNIEnv *env, jclass clz, int64_t orig) {
46820         LDKChannelCounterparty orig_conv;
46821         orig_conv.inner = untag_ptr(orig);
46822         orig_conv.is_owned = ptr_is_owned(orig);
46823         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
46824         orig_conv.is_owned = false;
46825         LDKChannelCounterparty ret_var = ChannelCounterparty_clone(&orig_conv);
46826         int64_t ret_ref = 0;
46827         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46828         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46829         return ret_ref;
46830 }
46831
46832 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
46833         LDKChannelDetails this_obj_conv;
46834         this_obj_conv.inner = untag_ptr(this_obj);
46835         this_obj_conv.is_owned = ptr_is_owned(this_obj);
46836         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
46837         ChannelDetails_free(this_obj_conv);
46838 }
46839
46840 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
46841         LDKChannelDetails this_ptr_conv;
46842         this_ptr_conv.inner = untag_ptr(this_ptr);
46843         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46844         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46845         this_ptr_conv.is_owned = false;
46846         LDKChannelId ret_var = ChannelDetails_get_channel_id(&this_ptr_conv);
46847         int64_t ret_ref = 0;
46848         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46849         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46850         return ret_ref;
46851 }
46852
46853 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
46854         LDKChannelDetails this_ptr_conv;
46855         this_ptr_conv.inner = untag_ptr(this_ptr);
46856         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46857         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46858         this_ptr_conv.is_owned = false;
46859         LDKChannelId val_conv;
46860         val_conv.inner = untag_ptr(val);
46861         val_conv.is_owned = ptr_is_owned(val);
46862         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
46863         val_conv = ChannelId_clone(&val_conv);
46864         ChannelDetails_set_channel_id(&this_ptr_conv, val_conv);
46865 }
46866
46867 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1counterparty(JNIEnv *env, jclass clz, int64_t this_ptr) {
46868         LDKChannelDetails this_ptr_conv;
46869         this_ptr_conv.inner = untag_ptr(this_ptr);
46870         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46871         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46872         this_ptr_conv.is_owned = false;
46873         LDKChannelCounterparty ret_var = ChannelDetails_get_counterparty(&this_ptr_conv);
46874         int64_t ret_ref = 0;
46875         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46876         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46877         return ret_ref;
46878 }
46879
46880 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1counterparty(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
46881         LDKChannelDetails this_ptr_conv;
46882         this_ptr_conv.inner = untag_ptr(this_ptr);
46883         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46884         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46885         this_ptr_conv.is_owned = false;
46886         LDKChannelCounterparty val_conv;
46887         val_conv.inner = untag_ptr(val);
46888         val_conv.is_owned = ptr_is_owned(val);
46889         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
46890         val_conv = ChannelCounterparty_clone(&val_conv);
46891         ChannelDetails_set_counterparty(&this_ptr_conv, val_conv);
46892 }
46893
46894 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1funding_1txo(JNIEnv *env, jclass clz, int64_t this_ptr) {
46895         LDKChannelDetails this_ptr_conv;
46896         this_ptr_conv.inner = untag_ptr(this_ptr);
46897         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46898         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46899         this_ptr_conv.is_owned = false;
46900         LDKOutPoint ret_var = ChannelDetails_get_funding_txo(&this_ptr_conv);
46901         int64_t ret_ref = 0;
46902         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46903         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46904         return ret_ref;
46905 }
46906
46907 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1funding_1txo(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
46908         LDKChannelDetails this_ptr_conv;
46909         this_ptr_conv.inner = untag_ptr(this_ptr);
46910         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46911         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46912         this_ptr_conv.is_owned = false;
46913         LDKOutPoint val_conv;
46914         val_conv.inner = untag_ptr(val);
46915         val_conv.is_owned = ptr_is_owned(val);
46916         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
46917         val_conv = OutPoint_clone(&val_conv);
46918         ChannelDetails_set_funding_txo(&this_ptr_conv, val_conv);
46919 }
46920
46921 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1channel_1type(JNIEnv *env, jclass clz, int64_t this_ptr) {
46922         LDKChannelDetails 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         LDKChannelTypeFeatures ret_var = ChannelDetails_get_channel_type(&this_ptr_conv);
46928         int64_t ret_ref = 0;
46929         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
46930         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
46931         return ret_ref;
46932 }
46933
46934 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1channel_1type(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
46935         LDKChannelDetails this_ptr_conv;
46936         this_ptr_conv.inner = untag_ptr(this_ptr);
46937         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46938         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46939         this_ptr_conv.is_owned = false;
46940         LDKChannelTypeFeatures val_conv;
46941         val_conv.inner = untag_ptr(val);
46942         val_conv.is_owned = ptr_is_owned(val);
46943         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
46944         val_conv = ChannelTypeFeatures_clone(&val_conv);
46945         ChannelDetails_set_channel_type(&this_ptr_conv, val_conv);
46946 }
46947
46948 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
46949         LDKChannelDetails this_ptr_conv;
46950         this_ptr_conv.inner = untag_ptr(this_ptr);
46951         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46952         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46953         this_ptr_conv.is_owned = false;
46954         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
46955         *ret_copy = ChannelDetails_get_short_channel_id(&this_ptr_conv);
46956         int64_t ret_ref = tag_ptr(ret_copy, true);
46957         return ret_ref;
46958 }
46959
46960 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
46961         LDKChannelDetails this_ptr_conv;
46962         this_ptr_conv.inner = untag_ptr(this_ptr);
46963         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46964         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46965         this_ptr_conv.is_owned = false;
46966         void* val_ptr = untag_ptr(val);
46967         CHECK_ACCESS(val_ptr);
46968         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
46969         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
46970         ChannelDetails_set_short_channel_id(&this_ptr_conv, val_conv);
46971 }
46972
46973 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1outbound_1scid_1alias(JNIEnv *env, jclass clz, int64_t this_ptr) {
46974         LDKChannelDetails this_ptr_conv;
46975         this_ptr_conv.inner = untag_ptr(this_ptr);
46976         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46977         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46978         this_ptr_conv.is_owned = false;
46979         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
46980         *ret_copy = ChannelDetails_get_outbound_scid_alias(&this_ptr_conv);
46981         int64_t ret_ref = tag_ptr(ret_copy, true);
46982         return ret_ref;
46983 }
46984
46985 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1outbound_1scid_1alias(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
46986         LDKChannelDetails this_ptr_conv;
46987         this_ptr_conv.inner = untag_ptr(this_ptr);
46988         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
46989         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
46990         this_ptr_conv.is_owned = false;
46991         void* val_ptr = untag_ptr(val);
46992         CHECK_ACCESS(val_ptr);
46993         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
46994         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
46995         ChannelDetails_set_outbound_scid_alias(&this_ptr_conv, val_conv);
46996 }
46997
46998 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1inbound_1scid_1alias(JNIEnv *env, jclass clz, int64_t this_ptr) {
46999         LDKChannelDetails this_ptr_conv;
47000         this_ptr_conv.inner = untag_ptr(this_ptr);
47001         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47002         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47003         this_ptr_conv.is_owned = false;
47004         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
47005         *ret_copy = ChannelDetails_get_inbound_scid_alias(&this_ptr_conv);
47006         int64_t ret_ref = tag_ptr(ret_copy, true);
47007         return ret_ref;
47008 }
47009
47010 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1inbound_1scid_1alias(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
47011         LDKChannelDetails this_ptr_conv;
47012         this_ptr_conv.inner = untag_ptr(this_ptr);
47013         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47014         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47015         this_ptr_conv.is_owned = false;
47016         void* val_ptr = untag_ptr(val);
47017         CHECK_ACCESS(val_ptr);
47018         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
47019         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
47020         ChannelDetails_set_inbound_scid_alias(&this_ptr_conv, val_conv);
47021 }
47022
47023 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
47024         LDKChannelDetails this_ptr_conv;
47025         this_ptr_conv.inner = untag_ptr(this_ptr);
47026         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47027         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47028         this_ptr_conv.is_owned = false;
47029         int64_t ret_conv = ChannelDetails_get_channel_value_satoshis(&this_ptr_conv);
47030         return ret_conv;
47031 }
47032
47033 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
47034         LDKChannelDetails this_ptr_conv;
47035         this_ptr_conv.inner = untag_ptr(this_ptr);
47036         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47037         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47038         this_ptr_conv.is_owned = false;
47039         ChannelDetails_set_channel_value_satoshis(&this_ptr_conv, val);
47040 }
47041
47042 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1unspendable_1punishment_1reserve(JNIEnv *env, jclass clz, int64_t this_ptr) {
47043         LDKChannelDetails this_ptr_conv;
47044         this_ptr_conv.inner = untag_ptr(this_ptr);
47045         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47046         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47047         this_ptr_conv.is_owned = false;
47048         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
47049         *ret_copy = ChannelDetails_get_unspendable_punishment_reserve(&this_ptr_conv);
47050         int64_t ret_ref = tag_ptr(ret_copy, true);
47051         return ret_ref;
47052 }
47053
47054 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1unspendable_1punishment_1reserve(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
47055         LDKChannelDetails 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         void* val_ptr = untag_ptr(val);
47061         CHECK_ACCESS(val_ptr);
47062         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
47063         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
47064         ChannelDetails_set_unspendable_punishment_reserve(&this_ptr_conv, val_conv);
47065 }
47066
47067 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1user_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
47068         LDKChannelDetails this_ptr_conv;
47069         this_ptr_conv.inner = untag_ptr(this_ptr);
47070         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47071         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47072         this_ptr_conv.is_owned = false;
47073         int8_tArray ret_arr = (*env)->NewByteArray(env, 16);
47074         (*env)->SetByteArrayRegion(env, ret_arr, 0, 16, ChannelDetails_get_user_channel_id(&this_ptr_conv).le_bytes);
47075         return ret_arr;
47076 }
47077
47078 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1user_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
47079         LDKChannelDetails this_ptr_conv;
47080         this_ptr_conv.inner = untag_ptr(this_ptr);
47081         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47082         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47083         this_ptr_conv.is_owned = false;
47084         LDKU128 val_ref;
47085         CHECK((*env)->GetArrayLength(env, val) == 16);
47086         (*env)->GetByteArrayRegion(env, val, 0, 16, val_ref.le_bytes);
47087         ChannelDetails_set_user_channel_id(&this_ptr_conv, val_ref);
47088 }
47089
47090 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1feerate_1sat_1per_11000_1weight(JNIEnv *env, jclass clz, int64_t this_ptr) {
47091         LDKChannelDetails this_ptr_conv;
47092         this_ptr_conv.inner = untag_ptr(this_ptr);
47093         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47094         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47095         this_ptr_conv.is_owned = false;
47096         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
47097         *ret_copy = ChannelDetails_get_feerate_sat_per_1000_weight(&this_ptr_conv);
47098         int64_t ret_ref = tag_ptr(ret_copy, true);
47099         return ret_ref;
47100 }
47101
47102 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) {
47103         LDKChannelDetails this_ptr_conv;
47104         this_ptr_conv.inner = untag_ptr(this_ptr);
47105         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47106         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47107         this_ptr_conv.is_owned = false;
47108         void* val_ptr = untag_ptr(val);
47109         CHECK_ACCESS(val_ptr);
47110         LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
47111         val_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(val));
47112         ChannelDetails_set_feerate_sat_per_1000_weight(&this_ptr_conv, val_conv);
47113 }
47114
47115 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1balance_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
47116         LDKChannelDetails 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         int64_t ret_conv = ChannelDetails_get_balance_msat(&this_ptr_conv);
47122         return ret_conv;
47123 }
47124
47125 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1balance_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
47126         LDKChannelDetails this_ptr_conv;
47127         this_ptr_conv.inner = untag_ptr(this_ptr);
47128         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47129         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47130         this_ptr_conv.is_owned = false;
47131         ChannelDetails_set_balance_msat(&this_ptr_conv, val);
47132 }
47133
47134 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1outbound_1capacity_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
47135         LDKChannelDetails this_ptr_conv;
47136         this_ptr_conv.inner = untag_ptr(this_ptr);
47137         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47138         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47139         this_ptr_conv.is_owned = false;
47140         int64_t ret_conv = ChannelDetails_get_outbound_capacity_msat(&this_ptr_conv);
47141         return ret_conv;
47142 }
47143
47144 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1outbound_1capacity_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
47145         LDKChannelDetails this_ptr_conv;
47146         this_ptr_conv.inner = untag_ptr(this_ptr);
47147         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47148         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47149         this_ptr_conv.is_owned = false;
47150         ChannelDetails_set_outbound_capacity_msat(&this_ptr_conv, val);
47151 }
47152
47153 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1next_1outbound_1htlc_1limit_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
47154         LDKChannelDetails this_ptr_conv;
47155         this_ptr_conv.inner = untag_ptr(this_ptr);
47156         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47157         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47158         this_ptr_conv.is_owned = false;
47159         int64_t ret_conv = ChannelDetails_get_next_outbound_htlc_limit_msat(&this_ptr_conv);
47160         return ret_conv;
47161 }
47162
47163 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) {
47164         LDKChannelDetails this_ptr_conv;
47165         this_ptr_conv.inner = untag_ptr(this_ptr);
47166         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47167         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47168         this_ptr_conv.is_owned = false;
47169         ChannelDetails_set_next_outbound_htlc_limit_msat(&this_ptr_conv, val);
47170 }
47171
47172 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1next_1outbound_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
47173         LDKChannelDetails 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         int64_t ret_conv = ChannelDetails_get_next_outbound_htlc_minimum_msat(&this_ptr_conv);
47179         return ret_conv;
47180 }
47181
47182 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) {
47183         LDKChannelDetails this_ptr_conv;
47184         this_ptr_conv.inner = untag_ptr(this_ptr);
47185         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47186         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47187         this_ptr_conv.is_owned = false;
47188         ChannelDetails_set_next_outbound_htlc_minimum_msat(&this_ptr_conv, val);
47189 }
47190
47191 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1inbound_1capacity_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
47192         LDKChannelDetails this_ptr_conv;
47193         this_ptr_conv.inner = untag_ptr(this_ptr);
47194         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47195         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47196         this_ptr_conv.is_owned = false;
47197         int64_t ret_conv = ChannelDetails_get_inbound_capacity_msat(&this_ptr_conv);
47198         return ret_conv;
47199 }
47200
47201 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1inbound_1capacity_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
47202         LDKChannelDetails this_ptr_conv;
47203         this_ptr_conv.inner = untag_ptr(this_ptr);
47204         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47205         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47206         this_ptr_conv.is_owned = false;
47207         ChannelDetails_set_inbound_capacity_msat(&this_ptr_conv, val);
47208 }
47209
47210 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1confirmations_1required(JNIEnv *env, jclass clz, int64_t this_ptr) {
47211         LDKChannelDetails this_ptr_conv;
47212         this_ptr_conv.inner = untag_ptr(this_ptr);
47213         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47214         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47215         this_ptr_conv.is_owned = false;
47216         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
47217         *ret_copy = ChannelDetails_get_confirmations_required(&this_ptr_conv);
47218         int64_t ret_ref = tag_ptr(ret_copy, true);
47219         return ret_ref;
47220 }
47221
47222 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1confirmations_1required(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
47223         LDKChannelDetails this_ptr_conv;
47224         this_ptr_conv.inner = untag_ptr(this_ptr);
47225         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47226         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47227         this_ptr_conv.is_owned = false;
47228         void* val_ptr = untag_ptr(val);
47229         CHECK_ACCESS(val_ptr);
47230         LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
47231         val_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(val));
47232         ChannelDetails_set_confirmations_required(&this_ptr_conv, val_conv);
47233 }
47234
47235 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1confirmations(JNIEnv *env, jclass clz, int64_t this_ptr) {
47236         LDKChannelDetails this_ptr_conv;
47237         this_ptr_conv.inner = untag_ptr(this_ptr);
47238         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47239         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47240         this_ptr_conv.is_owned = false;
47241         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
47242         *ret_copy = ChannelDetails_get_confirmations(&this_ptr_conv);
47243         int64_t ret_ref = tag_ptr(ret_copy, true);
47244         return ret_ref;
47245 }
47246
47247 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1confirmations(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
47248         LDKChannelDetails this_ptr_conv;
47249         this_ptr_conv.inner = untag_ptr(this_ptr);
47250         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47251         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47252         this_ptr_conv.is_owned = false;
47253         void* val_ptr = untag_ptr(val);
47254         CHECK_ACCESS(val_ptr);
47255         LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
47256         val_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(val));
47257         ChannelDetails_set_confirmations(&this_ptr_conv, val_conv);
47258 }
47259
47260 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1force_1close_1spend_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
47261         LDKChannelDetails this_ptr_conv;
47262         this_ptr_conv.inner = untag_ptr(this_ptr);
47263         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47264         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47265         this_ptr_conv.is_owned = false;
47266         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
47267         *ret_copy = ChannelDetails_get_force_close_spend_delay(&this_ptr_conv);
47268         int64_t ret_ref = tag_ptr(ret_copy, true);
47269         return ret_ref;
47270 }
47271
47272 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) {
47273         LDKChannelDetails this_ptr_conv;
47274         this_ptr_conv.inner = untag_ptr(this_ptr);
47275         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47276         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47277         this_ptr_conv.is_owned = false;
47278         void* val_ptr = untag_ptr(val);
47279         CHECK_ACCESS(val_ptr);
47280         LDKCOption_u16Z val_conv = *(LDKCOption_u16Z*)(val_ptr);
47281         val_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(val));
47282         ChannelDetails_set_force_close_spend_delay(&this_ptr_conv, val_conv);
47283 }
47284
47285 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1is_1outbound(JNIEnv *env, jclass clz, int64_t this_ptr) {
47286         LDKChannelDetails this_ptr_conv;
47287         this_ptr_conv.inner = untag_ptr(this_ptr);
47288         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47289         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47290         this_ptr_conv.is_owned = false;
47291         jboolean ret_conv = ChannelDetails_get_is_outbound(&this_ptr_conv);
47292         return ret_conv;
47293 }
47294
47295 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1is_1outbound(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
47296         LDKChannelDetails this_ptr_conv;
47297         this_ptr_conv.inner = untag_ptr(this_ptr);
47298         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47299         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47300         this_ptr_conv.is_owned = false;
47301         ChannelDetails_set_is_outbound(&this_ptr_conv, val);
47302 }
47303
47304 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1is_1channel_1ready(JNIEnv *env, jclass clz, int64_t this_ptr) {
47305         LDKChannelDetails this_ptr_conv;
47306         this_ptr_conv.inner = untag_ptr(this_ptr);
47307         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47308         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47309         this_ptr_conv.is_owned = false;
47310         jboolean ret_conv = ChannelDetails_get_is_channel_ready(&this_ptr_conv);
47311         return ret_conv;
47312 }
47313
47314 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1is_1channel_1ready(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
47315         LDKChannelDetails this_ptr_conv;
47316         this_ptr_conv.inner = untag_ptr(this_ptr);
47317         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47318         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47319         this_ptr_conv.is_owned = false;
47320         ChannelDetails_set_is_channel_ready(&this_ptr_conv, val);
47321 }
47322
47323 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1channel_1shutdown_1state(JNIEnv *env, jclass clz, int64_t this_ptr) {
47324         LDKChannelDetails this_ptr_conv;
47325         this_ptr_conv.inner = untag_ptr(this_ptr);
47326         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47327         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47328         this_ptr_conv.is_owned = false;
47329         LDKCOption_ChannelShutdownStateZ *ret_copy = MALLOC(sizeof(LDKCOption_ChannelShutdownStateZ), "LDKCOption_ChannelShutdownStateZ");
47330         *ret_copy = ChannelDetails_get_channel_shutdown_state(&this_ptr_conv);
47331         int64_t ret_ref = tag_ptr(ret_copy, true);
47332         return ret_ref;
47333 }
47334
47335 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1channel_1shutdown_1state(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
47336         LDKChannelDetails this_ptr_conv;
47337         this_ptr_conv.inner = untag_ptr(this_ptr);
47338         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47339         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47340         this_ptr_conv.is_owned = false;
47341         void* val_ptr = untag_ptr(val);
47342         CHECK_ACCESS(val_ptr);
47343         LDKCOption_ChannelShutdownStateZ val_conv = *(LDKCOption_ChannelShutdownStateZ*)(val_ptr);
47344         val_conv = COption_ChannelShutdownStateZ_clone((LDKCOption_ChannelShutdownStateZ*)untag_ptr(val));
47345         ChannelDetails_set_channel_shutdown_state(&this_ptr_conv, val_conv);
47346 }
47347
47348 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1is_1usable(JNIEnv *env, jclass clz, int64_t this_ptr) {
47349         LDKChannelDetails this_ptr_conv;
47350         this_ptr_conv.inner = untag_ptr(this_ptr);
47351         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47352         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47353         this_ptr_conv.is_owned = false;
47354         jboolean ret_conv = ChannelDetails_get_is_usable(&this_ptr_conv);
47355         return ret_conv;
47356 }
47357
47358 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1is_1usable(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
47359         LDKChannelDetails this_ptr_conv;
47360         this_ptr_conv.inner = untag_ptr(this_ptr);
47361         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47362         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47363         this_ptr_conv.is_owned = false;
47364         ChannelDetails_set_is_usable(&this_ptr_conv, val);
47365 }
47366
47367 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1is_1public(JNIEnv *env, jclass clz, int64_t this_ptr) {
47368         LDKChannelDetails this_ptr_conv;
47369         this_ptr_conv.inner = untag_ptr(this_ptr);
47370         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47371         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47372         this_ptr_conv.is_owned = false;
47373         jboolean ret_conv = ChannelDetails_get_is_public(&this_ptr_conv);
47374         return ret_conv;
47375 }
47376
47377 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1is_1public(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
47378         LDKChannelDetails this_ptr_conv;
47379         this_ptr_conv.inner = untag_ptr(this_ptr);
47380         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47381         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47382         this_ptr_conv.is_owned = false;
47383         ChannelDetails_set_is_public(&this_ptr_conv, val);
47384 }
47385
47386 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1inbound_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
47387         LDKChannelDetails this_ptr_conv;
47388         this_ptr_conv.inner = untag_ptr(this_ptr);
47389         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47390         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47391         this_ptr_conv.is_owned = false;
47392         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
47393         *ret_copy = ChannelDetails_get_inbound_htlc_minimum_msat(&this_ptr_conv);
47394         int64_t ret_ref = tag_ptr(ret_copy, true);
47395         return ret_ref;
47396 }
47397
47398 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) {
47399         LDKChannelDetails this_ptr_conv;
47400         this_ptr_conv.inner = untag_ptr(this_ptr);
47401         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47402         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47403         this_ptr_conv.is_owned = false;
47404         void* val_ptr = untag_ptr(val);
47405         CHECK_ACCESS(val_ptr);
47406         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
47407         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
47408         ChannelDetails_set_inbound_htlc_minimum_msat(&this_ptr_conv, val_conv);
47409 }
47410
47411 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1inbound_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
47412         LDKChannelDetails this_ptr_conv;
47413         this_ptr_conv.inner = untag_ptr(this_ptr);
47414         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47415         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47416         this_ptr_conv.is_owned = false;
47417         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
47418         *ret_copy = ChannelDetails_get_inbound_htlc_maximum_msat(&this_ptr_conv);
47419         int64_t ret_ref = tag_ptr(ret_copy, true);
47420         return ret_ref;
47421 }
47422
47423 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) {
47424         LDKChannelDetails this_ptr_conv;
47425         this_ptr_conv.inner = untag_ptr(this_ptr);
47426         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47427         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47428         this_ptr_conv.is_owned = false;
47429         void* val_ptr = untag_ptr(val);
47430         CHECK_ACCESS(val_ptr);
47431         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
47432         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
47433         ChannelDetails_set_inbound_htlc_maximum_msat(&this_ptr_conv, val_conv);
47434 }
47435
47436 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1config(JNIEnv *env, jclass clz, int64_t this_ptr) {
47437         LDKChannelDetails this_ptr_conv;
47438         this_ptr_conv.inner = untag_ptr(this_ptr);
47439         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47440         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47441         this_ptr_conv.is_owned = false;
47442         LDKChannelConfig ret_var = ChannelDetails_get_config(&this_ptr_conv);
47443         int64_t ret_ref = 0;
47444         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47445         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47446         return ret_ref;
47447 }
47448
47449 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1config(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
47450         LDKChannelDetails this_ptr_conv;
47451         this_ptr_conv.inner = untag_ptr(this_ptr);
47452         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47453         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47454         this_ptr_conv.is_owned = false;
47455         LDKChannelConfig val_conv;
47456         val_conv.inner = untag_ptr(val);
47457         val_conv.is_owned = ptr_is_owned(val);
47458         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
47459         val_conv = ChannelConfig_clone(&val_conv);
47460         ChannelDetails_set_config(&this_ptr_conv, val_conv);
47461 }
47462
47463 static inline uint64_t ChannelDetails_clone_ptr(LDKChannelDetails *NONNULL_PTR arg) {
47464         LDKChannelDetails ret_var = ChannelDetails_clone(arg);
47465         int64_t ret_ref = 0;
47466         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47467         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47468         return ret_ref;
47469 }
47470 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
47471         LDKChannelDetails arg_conv;
47472         arg_conv.inner = untag_ptr(arg);
47473         arg_conv.is_owned = ptr_is_owned(arg);
47474         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
47475         arg_conv.is_owned = false;
47476         int64_t ret_conv = ChannelDetails_clone_ptr(&arg_conv);
47477         return ret_conv;
47478 }
47479
47480 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1clone(JNIEnv *env, jclass clz, int64_t orig) {
47481         LDKChannelDetails orig_conv;
47482         orig_conv.inner = untag_ptr(orig);
47483         orig_conv.is_owned = ptr_is_owned(orig);
47484         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
47485         orig_conv.is_owned = false;
47486         LDKChannelDetails ret_var = ChannelDetails_clone(&orig_conv);
47487         int64_t ret_ref = 0;
47488         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47489         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47490         return ret_ref;
47491 }
47492
47493 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1inbound_1payment_1scid(JNIEnv *env, jclass clz, int64_t this_arg) {
47494         LDKChannelDetails this_arg_conv;
47495         this_arg_conv.inner = untag_ptr(this_arg);
47496         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47497         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47498         this_arg_conv.is_owned = false;
47499         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
47500         *ret_copy = ChannelDetails_get_inbound_payment_scid(&this_arg_conv);
47501         int64_t ret_ref = tag_ptr(ret_copy, true);
47502         return ret_ref;
47503 }
47504
47505 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1outbound_1payment_1scid(JNIEnv *env, jclass clz, int64_t this_arg) {
47506         LDKChannelDetails this_arg_conv;
47507         this_arg_conv.inner = untag_ptr(this_arg);
47508         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47509         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47510         this_arg_conv.is_owned = false;
47511         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
47512         *ret_copy = ChannelDetails_get_outbound_payment_scid(&this_arg_conv);
47513         int64_t ret_ref = tag_ptr(ret_copy, true);
47514         return ret_ref;
47515 }
47516
47517 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChannelShutdownState_1clone(JNIEnv *env, jclass clz, int64_t orig) {
47518         LDKChannelShutdownState* orig_conv = (LDKChannelShutdownState*)untag_ptr(orig);
47519         jclass ret_conv = LDKChannelShutdownState_to_java(env, ChannelShutdownState_clone(orig_conv));
47520         return ret_conv;
47521 }
47522
47523 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChannelShutdownState_1not_1shutting_1down(JNIEnv *env, jclass clz) {
47524         jclass ret_conv = LDKChannelShutdownState_to_java(env, ChannelShutdownState_not_shutting_down());
47525         return ret_conv;
47526 }
47527
47528 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChannelShutdownState_1shutdown_1initiated(JNIEnv *env, jclass clz) {
47529         jclass ret_conv = LDKChannelShutdownState_to_java(env, ChannelShutdownState_shutdown_initiated());
47530         return ret_conv;
47531 }
47532
47533 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChannelShutdownState_1resolving_1htlcs(JNIEnv *env, jclass clz) {
47534         jclass ret_conv = LDKChannelShutdownState_to_java(env, ChannelShutdownState_resolving_htlcs());
47535         return ret_conv;
47536 }
47537
47538 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChannelShutdownState_1negotiating_1closing_1fee(JNIEnv *env, jclass clz) {
47539         jclass ret_conv = LDKChannelShutdownState_to_java(env, ChannelShutdownState_negotiating_closing_fee());
47540         return ret_conv;
47541 }
47542
47543 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChannelShutdownState_1shutdown_1complete(JNIEnv *env, jclass clz) {
47544         jclass ret_conv = LDKChannelShutdownState_to_java(env, ChannelShutdownState_shutdown_complete());
47545         return ret_conv;
47546 }
47547
47548 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelShutdownState_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
47549         LDKChannelShutdownState* a_conv = (LDKChannelShutdownState*)untag_ptr(a);
47550         LDKChannelShutdownState* b_conv = (LDKChannelShutdownState*)untag_ptr(b);
47551         jboolean ret_conv = ChannelShutdownState_eq(a_conv, b_conv);
47552         return ret_conv;
47553 }
47554
47555 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RecentPaymentDetails_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
47556         if (!ptr_is_owned(this_ptr)) return;
47557         void* this_ptr_ptr = untag_ptr(this_ptr);
47558         CHECK_ACCESS(this_ptr_ptr);
47559         LDKRecentPaymentDetails this_ptr_conv = *(LDKRecentPaymentDetails*)(this_ptr_ptr);
47560         FREE(untag_ptr(this_ptr));
47561         RecentPaymentDetails_free(this_ptr_conv);
47562 }
47563
47564 static inline uint64_t RecentPaymentDetails_clone_ptr(LDKRecentPaymentDetails *NONNULL_PTR arg) {
47565         LDKRecentPaymentDetails *ret_copy = MALLOC(sizeof(LDKRecentPaymentDetails), "LDKRecentPaymentDetails");
47566         *ret_copy = RecentPaymentDetails_clone(arg);
47567         int64_t ret_ref = tag_ptr(ret_copy, true);
47568         return ret_ref;
47569 }
47570 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RecentPaymentDetails_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
47571         LDKRecentPaymentDetails* arg_conv = (LDKRecentPaymentDetails*)untag_ptr(arg);
47572         int64_t ret_conv = RecentPaymentDetails_clone_ptr(arg_conv);
47573         return ret_conv;
47574 }
47575
47576 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RecentPaymentDetails_1clone(JNIEnv *env, jclass clz, int64_t orig) {
47577         LDKRecentPaymentDetails* orig_conv = (LDKRecentPaymentDetails*)untag_ptr(orig);
47578         LDKRecentPaymentDetails *ret_copy = MALLOC(sizeof(LDKRecentPaymentDetails), "LDKRecentPaymentDetails");
47579         *ret_copy = RecentPaymentDetails_clone(orig_conv);
47580         int64_t ret_ref = tag_ptr(ret_copy, true);
47581         return ret_ref;
47582 }
47583
47584 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RecentPaymentDetails_1awaiting_1invoice(JNIEnv *env, jclass clz, int8_tArray payment_id) {
47585         LDKThirtyTwoBytes payment_id_ref;
47586         CHECK((*env)->GetArrayLength(env, payment_id) == 32);
47587         (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
47588         LDKRecentPaymentDetails *ret_copy = MALLOC(sizeof(LDKRecentPaymentDetails), "LDKRecentPaymentDetails");
47589         *ret_copy = RecentPaymentDetails_awaiting_invoice(payment_id_ref);
47590         int64_t ret_ref = tag_ptr(ret_copy, true);
47591         return ret_ref;
47592 }
47593
47594 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) {
47595         LDKThirtyTwoBytes payment_id_ref;
47596         CHECK((*env)->GetArrayLength(env, payment_id) == 32);
47597         (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
47598         LDKThirtyTwoBytes payment_hash_ref;
47599         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
47600         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
47601         LDKRecentPaymentDetails *ret_copy = MALLOC(sizeof(LDKRecentPaymentDetails), "LDKRecentPaymentDetails");
47602         *ret_copy = RecentPaymentDetails_pending(payment_id_ref, payment_hash_ref, total_msat);
47603         int64_t ret_ref = tag_ptr(ret_copy, true);
47604         return ret_ref;
47605 }
47606
47607 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RecentPaymentDetails_1fulfilled(JNIEnv *env, jclass clz, int8_tArray payment_id, int64_t payment_hash) {
47608         LDKThirtyTwoBytes payment_id_ref;
47609         CHECK((*env)->GetArrayLength(env, payment_id) == 32);
47610         (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
47611         void* payment_hash_ptr = untag_ptr(payment_hash);
47612         CHECK_ACCESS(payment_hash_ptr);
47613         LDKCOption_ThirtyTwoBytesZ payment_hash_conv = *(LDKCOption_ThirtyTwoBytesZ*)(payment_hash_ptr);
47614         payment_hash_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(payment_hash));
47615         LDKRecentPaymentDetails *ret_copy = MALLOC(sizeof(LDKRecentPaymentDetails), "LDKRecentPaymentDetails");
47616         *ret_copy = RecentPaymentDetails_fulfilled(payment_id_ref, payment_hash_conv);
47617         int64_t ret_ref = tag_ptr(ret_copy, true);
47618         return ret_ref;
47619 }
47620
47621 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RecentPaymentDetails_1abandoned(JNIEnv *env, jclass clz, int8_tArray payment_id, int8_tArray payment_hash) {
47622         LDKThirtyTwoBytes payment_id_ref;
47623         CHECK((*env)->GetArrayLength(env, payment_id) == 32);
47624         (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
47625         LDKThirtyTwoBytes payment_hash_ref;
47626         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
47627         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
47628         LDKRecentPaymentDetails *ret_copy = MALLOC(sizeof(LDKRecentPaymentDetails), "LDKRecentPaymentDetails");
47629         *ret_copy = RecentPaymentDetails_abandoned(payment_id_ref, payment_hash_ref);
47630         int64_t ret_ref = tag_ptr(ret_copy, true);
47631         return ret_ref;
47632 }
47633
47634 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
47635         LDKPhantomRouteHints this_obj_conv;
47636         this_obj_conv.inner = untag_ptr(this_obj);
47637         this_obj_conv.is_owned = ptr_is_owned(this_obj);
47638         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
47639         PhantomRouteHints_free(this_obj_conv);
47640 }
47641
47642 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1get_1channels(JNIEnv *env, jclass clz, int64_t this_ptr) {
47643         LDKPhantomRouteHints this_ptr_conv;
47644         this_ptr_conv.inner = untag_ptr(this_ptr);
47645         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47646         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47647         this_ptr_conv.is_owned = false;
47648         LDKCVec_ChannelDetailsZ ret_var = PhantomRouteHints_get_channels(&this_ptr_conv);
47649         int64_tArray ret_arr = NULL;
47650         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
47651         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
47652         for (size_t q = 0; q < ret_var.datalen; q++) {
47653                 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
47654                 int64_t ret_conv_16_ref = 0;
47655                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
47656                 ret_conv_16_ref = tag_ptr(ret_conv_16_var.inner, ret_conv_16_var.is_owned);
47657                 ret_arr_ptr[q] = ret_conv_16_ref;
47658         }
47659         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
47660         FREE(ret_var.data);
47661         return ret_arr;
47662 }
47663
47664 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1set_1channels(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
47665         LDKPhantomRouteHints this_ptr_conv;
47666         this_ptr_conv.inner = untag_ptr(this_ptr);
47667         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47668         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47669         this_ptr_conv.is_owned = false;
47670         LDKCVec_ChannelDetailsZ val_constr;
47671         val_constr.datalen = (*env)->GetArrayLength(env, val);
47672         if (val_constr.datalen > 0)
47673                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
47674         else
47675                 val_constr.data = NULL;
47676         int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
47677         for (size_t q = 0; q < val_constr.datalen; q++) {
47678                 int64_t val_conv_16 = val_vals[q];
47679                 LDKChannelDetails val_conv_16_conv;
47680                 val_conv_16_conv.inner = untag_ptr(val_conv_16);
47681                 val_conv_16_conv.is_owned = ptr_is_owned(val_conv_16);
47682                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_16_conv);
47683                 val_conv_16_conv = ChannelDetails_clone(&val_conv_16_conv);
47684                 val_constr.data[q] = val_conv_16_conv;
47685         }
47686         (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
47687         PhantomRouteHints_set_channels(&this_ptr_conv, val_constr);
47688 }
47689
47690 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1get_1phantom_1scid(JNIEnv *env, jclass clz, int64_t this_ptr) {
47691         LDKPhantomRouteHints this_ptr_conv;
47692         this_ptr_conv.inner = untag_ptr(this_ptr);
47693         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47694         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47695         this_ptr_conv.is_owned = false;
47696         int64_t ret_conv = PhantomRouteHints_get_phantom_scid(&this_ptr_conv);
47697         return ret_conv;
47698 }
47699
47700 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1set_1phantom_1scid(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
47701         LDKPhantomRouteHints this_ptr_conv;
47702         this_ptr_conv.inner = untag_ptr(this_ptr);
47703         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47704         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47705         this_ptr_conv.is_owned = false;
47706         PhantomRouteHints_set_phantom_scid(&this_ptr_conv, val);
47707 }
47708
47709 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1get_1real_1node_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
47710         LDKPhantomRouteHints this_ptr_conv;
47711         this_ptr_conv.inner = untag_ptr(this_ptr);
47712         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47713         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47714         this_ptr_conv.is_owned = false;
47715         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
47716         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, PhantomRouteHints_get_real_node_pubkey(&this_ptr_conv).compressed_form);
47717         return ret_arr;
47718 }
47719
47720 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1set_1real_1node_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
47721         LDKPhantomRouteHints this_ptr_conv;
47722         this_ptr_conv.inner = untag_ptr(this_ptr);
47723         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
47724         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
47725         this_ptr_conv.is_owned = false;
47726         LDKPublicKey val_ref;
47727         CHECK((*env)->GetArrayLength(env, val) == 33);
47728         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
47729         PhantomRouteHints_set_real_node_pubkey(&this_ptr_conv, val_ref);
47730 }
47731
47732 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) {
47733         LDKCVec_ChannelDetailsZ channels_arg_constr;
47734         channels_arg_constr.datalen = (*env)->GetArrayLength(env, channels_arg);
47735         if (channels_arg_constr.datalen > 0)
47736                 channels_arg_constr.data = MALLOC(channels_arg_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
47737         else
47738                 channels_arg_constr.data = NULL;
47739         int64_t* channels_arg_vals = (*env)->GetLongArrayElements (env, channels_arg, NULL);
47740         for (size_t q = 0; q < channels_arg_constr.datalen; q++) {
47741                 int64_t channels_arg_conv_16 = channels_arg_vals[q];
47742                 LDKChannelDetails channels_arg_conv_16_conv;
47743                 channels_arg_conv_16_conv.inner = untag_ptr(channels_arg_conv_16);
47744                 channels_arg_conv_16_conv.is_owned = ptr_is_owned(channels_arg_conv_16);
47745                 CHECK_INNER_FIELD_ACCESS_OR_NULL(channels_arg_conv_16_conv);
47746                 channels_arg_conv_16_conv = ChannelDetails_clone(&channels_arg_conv_16_conv);
47747                 channels_arg_constr.data[q] = channels_arg_conv_16_conv;
47748         }
47749         (*env)->ReleaseLongArrayElements(env, channels_arg, channels_arg_vals, 0);
47750         LDKPublicKey real_node_pubkey_arg_ref;
47751         CHECK((*env)->GetArrayLength(env, real_node_pubkey_arg) == 33);
47752         (*env)->GetByteArrayRegion(env, real_node_pubkey_arg, 0, 33, real_node_pubkey_arg_ref.compressed_form);
47753         LDKPhantomRouteHints ret_var = PhantomRouteHints_new(channels_arg_constr, phantom_scid_arg, real_node_pubkey_arg_ref);
47754         int64_t ret_ref = 0;
47755         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47756         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47757         return ret_ref;
47758 }
47759
47760 static inline uint64_t PhantomRouteHints_clone_ptr(LDKPhantomRouteHints *NONNULL_PTR arg) {
47761         LDKPhantomRouteHints ret_var = PhantomRouteHints_clone(arg);
47762         int64_t ret_ref = 0;
47763         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47764         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47765         return ret_ref;
47766 }
47767 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
47768         LDKPhantomRouteHints arg_conv;
47769         arg_conv.inner = untag_ptr(arg);
47770         arg_conv.is_owned = ptr_is_owned(arg);
47771         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
47772         arg_conv.is_owned = false;
47773         int64_t ret_conv = PhantomRouteHints_clone_ptr(&arg_conv);
47774         return ret_conv;
47775 }
47776
47777 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1clone(JNIEnv *env, jclass clz, int64_t orig) {
47778         LDKPhantomRouteHints orig_conv;
47779         orig_conv.inner = untag_ptr(orig);
47780         orig_conv.is_owned = ptr_is_owned(orig);
47781         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
47782         orig_conv.is_owned = false;
47783         LDKPhantomRouteHints ret_var = PhantomRouteHints_clone(&orig_conv);
47784         int64_t ret_ref = 0;
47785         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47786         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47787         return ret_ref;
47788 }
47789
47790 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) {
47791         void* fee_est_ptr = untag_ptr(fee_est);
47792         CHECK_ACCESS(fee_est_ptr);
47793         LDKFeeEstimator fee_est_conv = *(LDKFeeEstimator*)(fee_est_ptr);
47794         if (fee_est_conv.free == LDKFeeEstimator_JCalls_free) {
47795                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
47796                 LDKFeeEstimator_JCalls_cloned(&fee_est_conv);
47797         }
47798         void* chain_monitor_ptr = untag_ptr(chain_monitor);
47799         CHECK_ACCESS(chain_monitor_ptr);
47800         LDKWatch chain_monitor_conv = *(LDKWatch*)(chain_monitor_ptr);
47801         if (chain_monitor_conv.free == LDKWatch_JCalls_free) {
47802                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
47803                 LDKWatch_JCalls_cloned(&chain_monitor_conv);
47804         }
47805         void* tx_broadcaster_ptr = untag_ptr(tx_broadcaster);
47806         CHECK_ACCESS(tx_broadcaster_ptr);
47807         LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)(tx_broadcaster_ptr);
47808         if (tx_broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
47809                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
47810                 LDKBroadcasterInterface_JCalls_cloned(&tx_broadcaster_conv);
47811         }
47812         void* router_ptr = untag_ptr(router);
47813         CHECK_ACCESS(router_ptr);
47814         LDKRouter router_conv = *(LDKRouter*)(router_ptr);
47815         if (router_conv.free == LDKRouter_JCalls_free) {
47816                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
47817                 LDKRouter_JCalls_cloned(&router_conv);
47818         }
47819         void* logger_ptr = untag_ptr(logger);
47820         CHECK_ACCESS(logger_ptr);
47821         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
47822         if (logger_conv.free == LDKLogger_JCalls_free) {
47823                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
47824                 LDKLogger_JCalls_cloned(&logger_conv);
47825         }
47826         void* entropy_source_ptr = untag_ptr(entropy_source);
47827         CHECK_ACCESS(entropy_source_ptr);
47828         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
47829         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
47830                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
47831                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
47832         }
47833         void* node_signer_ptr = untag_ptr(node_signer);
47834         CHECK_ACCESS(node_signer_ptr);
47835         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
47836         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
47837                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
47838                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
47839         }
47840         void* signer_provider_ptr = untag_ptr(signer_provider);
47841         CHECK_ACCESS(signer_provider_ptr);
47842         LDKSignerProvider signer_provider_conv = *(LDKSignerProvider*)(signer_provider_ptr);
47843         if (signer_provider_conv.free == LDKSignerProvider_JCalls_free) {
47844                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
47845                 LDKSignerProvider_JCalls_cloned(&signer_provider_conv);
47846         }
47847         LDKUserConfig config_conv;
47848         config_conv.inner = untag_ptr(config);
47849         config_conv.is_owned = ptr_is_owned(config);
47850         CHECK_INNER_FIELD_ACCESS_OR_NULL(config_conv);
47851         config_conv = UserConfig_clone(&config_conv);
47852         LDKChainParameters params_conv;
47853         params_conv.inner = untag_ptr(params);
47854         params_conv.is_owned = ptr_is_owned(params);
47855         CHECK_INNER_FIELD_ACCESS_OR_NULL(params_conv);
47856         params_conv = ChainParameters_clone(&params_conv);
47857         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);
47858         int64_t ret_ref = 0;
47859         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47860         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47861         return ret_ref;
47862 }
47863
47864 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1get_1current_1default_1configuration(JNIEnv *env, jclass clz, int64_t this_arg) {
47865         LDKChannelManager this_arg_conv;
47866         this_arg_conv.inner = untag_ptr(this_arg);
47867         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47868         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47869         this_arg_conv.is_owned = false;
47870         LDKUserConfig ret_var = ChannelManager_get_current_default_configuration(&this_arg_conv);
47871         int64_t ret_ref = 0;
47872         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
47873         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
47874         return ret_ref;
47875 }
47876
47877 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) {
47878         LDKChannelManager this_arg_conv;
47879         this_arg_conv.inner = untag_ptr(this_arg);
47880         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47881         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47882         this_arg_conv.is_owned = false;
47883         LDKPublicKey their_network_key_ref;
47884         CHECK((*env)->GetArrayLength(env, their_network_key) == 33);
47885         (*env)->GetByteArrayRegion(env, their_network_key, 0, 33, their_network_key_ref.compressed_form);
47886         LDKU128 user_channel_id_ref;
47887         CHECK((*env)->GetArrayLength(env, user_channel_id) == 16);
47888         (*env)->GetByteArrayRegion(env, user_channel_id, 0, 16, user_channel_id_ref.le_bytes);
47889         LDKChannelId temporary_channel_id_conv;
47890         temporary_channel_id_conv.inner = untag_ptr(temporary_channel_id);
47891         temporary_channel_id_conv.is_owned = ptr_is_owned(temporary_channel_id);
47892         CHECK_INNER_FIELD_ACCESS_OR_NULL(temporary_channel_id_conv);
47893         temporary_channel_id_conv = ChannelId_clone(&temporary_channel_id_conv);
47894         LDKUserConfig override_config_conv;
47895         override_config_conv.inner = untag_ptr(override_config);
47896         override_config_conv.is_owned = ptr_is_owned(override_config);
47897         CHECK_INNER_FIELD_ACCESS_OR_NULL(override_config_conv);
47898         override_config_conv = UserConfig_clone(&override_config_conv);
47899         LDKCResult_ChannelIdAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelIdAPIErrorZ), "LDKCResult_ChannelIdAPIErrorZ");
47900         *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);
47901         return tag_ptr(ret_conv, true);
47902 }
47903
47904 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1list_1channels(JNIEnv *env, jclass clz, int64_t this_arg) {
47905         LDKChannelManager this_arg_conv;
47906         this_arg_conv.inner = untag_ptr(this_arg);
47907         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47908         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47909         this_arg_conv.is_owned = false;
47910         LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_channels(&this_arg_conv);
47911         int64_tArray ret_arr = NULL;
47912         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
47913         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
47914         for (size_t q = 0; q < ret_var.datalen; q++) {
47915                 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
47916                 int64_t ret_conv_16_ref = 0;
47917                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
47918                 ret_conv_16_ref = tag_ptr(ret_conv_16_var.inner, ret_conv_16_var.is_owned);
47919                 ret_arr_ptr[q] = ret_conv_16_ref;
47920         }
47921         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
47922         FREE(ret_var.data);
47923         return ret_arr;
47924 }
47925
47926 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1list_1usable_1channels(JNIEnv *env, jclass clz, int64_t this_arg) {
47927         LDKChannelManager this_arg_conv;
47928         this_arg_conv.inner = untag_ptr(this_arg);
47929         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47930         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47931         this_arg_conv.is_owned = false;
47932         LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_usable_channels(&this_arg_conv);
47933         int64_tArray ret_arr = NULL;
47934         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
47935         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
47936         for (size_t q = 0; q < ret_var.datalen; q++) {
47937                 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
47938                 int64_t ret_conv_16_ref = 0;
47939                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
47940                 ret_conv_16_ref = tag_ptr(ret_conv_16_var.inner, ret_conv_16_var.is_owned);
47941                 ret_arr_ptr[q] = ret_conv_16_ref;
47942         }
47943         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
47944         FREE(ret_var.data);
47945         return ret_arr;
47946 }
47947
47948 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) {
47949         LDKChannelManager this_arg_conv;
47950         this_arg_conv.inner = untag_ptr(this_arg);
47951         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47952         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47953         this_arg_conv.is_owned = false;
47954         LDKPublicKey counterparty_node_id_ref;
47955         CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
47956         (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
47957         LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_channels_with_counterparty(&this_arg_conv, counterparty_node_id_ref);
47958         int64_tArray ret_arr = NULL;
47959         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
47960         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
47961         for (size_t q = 0; q < ret_var.datalen; q++) {
47962                 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
47963                 int64_t ret_conv_16_ref = 0;
47964                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
47965                 ret_conv_16_ref = tag_ptr(ret_conv_16_var.inner, ret_conv_16_var.is_owned);
47966                 ret_arr_ptr[q] = ret_conv_16_ref;
47967         }
47968         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
47969         FREE(ret_var.data);
47970         return ret_arr;
47971 }
47972
47973 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1list_1recent_1payments(JNIEnv *env, jclass clz, int64_t this_arg) {
47974         LDKChannelManager this_arg_conv;
47975         this_arg_conv.inner = untag_ptr(this_arg);
47976         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47977         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47978         this_arg_conv.is_owned = false;
47979         LDKCVec_RecentPaymentDetailsZ ret_var = ChannelManager_list_recent_payments(&this_arg_conv);
47980         int64_tArray ret_arr = NULL;
47981         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
47982         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
47983         for (size_t w = 0; w < ret_var.datalen; w++) {
47984                 LDKRecentPaymentDetails *ret_conv_22_copy = MALLOC(sizeof(LDKRecentPaymentDetails), "LDKRecentPaymentDetails");
47985                 *ret_conv_22_copy = ret_var.data[w];
47986                 int64_t ret_conv_22_ref = tag_ptr(ret_conv_22_copy, true);
47987                 ret_arr_ptr[w] = ret_conv_22_ref;
47988         }
47989         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
47990         FREE(ret_var.data);
47991         return ret_arr;
47992 }
47993
47994 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1close_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int64_t channel_id, int8_tArray counterparty_node_id) {
47995         LDKChannelManager this_arg_conv;
47996         this_arg_conv.inner = untag_ptr(this_arg);
47997         this_arg_conv.is_owned = ptr_is_owned(this_arg);
47998         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
47999         this_arg_conv.is_owned = false;
48000         LDKChannelId channel_id_conv;
48001         channel_id_conv.inner = untag_ptr(channel_id);
48002         channel_id_conv.is_owned = ptr_is_owned(channel_id);
48003         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_conv);
48004         channel_id_conv.is_owned = false;
48005         LDKPublicKey counterparty_node_id_ref;
48006         CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
48007         (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
48008         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
48009         *ret_conv = ChannelManager_close_channel(&this_arg_conv, &channel_id_conv, counterparty_node_id_ref);
48010         return tag_ptr(ret_conv, true);
48011 }
48012
48013 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1close_1channel_1with_1feerate_1and_1script(JNIEnv *env, jclass clz, int64_t this_arg, int64_t channel_id, int8_tArray counterparty_node_id, int64_t target_feerate_sats_per_1000_weight, int64_t shutdown_script) {
48014         LDKChannelManager this_arg_conv;
48015         this_arg_conv.inner = untag_ptr(this_arg);
48016         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48017         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48018         this_arg_conv.is_owned = false;
48019         LDKChannelId channel_id_conv;
48020         channel_id_conv.inner = untag_ptr(channel_id);
48021         channel_id_conv.is_owned = ptr_is_owned(channel_id);
48022         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_conv);
48023         channel_id_conv.is_owned = false;
48024         LDKPublicKey counterparty_node_id_ref;
48025         CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
48026         (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
48027         void* target_feerate_sats_per_1000_weight_ptr = untag_ptr(target_feerate_sats_per_1000_weight);
48028         CHECK_ACCESS(target_feerate_sats_per_1000_weight_ptr);
48029         LDKCOption_u32Z target_feerate_sats_per_1000_weight_conv = *(LDKCOption_u32Z*)(target_feerate_sats_per_1000_weight_ptr);
48030         target_feerate_sats_per_1000_weight_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(target_feerate_sats_per_1000_weight));
48031         LDKShutdownScript shutdown_script_conv;
48032         shutdown_script_conv.inner = untag_ptr(shutdown_script);
48033         shutdown_script_conv.is_owned = ptr_is_owned(shutdown_script);
48034         CHECK_INNER_FIELD_ACCESS_OR_NULL(shutdown_script_conv);
48035         shutdown_script_conv = ShutdownScript_clone(&shutdown_script_conv);
48036         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
48037         *ret_conv = ChannelManager_close_channel_with_feerate_and_script(&this_arg_conv, &channel_id_conv, counterparty_node_id_ref, target_feerate_sats_per_1000_weight_conv, shutdown_script_conv);
48038         return tag_ptr(ret_conv, true);
48039 }
48040
48041 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1force_1close_1broadcasting_1latest_1txn(JNIEnv *env, jclass clz, int64_t this_arg, int64_t channel_id, int8_tArray counterparty_node_id) {
48042         LDKChannelManager this_arg_conv;
48043         this_arg_conv.inner = untag_ptr(this_arg);
48044         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48045         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48046         this_arg_conv.is_owned = false;
48047         LDKChannelId channel_id_conv;
48048         channel_id_conv.inner = untag_ptr(channel_id);
48049         channel_id_conv.is_owned = ptr_is_owned(channel_id);
48050         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_conv);
48051         channel_id_conv.is_owned = false;
48052         LDKPublicKey counterparty_node_id_ref;
48053         CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
48054         (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
48055         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
48056         *ret_conv = ChannelManager_force_close_broadcasting_latest_txn(&this_arg_conv, &channel_id_conv, counterparty_node_id_ref);
48057         return tag_ptr(ret_conv, true);
48058 }
48059
48060 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1force_1close_1without_1broadcasting_1txn(JNIEnv *env, jclass clz, int64_t this_arg, int64_t channel_id, int8_tArray counterparty_node_id) {
48061         LDKChannelManager this_arg_conv;
48062         this_arg_conv.inner = untag_ptr(this_arg);
48063         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48064         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48065         this_arg_conv.is_owned = false;
48066         LDKChannelId channel_id_conv;
48067         channel_id_conv.inner = untag_ptr(channel_id);
48068         channel_id_conv.is_owned = ptr_is_owned(channel_id);
48069         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_conv);
48070         channel_id_conv.is_owned = false;
48071         LDKPublicKey counterparty_node_id_ref;
48072         CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
48073         (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
48074         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
48075         *ret_conv = ChannelManager_force_close_without_broadcasting_txn(&this_arg_conv, &channel_id_conv, counterparty_node_id_ref);
48076         return tag_ptr(ret_conv, true);
48077 }
48078
48079 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1force_1close_1all_1channels_1broadcasting_1latest_1txn(JNIEnv *env, jclass clz, int64_t this_arg) {
48080         LDKChannelManager this_arg_conv;
48081         this_arg_conv.inner = untag_ptr(this_arg);
48082         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48083         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48084         this_arg_conv.is_owned = false;
48085         ChannelManager_force_close_all_channels_broadcasting_latest_txn(&this_arg_conv);
48086 }
48087
48088 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1force_1close_1all_1channels_1without_1broadcasting_1txn(JNIEnv *env, jclass clz, int64_t this_arg) {
48089         LDKChannelManager this_arg_conv;
48090         this_arg_conv.inner = untag_ptr(this_arg);
48091         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48092         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48093         this_arg_conv.is_owned = false;
48094         ChannelManager_force_close_all_channels_without_broadcasting_txn(&this_arg_conv);
48095 }
48096
48097 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) {
48098         LDKChannelManager this_arg_conv;
48099         this_arg_conv.inner = untag_ptr(this_arg);
48100         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48101         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48102         this_arg_conv.is_owned = false;
48103         LDKRoute route_conv;
48104         route_conv.inner = untag_ptr(route);
48105         route_conv.is_owned = ptr_is_owned(route);
48106         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
48107         route_conv.is_owned = false;
48108         LDKThirtyTwoBytes payment_hash_ref;
48109         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
48110         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
48111         LDKRecipientOnionFields recipient_onion_conv;
48112         recipient_onion_conv.inner = untag_ptr(recipient_onion);
48113         recipient_onion_conv.is_owned = ptr_is_owned(recipient_onion);
48114         CHECK_INNER_FIELD_ACCESS_OR_NULL(recipient_onion_conv);
48115         recipient_onion_conv = RecipientOnionFields_clone(&recipient_onion_conv);
48116         LDKThirtyTwoBytes payment_id_ref;
48117         CHECK((*env)->GetArrayLength(env, payment_id) == 32);
48118         (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
48119         LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
48120         *ret_conv = ChannelManager_send_payment_with_route(&this_arg_conv, &route_conv, payment_hash_ref, recipient_onion_conv, payment_id_ref);
48121         return tag_ptr(ret_conv, true);
48122 }
48123
48124 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) {
48125         LDKChannelManager this_arg_conv;
48126         this_arg_conv.inner = untag_ptr(this_arg);
48127         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48128         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48129         this_arg_conv.is_owned = false;
48130         LDKThirtyTwoBytes payment_hash_ref;
48131         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
48132         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
48133         LDKRecipientOnionFields recipient_onion_conv;
48134         recipient_onion_conv.inner = untag_ptr(recipient_onion);
48135         recipient_onion_conv.is_owned = ptr_is_owned(recipient_onion);
48136         CHECK_INNER_FIELD_ACCESS_OR_NULL(recipient_onion_conv);
48137         recipient_onion_conv = RecipientOnionFields_clone(&recipient_onion_conv);
48138         LDKThirtyTwoBytes payment_id_ref;
48139         CHECK((*env)->GetArrayLength(env, payment_id) == 32);
48140         (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
48141         LDKRouteParameters route_params_conv;
48142         route_params_conv.inner = untag_ptr(route_params);
48143         route_params_conv.is_owned = ptr_is_owned(route_params);
48144         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
48145         route_params_conv = RouteParameters_clone(&route_params_conv);
48146         void* retry_strategy_ptr = untag_ptr(retry_strategy);
48147         CHECK_ACCESS(retry_strategy_ptr);
48148         LDKRetry retry_strategy_conv = *(LDKRetry*)(retry_strategy_ptr);
48149         retry_strategy_conv = Retry_clone((LDKRetry*)untag_ptr(retry_strategy));
48150         LDKCResult_NoneRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneRetryableSendFailureZ), "LDKCResult_NoneRetryableSendFailureZ");
48151         *ret_conv = ChannelManager_send_payment(&this_arg_conv, payment_hash_ref, recipient_onion_conv, payment_id_ref, route_params_conv, retry_strategy_conv);
48152         return tag_ptr(ret_conv, true);
48153 }
48154
48155 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1abandon_1payment(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray payment_id) {
48156         LDKChannelManager this_arg_conv;
48157         this_arg_conv.inner = untag_ptr(this_arg);
48158         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48159         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48160         this_arg_conv.is_owned = false;
48161         LDKThirtyTwoBytes payment_id_ref;
48162         CHECK((*env)->GetArrayLength(env, payment_id) == 32);
48163         (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
48164         ChannelManager_abandon_payment(&this_arg_conv, payment_id_ref);
48165 }
48166
48167 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) {
48168         LDKChannelManager this_arg_conv;
48169         this_arg_conv.inner = untag_ptr(this_arg);
48170         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48171         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48172         this_arg_conv.is_owned = false;
48173         LDKRoute route_conv;
48174         route_conv.inner = untag_ptr(route);
48175         route_conv.is_owned = ptr_is_owned(route);
48176         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv);
48177         route_conv.is_owned = false;
48178         void* payment_preimage_ptr = untag_ptr(payment_preimage);
48179         CHECK_ACCESS(payment_preimage_ptr);
48180         LDKCOption_ThirtyTwoBytesZ payment_preimage_conv = *(LDKCOption_ThirtyTwoBytesZ*)(payment_preimage_ptr);
48181         payment_preimage_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(payment_preimage));
48182         LDKRecipientOnionFields recipient_onion_conv;
48183         recipient_onion_conv.inner = untag_ptr(recipient_onion);
48184         recipient_onion_conv.is_owned = ptr_is_owned(recipient_onion);
48185         CHECK_INNER_FIELD_ACCESS_OR_NULL(recipient_onion_conv);
48186         recipient_onion_conv = RecipientOnionFields_clone(&recipient_onion_conv);
48187         LDKThirtyTwoBytes payment_id_ref;
48188         CHECK((*env)->GetArrayLength(env, payment_id) == 32);
48189         (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
48190         LDKCResult_ThirtyTwoBytesPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesPaymentSendFailureZ), "LDKCResult_ThirtyTwoBytesPaymentSendFailureZ");
48191         *ret_conv = ChannelManager_send_spontaneous_payment(&this_arg_conv, &route_conv, payment_preimage_conv, recipient_onion_conv, payment_id_ref);
48192         return tag_ptr(ret_conv, true);
48193 }
48194
48195 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) {
48196         LDKChannelManager this_arg_conv;
48197         this_arg_conv.inner = untag_ptr(this_arg);
48198         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48199         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48200         this_arg_conv.is_owned = false;
48201         void* payment_preimage_ptr = untag_ptr(payment_preimage);
48202         CHECK_ACCESS(payment_preimage_ptr);
48203         LDKCOption_ThirtyTwoBytesZ payment_preimage_conv = *(LDKCOption_ThirtyTwoBytesZ*)(payment_preimage_ptr);
48204         payment_preimage_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(payment_preimage));
48205         LDKRecipientOnionFields recipient_onion_conv;
48206         recipient_onion_conv.inner = untag_ptr(recipient_onion);
48207         recipient_onion_conv.is_owned = ptr_is_owned(recipient_onion);
48208         CHECK_INNER_FIELD_ACCESS_OR_NULL(recipient_onion_conv);
48209         recipient_onion_conv = RecipientOnionFields_clone(&recipient_onion_conv);
48210         LDKThirtyTwoBytes payment_id_ref;
48211         CHECK((*env)->GetArrayLength(env, payment_id) == 32);
48212         (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
48213         LDKRouteParameters route_params_conv;
48214         route_params_conv.inner = untag_ptr(route_params);
48215         route_params_conv.is_owned = ptr_is_owned(route_params);
48216         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
48217         route_params_conv = RouteParameters_clone(&route_params_conv);
48218         void* retry_strategy_ptr = untag_ptr(retry_strategy);
48219         CHECK_ACCESS(retry_strategy_ptr);
48220         LDKRetry retry_strategy_conv = *(LDKRetry*)(retry_strategy_ptr);
48221         retry_strategy_conv = Retry_clone((LDKRetry*)untag_ptr(retry_strategy));
48222         LDKCResult_ThirtyTwoBytesRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesRetryableSendFailureZ), "LDKCResult_ThirtyTwoBytesRetryableSendFailureZ");
48223         *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);
48224         return tag_ptr(ret_conv, true);
48225 }
48226
48227 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1send_1probe(JNIEnv *env, jclass clz, int64_t this_arg, int64_t path) {
48228         LDKChannelManager this_arg_conv;
48229         this_arg_conv.inner = untag_ptr(this_arg);
48230         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48231         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48232         this_arg_conv.is_owned = false;
48233         LDKPath path_conv;
48234         path_conv.inner = untag_ptr(path);
48235         path_conv.is_owned = ptr_is_owned(path);
48236         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
48237         path_conv = Path_clone(&path_conv);
48238         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ), "LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ");
48239         *ret_conv = ChannelManager_send_probe(&this_arg_conv, path_conv);
48240         return tag_ptr(ret_conv, true);
48241 }
48242
48243 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) {
48244         LDKChannelManager this_arg_conv;
48245         this_arg_conv.inner = untag_ptr(this_arg);
48246         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48247         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48248         this_arg_conv.is_owned = false;
48249         LDKPublicKey node_id_ref;
48250         CHECK((*env)->GetArrayLength(env, node_id) == 33);
48251         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
48252         void* liquidity_limit_multiplier_ptr = untag_ptr(liquidity_limit_multiplier);
48253         CHECK_ACCESS(liquidity_limit_multiplier_ptr);
48254         LDKCOption_u64Z liquidity_limit_multiplier_conv = *(LDKCOption_u64Z*)(liquidity_limit_multiplier_ptr);
48255         liquidity_limit_multiplier_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(liquidity_limit_multiplier));
48256         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ");
48257         *ret_conv = ChannelManager_send_spontaneous_preflight_probes(&this_arg_conv, node_id_ref, amount_msat, final_cltv_expiry_delta, liquidity_limit_multiplier_conv);
48258         return tag_ptr(ret_conv, true);
48259 }
48260
48261 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) {
48262         LDKChannelManager this_arg_conv;
48263         this_arg_conv.inner = untag_ptr(this_arg);
48264         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48265         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48266         this_arg_conv.is_owned = false;
48267         LDKRouteParameters route_params_conv;
48268         route_params_conv.inner = untag_ptr(route_params);
48269         route_params_conv.is_owned = ptr_is_owned(route_params);
48270         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
48271         route_params_conv = RouteParameters_clone(&route_params_conv);
48272         void* liquidity_limit_multiplier_ptr = untag_ptr(liquidity_limit_multiplier);
48273         CHECK_ACCESS(liquidity_limit_multiplier_ptr);
48274         LDKCOption_u64Z liquidity_limit_multiplier_conv = *(LDKCOption_u64Z*)(liquidity_limit_multiplier_ptr);
48275         liquidity_limit_multiplier_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(liquidity_limit_multiplier));
48276         LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ), "LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ");
48277         *ret_conv = ChannelManager_send_preflight_probes(&this_arg_conv, route_params_conv, liquidity_limit_multiplier_conv);
48278         return tag_ptr(ret_conv, true);
48279 }
48280
48281 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1funding_1transaction_1generated(JNIEnv *env, jclass clz, int64_t this_arg, int64_t temporary_channel_id, int8_tArray counterparty_node_id, int8_tArray funding_transaction) {
48282         LDKChannelManager this_arg_conv;
48283         this_arg_conv.inner = untag_ptr(this_arg);
48284         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48285         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48286         this_arg_conv.is_owned = false;
48287         LDKChannelId temporary_channel_id_conv;
48288         temporary_channel_id_conv.inner = untag_ptr(temporary_channel_id);
48289         temporary_channel_id_conv.is_owned = ptr_is_owned(temporary_channel_id);
48290         CHECK_INNER_FIELD_ACCESS_OR_NULL(temporary_channel_id_conv);
48291         temporary_channel_id_conv.is_owned = false;
48292         LDKPublicKey counterparty_node_id_ref;
48293         CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
48294         (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
48295         LDKTransaction funding_transaction_ref;
48296         funding_transaction_ref.datalen = (*env)->GetArrayLength(env, funding_transaction);
48297         funding_transaction_ref.data = MALLOC(funding_transaction_ref.datalen, "LDKTransaction Bytes");
48298         (*env)->GetByteArrayRegion(env, funding_transaction, 0, funding_transaction_ref.datalen, funding_transaction_ref.data);
48299         funding_transaction_ref.data_is_owned = true;
48300         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
48301         *ret_conv = ChannelManager_funding_transaction_generated(&this_arg_conv, &temporary_channel_id_conv, counterparty_node_id_ref, funding_transaction_ref);
48302         return tag_ptr(ret_conv, true);
48303 }
48304
48305 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) {
48306         LDKChannelManager this_arg_conv;
48307         this_arg_conv.inner = untag_ptr(this_arg);
48308         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48309         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48310         this_arg_conv.is_owned = false;
48311         LDKCVec_C2Tuple_ChannelIdPublicKeyZZ temporary_channels_constr;
48312         temporary_channels_constr.datalen = (*env)->GetArrayLength(env, temporary_channels);
48313         if (temporary_channels_constr.datalen > 0)
48314                 temporary_channels_constr.data = MALLOC(temporary_channels_constr.datalen * sizeof(LDKC2Tuple_ChannelIdPublicKeyZ), "LDKCVec_C2Tuple_ChannelIdPublicKeyZZ Elements");
48315         else
48316                 temporary_channels_constr.data = NULL;
48317         int64_t* temporary_channels_vals = (*env)->GetLongArrayElements (env, temporary_channels, NULL);
48318         for (size_t e = 0; e < temporary_channels_constr.datalen; e++) {
48319                 int64_t temporary_channels_conv_30 = temporary_channels_vals[e];
48320                 void* temporary_channels_conv_30_ptr = untag_ptr(temporary_channels_conv_30);
48321                 CHECK_ACCESS(temporary_channels_conv_30_ptr);
48322                 LDKC2Tuple_ChannelIdPublicKeyZ temporary_channels_conv_30_conv = *(LDKC2Tuple_ChannelIdPublicKeyZ*)(temporary_channels_conv_30_ptr);
48323                 temporary_channels_conv_30_conv = C2Tuple_ChannelIdPublicKeyZ_clone((LDKC2Tuple_ChannelIdPublicKeyZ*)untag_ptr(temporary_channels_conv_30));
48324                 temporary_channels_constr.data[e] = temporary_channels_conv_30_conv;
48325         }
48326         (*env)->ReleaseLongArrayElements(env, temporary_channels, temporary_channels_vals, 0);
48327         LDKTransaction funding_transaction_ref;
48328         funding_transaction_ref.datalen = (*env)->GetArrayLength(env, funding_transaction);
48329         funding_transaction_ref.data = MALLOC(funding_transaction_ref.datalen, "LDKTransaction Bytes");
48330         (*env)->GetByteArrayRegion(env, funding_transaction, 0, funding_transaction_ref.datalen, funding_transaction_ref.data);
48331         funding_transaction_ref.data_is_owned = true;
48332         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
48333         *ret_conv = ChannelManager_batch_funding_transaction_generated(&this_arg_conv, temporary_channels_constr, funding_transaction_ref);
48334         return tag_ptr(ret_conv, true);
48335 }
48336
48337 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1update_1partial_1channel_1config(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray counterparty_node_id, int64_tArray channel_ids, int64_t config_update) {
48338         LDKChannelManager this_arg_conv;
48339         this_arg_conv.inner = untag_ptr(this_arg);
48340         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48341         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48342         this_arg_conv.is_owned = false;
48343         LDKPublicKey counterparty_node_id_ref;
48344         CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
48345         (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
48346         LDKCVec_ChannelIdZ channel_ids_constr;
48347         channel_ids_constr.datalen = (*env)->GetArrayLength(env, channel_ids);
48348         if (channel_ids_constr.datalen > 0)
48349                 channel_ids_constr.data = MALLOC(channel_ids_constr.datalen * sizeof(LDKChannelId), "LDKCVec_ChannelIdZ Elements");
48350         else
48351                 channel_ids_constr.data = NULL;
48352         int64_t* channel_ids_vals = (*env)->GetLongArrayElements (env, channel_ids, NULL);
48353         for (size_t l = 0; l < channel_ids_constr.datalen; l++) {
48354                 int64_t channel_ids_conv_11 = channel_ids_vals[l];
48355                 LDKChannelId channel_ids_conv_11_conv;
48356                 channel_ids_conv_11_conv.inner = untag_ptr(channel_ids_conv_11);
48357                 channel_ids_conv_11_conv.is_owned = ptr_is_owned(channel_ids_conv_11);
48358                 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_ids_conv_11_conv);
48359                 channel_ids_conv_11_conv = ChannelId_clone(&channel_ids_conv_11_conv);
48360                 channel_ids_constr.data[l] = channel_ids_conv_11_conv;
48361         }
48362         (*env)->ReleaseLongArrayElements(env, channel_ids, channel_ids_vals, 0);
48363         LDKChannelConfigUpdate config_update_conv;
48364         config_update_conv.inner = untag_ptr(config_update);
48365         config_update_conv.is_owned = ptr_is_owned(config_update);
48366         CHECK_INNER_FIELD_ACCESS_OR_NULL(config_update_conv);
48367         config_update_conv.is_owned = false;
48368         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
48369         *ret_conv = ChannelManager_update_partial_channel_config(&this_arg_conv, counterparty_node_id_ref, channel_ids_constr, &config_update_conv);
48370         return tag_ptr(ret_conv, true);
48371 }
48372
48373 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1update_1channel_1config(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray counterparty_node_id, int64_tArray channel_ids, int64_t config) {
48374         LDKChannelManager this_arg_conv;
48375         this_arg_conv.inner = untag_ptr(this_arg);
48376         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48377         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48378         this_arg_conv.is_owned = false;
48379         LDKPublicKey counterparty_node_id_ref;
48380         CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
48381         (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
48382         LDKCVec_ChannelIdZ channel_ids_constr;
48383         channel_ids_constr.datalen = (*env)->GetArrayLength(env, channel_ids);
48384         if (channel_ids_constr.datalen > 0)
48385                 channel_ids_constr.data = MALLOC(channel_ids_constr.datalen * sizeof(LDKChannelId), "LDKCVec_ChannelIdZ Elements");
48386         else
48387                 channel_ids_constr.data = NULL;
48388         int64_t* channel_ids_vals = (*env)->GetLongArrayElements (env, channel_ids, NULL);
48389         for (size_t l = 0; l < channel_ids_constr.datalen; l++) {
48390                 int64_t channel_ids_conv_11 = channel_ids_vals[l];
48391                 LDKChannelId channel_ids_conv_11_conv;
48392                 channel_ids_conv_11_conv.inner = untag_ptr(channel_ids_conv_11);
48393                 channel_ids_conv_11_conv.is_owned = ptr_is_owned(channel_ids_conv_11);
48394                 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_ids_conv_11_conv);
48395                 channel_ids_conv_11_conv = ChannelId_clone(&channel_ids_conv_11_conv);
48396                 channel_ids_constr.data[l] = channel_ids_conv_11_conv;
48397         }
48398         (*env)->ReleaseLongArrayElements(env, channel_ids, channel_ids_vals, 0);
48399         LDKChannelConfig config_conv;
48400         config_conv.inner = untag_ptr(config);
48401         config_conv.is_owned = ptr_is_owned(config);
48402         CHECK_INNER_FIELD_ACCESS_OR_NULL(config_conv);
48403         config_conv.is_owned = false;
48404         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
48405         *ret_conv = ChannelManager_update_channel_config(&this_arg_conv, counterparty_node_id_ref, channel_ids_constr, &config_conv);
48406         return tag_ptr(ret_conv, true);
48407 }
48408
48409 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1forward_1intercepted_1htlc(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray intercept_id, int64_t next_hop_channel_id, int8_tArray next_node_id, int64_t amt_to_forward_msat) {
48410         LDKChannelManager this_arg_conv;
48411         this_arg_conv.inner = untag_ptr(this_arg);
48412         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48413         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48414         this_arg_conv.is_owned = false;
48415         LDKThirtyTwoBytes intercept_id_ref;
48416         CHECK((*env)->GetArrayLength(env, intercept_id) == 32);
48417         (*env)->GetByteArrayRegion(env, intercept_id, 0, 32, intercept_id_ref.data);
48418         LDKChannelId next_hop_channel_id_conv;
48419         next_hop_channel_id_conv.inner = untag_ptr(next_hop_channel_id);
48420         next_hop_channel_id_conv.is_owned = ptr_is_owned(next_hop_channel_id);
48421         CHECK_INNER_FIELD_ACCESS_OR_NULL(next_hop_channel_id_conv);
48422         next_hop_channel_id_conv.is_owned = false;
48423         LDKPublicKey next_node_id_ref;
48424         CHECK((*env)->GetArrayLength(env, next_node_id) == 33);
48425         (*env)->GetByteArrayRegion(env, next_node_id, 0, 33, next_node_id_ref.compressed_form);
48426         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
48427         *ret_conv = ChannelManager_forward_intercepted_htlc(&this_arg_conv, intercept_id_ref, &next_hop_channel_id_conv, next_node_id_ref, amt_to_forward_msat);
48428         return tag_ptr(ret_conv, true);
48429 }
48430
48431 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) {
48432         LDKChannelManager this_arg_conv;
48433         this_arg_conv.inner = untag_ptr(this_arg);
48434         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48435         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48436         this_arg_conv.is_owned = false;
48437         LDKThirtyTwoBytes intercept_id_ref;
48438         CHECK((*env)->GetArrayLength(env, intercept_id) == 32);
48439         (*env)->GetByteArrayRegion(env, intercept_id, 0, 32, intercept_id_ref.data);
48440         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
48441         *ret_conv = ChannelManager_fail_intercepted_htlc(&this_arg_conv, intercept_id_ref);
48442         return tag_ptr(ret_conv, true);
48443 }
48444
48445 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1process_1pending_1htlc_1forwards(JNIEnv *env, jclass clz, int64_t this_arg) {
48446         LDKChannelManager this_arg_conv;
48447         this_arg_conv.inner = untag_ptr(this_arg);
48448         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48449         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48450         this_arg_conv.is_owned = false;
48451         ChannelManager_process_pending_htlc_forwards(&this_arg_conv);
48452 }
48453
48454 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1timer_1tick_1occurred(JNIEnv *env, jclass clz, int64_t this_arg) {
48455         LDKChannelManager this_arg_conv;
48456         this_arg_conv.inner = untag_ptr(this_arg);
48457         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48458         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48459         this_arg_conv.is_owned = false;
48460         ChannelManager_timer_tick_occurred(&this_arg_conv);
48461 }
48462
48463 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1fail_1htlc_1backwards(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray payment_hash) {
48464         LDKChannelManager this_arg_conv;
48465         this_arg_conv.inner = untag_ptr(this_arg);
48466         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48467         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48468         this_arg_conv.is_owned = false;
48469         uint8_t payment_hash_arr[32];
48470         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
48471         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_arr);
48472         uint8_t (*payment_hash_ref)[32] = &payment_hash_arr;
48473         ChannelManager_fail_htlc_backwards(&this_arg_conv, payment_hash_ref);
48474 }
48475
48476 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) {
48477         LDKChannelManager this_arg_conv;
48478         this_arg_conv.inner = untag_ptr(this_arg);
48479         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48480         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48481         this_arg_conv.is_owned = false;
48482         uint8_t payment_hash_arr[32];
48483         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
48484         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_arr);
48485         uint8_t (*payment_hash_ref)[32] = &payment_hash_arr;
48486         void* failure_code_ptr = untag_ptr(failure_code);
48487         CHECK_ACCESS(failure_code_ptr);
48488         LDKFailureCode failure_code_conv = *(LDKFailureCode*)(failure_code_ptr);
48489         failure_code_conv = FailureCode_clone((LDKFailureCode*)untag_ptr(failure_code));
48490         ChannelManager_fail_htlc_backwards_with_reason(&this_arg_conv, payment_hash_ref, failure_code_conv);
48491 }
48492
48493 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1claim_1funds(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray payment_preimage) {
48494         LDKChannelManager this_arg_conv;
48495         this_arg_conv.inner = untag_ptr(this_arg);
48496         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48497         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48498         this_arg_conv.is_owned = false;
48499         LDKThirtyTwoBytes payment_preimage_ref;
48500         CHECK((*env)->GetArrayLength(env, payment_preimage) == 32);
48501         (*env)->GetByteArrayRegion(env, payment_preimage, 0, 32, payment_preimage_ref.data);
48502         ChannelManager_claim_funds(&this_arg_conv, payment_preimage_ref);
48503 }
48504
48505 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) {
48506         LDKChannelManager this_arg_conv;
48507         this_arg_conv.inner = untag_ptr(this_arg);
48508         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48509         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48510         this_arg_conv.is_owned = false;
48511         LDKThirtyTwoBytes payment_preimage_ref;
48512         CHECK((*env)->GetArrayLength(env, payment_preimage) == 32);
48513         (*env)->GetByteArrayRegion(env, payment_preimage, 0, 32, payment_preimage_ref.data);
48514         ChannelManager_claim_funds_with_known_custom_tlvs(&this_arg_conv, payment_preimage_ref);
48515 }
48516
48517 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1get_1our_1node_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
48518         LDKChannelManager this_arg_conv;
48519         this_arg_conv.inner = untag_ptr(this_arg);
48520         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48521         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48522         this_arg_conv.is_owned = false;
48523         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
48524         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelManager_get_our_node_id(&this_arg_conv).compressed_form);
48525         return ret_arr;
48526 }
48527
48528 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1accept_1inbound_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int64_t temporary_channel_id, int8_tArray counterparty_node_id, int8_tArray user_channel_id) {
48529         LDKChannelManager this_arg_conv;
48530         this_arg_conv.inner = untag_ptr(this_arg);
48531         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48532         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48533         this_arg_conv.is_owned = false;
48534         LDKChannelId temporary_channel_id_conv;
48535         temporary_channel_id_conv.inner = untag_ptr(temporary_channel_id);
48536         temporary_channel_id_conv.is_owned = ptr_is_owned(temporary_channel_id);
48537         CHECK_INNER_FIELD_ACCESS_OR_NULL(temporary_channel_id_conv);
48538         temporary_channel_id_conv.is_owned = false;
48539         LDKPublicKey counterparty_node_id_ref;
48540         CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
48541         (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
48542         LDKU128 user_channel_id_ref;
48543         CHECK((*env)->GetArrayLength(env, user_channel_id) == 16);
48544         (*env)->GetByteArrayRegion(env, user_channel_id, 0, 16, user_channel_id_ref.le_bytes);
48545         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
48546         *ret_conv = ChannelManager_accept_inbound_channel(&this_arg_conv, &temporary_channel_id_conv, counterparty_node_id_ref, user_channel_id_ref);
48547         return tag_ptr(ret_conv, true);
48548 }
48549
48550 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1accept_1inbound_1channel_1from_1trusted_1peer_10conf(JNIEnv *env, jclass clz, int64_t this_arg, int64_t temporary_channel_id, int8_tArray counterparty_node_id, int8_tArray user_channel_id) {
48551         LDKChannelManager this_arg_conv;
48552         this_arg_conv.inner = untag_ptr(this_arg);
48553         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48554         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48555         this_arg_conv.is_owned = false;
48556         LDKChannelId temporary_channel_id_conv;
48557         temporary_channel_id_conv.inner = untag_ptr(temporary_channel_id);
48558         temporary_channel_id_conv.is_owned = ptr_is_owned(temporary_channel_id);
48559         CHECK_INNER_FIELD_ACCESS_OR_NULL(temporary_channel_id_conv);
48560         temporary_channel_id_conv.is_owned = false;
48561         LDKPublicKey counterparty_node_id_ref;
48562         CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
48563         (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
48564         LDKU128 user_channel_id_ref;
48565         CHECK((*env)->GetArrayLength(env, user_channel_id) == 16);
48566         (*env)->GetByteArrayRegion(env, user_channel_id, 0, 16, user_channel_id_ref.le_bytes);
48567         LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
48568         *ret_conv = ChannelManager_accept_inbound_channel_from_trusted_peer_0conf(&this_arg_conv, &temporary_channel_id_conv, counterparty_node_id_ref, user_channel_id_ref);
48569         return tag_ptr(ret_conv, true);
48570 }
48571
48572 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1create_1offer_1builder(JNIEnv *env, jclass clz, int64_t this_arg) {
48573         LDKChannelManager this_arg_conv;
48574         this_arg_conv.inner = untag_ptr(this_arg);
48575         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48576         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48577         this_arg_conv.is_owned = false;
48578         LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ), "LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ");
48579         *ret_conv = ChannelManager_create_offer_builder(&this_arg_conv);
48580         return tag_ptr(ret_conv, true);
48581 }
48582
48583 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1create_1refund_1builder(JNIEnv *env, jclass clz, int64_t this_arg, int64_t amount_msats, int64_t absolute_expiry, int8_tArray payment_id, int64_t retry_strategy, int64_t max_total_routing_fee_msat) {
48584         LDKChannelManager this_arg_conv;
48585         this_arg_conv.inner = untag_ptr(this_arg);
48586         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48587         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48588         this_arg_conv.is_owned = false;
48589         LDKThirtyTwoBytes payment_id_ref;
48590         CHECK((*env)->GetArrayLength(env, payment_id) == 32);
48591         (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
48592         void* retry_strategy_ptr = untag_ptr(retry_strategy);
48593         CHECK_ACCESS(retry_strategy_ptr);
48594         LDKRetry retry_strategy_conv = *(LDKRetry*)(retry_strategy_ptr);
48595         retry_strategy_conv = Retry_clone((LDKRetry*)untag_ptr(retry_strategy));
48596         void* max_total_routing_fee_msat_ptr = untag_ptr(max_total_routing_fee_msat);
48597         CHECK_ACCESS(max_total_routing_fee_msat_ptr);
48598         LDKCOption_u64Z max_total_routing_fee_msat_conv = *(LDKCOption_u64Z*)(max_total_routing_fee_msat_ptr);
48599         max_total_routing_fee_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(max_total_routing_fee_msat));
48600         LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ), "LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ");
48601         *ret_conv = ChannelManager_create_refund_builder(&this_arg_conv, amount_msats, absolute_expiry, payment_id_ref, retry_strategy_conv, max_total_routing_fee_msat_conv);
48602         return tag_ptr(ret_conv, true);
48603 }
48604
48605 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) {
48606         LDKChannelManager this_arg_conv;
48607         this_arg_conv.inner = untag_ptr(this_arg);
48608         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48609         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48610         this_arg_conv.is_owned = false;
48611         LDKOffer offer_conv;
48612         offer_conv.inner = untag_ptr(offer);
48613         offer_conv.is_owned = ptr_is_owned(offer);
48614         CHECK_INNER_FIELD_ACCESS_OR_NULL(offer_conv);
48615         offer_conv.is_owned = false;
48616         void* quantity_ptr = untag_ptr(quantity);
48617         CHECK_ACCESS(quantity_ptr);
48618         LDKCOption_u64Z quantity_conv = *(LDKCOption_u64Z*)(quantity_ptr);
48619         quantity_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(quantity));
48620         void* amount_msats_ptr = untag_ptr(amount_msats);
48621         CHECK_ACCESS(amount_msats_ptr);
48622         LDKCOption_u64Z amount_msats_conv = *(LDKCOption_u64Z*)(amount_msats_ptr);
48623         amount_msats_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amount_msats));
48624         void* payer_note_ptr = untag_ptr(payer_note);
48625         CHECK_ACCESS(payer_note_ptr);
48626         LDKCOption_StrZ payer_note_conv = *(LDKCOption_StrZ*)(payer_note_ptr);
48627         payer_note_conv = COption_StrZ_clone((LDKCOption_StrZ*)untag_ptr(payer_note));
48628         LDKThirtyTwoBytes payment_id_ref;
48629         CHECK((*env)->GetArrayLength(env, payment_id) == 32);
48630         (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
48631         void* retry_strategy_ptr = untag_ptr(retry_strategy);
48632         CHECK_ACCESS(retry_strategy_ptr);
48633         LDKRetry retry_strategy_conv = *(LDKRetry*)(retry_strategy_ptr);
48634         retry_strategy_conv = Retry_clone((LDKRetry*)untag_ptr(retry_strategy));
48635         void* max_total_routing_fee_msat_ptr = untag_ptr(max_total_routing_fee_msat);
48636         CHECK_ACCESS(max_total_routing_fee_msat_ptr);
48637         LDKCOption_u64Z max_total_routing_fee_msat_conv = *(LDKCOption_u64Z*)(max_total_routing_fee_msat_ptr);
48638         max_total_routing_fee_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(max_total_routing_fee_msat));
48639         LDKCResult_NoneBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt12SemanticErrorZ), "LDKCResult_NoneBolt12SemanticErrorZ");
48640         *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);
48641         return tag_ptr(ret_conv, true);
48642 }
48643
48644 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1request_1refund_1payment(JNIEnv *env, jclass clz, int64_t this_arg, int64_t refund) {
48645         LDKChannelManager this_arg_conv;
48646         this_arg_conv.inner = untag_ptr(this_arg);
48647         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48648         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48649         this_arg_conv.is_owned = false;
48650         LDKRefund refund_conv;
48651         refund_conv.inner = untag_ptr(refund);
48652         refund_conv.is_owned = ptr_is_owned(refund);
48653         CHECK_INNER_FIELD_ACCESS_OR_NULL(refund_conv);
48654         refund_conv.is_owned = false;
48655         LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ), "LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ");
48656         *ret_conv = ChannelManager_request_refund_payment(&this_arg_conv, &refund_conv);
48657         return tag_ptr(ret_conv, true);
48658 }
48659
48660 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) {
48661         LDKChannelManager this_arg_conv;
48662         this_arg_conv.inner = untag_ptr(this_arg);
48663         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48664         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48665         this_arg_conv.is_owned = false;
48666         void* min_value_msat_ptr = untag_ptr(min_value_msat);
48667         CHECK_ACCESS(min_value_msat_ptr);
48668         LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
48669         min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(min_value_msat));
48670         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
48671         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
48672         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
48673         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
48674         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ), "LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ");
48675         *ret_conv = ChannelManager_create_inbound_payment(&this_arg_conv, min_value_msat_conv, invoice_expiry_delta_secs, min_final_cltv_expiry_delta_conv);
48676         return tag_ptr(ret_conv, true);
48677 }
48678
48679 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) {
48680         LDKChannelManager this_arg_conv;
48681         this_arg_conv.inner = untag_ptr(this_arg);
48682         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48683         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48684         this_arg_conv.is_owned = false;
48685         LDKThirtyTwoBytes payment_hash_ref;
48686         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
48687         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
48688         void* min_value_msat_ptr = untag_ptr(min_value_msat);
48689         CHECK_ACCESS(min_value_msat_ptr);
48690         LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
48691         min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(min_value_msat));
48692         void* min_final_cltv_expiry_ptr = untag_ptr(min_final_cltv_expiry);
48693         CHECK_ACCESS(min_final_cltv_expiry_ptr);
48694         LDKCOption_u16Z min_final_cltv_expiry_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_ptr);
48695         min_final_cltv_expiry_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry));
48696         LDKCResult_ThirtyTwoBytesNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesNoneZ), "LDKCResult_ThirtyTwoBytesNoneZ");
48697         *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);
48698         return tag_ptr(ret_conv, true);
48699 }
48700
48701 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) {
48702         LDKChannelManager this_arg_conv;
48703         this_arg_conv.inner = untag_ptr(this_arg);
48704         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48705         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48706         this_arg_conv.is_owned = false;
48707         LDKThirtyTwoBytes payment_hash_ref;
48708         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
48709         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
48710         LDKThirtyTwoBytes payment_secret_ref;
48711         CHECK((*env)->GetArrayLength(env, payment_secret) == 32);
48712         (*env)->GetByteArrayRegion(env, payment_secret, 0, 32, payment_secret_ref.data);
48713         LDKCResult_ThirtyTwoBytesAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesAPIErrorZ), "LDKCResult_ThirtyTwoBytesAPIErrorZ");
48714         *ret_conv = ChannelManager_get_payment_preimage(&this_arg_conv, payment_hash_ref, payment_secret_ref);
48715         return tag_ptr(ret_conv, true);
48716 }
48717
48718 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1get_1phantom_1scid(JNIEnv *env, jclass clz, int64_t this_arg) {
48719         LDKChannelManager this_arg_conv;
48720         this_arg_conv.inner = untag_ptr(this_arg);
48721         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48722         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48723         this_arg_conv.is_owned = false;
48724         int64_t ret_conv = ChannelManager_get_phantom_scid(&this_arg_conv);
48725         return ret_conv;
48726 }
48727
48728 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1get_1phantom_1route_1hints(JNIEnv *env, jclass clz, int64_t this_arg) {
48729         LDKChannelManager this_arg_conv;
48730         this_arg_conv.inner = untag_ptr(this_arg);
48731         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48732         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48733         this_arg_conv.is_owned = false;
48734         LDKPhantomRouteHints ret_var = ChannelManager_get_phantom_route_hints(&this_arg_conv);
48735         int64_t ret_ref = 0;
48736         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48737         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48738         return ret_ref;
48739 }
48740
48741 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1get_1intercept_1scid(JNIEnv *env, jclass clz, int64_t this_arg) {
48742         LDKChannelManager this_arg_conv;
48743         this_arg_conv.inner = untag_ptr(this_arg);
48744         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48745         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48746         this_arg_conv.is_owned = false;
48747         int64_t ret_conv = ChannelManager_get_intercept_scid(&this_arg_conv);
48748         return ret_conv;
48749 }
48750
48751 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1compute_1inflight_1htlcs(JNIEnv *env, jclass clz, int64_t this_arg) {
48752         LDKChannelManager this_arg_conv;
48753         this_arg_conv.inner = untag_ptr(this_arg);
48754         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48755         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48756         this_arg_conv.is_owned = false;
48757         LDKInFlightHtlcs ret_var = ChannelManager_compute_inflight_htlcs(&this_arg_conv);
48758         int64_t ret_ref = 0;
48759         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48760         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48761         return ret_ref;
48762 }
48763
48764 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
48765         LDKChannelManager this_arg_conv;
48766         this_arg_conv.inner = untag_ptr(this_arg);
48767         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48768         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48769         this_arg_conv.is_owned = false;
48770         LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
48771         *ret_ret = ChannelManager_as_MessageSendEventsProvider(&this_arg_conv);
48772         return tag_ptr(ret_ret, true);
48773 }
48774
48775 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1EventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
48776         LDKChannelManager this_arg_conv;
48777         this_arg_conv.inner = untag_ptr(this_arg);
48778         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48779         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48780         this_arg_conv.is_owned = false;
48781         LDKEventsProvider* ret_ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
48782         *ret_ret = ChannelManager_as_EventsProvider(&this_arg_conv);
48783         return tag_ptr(ret_ret, true);
48784 }
48785
48786 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1Listen(JNIEnv *env, jclass clz, int64_t this_arg) {
48787         LDKChannelManager this_arg_conv;
48788         this_arg_conv.inner = untag_ptr(this_arg);
48789         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48790         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48791         this_arg_conv.is_owned = false;
48792         LDKListen* ret_ret = MALLOC(sizeof(LDKListen), "LDKListen");
48793         *ret_ret = ChannelManager_as_Listen(&this_arg_conv);
48794         return tag_ptr(ret_ret, true);
48795 }
48796
48797 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1Confirm(JNIEnv *env, jclass clz, int64_t this_arg) {
48798         LDKChannelManager this_arg_conv;
48799         this_arg_conv.inner = untag_ptr(this_arg);
48800         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48801         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48802         this_arg_conv.is_owned = false;
48803         LDKConfirm* ret_ret = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
48804         *ret_ret = ChannelManager_as_Confirm(&this_arg_conv);
48805         return tag_ptr(ret_ret, true);
48806 }
48807
48808 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1get_1event_1or_1persistence_1needed_1future(JNIEnv *env, jclass clz, int64_t this_arg) {
48809         LDKChannelManager this_arg_conv;
48810         this_arg_conv.inner = untag_ptr(this_arg);
48811         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48812         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48813         this_arg_conv.is_owned = false;
48814         LDKFuture ret_var = ChannelManager_get_event_or_persistence_needed_future(&this_arg_conv);
48815         int64_t ret_ref = 0;
48816         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48817         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48818         return ret_ref;
48819 }
48820
48821 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelManager_1get_1and_1clear_1needs_1persistence(JNIEnv *env, jclass clz, int64_t this_arg) {
48822         LDKChannelManager this_arg_conv;
48823         this_arg_conv.inner = untag_ptr(this_arg);
48824         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48825         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48826         this_arg_conv.is_owned = false;
48827         jboolean ret_conv = ChannelManager_get_and_clear_needs_persistence(&this_arg_conv);
48828         return ret_conv;
48829 }
48830
48831 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1current_1best_1block(JNIEnv *env, jclass clz, int64_t this_arg) {
48832         LDKChannelManager this_arg_conv;
48833         this_arg_conv.inner = untag_ptr(this_arg);
48834         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48835         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48836         this_arg_conv.is_owned = false;
48837         LDKBestBlock ret_var = ChannelManager_current_best_block(&this_arg_conv);
48838         int64_t ret_ref = 0;
48839         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48840         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48841         return ret_ref;
48842 }
48843
48844 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1node_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
48845         LDKChannelManager this_arg_conv;
48846         this_arg_conv.inner = untag_ptr(this_arg);
48847         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48848         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48849         this_arg_conv.is_owned = false;
48850         LDKNodeFeatures ret_var = ChannelManager_node_features(&this_arg_conv);
48851         int64_t ret_ref = 0;
48852         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48853         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48854         return ret_ref;
48855 }
48856
48857 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1channel_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
48858         LDKChannelManager this_arg_conv;
48859         this_arg_conv.inner = untag_ptr(this_arg);
48860         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48861         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48862         this_arg_conv.is_owned = false;
48863         LDKChannelFeatures ret_var = ChannelManager_channel_features(&this_arg_conv);
48864         int64_t ret_ref = 0;
48865         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48866         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48867         return ret_ref;
48868 }
48869
48870 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1channel_1type_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
48871         LDKChannelManager this_arg_conv;
48872         this_arg_conv.inner = untag_ptr(this_arg);
48873         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48874         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48875         this_arg_conv.is_owned = false;
48876         LDKChannelTypeFeatures ret_var = ChannelManager_channel_type_features(&this_arg_conv);
48877         int64_t ret_ref = 0;
48878         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48879         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48880         return ret_ref;
48881 }
48882
48883 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1init_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
48884         LDKChannelManager this_arg_conv;
48885         this_arg_conv.inner = untag_ptr(this_arg);
48886         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48887         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48888         this_arg_conv.is_owned = false;
48889         LDKInitFeatures ret_var = ChannelManager_init_features(&this_arg_conv);
48890         int64_t ret_ref = 0;
48891         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48892         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48893         return ret_ref;
48894 }
48895
48896 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1ChannelMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
48897         LDKChannelManager this_arg_conv;
48898         this_arg_conv.inner = untag_ptr(this_arg);
48899         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48900         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48901         this_arg_conv.is_owned = false;
48902         LDKChannelMessageHandler* ret_ret = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
48903         *ret_ret = ChannelManager_as_ChannelMessageHandler(&this_arg_conv);
48904         return tag_ptr(ret_ret, true);
48905 }
48906
48907 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1OffersMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
48908         LDKChannelManager this_arg_conv;
48909         this_arg_conv.inner = untag_ptr(this_arg);
48910         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48911         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48912         this_arg_conv.is_owned = false;
48913         LDKOffersMessageHandler* ret_ret = MALLOC(sizeof(LDKOffersMessageHandler), "LDKOffersMessageHandler");
48914         *ret_ret = ChannelManager_as_OffersMessageHandler(&this_arg_conv);
48915         return tag_ptr(ret_ret, true);
48916 }
48917
48918 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1NodeIdLookUp(JNIEnv *env, jclass clz, int64_t this_arg) {
48919         LDKChannelManager this_arg_conv;
48920         this_arg_conv.inner = untag_ptr(this_arg);
48921         this_arg_conv.is_owned = ptr_is_owned(this_arg);
48922         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
48923         this_arg_conv.is_owned = false;
48924         LDKNodeIdLookUp* ret_ret = MALLOC(sizeof(LDKNodeIdLookUp), "LDKNodeIdLookUp");
48925         *ret_ret = ChannelManager_as_NodeIdLookUp(&this_arg_conv);
48926         return tag_ptr(ret_ret, true);
48927 }
48928
48929 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_provided_1init_1features(JNIEnv *env, jclass clz, int64_t config) {
48930         LDKUserConfig config_conv;
48931         config_conv.inner = untag_ptr(config);
48932         config_conv.is_owned = ptr_is_owned(config);
48933         CHECK_INNER_FIELD_ACCESS_OR_NULL(config_conv);
48934         config_conv.is_owned = false;
48935         LDKInitFeatures ret_var = provided_init_features(&config_conv);
48936         int64_t ret_ref = 0;
48937         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
48938         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
48939         return ret_ref;
48940 }
48941
48942 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1write(JNIEnv *env, jclass clz, int64_t obj) {
48943         LDKCounterpartyForwardingInfo obj_conv;
48944         obj_conv.inner = untag_ptr(obj);
48945         obj_conv.is_owned = ptr_is_owned(obj);
48946         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
48947         obj_conv.is_owned = false;
48948         LDKCVec_u8Z ret_var = CounterpartyForwardingInfo_write(&obj_conv);
48949         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
48950         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
48951         CVec_u8Z_free(ret_var);
48952         return ret_arr;
48953 }
48954
48955 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
48956         LDKu8slice ser_ref;
48957         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
48958         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
48959         LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ), "LDKCResult_CounterpartyForwardingInfoDecodeErrorZ");
48960         *ret_conv = CounterpartyForwardingInfo_read(ser_ref);
48961         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
48962         return tag_ptr(ret_conv, true);
48963 }
48964
48965 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1write(JNIEnv *env, jclass clz, int64_t obj) {
48966         LDKChannelCounterparty obj_conv;
48967         obj_conv.inner = untag_ptr(obj);
48968         obj_conv.is_owned = ptr_is_owned(obj);
48969         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
48970         obj_conv.is_owned = false;
48971         LDKCVec_u8Z ret_var = ChannelCounterparty_write(&obj_conv);
48972         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
48973         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
48974         CVec_u8Z_free(ret_var);
48975         return ret_arr;
48976 }
48977
48978 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
48979         LDKu8slice ser_ref;
48980         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
48981         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
48982         LDKCResult_ChannelCounterpartyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ), "LDKCResult_ChannelCounterpartyDecodeErrorZ");
48983         *ret_conv = ChannelCounterparty_read(ser_ref);
48984         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
48985         return tag_ptr(ret_conv, true);
48986 }
48987
48988 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1write(JNIEnv *env, jclass clz, int64_t obj) {
48989         LDKChannelDetails obj_conv;
48990         obj_conv.inner = untag_ptr(obj);
48991         obj_conv.is_owned = ptr_is_owned(obj);
48992         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
48993         obj_conv.is_owned = false;
48994         LDKCVec_u8Z ret_var = ChannelDetails_write(&obj_conv);
48995         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
48996         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
48997         CVec_u8Z_free(ret_var);
48998         return ret_arr;
48999 }
49000
49001 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
49002         LDKu8slice ser_ref;
49003         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
49004         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
49005         LDKCResult_ChannelDetailsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDetailsDecodeErrorZ), "LDKCResult_ChannelDetailsDecodeErrorZ");
49006         *ret_conv = ChannelDetails_read(ser_ref);
49007         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
49008         return tag_ptr(ret_conv, true);
49009 }
49010
49011 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1write(JNIEnv *env, jclass clz, int64_t obj) {
49012         LDKPhantomRouteHints obj_conv;
49013         obj_conv.inner = untag_ptr(obj);
49014         obj_conv.is_owned = ptr_is_owned(obj);
49015         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
49016         obj_conv.is_owned = false;
49017         LDKCVec_u8Z ret_var = PhantomRouteHints_write(&obj_conv);
49018         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
49019         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
49020         CVec_u8Z_free(ret_var);
49021         return ret_arr;
49022 }
49023
49024 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PhantomRouteHints_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
49025         LDKu8slice ser_ref;
49026         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
49027         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
49028         LDKCResult_PhantomRouteHintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ), "LDKCResult_PhantomRouteHintsDecodeErrorZ");
49029         *ret_conv = PhantomRouteHints_read(ser_ref);
49030         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
49031         return tag_ptr(ret_conv, true);
49032 }
49033
49034 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BlindedForward_1write(JNIEnv *env, jclass clz, int64_t obj) {
49035         LDKBlindedForward obj_conv;
49036         obj_conv.inner = untag_ptr(obj);
49037         obj_conv.is_owned = ptr_is_owned(obj);
49038         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
49039         obj_conv.is_owned = false;
49040         LDKCVec_u8Z ret_var = BlindedForward_write(&obj_conv);
49041         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
49042         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
49043         CVec_u8Z_free(ret_var);
49044         return ret_arr;
49045 }
49046
49047 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedForward_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
49048         LDKu8slice ser_ref;
49049         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
49050         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
49051         LDKCResult_BlindedForwardDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedForwardDecodeErrorZ), "LDKCResult_BlindedForwardDecodeErrorZ");
49052         *ret_conv = BlindedForward_read(ser_ref);
49053         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
49054         return tag_ptr(ret_conv, true);
49055 }
49056
49057 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_PendingHTLCRouting_1write(JNIEnv *env, jclass clz, int64_t obj) {
49058         LDKPendingHTLCRouting* obj_conv = (LDKPendingHTLCRouting*)untag_ptr(obj);
49059         LDKCVec_u8Z ret_var = PendingHTLCRouting_write(obj_conv);
49060         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
49061         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
49062         CVec_u8Z_free(ret_var);
49063         return ret_arr;
49064 }
49065
49066 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PendingHTLCRouting_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
49067         LDKu8slice ser_ref;
49068         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
49069         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
49070         LDKCResult_PendingHTLCRoutingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PendingHTLCRoutingDecodeErrorZ), "LDKCResult_PendingHTLCRoutingDecodeErrorZ");
49071         *ret_conv = PendingHTLCRouting_read(ser_ref);
49072         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
49073         return tag_ptr(ret_conv, true);
49074 }
49075
49076 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_PendingHTLCInfo_1write(JNIEnv *env, jclass clz, int64_t obj) {
49077         LDKPendingHTLCInfo obj_conv;
49078         obj_conv.inner = untag_ptr(obj);
49079         obj_conv.is_owned = ptr_is_owned(obj);
49080         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
49081         obj_conv.is_owned = false;
49082         LDKCVec_u8Z ret_var = PendingHTLCInfo_write(&obj_conv);
49083         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
49084         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
49085         CVec_u8Z_free(ret_var);
49086         return ret_arr;
49087 }
49088
49089 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PendingHTLCInfo_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
49090         LDKu8slice ser_ref;
49091         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
49092         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
49093         LDKCResult_PendingHTLCInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PendingHTLCInfoDecodeErrorZ), "LDKCResult_PendingHTLCInfoDecodeErrorZ");
49094         *ret_conv = PendingHTLCInfo_read(ser_ref);
49095         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
49096         return tag_ptr(ret_conv, true);
49097 }
49098
49099 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BlindedFailure_1write(JNIEnv *env, jclass clz, int64_t obj) {
49100         LDKBlindedFailure* obj_conv = (LDKBlindedFailure*)untag_ptr(obj);
49101         LDKCVec_u8Z ret_var = BlindedFailure_write(obj_conv);
49102         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
49103         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
49104         CVec_u8Z_free(ret_var);
49105         return ret_arr;
49106 }
49107
49108 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedFailure_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
49109         LDKu8slice ser_ref;
49110         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
49111         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
49112         LDKCResult_BlindedFailureDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedFailureDecodeErrorZ), "LDKCResult_BlindedFailureDecodeErrorZ");
49113         *ret_conv = BlindedFailure_read(ser_ref);
49114         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
49115         return tag_ptr(ret_conv, true);
49116 }
49117
49118 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1write(JNIEnv *env, jclass clz, int64_t obj) {
49119         LDKChannelManager obj_conv;
49120         obj_conv.inner = untag_ptr(obj);
49121         obj_conv.is_owned = ptr_is_owned(obj);
49122         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
49123         obj_conv.is_owned = false;
49124         LDKCVec_u8Z ret_var = ChannelManager_write(&obj_conv);
49125         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
49126         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
49127         CVec_u8Z_free(ret_var);
49128         return ret_arr;
49129 }
49130
49131 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelShutdownState_1write(JNIEnv *env, jclass clz, int64_t obj) {
49132         LDKChannelShutdownState* obj_conv = (LDKChannelShutdownState*)untag_ptr(obj);
49133         LDKCVec_u8Z ret_var = ChannelShutdownState_write(obj_conv);
49134         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
49135         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
49136         CVec_u8Z_free(ret_var);
49137         return ret_arr;
49138 }
49139
49140 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelShutdownState_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
49141         LDKu8slice ser_ref;
49142         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
49143         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
49144         LDKCResult_ChannelShutdownStateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelShutdownStateDecodeErrorZ), "LDKCResult_ChannelShutdownStateDecodeErrorZ");
49145         *ret_conv = ChannelShutdownState_read(ser_ref);
49146         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
49147         return tag_ptr(ret_conv, true);
49148 }
49149
49150 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
49151         LDKChannelManagerReadArgs this_obj_conv;
49152         this_obj_conv.inner = untag_ptr(this_obj);
49153         this_obj_conv.is_owned = ptr_is_owned(this_obj);
49154         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
49155         ChannelManagerReadArgs_free(this_obj_conv);
49156 }
49157
49158 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1entropy_1source(JNIEnv *env, jclass clz, int64_t this_ptr) {
49159         LDKChannelManagerReadArgs this_ptr_conv;
49160         this_ptr_conv.inner = untag_ptr(this_ptr);
49161         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49162         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49163         this_ptr_conv.is_owned = false;
49164         // WARNING: This object doesn't live past this scope, needs clone!
49165         int64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_entropy_source(&this_ptr_conv), false);
49166         return ret_ret;
49167 }
49168
49169 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1entropy_1source(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
49170         LDKChannelManagerReadArgs this_ptr_conv;
49171         this_ptr_conv.inner = untag_ptr(this_ptr);
49172         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49173         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49174         this_ptr_conv.is_owned = false;
49175         void* val_ptr = untag_ptr(val);
49176         CHECK_ACCESS(val_ptr);
49177         LDKEntropySource val_conv = *(LDKEntropySource*)(val_ptr);
49178         if (val_conv.free == LDKEntropySource_JCalls_free) {
49179                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
49180                 LDKEntropySource_JCalls_cloned(&val_conv);
49181         }
49182         ChannelManagerReadArgs_set_entropy_source(&this_ptr_conv, val_conv);
49183 }
49184
49185 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1node_1signer(JNIEnv *env, jclass clz, int64_t this_ptr) {
49186         LDKChannelManagerReadArgs this_ptr_conv;
49187         this_ptr_conv.inner = untag_ptr(this_ptr);
49188         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49189         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49190         this_ptr_conv.is_owned = false;
49191         // WARNING: This object doesn't live past this scope, needs clone!
49192         int64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_node_signer(&this_ptr_conv), false);
49193         return ret_ret;
49194 }
49195
49196 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1node_1signer(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
49197         LDKChannelManagerReadArgs this_ptr_conv;
49198         this_ptr_conv.inner = untag_ptr(this_ptr);
49199         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49200         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49201         this_ptr_conv.is_owned = false;
49202         void* val_ptr = untag_ptr(val);
49203         CHECK_ACCESS(val_ptr);
49204         LDKNodeSigner val_conv = *(LDKNodeSigner*)(val_ptr);
49205         if (val_conv.free == LDKNodeSigner_JCalls_free) {
49206                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
49207                 LDKNodeSigner_JCalls_cloned(&val_conv);
49208         }
49209         ChannelManagerReadArgs_set_node_signer(&this_ptr_conv, val_conv);
49210 }
49211
49212 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1signer_1provider(JNIEnv *env, jclass clz, int64_t this_ptr) {
49213         LDKChannelManagerReadArgs this_ptr_conv;
49214         this_ptr_conv.inner = untag_ptr(this_ptr);
49215         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49216         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49217         this_ptr_conv.is_owned = false;
49218         // WARNING: This object doesn't live past this scope, needs clone!
49219         int64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_signer_provider(&this_ptr_conv), false);
49220         return ret_ret;
49221 }
49222
49223 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1signer_1provider(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
49224         LDKChannelManagerReadArgs this_ptr_conv;
49225         this_ptr_conv.inner = untag_ptr(this_ptr);
49226         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49227         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49228         this_ptr_conv.is_owned = false;
49229         void* val_ptr = untag_ptr(val);
49230         CHECK_ACCESS(val_ptr);
49231         LDKSignerProvider val_conv = *(LDKSignerProvider*)(val_ptr);
49232         if (val_conv.free == LDKSignerProvider_JCalls_free) {
49233                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
49234                 LDKSignerProvider_JCalls_cloned(&val_conv);
49235         }
49236         ChannelManagerReadArgs_set_signer_provider(&this_ptr_conv, val_conv);
49237 }
49238
49239 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1fee_1estimator(JNIEnv *env, jclass clz, int64_t this_ptr) {
49240         LDKChannelManagerReadArgs this_ptr_conv;
49241         this_ptr_conv.inner = untag_ptr(this_ptr);
49242         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49243         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49244         this_ptr_conv.is_owned = false;
49245         // WARNING: This object doesn't live past this scope, needs clone!
49246         int64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_fee_estimator(&this_ptr_conv), false);
49247         return ret_ret;
49248 }
49249
49250 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1fee_1estimator(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
49251         LDKChannelManagerReadArgs this_ptr_conv;
49252         this_ptr_conv.inner = untag_ptr(this_ptr);
49253         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49254         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49255         this_ptr_conv.is_owned = false;
49256         void* val_ptr = untag_ptr(val);
49257         CHECK_ACCESS(val_ptr);
49258         LDKFeeEstimator val_conv = *(LDKFeeEstimator*)(val_ptr);
49259         if (val_conv.free == LDKFeeEstimator_JCalls_free) {
49260                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
49261                 LDKFeeEstimator_JCalls_cloned(&val_conv);
49262         }
49263         ChannelManagerReadArgs_set_fee_estimator(&this_ptr_conv, val_conv);
49264 }
49265
49266 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1chain_1monitor(JNIEnv *env, jclass clz, int64_t this_ptr) {
49267         LDKChannelManagerReadArgs this_ptr_conv;
49268         this_ptr_conv.inner = untag_ptr(this_ptr);
49269         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49270         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49271         this_ptr_conv.is_owned = false;
49272         // WARNING: This object doesn't live past this scope, needs clone!
49273         int64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_chain_monitor(&this_ptr_conv), false);
49274         return ret_ret;
49275 }
49276
49277 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1chain_1monitor(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
49278         LDKChannelManagerReadArgs this_ptr_conv;
49279         this_ptr_conv.inner = untag_ptr(this_ptr);
49280         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49281         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49282         this_ptr_conv.is_owned = false;
49283         void* val_ptr = untag_ptr(val);
49284         CHECK_ACCESS(val_ptr);
49285         LDKWatch val_conv = *(LDKWatch*)(val_ptr);
49286         if (val_conv.free == LDKWatch_JCalls_free) {
49287                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
49288                 LDKWatch_JCalls_cloned(&val_conv);
49289         }
49290         ChannelManagerReadArgs_set_chain_monitor(&this_ptr_conv, val_conv);
49291 }
49292
49293 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1tx_1broadcaster(JNIEnv *env, jclass clz, int64_t this_ptr) {
49294         LDKChannelManagerReadArgs this_ptr_conv;
49295         this_ptr_conv.inner = untag_ptr(this_ptr);
49296         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49297         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49298         this_ptr_conv.is_owned = false;
49299         // WARNING: This object doesn't live past this scope, needs clone!
49300         int64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_tx_broadcaster(&this_ptr_conv), false);
49301         return ret_ret;
49302 }
49303
49304 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1tx_1broadcaster(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
49305         LDKChannelManagerReadArgs this_ptr_conv;
49306         this_ptr_conv.inner = untag_ptr(this_ptr);
49307         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49308         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49309         this_ptr_conv.is_owned = false;
49310         void* val_ptr = untag_ptr(val);
49311         CHECK_ACCESS(val_ptr);
49312         LDKBroadcasterInterface val_conv = *(LDKBroadcasterInterface*)(val_ptr);
49313         if (val_conv.free == LDKBroadcasterInterface_JCalls_free) {
49314                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
49315                 LDKBroadcasterInterface_JCalls_cloned(&val_conv);
49316         }
49317         ChannelManagerReadArgs_set_tx_broadcaster(&this_ptr_conv, val_conv);
49318 }
49319
49320 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1router(JNIEnv *env, jclass clz, int64_t this_ptr) {
49321         LDKChannelManagerReadArgs this_ptr_conv;
49322         this_ptr_conv.inner = untag_ptr(this_ptr);
49323         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49324         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49325         this_ptr_conv.is_owned = false;
49326         // WARNING: This object doesn't live past this scope, needs clone!
49327         int64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_router(&this_ptr_conv), false);
49328         return ret_ret;
49329 }
49330
49331 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1router(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
49332         LDKChannelManagerReadArgs this_ptr_conv;
49333         this_ptr_conv.inner = untag_ptr(this_ptr);
49334         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49335         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49336         this_ptr_conv.is_owned = false;
49337         void* val_ptr = untag_ptr(val);
49338         CHECK_ACCESS(val_ptr);
49339         LDKRouter val_conv = *(LDKRouter*)(val_ptr);
49340         if (val_conv.free == LDKRouter_JCalls_free) {
49341                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
49342                 LDKRouter_JCalls_cloned(&val_conv);
49343         }
49344         ChannelManagerReadArgs_set_router(&this_ptr_conv, val_conv);
49345 }
49346
49347 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1logger(JNIEnv *env, jclass clz, int64_t this_ptr) {
49348         LDKChannelManagerReadArgs this_ptr_conv;
49349         this_ptr_conv.inner = untag_ptr(this_ptr);
49350         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49351         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49352         this_ptr_conv.is_owned = false;
49353         // WARNING: This object doesn't live past this scope, needs clone!
49354         int64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_logger(&this_ptr_conv), false);
49355         return ret_ret;
49356 }
49357
49358 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1logger(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
49359         LDKChannelManagerReadArgs this_ptr_conv;
49360         this_ptr_conv.inner = untag_ptr(this_ptr);
49361         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49362         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49363         this_ptr_conv.is_owned = false;
49364         void* val_ptr = untag_ptr(val);
49365         CHECK_ACCESS(val_ptr);
49366         LDKLogger val_conv = *(LDKLogger*)(val_ptr);
49367         if (val_conv.free == LDKLogger_JCalls_free) {
49368                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
49369                 LDKLogger_JCalls_cloned(&val_conv);
49370         }
49371         ChannelManagerReadArgs_set_logger(&this_ptr_conv, val_conv);
49372 }
49373
49374 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1default_1config(JNIEnv *env, jclass clz, int64_t this_ptr) {
49375         LDKChannelManagerReadArgs this_ptr_conv;
49376         this_ptr_conv.inner = untag_ptr(this_ptr);
49377         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49378         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49379         this_ptr_conv.is_owned = false;
49380         LDKUserConfig ret_var = ChannelManagerReadArgs_get_default_config(&this_ptr_conv);
49381         int64_t ret_ref = 0;
49382         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49383         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49384         return ret_ref;
49385 }
49386
49387 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1default_1config(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
49388         LDKChannelManagerReadArgs this_ptr_conv;
49389         this_ptr_conv.inner = untag_ptr(this_ptr);
49390         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49391         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49392         this_ptr_conv.is_owned = false;
49393         LDKUserConfig val_conv;
49394         val_conv.inner = untag_ptr(val);
49395         val_conv.is_owned = ptr_is_owned(val);
49396         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
49397         val_conv = UserConfig_clone(&val_conv);
49398         ChannelManagerReadArgs_set_default_config(&this_ptr_conv, val_conv);
49399 }
49400
49401 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) {
49402         void* entropy_source_ptr = untag_ptr(entropy_source);
49403         CHECK_ACCESS(entropy_source_ptr);
49404         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
49405         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
49406                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
49407                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
49408         }
49409         void* node_signer_ptr = untag_ptr(node_signer);
49410         CHECK_ACCESS(node_signer_ptr);
49411         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
49412         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
49413                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
49414                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
49415         }
49416         void* signer_provider_ptr = untag_ptr(signer_provider);
49417         CHECK_ACCESS(signer_provider_ptr);
49418         LDKSignerProvider signer_provider_conv = *(LDKSignerProvider*)(signer_provider_ptr);
49419         if (signer_provider_conv.free == LDKSignerProvider_JCalls_free) {
49420                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
49421                 LDKSignerProvider_JCalls_cloned(&signer_provider_conv);
49422         }
49423         void* fee_estimator_ptr = untag_ptr(fee_estimator);
49424         CHECK_ACCESS(fee_estimator_ptr);
49425         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
49426         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
49427                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
49428                 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
49429         }
49430         void* chain_monitor_ptr = untag_ptr(chain_monitor);
49431         CHECK_ACCESS(chain_monitor_ptr);
49432         LDKWatch chain_monitor_conv = *(LDKWatch*)(chain_monitor_ptr);
49433         if (chain_monitor_conv.free == LDKWatch_JCalls_free) {
49434                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
49435                 LDKWatch_JCalls_cloned(&chain_monitor_conv);
49436         }
49437         void* tx_broadcaster_ptr = untag_ptr(tx_broadcaster);
49438         CHECK_ACCESS(tx_broadcaster_ptr);
49439         LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)(tx_broadcaster_ptr);
49440         if (tx_broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
49441                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
49442                 LDKBroadcasterInterface_JCalls_cloned(&tx_broadcaster_conv);
49443         }
49444         void* router_ptr = untag_ptr(router);
49445         CHECK_ACCESS(router_ptr);
49446         LDKRouter router_conv = *(LDKRouter*)(router_ptr);
49447         if (router_conv.free == LDKRouter_JCalls_free) {
49448                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
49449                 LDKRouter_JCalls_cloned(&router_conv);
49450         }
49451         void* logger_ptr = untag_ptr(logger);
49452         CHECK_ACCESS(logger_ptr);
49453         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
49454         if (logger_conv.free == LDKLogger_JCalls_free) {
49455                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
49456                 LDKLogger_JCalls_cloned(&logger_conv);
49457         }
49458         LDKUserConfig default_config_conv;
49459         default_config_conv.inner = untag_ptr(default_config);
49460         default_config_conv.is_owned = ptr_is_owned(default_config);
49461         CHECK_INNER_FIELD_ACCESS_OR_NULL(default_config_conv);
49462         default_config_conv = UserConfig_clone(&default_config_conv);
49463         LDKCVec_ChannelMonitorZ channel_monitors_constr;
49464         channel_monitors_constr.datalen = (*env)->GetArrayLength(env, channel_monitors);
49465         if (channel_monitors_constr.datalen > 0)
49466                 channel_monitors_constr.data = MALLOC(channel_monitors_constr.datalen * sizeof(LDKChannelMonitor), "LDKCVec_ChannelMonitorZ Elements");
49467         else
49468                 channel_monitors_constr.data = NULL;
49469         int64_t* channel_monitors_vals = (*env)->GetLongArrayElements (env, channel_monitors, NULL);
49470         for (size_t q = 0; q < channel_monitors_constr.datalen; q++) {
49471                 int64_t channel_monitors_conv_16 = channel_monitors_vals[q];
49472                 LDKChannelMonitor channel_monitors_conv_16_conv;
49473                 channel_monitors_conv_16_conv.inner = untag_ptr(channel_monitors_conv_16);
49474                 channel_monitors_conv_16_conv.is_owned = ptr_is_owned(channel_monitors_conv_16);
49475                 CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_monitors_conv_16_conv);
49476                 channel_monitors_conv_16_conv.is_owned = false;
49477                 channel_monitors_constr.data[q] = channel_monitors_conv_16_conv;
49478         }
49479         (*env)->ReleaseLongArrayElements(env, channel_monitors, channel_monitors_vals, 0);
49480         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);
49481         int64_t ret_ref = 0;
49482         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49483         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49484         return ret_ref;
49485 }
49486
49487 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesChannelManagerZ_1read(JNIEnv *env, jclass clz, int8_tArray ser, int64_t arg) {
49488         LDKu8slice ser_ref;
49489         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
49490         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
49491         LDKChannelManagerReadArgs arg_conv;
49492         arg_conv.inner = untag_ptr(arg);
49493         arg_conv.is_owned = ptr_is_owned(arg);
49494         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
49495         // WARNING: we need a move here but no clone is available for LDKChannelManagerReadArgs
49496         
49497         LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ");
49498         *ret_conv = C2Tuple_ThirtyTwoBytesChannelManagerZ_read(ser_ref, arg_conv);
49499         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
49500         return tag_ptr(ret_conv, true);
49501 }
49502
49503 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentBasepoint_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
49504         LDKDelayedPaymentBasepoint this_obj_conv;
49505         this_obj_conv.inner = untag_ptr(this_obj);
49506         this_obj_conv.is_owned = ptr_is_owned(this_obj);
49507         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
49508         DelayedPaymentBasepoint_free(this_obj_conv);
49509 }
49510
49511 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DelayedPaymentBasepoint_1get_1a(JNIEnv *env, jclass clz, int64_t this_ptr) {
49512         LDKDelayedPaymentBasepoint this_ptr_conv;
49513         this_ptr_conv.inner = untag_ptr(this_ptr);
49514         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49515         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49516         this_ptr_conv.is_owned = false;
49517         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
49518         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, DelayedPaymentBasepoint_get_a(&this_ptr_conv).compressed_form);
49519         return ret_arr;
49520 }
49521
49522 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentBasepoint_1set_1a(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
49523         LDKDelayedPaymentBasepoint this_ptr_conv;
49524         this_ptr_conv.inner = untag_ptr(this_ptr);
49525         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49526         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49527         this_ptr_conv.is_owned = false;
49528         LDKPublicKey val_ref;
49529         CHECK((*env)->GetArrayLength(env, val) == 33);
49530         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
49531         DelayedPaymentBasepoint_set_a(&this_ptr_conv, val_ref);
49532 }
49533
49534 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentBasepoint_1new(JNIEnv *env, jclass clz, int8_tArray a_arg) {
49535         LDKPublicKey a_arg_ref;
49536         CHECK((*env)->GetArrayLength(env, a_arg) == 33);
49537         (*env)->GetByteArrayRegion(env, a_arg, 0, 33, a_arg_ref.compressed_form);
49538         LDKDelayedPaymentBasepoint ret_var = DelayedPaymentBasepoint_new(a_arg_ref);
49539         int64_t ret_ref = 0;
49540         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49541         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49542         return ret_ref;
49543 }
49544
49545 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_DelayedPaymentBasepoint_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
49546         LDKDelayedPaymentBasepoint a_conv;
49547         a_conv.inner = untag_ptr(a);
49548         a_conv.is_owned = ptr_is_owned(a);
49549         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
49550         a_conv.is_owned = false;
49551         LDKDelayedPaymentBasepoint b_conv;
49552         b_conv.inner = untag_ptr(b);
49553         b_conv.is_owned = ptr_is_owned(b);
49554         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
49555         b_conv.is_owned = false;
49556         jboolean ret_conv = DelayedPaymentBasepoint_eq(&a_conv, &b_conv);
49557         return ret_conv;
49558 }
49559
49560 static inline uint64_t DelayedPaymentBasepoint_clone_ptr(LDKDelayedPaymentBasepoint *NONNULL_PTR arg) {
49561         LDKDelayedPaymentBasepoint ret_var = DelayedPaymentBasepoint_clone(arg);
49562         int64_t ret_ref = 0;
49563         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49564         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49565         return ret_ref;
49566 }
49567 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentBasepoint_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
49568         LDKDelayedPaymentBasepoint arg_conv;
49569         arg_conv.inner = untag_ptr(arg);
49570         arg_conv.is_owned = ptr_is_owned(arg);
49571         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
49572         arg_conv.is_owned = false;
49573         int64_t ret_conv = DelayedPaymentBasepoint_clone_ptr(&arg_conv);
49574         return ret_conv;
49575 }
49576
49577 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentBasepoint_1clone(JNIEnv *env, jclass clz, int64_t orig) {
49578         LDKDelayedPaymentBasepoint orig_conv;
49579         orig_conv.inner = untag_ptr(orig);
49580         orig_conv.is_owned = ptr_is_owned(orig);
49581         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
49582         orig_conv.is_owned = false;
49583         LDKDelayedPaymentBasepoint ret_var = DelayedPaymentBasepoint_clone(&orig_conv);
49584         int64_t ret_ref = 0;
49585         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49586         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49587         return ret_ref;
49588 }
49589
49590 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentBasepoint_1hash(JNIEnv *env, jclass clz, int64_t o) {
49591         LDKDelayedPaymentBasepoint o_conv;
49592         o_conv.inner = untag_ptr(o);
49593         o_conv.is_owned = ptr_is_owned(o);
49594         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
49595         o_conv.is_owned = false;
49596         int64_t ret_conv = DelayedPaymentBasepoint_hash(&o_conv);
49597         return ret_conv;
49598 }
49599
49600 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DelayedPaymentBasepoint_1to_1public_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
49601         LDKDelayedPaymentBasepoint this_arg_conv;
49602         this_arg_conv.inner = untag_ptr(this_arg);
49603         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49604         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49605         this_arg_conv.is_owned = false;
49606         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
49607         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, DelayedPaymentBasepoint_to_public_key(&this_arg_conv).compressed_form);
49608         return ret_arr;
49609 }
49610
49611 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DelayedPaymentBasepoint_1derive_1add_1tweak(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray per_commitment_point) {
49612         LDKDelayedPaymentBasepoint this_arg_conv;
49613         this_arg_conv.inner = untag_ptr(this_arg);
49614         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49615         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49616         this_arg_conv.is_owned = false;
49617         LDKPublicKey per_commitment_point_ref;
49618         CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
49619         (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
49620         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
49621         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, DelayedPaymentBasepoint_derive_add_tweak(&this_arg_conv, per_commitment_point_ref).data);
49622         return ret_arr;
49623 }
49624
49625 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DelayedPaymentBasepoint_1write(JNIEnv *env, jclass clz, int64_t obj) {
49626         LDKDelayedPaymentBasepoint obj_conv;
49627         obj_conv.inner = untag_ptr(obj);
49628         obj_conv.is_owned = ptr_is_owned(obj);
49629         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
49630         obj_conv.is_owned = false;
49631         LDKCVec_u8Z ret_var = DelayedPaymentBasepoint_write(&obj_conv);
49632         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
49633         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
49634         CVec_u8Z_free(ret_var);
49635         return ret_arr;
49636 }
49637
49638 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentBasepoint_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
49639         LDKu8slice ser_ref;
49640         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
49641         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
49642         LDKCResult_DelayedPaymentBasepointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentBasepointDecodeErrorZ), "LDKCResult_DelayedPaymentBasepointDecodeErrorZ");
49643         *ret_conv = DelayedPaymentBasepoint_read(ser_ref);
49644         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
49645         return tag_ptr(ret_conv, true);
49646 }
49647
49648 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentKey_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
49649         LDKDelayedPaymentKey this_obj_conv;
49650         this_obj_conv.inner = untag_ptr(this_obj);
49651         this_obj_conv.is_owned = ptr_is_owned(this_obj);
49652         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
49653         DelayedPaymentKey_free(this_obj_conv);
49654 }
49655
49656 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DelayedPaymentKey_1get_1a(JNIEnv *env, jclass clz, int64_t this_ptr) {
49657         LDKDelayedPaymentKey this_ptr_conv;
49658         this_ptr_conv.inner = untag_ptr(this_ptr);
49659         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49660         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49661         this_ptr_conv.is_owned = false;
49662         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
49663         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, DelayedPaymentKey_get_a(&this_ptr_conv).compressed_form);
49664         return ret_arr;
49665 }
49666
49667 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentKey_1set_1a(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
49668         LDKDelayedPaymentKey this_ptr_conv;
49669         this_ptr_conv.inner = untag_ptr(this_ptr);
49670         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49671         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49672         this_ptr_conv.is_owned = false;
49673         LDKPublicKey val_ref;
49674         CHECK((*env)->GetArrayLength(env, val) == 33);
49675         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
49676         DelayedPaymentKey_set_a(&this_ptr_conv, val_ref);
49677 }
49678
49679 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentKey_1new(JNIEnv *env, jclass clz, int8_tArray a_arg) {
49680         LDKPublicKey a_arg_ref;
49681         CHECK((*env)->GetArrayLength(env, a_arg) == 33);
49682         (*env)->GetByteArrayRegion(env, a_arg, 0, 33, a_arg_ref.compressed_form);
49683         LDKDelayedPaymentKey ret_var = DelayedPaymentKey_new(a_arg_ref);
49684         int64_t ret_ref = 0;
49685         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49686         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49687         return ret_ref;
49688 }
49689
49690 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_DelayedPaymentKey_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
49691         LDKDelayedPaymentKey a_conv;
49692         a_conv.inner = untag_ptr(a);
49693         a_conv.is_owned = ptr_is_owned(a);
49694         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
49695         a_conv.is_owned = false;
49696         LDKDelayedPaymentKey b_conv;
49697         b_conv.inner = untag_ptr(b);
49698         b_conv.is_owned = ptr_is_owned(b);
49699         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
49700         b_conv.is_owned = false;
49701         jboolean ret_conv = DelayedPaymentKey_eq(&a_conv, &b_conv);
49702         return ret_conv;
49703 }
49704
49705 static inline uint64_t DelayedPaymentKey_clone_ptr(LDKDelayedPaymentKey *NONNULL_PTR arg) {
49706         LDKDelayedPaymentKey ret_var = DelayedPaymentKey_clone(arg);
49707         int64_t ret_ref = 0;
49708         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49709         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49710         return ret_ref;
49711 }
49712 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentKey_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
49713         LDKDelayedPaymentKey arg_conv;
49714         arg_conv.inner = untag_ptr(arg);
49715         arg_conv.is_owned = ptr_is_owned(arg);
49716         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
49717         arg_conv.is_owned = false;
49718         int64_t ret_conv = DelayedPaymentKey_clone_ptr(&arg_conv);
49719         return ret_conv;
49720 }
49721
49722 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentKey_1clone(JNIEnv *env, jclass clz, int64_t orig) {
49723         LDKDelayedPaymentKey orig_conv;
49724         orig_conv.inner = untag_ptr(orig);
49725         orig_conv.is_owned = ptr_is_owned(orig);
49726         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
49727         orig_conv.is_owned = false;
49728         LDKDelayedPaymentKey ret_var = DelayedPaymentKey_clone(&orig_conv);
49729         int64_t ret_ref = 0;
49730         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49731         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49732         return ret_ref;
49733 }
49734
49735 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) {
49736         LDKDelayedPaymentBasepoint countersignatory_basepoint_conv;
49737         countersignatory_basepoint_conv.inner = untag_ptr(countersignatory_basepoint);
49738         countersignatory_basepoint_conv.is_owned = ptr_is_owned(countersignatory_basepoint);
49739         CHECK_INNER_FIELD_ACCESS_OR_NULL(countersignatory_basepoint_conv);
49740         countersignatory_basepoint_conv.is_owned = false;
49741         LDKPublicKey per_commitment_point_ref;
49742         CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
49743         (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
49744         LDKDelayedPaymentKey ret_var = DelayedPaymentKey_from_basepoint(&countersignatory_basepoint_conv, per_commitment_point_ref);
49745         int64_t ret_ref = 0;
49746         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49747         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49748         return ret_ref;
49749 }
49750
49751 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentKey_1from_1secret_1key(JNIEnv *env, jclass clz, int8_tArray sk) {
49752         uint8_t sk_arr[32];
49753         CHECK((*env)->GetArrayLength(env, sk) == 32);
49754         (*env)->GetByteArrayRegion(env, sk, 0, 32, sk_arr);
49755         uint8_t (*sk_ref)[32] = &sk_arr;
49756         LDKDelayedPaymentKey ret_var = DelayedPaymentKey_from_secret_key(sk_ref);
49757         int64_t ret_ref = 0;
49758         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49759         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49760         return ret_ref;
49761 }
49762
49763 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DelayedPaymentKey_1to_1public_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
49764         LDKDelayedPaymentKey this_arg_conv;
49765         this_arg_conv.inner = untag_ptr(this_arg);
49766         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49767         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49768         this_arg_conv.is_owned = false;
49769         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
49770         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, DelayedPaymentKey_to_public_key(&this_arg_conv).compressed_form);
49771         return ret_arr;
49772 }
49773
49774 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DelayedPaymentKey_1write(JNIEnv *env, jclass clz, int64_t obj) {
49775         LDKDelayedPaymentKey obj_conv;
49776         obj_conv.inner = untag_ptr(obj);
49777         obj_conv.is_owned = ptr_is_owned(obj);
49778         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
49779         obj_conv.is_owned = false;
49780         LDKCVec_u8Z ret_var = DelayedPaymentKey_write(&obj_conv);
49781         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
49782         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
49783         CVec_u8Z_free(ret_var);
49784         return ret_arr;
49785 }
49786
49787 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentKey_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
49788         LDKu8slice ser_ref;
49789         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
49790         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
49791         LDKCResult_DelayedPaymentKeyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentKeyDecodeErrorZ), "LDKCResult_DelayedPaymentKeyDecodeErrorZ");
49792         *ret_conv = DelayedPaymentKey_read(ser_ref);
49793         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
49794         return tag_ptr(ret_conv, true);
49795 }
49796
49797 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HtlcBasepoint_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
49798         LDKHtlcBasepoint this_obj_conv;
49799         this_obj_conv.inner = untag_ptr(this_obj);
49800         this_obj_conv.is_owned = ptr_is_owned(this_obj);
49801         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
49802         HtlcBasepoint_free(this_obj_conv);
49803 }
49804
49805 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HtlcBasepoint_1get_1a(JNIEnv *env, jclass clz, int64_t this_ptr) {
49806         LDKHtlcBasepoint this_ptr_conv;
49807         this_ptr_conv.inner = untag_ptr(this_ptr);
49808         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49809         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49810         this_ptr_conv.is_owned = false;
49811         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
49812         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, HtlcBasepoint_get_a(&this_ptr_conv).compressed_form);
49813         return ret_arr;
49814 }
49815
49816 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HtlcBasepoint_1set_1a(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
49817         LDKHtlcBasepoint this_ptr_conv;
49818         this_ptr_conv.inner = untag_ptr(this_ptr);
49819         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49820         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49821         this_ptr_conv.is_owned = false;
49822         LDKPublicKey val_ref;
49823         CHECK((*env)->GetArrayLength(env, val) == 33);
49824         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
49825         HtlcBasepoint_set_a(&this_ptr_conv, val_ref);
49826 }
49827
49828 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HtlcBasepoint_1new(JNIEnv *env, jclass clz, int8_tArray a_arg) {
49829         LDKPublicKey a_arg_ref;
49830         CHECK((*env)->GetArrayLength(env, a_arg) == 33);
49831         (*env)->GetByteArrayRegion(env, a_arg, 0, 33, a_arg_ref.compressed_form);
49832         LDKHtlcBasepoint ret_var = HtlcBasepoint_new(a_arg_ref);
49833         int64_t ret_ref = 0;
49834         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49835         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49836         return ret_ref;
49837 }
49838
49839 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_HtlcBasepoint_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
49840         LDKHtlcBasepoint a_conv;
49841         a_conv.inner = untag_ptr(a);
49842         a_conv.is_owned = ptr_is_owned(a);
49843         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
49844         a_conv.is_owned = false;
49845         LDKHtlcBasepoint b_conv;
49846         b_conv.inner = untag_ptr(b);
49847         b_conv.is_owned = ptr_is_owned(b);
49848         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
49849         b_conv.is_owned = false;
49850         jboolean ret_conv = HtlcBasepoint_eq(&a_conv, &b_conv);
49851         return ret_conv;
49852 }
49853
49854 static inline uint64_t HtlcBasepoint_clone_ptr(LDKHtlcBasepoint *NONNULL_PTR arg) {
49855         LDKHtlcBasepoint ret_var = HtlcBasepoint_clone(arg);
49856         int64_t ret_ref = 0;
49857         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49858         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49859         return ret_ref;
49860 }
49861 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HtlcBasepoint_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
49862         LDKHtlcBasepoint arg_conv;
49863         arg_conv.inner = untag_ptr(arg);
49864         arg_conv.is_owned = ptr_is_owned(arg);
49865         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
49866         arg_conv.is_owned = false;
49867         int64_t ret_conv = HtlcBasepoint_clone_ptr(&arg_conv);
49868         return ret_conv;
49869 }
49870
49871 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HtlcBasepoint_1clone(JNIEnv *env, jclass clz, int64_t orig) {
49872         LDKHtlcBasepoint orig_conv;
49873         orig_conv.inner = untag_ptr(orig);
49874         orig_conv.is_owned = ptr_is_owned(orig);
49875         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
49876         orig_conv.is_owned = false;
49877         LDKHtlcBasepoint ret_var = HtlcBasepoint_clone(&orig_conv);
49878         int64_t ret_ref = 0;
49879         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49880         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49881         return ret_ref;
49882 }
49883
49884 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HtlcBasepoint_1hash(JNIEnv *env, jclass clz, int64_t o) {
49885         LDKHtlcBasepoint o_conv;
49886         o_conv.inner = untag_ptr(o);
49887         o_conv.is_owned = ptr_is_owned(o);
49888         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
49889         o_conv.is_owned = false;
49890         int64_t ret_conv = HtlcBasepoint_hash(&o_conv);
49891         return ret_conv;
49892 }
49893
49894 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HtlcBasepoint_1to_1public_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
49895         LDKHtlcBasepoint this_arg_conv;
49896         this_arg_conv.inner = untag_ptr(this_arg);
49897         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49898         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49899         this_arg_conv.is_owned = false;
49900         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
49901         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, HtlcBasepoint_to_public_key(&this_arg_conv).compressed_form);
49902         return ret_arr;
49903 }
49904
49905 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HtlcBasepoint_1derive_1add_1tweak(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray per_commitment_point) {
49906         LDKHtlcBasepoint this_arg_conv;
49907         this_arg_conv.inner = untag_ptr(this_arg);
49908         this_arg_conv.is_owned = ptr_is_owned(this_arg);
49909         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
49910         this_arg_conv.is_owned = false;
49911         LDKPublicKey per_commitment_point_ref;
49912         CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
49913         (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
49914         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
49915         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, HtlcBasepoint_derive_add_tweak(&this_arg_conv, per_commitment_point_ref).data);
49916         return ret_arr;
49917 }
49918
49919 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HtlcBasepoint_1write(JNIEnv *env, jclass clz, int64_t obj) {
49920         LDKHtlcBasepoint obj_conv;
49921         obj_conv.inner = untag_ptr(obj);
49922         obj_conv.is_owned = ptr_is_owned(obj);
49923         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
49924         obj_conv.is_owned = false;
49925         LDKCVec_u8Z ret_var = HtlcBasepoint_write(&obj_conv);
49926         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
49927         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
49928         CVec_u8Z_free(ret_var);
49929         return ret_arr;
49930 }
49931
49932 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HtlcBasepoint_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
49933         LDKu8slice ser_ref;
49934         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
49935         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
49936         LDKCResult_HtlcBasepointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HtlcBasepointDecodeErrorZ), "LDKCResult_HtlcBasepointDecodeErrorZ");
49937         *ret_conv = HtlcBasepoint_read(ser_ref);
49938         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
49939         return tag_ptr(ret_conv, true);
49940 }
49941
49942 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HtlcKey_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
49943         LDKHtlcKey this_obj_conv;
49944         this_obj_conv.inner = untag_ptr(this_obj);
49945         this_obj_conv.is_owned = ptr_is_owned(this_obj);
49946         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
49947         HtlcKey_free(this_obj_conv);
49948 }
49949
49950 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HtlcKey_1get_1a(JNIEnv *env, jclass clz, int64_t this_ptr) {
49951         LDKHtlcKey this_ptr_conv;
49952         this_ptr_conv.inner = untag_ptr(this_ptr);
49953         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49954         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49955         this_ptr_conv.is_owned = false;
49956         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
49957         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, HtlcKey_get_a(&this_ptr_conv).compressed_form);
49958         return ret_arr;
49959 }
49960
49961 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HtlcKey_1set_1a(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
49962         LDKHtlcKey this_ptr_conv;
49963         this_ptr_conv.inner = untag_ptr(this_ptr);
49964         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
49965         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
49966         this_ptr_conv.is_owned = false;
49967         LDKPublicKey val_ref;
49968         CHECK((*env)->GetArrayLength(env, val) == 33);
49969         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
49970         HtlcKey_set_a(&this_ptr_conv, val_ref);
49971 }
49972
49973 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HtlcKey_1new(JNIEnv *env, jclass clz, int8_tArray a_arg) {
49974         LDKPublicKey a_arg_ref;
49975         CHECK((*env)->GetArrayLength(env, a_arg) == 33);
49976         (*env)->GetByteArrayRegion(env, a_arg, 0, 33, a_arg_ref.compressed_form);
49977         LDKHtlcKey ret_var = HtlcKey_new(a_arg_ref);
49978         int64_t ret_ref = 0;
49979         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
49980         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
49981         return ret_ref;
49982 }
49983
49984 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_HtlcKey_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
49985         LDKHtlcKey a_conv;
49986         a_conv.inner = untag_ptr(a);
49987         a_conv.is_owned = ptr_is_owned(a);
49988         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
49989         a_conv.is_owned = false;
49990         LDKHtlcKey b_conv;
49991         b_conv.inner = untag_ptr(b);
49992         b_conv.is_owned = ptr_is_owned(b);
49993         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
49994         b_conv.is_owned = false;
49995         jboolean ret_conv = HtlcKey_eq(&a_conv, &b_conv);
49996         return ret_conv;
49997 }
49998
49999 static inline uint64_t HtlcKey_clone_ptr(LDKHtlcKey *NONNULL_PTR arg) {
50000         LDKHtlcKey ret_var = HtlcKey_clone(arg);
50001         int64_t ret_ref = 0;
50002         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50003         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50004         return ret_ref;
50005 }
50006 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HtlcKey_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
50007         LDKHtlcKey arg_conv;
50008         arg_conv.inner = untag_ptr(arg);
50009         arg_conv.is_owned = ptr_is_owned(arg);
50010         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
50011         arg_conv.is_owned = false;
50012         int64_t ret_conv = HtlcKey_clone_ptr(&arg_conv);
50013         return ret_conv;
50014 }
50015
50016 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HtlcKey_1clone(JNIEnv *env, jclass clz, int64_t orig) {
50017         LDKHtlcKey orig_conv;
50018         orig_conv.inner = untag_ptr(orig);
50019         orig_conv.is_owned = ptr_is_owned(orig);
50020         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
50021         orig_conv.is_owned = false;
50022         LDKHtlcKey ret_var = HtlcKey_clone(&orig_conv);
50023         int64_t ret_ref = 0;
50024         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50025         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50026         return ret_ref;
50027 }
50028
50029 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) {
50030         LDKHtlcBasepoint countersignatory_basepoint_conv;
50031         countersignatory_basepoint_conv.inner = untag_ptr(countersignatory_basepoint);
50032         countersignatory_basepoint_conv.is_owned = ptr_is_owned(countersignatory_basepoint);
50033         CHECK_INNER_FIELD_ACCESS_OR_NULL(countersignatory_basepoint_conv);
50034         countersignatory_basepoint_conv.is_owned = false;
50035         LDKPublicKey per_commitment_point_ref;
50036         CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
50037         (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
50038         LDKHtlcKey ret_var = HtlcKey_from_basepoint(&countersignatory_basepoint_conv, per_commitment_point_ref);
50039         int64_t ret_ref = 0;
50040         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50041         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50042         return ret_ref;
50043 }
50044
50045 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HtlcKey_1from_1secret_1key(JNIEnv *env, jclass clz, int8_tArray sk) {
50046         uint8_t sk_arr[32];
50047         CHECK((*env)->GetArrayLength(env, sk) == 32);
50048         (*env)->GetByteArrayRegion(env, sk, 0, 32, sk_arr);
50049         uint8_t (*sk_ref)[32] = &sk_arr;
50050         LDKHtlcKey ret_var = HtlcKey_from_secret_key(sk_ref);
50051         int64_t ret_ref = 0;
50052         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50053         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50054         return ret_ref;
50055 }
50056
50057 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HtlcKey_1to_1public_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
50058         LDKHtlcKey this_arg_conv;
50059         this_arg_conv.inner = untag_ptr(this_arg);
50060         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50061         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50062         this_arg_conv.is_owned = false;
50063         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
50064         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, HtlcKey_to_public_key(&this_arg_conv).compressed_form);
50065         return ret_arr;
50066 }
50067
50068 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HtlcKey_1write(JNIEnv *env, jclass clz, int64_t obj) {
50069         LDKHtlcKey obj_conv;
50070         obj_conv.inner = untag_ptr(obj);
50071         obj_conv.is_owned = ptr_is_owned(obj);
50072         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
50073         obj_conv.is_owned = false;
50074         LDKCVec_u8Z ret_var = HtlcKey_write(&obj_conv);
50075         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
50076         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
50077         CVec_u8Z_free(ret_var);
50078         return ret_arr;
50079 }
50080
50081 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HtlcKey_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
50082         LDKu8slice ser_ref;
50083         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
50084         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
50085         LDKCResult_HtlcKeyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HtlcKeyDecodeErrorZ), "LDKCResult_HtlcKeyDecodeErrorZ");
50086         *ret_conv = HtlcKey_read(ser_ref);
50087         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
50088         return tag_ptr(ret_conv, true);
50089 }
50090
50091 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_add_1public_1key_1tweak(JNIEnv *env, jclass clz, int8_tArray base_point, int8_tArray tweak) {
50092         LDKPublicKey base_point_ref;
50093         CHECK((*env)->GetArrayLength(env, base_point) == 33);
50094         (*env)->GetByteArrayRegion(env, base_point, 0, 33, base_point_ref.compressed_form);
50095         uint8_t tweak_arr[32];
50096         CHECK((*env)->GetArrayLength(env, tweak) == 32);
50097         (*env)->GetByteArrayRegion(env, tweak, 0, 32, tweak_arr);
50098         uint8_t (*tweak_ref)[32] = &tweak_arr;
50099         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
50100         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, add_public_key_tweak(base_point_ref, tweak_ref).compressed_form);
50101         return ret_arr;
50102 }
50103
50104 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevocationBasepoint_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
50105         LDKRevocationBasepoint this_obj_conv;
50106         this_obj_conv.inner = untag_ptr(this_obj);
50107         this_obj_conv.is_owned = ptr_is_owned(this_obj);
50108         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
50109         RevocationBasepoint_free(this_obj_conv);
50110 }
50111
50112 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RevocationBasepoint_1get_1a(JNIEnv *env, jclass clz, int64_t this_ptr) {
50113         LDKRevocationBasepoint this_ptr_conv;
50114         this_ptr_conv.inner = untag_ptr(this_ptr);
50115         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50116         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50117         this_ptr_conv.is_owned = false;
50118         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
50119         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, RevocationBasepoint_get_a(&this_ptr_conv).compressed_form);
50120         return ret_arr;
50121 }
50122
50123 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevocationBasepoint_1set_1a(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
50124         LDKRevocationBasepoint this_ptr_conv;
50125         this_ptr_conv.inner = untag_ptr(this_ptr);
50126         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50127         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50128         this_ptr_conv.is_owned = false;
50129         LDKPublicKey val_ref;
50130         CHECK((*env)->GetArrayLength(env, val) == 33);
50131         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
50132         RevocationBasepoint_set_a(&this_ptr_conv, val_ref);
50133 }
50134
50135 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RevocationBasepoint_1new(JNIEnv *env, jclass clz, int8_tArray a_arg) {
50136         LDKPublicKey a_arg_ref;
50137         CHECK((*env)->GetArrayLength(env, a_arg) == 33);
50138         (*env)->GetByteArrayRegion(env, a_arg, 0, 33, a_arg_ref.compressed_form);
50139         LDKRevocationBasepoint ret_var = RevocationBasepoint_new(a_arg_ref);
50140         int64_t ret_ref = 0;
50141         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50142         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50143         return ret_ref;
50144 }
50145
50146 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RevocationBasepoint_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
50147         LDKRevocationBasepoint a_conv;
50148         a_conv.inner = untag_ptr(a);
50149         a_conv.is_owned = ptr_is_owned(a);
50150         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
50151         a_conv.is_owned = false;
50152         LDKRevocationBasepoint b_conv;
50153         b_conv.inner = untag_ptr(b);
50154         b_conv.is_owned = ptr_is_owned(b);
50155         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
50156         b_conv.is_owned = false;
50157         jboolean ret_conv = RevocationBasepoint_eq(&a_conv, &b_conv);
50158         return ret_conv;
50159 }
50160
50161 static inline uint64_t RevocationBasepoint_clone_ptr(LDKRevocationBasepoint *NONNULL_PTR arg) {
50162         LDKRevocationBasepoint ret_var = RevocationBasepoint_clone(arg);
50163         int64_t ret_ref = 0;
50164         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50165         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50166         return ret_ref;
50167 }
50168 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RevocationBasepoint_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
50169         LDKRevocationBasepoint arg_conv;
50170         arg_conv.inner = untag_ptr(arg);
50171         arg_conv.is_owned = ptr_is_owned(arg);
50172         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
50173         arg_conv.is_owned = false;
50174         int64_t ret_conv = RevocationBasepoint_clone_ptr(&arg_conv);
50175         return ret_conv;
50176 }
50177
50178 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RevocationBasepoint_1clone(JNIEnv *env, jclass clz, int64_t orig) {
50179         LDKRevocationBasepoint orig_conv;
50180         orig_conv.inner = untag_ptr(orig);
50181         orig_conv.is_owned = ptr_is_owned(orig);
50182         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
50183         orig_conv.is_owned = false;
50184         LDKRevocationBasepoint ret_var = RevocationBasepoint_clone(&orig_conv);
50185         int64_t ret_ref = 0;
50186         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50187         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50188         return ret_ref;
50189 }
50190
50191 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RevocationBasepoint_1hash(JNIEnv *env, jclass clz, int64_t o) {
50192         LDKRevocationBasepoint o_conv;
50193         o_conv.inner = untag_ptr(o);
50194         o_conv.is_owned = ptr_is_owned(o);
50195         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
50196         o_conv.is_owned = false;
50197         int64_t ret_conv = RevocationBasepoint_hash(&o_conv);
50198         return ret_conv;
50199 }
50200
50201 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RevocationBasepoint_1to_1public_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
50202         LDKRevocationBasepoint this_arg_conv;
50203         this_arg_conv.inner = untag_ptr(this_arg);
50204         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50205         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50206         this_arg_conv.is_owned = false;
50207         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
50208         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, RevocationBasepoint_to_public_key(&this_arg_conv).compressed_form);
50209         return ret_arr;
50210 }
50211
50212 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RevocationBasepoint_1write(JNIEnv *env, jclass clz, int64_t obj) {
50213         LDKRevocationBasepoint obj_conv;
50214         obj_conv.inner = untag_ptr(obj);
50215         obj_conv.is_owned = ptr_is_owned(obj);
50216         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
50217         obj_conv.is_owned = false;
50218         LDKCVec_u8Z ret_var = RevocationBasepoint_write(&obj_conv);
50219         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
50220         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
50221         CVec_u8Z_free(ret_var);
50222         return ret_arr;
50223 }
50224
50225 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RevocationBasepoint_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
50226         LDKu8slice ser_ref;
50227         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
50228         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
50229         LDKCResult_RevocationBasepointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevocationBasepointDecodeErrorZ), "LDKCResult_RevocationBasepointDecodeErrorZ");
50230         *ret_conv = RevocationBasepoint_read(ser_ref);
50231         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
50232         return tag_ptr(ret_conv, true);
50233 }
50234
50235 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevocationKey_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
50236         LDKRevocationKey this_obj_conv;
50237         this_obj_conv.inner = untag_ptr(this_obj);
50238         this_obj_conv.is_owned = ptr_is_owned(this_obj);
50239         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
50240         RevocationKey_free(this_obj_conv);
50241 }
50242
50243 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RevocationKey_1get_1a(JNIEnv *env, jclass clz, int64_t this_ptr) {
50244         LDKRevocationKey this_ptr_conv;
50245         this_ptr_conv.inner = untag_ptr(this_ptr);
50246         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50247         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50248         this_ptr_conv.is_owned = false;
50249         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
50250         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, RevocationKey_get_a(&this_ptr_conv).compressed_form);
50251         return ret_arr;
50252 }
50253
50254 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevocationKey_1set_1a(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
50255         LDKRevocationKey this_ptr_conv;
50256         this_ptr_conv.inner = untag_ptr(this_ptr);
50257         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50258         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50259         this_ptr_conv.is_owned = false;
50260         LDKPublicKey val_ref;
50261         CHECK((*env)->GetArrayLength(env, val) == 33);
50262         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
50263         RevocationKey_set_a(&this_ptr_conv, val_ref);
50264 }
50265
50266 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RevocationKey_1new(JNIEnv *env, jclass clz, int8_tArray a_arg) {
50267         LDKPublicKey a_arg_ref;
50268         CHECK((*env)->GetArrayLength(env, a_arg) == 33);
50269         (*env)->GetByteArrayRegion(env, a_arg, 0, 33, a_arg_ref.compressed_form);
50270         LDKRevocationKey ret_var = RevocationKey_new(a_arg_ref);
50271         int64_t ret_ref = 0;
50272         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50273         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50274         return ret_ref;
50275 }
50276
50277 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RevocationKey_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
50278         LDKRevocationKey a_conv;
50279         a_conv.inner = untag_ptr(a);
50280         a_conv.is_owned = ptr_is_owned(a);
50281         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
50282         a_conv.is_owned = false;
50283         LDKRevocationKey b_conv;
50284         b_conv.inner = untag_ptr(b);
50285         b_conv.is_owned = ptr_is_owned(b);
50286         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
50287         b_conv.is_owned = false;
50288         jboolean ret_conv = RevocationKey_eq(&a_conv, &b_conv);
50289         return ret_conv;
50290 }
50291
50292 static inline uint64_t RevocationKey_clone_ptr(LDKRevocationKey *NONNULL_PTR arg) {
50293         LDKRevocationKey ret_var = RevocationKey_clone(arg);
50294         int64_t ret_ref = 0;
50295         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50296         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50297         return ret_ref;
50298 }
50299 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RevocationKey_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
50300         LDKRevocationKey arg_conv;
50301         arg_conv.inner = untag_ptr(arg);
50302         arg_conv.is_owned = ptr_is_owned(arg);
50303         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
50304         arg_conv.is_owned = false;
50305         int64_t ret_conv = RevocationKey_clone_ptr(&arg_conv);
50306         return ret_conv;
50307 }
50308
50309 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RevocationKey_1clone(JNIEnv *env, jclass clz, int64_t orig) {
50310         LDKRevocationKey orig_conv;
50311         orig_conv.inner = untag_ptr(orig);
50312         orig_conv.is_owned = ptr_is_owned(orig);
50313         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
50314         orig_conv.is_owned = false;
50315         LDKRevocationKey ret_var = RevocationKey_clone(&orig_conv);
50316         int64_t ret_ref = 0;
50317         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50318         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50319         return ret_ref;
50320 }
50321
50322 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RevocationKey_1hash(JNIEnv *env, jclass clz, int64_t o) {
50323         LDKRevocationKey o_conv;
50324         o_conv.inner = untag_ptr(o);
50325         o_conv.is_owned = ptr_is_owned(o);
50326         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
50327         o_conv.is_owned = false;
50328         int64_t ret_conv = RevocationKey_hash(&o_conv);
50329         return ret_conv;
50330 }
50331
50332 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) {
50333         LDKRevocationBasepoint countersignatory_basepoint_conv;
50334         countersignatory_basepoint_conv.inner = untag_ptr(countersignatory_basepoint);
50335         countersignatory_basepoint_conv.is_owned = ptr_is_owned(countersignatory_basepoint);
50336         CHECK_INNER_FIELD_ACCESS_OR_NULL(countersignatory_basepoint_conv);
50337         countersignatory_basepoint_conv.is_owned = false;
50338         LDKPublicKey per_commitment_point_ref;
50339         CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
50340         (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
50341         LDKRevocationKey ret_var = RevocationKey_from_basepoint(&countersignatory_basepoint_conv, per_commitment_point_ref);
50342         int64_t ret_ref = 0;
50343         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50344         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50345         return ret_ref;
50346 }
50347
50348 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RevocationKey_1to_1public_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
50349         LDKRevocationKey this_arg_conv;
50350         this_arg_conv.inner = untag_ptr(this_arg);
50351         this_arg_conv.is_owned = ptr_is_owned(this_arg);
50352         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
50353         this_arg_conv.is_owned = false;
50354         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
50355         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, RevocationKey_to_public_key(&this_arg_conv).compressed_form);
50356         return ret_arr;
50357 }
50358
50359 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RevocationKey_1write(JNIEnv *env, jclass clz, int64_t obj) {
50360         LDKRevocationKey obj_conv;
50361         obj_conv.inner = untag_ptr(obj);
50362         obj_conv.is_owned = ptr_is_owned(obj);
50363         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
50364         obj_conv.is_owned = false;
50365         LDKCVec_u8Z ret_var = RevocationKey_write(&obj_conv);
50366         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
50367         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
50368         CVec_u8Z_free(ret_var);
50369         return ret_arr;
50370 }
50371
50372 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RevocationKey_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
50373         LDKu8slice ser_ref;
50374         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
50375         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
50376         LDKCResult_RevocationKeyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevocationKeyDecodeErrorZ), "LDKCResult_RevocationKeyDecodeErrorZ");
50377         *ret_conv = RevocationKey_read(ser_ref);
50378         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
50379         return tag_ptr(ret_conv, true);
50380 }
50381
50382 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ExpandedKey_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
50383         LDKExpandedKey this_obj_conv;
50384         this_obj_conv.inner = untag_ptr(this_obj);
50385         this_obj_conv.is_owned = ptr_is_owned(this_obj);
50386         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
50387         ExpandedKey_free(this_obj_conv);
50388 }
50389
50390 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpandedKey_1new(JNIEnv *env, jclass clz, int8_tArray key_material) {
50391         uint8_t key_material_arr[32];
50392         CHECK((*env)->GetArrayLength(env, key_material) == 32);
50393         (*env)->GetByteArrayRegion(env, key_material, 0, 32, key_material_arr);
50394         uint8_t (*key_material_ref)[32] = &key_material_arr;
50395         LDKExpandedKey ret_var = ExpandedKey_new(key_material_ref);
50396         int64_t ret_ref = 0;
50397         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50398         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50399         return ret_ref;
50400 }
50401
50402 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) {
50403         LDKExpandedKey keys_conv;
50404         keys_conv.inner = untag_ptr(keys);
50405         keys_conv.is_owned = ptr_is_owned(keys);
50406         CHECK_INNER_FIELD_ACCESS_OR_NULL(keys_conv);
50407         keys_conv.is_owned = false;
50408         void* min_value_msat_ptr = untag_ptr(min_value_msat);
50409         CHECK_ACCESS(min_value_msat_ptr);
50410         LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
50411         min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(min_value_msat));
50412         void* entropy_source_ptr = untag_ptr(entropy_source);
50413         if (ptr_is_owned(entropy_source)) { CHECK_ACCESS(entropy_source_ptr); }
50414         LDKEntropySource* entropy_source_conv = (LDKEntropySource*)entropy_source_ptr;
50415         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
50416         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
50417         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
50418         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
50419         LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ), "LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ");
50420         *ret_conv = create(&keys_conv, min_value_msat_conv, invoice_expiry_delta_secs, entropy_source_conv, current_time, min_final_cltv_expiry_delta_conv);
50421         return tag_ptr(ret_conv, true);
50422 }
50423
50424 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) {
50425         LDKExpandedKey keys_conv;
50426         keys_conv.inner = untag_ptr(keys);
50427         keys_conv.is_owned = ptr_is_owned(keys);
50428         CHECK_INNER_FIELD_ACCESS_OR_NULL(keys_conv);
50429         keys_conv.is_owned = false;
50430         void* min_value_msat_ptr = untag_ptr(min_value_msat);
50431         CHECK_ACCESS(min_value_msat_ptr);
50432         LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
50433         min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(min_value_msat));
50434         LDKThirtyTwoBytes payment_hash_ref;
50435         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
50436         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
50437         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
50438         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
50439         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
50440         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
50441         LDKCResult_ThirtyTwoBytesNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesNoneZ), "LDKCResult_ThirtyTwoBytesNoneZ");
50442         *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);
50443         return tag_ptr(ret_conv, true);
50444 }
50445
50446 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DecodeError_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
50447         if (!ptr_is_owned(this_ptr)) return;
50448         void* this_ptr_ptr = untag_ptr(this_ptr);
50449         CHECK_ACCESS(this_ptr_ptr);
50450         LDKDecodeError this_ptr_conv = *(LDKDecodeError*)(this_ptr_ptr);
50451         FREE(untag_ptr(this_ptr));
50452         DecodeError_free(this_ptr_conv);
50453 }
50454
50455 static inline uint64_t DecodeError_clone_ptr(LDKDecodeError *NONNULL_PTR arg) {
50456         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
50457         *ret_copy = DecodeError_clone(arg);
50458         int64_t ret_ref = tag_ptr(ret_copy, true);
50459         return ret_ref;
50460 }
50461 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DecodeError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
50462         LDKDecodeError* arg_conv = (LDKDecodeError*)untag_ptr(arg);
50463         int64_t ret_conv = DecodeError_clone_ptr(arg_conv);
50464         return ret_conv;
50465 }
50466
50467 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DecodeError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
50468         LDKDecodeError* orig_conv = (LDKDecodeError*)untag_ptr(orig);
50469         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
50470         *ret_copy = DecodeError_clone(orig_conv);
50471         int64_t ret_ref = tag_ptr(ret_copy, true);
50472         return ret_ref;
50473 }
50474
50475 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DecodeError_1unknown_1version(JNIEnv *env, jclass clz) {
50476         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
50477         *ret_copy = DecodeError_unknown_version();
50478         int64_t ret_ref = tag_ptr(ret_copy, true);
50479         return ret_ref;
50480 }
50481
50482 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DecodeError_1unknown_1required_1feature(JNIEnv *env, jclass clz) {
50483         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
50484         *ret_copy = DecodeError_unknown_required_feature();
50485         int64_t ret_ref = tag_ptr(ret_copy, true);
50486         return ret_ref;
50487 }
50488
50489 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DecodeError_1invalid_1value(JNIEnv *env, jclass clz) {
50490         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
50491         *ret_copy = DecodeError_invalid_value();
50492         int64_t ret_ref = tag_ptr(ret_copy, true);
50493         return ret_ref;
50494 }
50495
50496 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DecodeError_1short_1read(JNIEnv *env, jclass clz) {
50497         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
50498         *ret_copy = DecodeError_short_read();
50499         int64_t ret_ref = tag_ptr(ret_copy, true);
50500         return ret_ref;
50501 }
50502
50503 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DecodeError_1bad_1length_1descriptor(JNIEnv *env, jclass clz) {
50504         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
50505         *ret_copy = DecodeError_bad_length_descriptor();
50506         int64_t ret_ref = tag_ptr(ret_copy, true);
50507         return ret_ref;
50508 }
50509
50510 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DecodeError_1io(JNIEnv *env, jclass clz, jclass a) {
50511         LDKIOError a_conv = LDKIOError_from_java(env, a);
50512         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
50513         *ret_copy = DecodeError_io(a_conv);
50514         int64_t ret_ref = tag_ptr(ret_copy, true);
50515         return ret_ref;
50516 }
50517
50518 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DecodeError_1unsupported_1compression(JNIEnv *env, jclass clz) {
50519         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
50520         *ret_copy = DecodeError_unsupported_compression();
50521         int64_t ret_ref = tag_ptr(ret_copy, true);
50522         return ret_ref;
50523 }
50524
50525 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DecodeError_1dangerous_1value(JNIEnv *env, jclass clz) {
50526         LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
50527         *ret_copy = DecodeError_dangerous_value();
50528         int64_t ret_ref = tag_ptr(ret_copy, true);
50529         return ret_ref;
50530 }
50531
50532 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DecodeError_1hash(JNIEnv *env, jclass clz, int64_t o) {
50533         LDKDecodeError* o_conv = (LDKDecodeError*)untag_ptr(o);
50534         int64_t ret_conv = DecodeError_hash(o_conv);
50535         return ret_conv;
50536 }
50537
50538 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_DecodeError_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
50539         LDKDecodeError* a_conv = (LDKDecodeError*)untag_ptr(a);
50540         LDKDecodeError* b_conv = (LDKDecodeError*)untag_ptr(b);
50541         jboolean ret_conv = DecodeError_eq(a_conv, b_conv);
50542         return ret_conv;
50543 }
50544
50545 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Init_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
50546         LDKInit this_obj_conv;
50547         this_obj_conv.inner = untag_ptr(this_obj);
50548         this_obj_conv.is_owned = ptr_is_owned(this_obj);
50549         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
50550         Init_free(this_obj_conv);
50551 }
50552
50553 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Init_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
50554         LDKInit this_ptr_conv;
50555         this_ptr_conv.inner = untag_ptr(this_ptr);
50556         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50557         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50558         this_ptr_conv.is_owned = false;
50559         LDKInitFeatures ret_var = Init_get_features(&this_ptr_conv);
50560         int64_t ret_ref = 0;
50561         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50562         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50563         return ret_ref;
50564 }
50565
50566 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Init_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
50567         LDKInit this_ptr_conv;
50568         this_ptr_conv.inner = untag_ptr(this_ptr);
50569         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50570         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50571         this_ptr_conv.is_owned = false;
50572         LDKInitFeatures val_conv;
50573         val_conv.inner = untag_ptr(val);
50574         val_conv.is_owned = ptr_is_owned(val);
50575         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
50576         val_conv = InitFeatures_clone(&val_conv);
50577         Init_set_features(&this_ptr_conv, val_conv);
50578 }
50579
50580 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Init_1get_1networks(JNIEnv *env, jclass clz, int64_t this_ptr) {
50581         LDKInit this_ptr_conv;
50582         this_ptr_conv.inner = untag_ptr(this_ptr);
50583         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50584         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50585         this_ptr_conv.is_owned = false;
50586         LDKCOption_CVec_ThirtyTwoBytesZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_ThirtyTwoBytesZZ), "LDKCOption_CVec_ThirtyTwoBytesZZ");
50587         *ret_copy = Init_get_networks(&this_ptr_conv);
50588         int64_t ret_ref = tag_ptr(ret_copy, true);
50589         return ret_ref;
50590 }
50591
50592 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Init_1set_1networks(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
50593         LDKInit this_ptr_conv;
50594         this_ptr_conv.inner = untag_ptr(this_ptr);
50595         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50596         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50597         this_ptr_conv.is_owned = false;
50598         void* val_ptr = untag_ptr(val);
50599         CHECK_ACCESS(val_ptr);
50600         LDKCOption_CVec_ThirtyTwoBytesZZ val_conv = *(LDKCOption_CVec_ThirtyTwoBytesZZ*)(val_ptr);
50601         val_conv = COption_CVec_ThirtyTwoBytesZZ_clone((LDKCOption_CVec_ThirtyTwoBytesZZ*)untag_ptr(val));
50602         Init_set_networks(&this_ptr_conv, val_conv);
50603 }
50604
50605 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Init_1get_1remote_1network_1address(JNIEnv *env, jclass clz, int64_t this_ptr) {
50606         LDKInit this_ptr_conv;
50607         this_ptr_conv.inner = untag_ptr(this_ptr);
50608         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50609         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50610         this_ptr_conv.is_owned = false;
50611         LDKCOption_SocketAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_SocketAddressZ), "LDKCOption_SocketAddressZ");
50612         *ret_copy = Init_get_remote_network_address(&this_ptr_conv);
50613         int64_t ret_ref = tag_ptr(ret_copy, true);
50614         return ret_ref;
50615 }
50616
50617 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Init_1set_1remote_1network_1address(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
50618         LDKInit this_ptr_conv;
50619         this_ptr_conv.inner = untag_ptr(this_ptr);
50620         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50621         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50622         this_ptr_conv.is_owned = false;
50623         void* val_ptr = untag_ptr(val);
50624         CHECK_ACCESS(val_ptr);
50625         LDKCOption_SocketAddressZ val_conv = *(LDKCOption_SocketAddressZ*)(val_ptr);
50626         val_conv = COption_SocketAddressZ_clone((LDKCOption_SocketAddressZ*)untag_ptr(val));
50627         Init_set_remote_network_address(&this_ptr_conv, val_conv);
50628 }
50629
50630 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) {
50631         LDKInitFeatures features_arg_conv;
50632         features_arg_conv.inner = untag_ptr(features_arg);
50633         features_arg_conv.is_owned = ptr_is_owned(features_arg);
50634         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
50635         features_arg_conv = InitFeatures_clone(&features_arg_conv);
50636         void* networks_arg_ptr = untag_ptr(networks_arg);
50637         CHECK_ACCESS(networks_arg_ptr);
50638         LDKCOption_CVec_ThirtyTwoBytesZZ networks_arg_conv = *(LDKCOption_CVec_ThirtyTwoBytesZZ*)(networks_arg_ptr);
50639         networks_arg_conv = COption_CVec_ThirtyTwoBytesZZ_clone((LDKCOption_CVec_ThirtyTwoBytesZZ*)untag_ptr(networks_arg));
50640         void* remote_network_address_arg_ptr = untag_ptr(remote_network_address_arg);
50641         CHECK_ACCESS(remote_network_address_arg_ptr);
50642         LDKCOption_SocketAddressZ remote_network_address_arg_conv = *(LDKCOption_SocketAddressZ*)(remote_network_address_arg_ptr);
50643         LDKInit ret_var = Init_new(features_arg_conv, networks_arg_conv, remote_network_address_arg_conv);
50644         int64_t ret_ref = 0;
50645         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50646         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50647         return ret_ref;
50648 }
50649
50650 static inline uint64_t Init_clone_ptr(LDKInit *NONNULL_PTR arg) {
50651         LDKInit ret_var = Init_clone(arg);
50652         int64_t ret_ref = 0;
50653         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50654         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50655         return ret_ref;
50656 }
50657 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Init_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
50658         LDKInit arg_conv;
50659         arg_conv.inner = untag_ptr(arg);
50660         arg_conv.is_owned = ptr_is_owned(arg);
50661         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
50662         arg_conv.is_owned = false;
50663         int64_t ret_conv = Init_clone_ptr(&arg_conv);
50664         return ret_conv;
50665 }
50666
50667 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Init_1clone(JNIEnv *env, jclass clz, int64_t orig) {
50668         LDKInit orig_conv;
50669         orig_conv.inner = untag_ptr(orig);
50670         orig_conv.is_owned = ptr_is_owned(orig);
50671         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
50672         orig_conv.is_owned = false;
50673         LDKInit ret_var = Init_clone(&orig_conv);
50674         int64_t ret_ref = 0;
50675         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50676         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50677         return ret_ref;
50678 }
50679
50680 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Init_1hash(JNIEnv *env, jclass clz, int64_t o) {
50681         LDKInit o_conv;
50682         o_conv.inner = untag_ptr(o);
50683         o_conv.is_owned = ptr_is_owned(o);
50684         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
50685         o_conv.is_owned = false;
50686         int64_t ret_conv = Init_hash(&o_conv);
50687         return ret_conv;
50688 }
50689
50690 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Init_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
50691         LDKInit a_conv;
50692         a_conv.inner = untag_ptr(a);
50693         a_conv.is_owned = ptr_is_owned(a);
50694         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
50695         a_conv.is_owned = false;
50696         LDKInit b_conv;
50697         b_conv.inner = untag_ptr(b);
50698         b_conv.is_owned = ptr_is_owned(b);
50699         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
50700         b_conv.is_owned = false;
50701         jboolean ret_conv = Init_eq(&a_conv, &b_conv);
50702         return ret_conv;
50703 }
50704
50705 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
50706         LDKErrorMessage this_obj_conv;
50707         this_obj_conv.inner = untag_ptr(this_obj);
50708         this_obj_conv.is_owned = ptr_is_owned(this_obj);
50709         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
50710         ErrorMessage_free(this_obj_conv);
50711 }
50712
50713 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
50714         LDKErrorMessage this_ptr_conv;
50715         this_ptr_conv.inner = untag_ptr(this_ptr);
50716         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50717         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50718         this_ptr_conv.is_owned = false;
50719         LDKChannelId ret_var = ErrorMessage_get_channel_id(&this_ptr_conv);
50720         int64_t ret_ref = 0;
50721         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50722         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50723         return ret_ref;
50724 }
50725
50726 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
50727         LDKErrorMessage this_ptr_conv;
50728         this_ptr_conv.inner = untag_ptr(this_ptr);
50729         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50730         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50731         this_ptr_conv.is_owned = false;
50732         LDKChannelId val_conv;
50733         val_conv.inner = untag_ptr(val);
50734         val_conv.is_owned = ptr_is_owned(val);
50735         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
50736         val_conv = ChannelId_clone(&val_conv);
50737         ErrorMessage_set_channel_id(&this_ptr_conv, val_conv);
50738 }
50739
50740 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1get_1data(JNIEnv *env, jclass clz, int64_t this_ptr) {
50741         LDKErrorMessage this_ptr_conv;
50742         this_ptr_conv.inner = untag_ptr(this_ptr);
50743         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50744         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50745         this_ptr_conv.is_owned = false;
50746         LDKStr ret_str = ErrorMessage_get_data(&this_ptr_conv);
50747         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
50748         Str_free(ret_str);
50749         return ret_conv;
50750 }
50751
50752 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1set_1data(JNIEnv *env, jclass clz, int64_t this_ptr, jstring val) {
50753         LDKErrorMessage this_ptr_conv;
50754         this_ptr_conv.inner = untag_ptr(this_ptr);
50755         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50756         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50757         this_ptr_conv.is_owned = false;
50758         LDKStr val_conv = java_to_owned_str(env, val);
50759         ErrorMessage_set_data(&this_ptr_conv, val_conv);
50760 }
50761
50762 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1new(JNIEnv *env, jclass clz, int64_t channel_id_arg, jstring data_arg) {
50763         LDKChannelId channel_id_arg_conv;
50764         channel_id_arg_conv.inner = untag_ptr(channel_id_arg);
50765         channel_id_arg_conv.is_owned = ptr_is_owned(channel_id_arg);
50766         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_arg_conv);
50767         channel_id_arg_conv = ChannelId_clone(&channel_id_arg_conv);
50768         LDKStr data_arg_conv = java_to_owned_str(env, data_arg);
50769         LDKErrorMessage ret_var = ErrorMessage_new(channel_id_arg_conv, data_arg_conv);
50770         int64_t ret_ref = 0;
50771         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50772         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50773         return ret_ref;
50774 }
50775
50776 static inline uint64_t ErrorMessage_clone_ptr(LDKErrorMessage *NONNULL_PTR arg) {
50777         LDKErrorMessage ret_var = ErrorMessage_clone(arg);
50778         int64_t ret_ref = 0;
50779         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50780         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50781         return ret_ref;
50782 }
50783 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
50784         LDKErrorMessage arg_conv;
50785         arg_conv.inner = untag_ptr(arg);
50786         arg_conv.is_owned = ptr_is_owned(arg);
50787         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
50788         arg_conv.is_owned = false;
50789         int64_t ret_conv = ErrorMessage_clone_ptr(&arg_conv);
50790         return ret_conv;
50791 }
50792
50793 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1clone(JNIEnv *env, jclass clz, int64_t orig) {
50794         LDKErrorMessage orig_conv;
50795         orig_conv.inner = untag_ptr(orig);
50796         orig_conv.is_owned = ptr_is_owned(orig);
50797         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
50798         orig_conv.is_owned = false;
50799         LDKErrorMessage ret_var = ErrorMessage_clone(&orig_conv);
50800         int64_t ret_ref = 0;
50801         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50802         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50803         return ret_ref;
50804 }
50805
50806 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1hash(JNIEnv *env, jclass clz, int64_t o) {
50807         LDKErrorMessage o_conv;
50808         o_conv.inner = untag_ptr(o);
50809         o_conv.is_owned = ptr_is_owned(o);
50810         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
50811         o_conv.is_owned = false;
50812         int64_t ret_conv = ErrorMessage_hash(&o_conv);
50813         return ret_conv;
50814 }
50815
50816 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
50817         LDKErrorMessage a_conv;
50818         a_conv.inner = untag_ptr(a);
50819         a_conv.is_owned = ptr_is_owned(a);
50820         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
50821         a_conv.is_owned = false;
50822         LDKErrorMessage b_conv;
50823         b_conv.inner = untag_ptr(b);
50824         b_conv.is_owned = ptr_is_owned(b);
50825         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
50826         b_conv.is_owned = false;
50827         jboolean ret_conv = ErrorMessage_eq(&a_conv, &b_conv);
50828         return ret_conv;
50829 }
50830
50831 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WarningMessage_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
50832         LDKWarningMessage this_obj_conv;
50833         this_obj_conv.inner = untag_ptr(this_obj);
50834         this_obj_conv.is_owned = ptr_is_owned(this_obj);
50835         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
50836         WarningMessage_free(this_obj_conv);
50837 }
50838
50839 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WarningMessage_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
50840         LDKWarningMessage this_ptr_conv;
50841         this_ptr_conv.inner = untag_ptr(this_ptr);
50842         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50843         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50844         this_ptr_conv.is_owned = false;
50845         LDKChannelId ret_var = WarningMessage_get_channel_id(&this_ptr_conv);
50846         int64_t ret_ref = 0;
50847         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50848         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50849         return ret_ref;
50850 }
50851
50852 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WarningMessage_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
50853         LDKWarningMessage this_ptr_conv;
50854         this_ptr_conv.inner = untag_ptr(this_ptr);
50855         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50856         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50857         this_ptr_conv.is_owned = false;
50858         LDKChannelId val_conv;
50859         val_conv.inner = untag_ptr(val);
50860         val_conv.is_owned = ptr_is_owned(val);
50861         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
50862         val_conv = ChannelId_clone(&val_conv);
50863         WarningMessage_set_channel_id(&this_ptr_conv, val_conv);
50864 }
50865
50866 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_WarningMessage_1get_1data(JNIEnv *env, jclass clz, int64_t this_ptr) {
50867         LDKWarningMessage this_ptr_conv;
50868         this_ptr_conv.inner = untag_ptr(this_ptr);
50869         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50870         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50871         this_ptr_conv.is_owned = false;
50872         LDKStr ret_str = WarningMessage_get_data(&this_ptr_conv);
50873         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
50874         Str_free(ret_str);
50875         return ret_conv;
50876 }
50877
50878 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WarningMessage_1set_1data(JNIEnv *env, jclass clz, int64_t this_ptr, jstring val) {
50879         LDKWarningMessage this_ptr_conv;
50880         this_ptr_conv.inner = untag_ptr(this_ptr);
50881         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50882         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50883         this_ptr_conv.is_owned = false;
50884         LDKStr val_conv = java_to_owned_str(env, val);
50885         WarningMessage_set_data(&this_ptr_conv, val_conv);
50886 }
50887
50888 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WarningMessage_1new(JNIEnv *env, jclass clz, int64_t channel_id_arg, jstring data_arg) {
50889         LDKChannelId channel_id_arg_conv;
50890         channel_id_arg_conv.inner = untag_ptr(channel_id_arg);
50891         channel_id_arg_conv.is_owned = ptr_is_owned(channel_id_arg);
50892         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_arg_conv);
50893         channel_id_arg_conv = ChannelId_clone(&channel_id_arg_conv);
50894         LDKStr data_arg_conv = java_to_owned_str(env, data_arg);
50895         LDKWarningMessage ret_var = WarningMessage_new(channel_id_arg_conv, data_arg_conv);
50896         int64_t ret_ref = 0;
50897         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50898         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50899         return ret_ref;
50900 }
50901
50902 static inline uint64_t WarningMessage_clone_ptr(LDKWarningMessage *NONNULL_PTR arg) {
50903         LDKWarningMessage ret_var = WarningMessage_clone(arg);
50904         int64_t ret_ref = 0;
50905         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50906         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50907         return ret_ref;
50908 }
50909 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WarningMessage_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
50910         LDKWarningMessage arg_conv;
50911         arg_conv.inner = untag_ptr(arg);
50912         arg_conv.is_owned = ptr_is_owned(arg);
50913         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
50914         arg_conv.is_owned = false;
50915         int64_t ret_conv = WarningMessage_clone_ptr(&arg_conv);
50916         return ret_conv;
50917 }
50918
50919 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WarningMessage_1clone(JNIEnv *env, jclass clz, int64_t orig) {
50920         LDKWarningMessage orig_conv;
50921         orig_conv.inner = untag_ptr(orig);
50922         orig_conv.is_owned = ptr_is_owned(orig);
50923         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
50924         orig_conv.is_owned = false;
50925         LDKWarningMessage ret_var = WarningMessage_clone(&orig_conv);
50926         int64_t ret_ref = 0;
50927         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
50928         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
50929         return ret_ref;
50930 }
50931
50932 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WarningMessage_1hash(JNIEnv *env, jclass clz, int64_t o) {
50933         LDKWarningMessage o_conv;
50934         o_conv.inner = untag_ptr(o);
50935         o_conv.is_owned = ptr_is_owned(o);
50936         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
50937         o_conv.is_owned = false;
50938         int64_t ret_conv = WarningMessage_hash(&o_conv);
50939         return ret_conv;
50940 }
50941
50942 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_WarningMessage_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
50943         LDKWarningMessage a_conv;
50944         a_conv.inner = untag_ptr(a);
50945         a_conv.is_owned = ptr_is_owned(a);
50946         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
50947         a_conv.is_owned = false;
50948         LDKWarningMessage b_conv;
50949         b_conv.inner = untag_ptr(b);
50950         b_conv.is_owned = ptr_is_owned(b);
50951         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
50952         b_conv.is_owned = false;
50953         jboolean ret_conv = WarningMessage_eq(&a_conv, &b_conv);
50954         return ret_conv;
50955 }
50956
50957 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Ping_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
50958         LDKPing this_obj_conv;
50959         this_obj_conv.inner = untag_ptr(this_obj);
50960         this_obj_conv.is_owned = ptr_is_owned(this_obj);
50961         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
50962         Ping_free(this_obj_conv);
50963 }
50964
50965 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_Ping_1get_1ponglen(JNIEnv *env, jclass clz, int64_t this_ptr) {
50966         LDKPing this_ptr_conv;
50967         this_ptr_conv.inner = untag_ptr(this_ptr);
50968         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50969         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50970         this_ptr_conv.is_owned = false;
50971         int16_t ret_conv = Ping_get_ponglen(&this_ptr_conv);
50972         return ret_conv;
50973 }
50974
50975 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Ping_1set_1ponglen(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
50976         LDKPing this_ptr_conv;
50977         this_ptr_conv.inner = untag_ptr(this_ptr);
50978         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50979         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50980         this_ptr_conv.is_owned = false;
50981         Ping_set_ponglen(&this_ptr_conv, val);
50982 }
50983
50984 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_Ping_1get_1byteslen(JNIEnv *env, jclass clz, int64_t this_ptr) {
50985         LDKPing this_ptr_conv;
50986         this_ptr_conv.inner = untag_ptr(this_ptr);
50987         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50988         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50989         this_ptr_conv.is_owned = false;
50990         int16_t ret_conv = Ping_get_byteslen(&this_ptr_conv);
50991         return ret_conv;
50992 }
50993
50994 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Ping_1set_1byteslen(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
50995         LDKPing this_ptr_conv;
50996         this_ptr_conv.inner = untag_ptr(this_ptr);
50997         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
50998         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
50999         this_ptr_conv.is_owned = false;
51000         Ping_set_byteslen(&this_ptr_conv, val);
51001 }
51002
51003 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Ping_1new(JNIEnv *env, jclass clz, int16_t ponglen_arg, int16_t byteslen_arg) {
51004         LDKPing ret_var = Ping_new(ponglen_arg, byteslen_arg);
51005         int64_t ret_ref = 0;
51006         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51007         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51008         return ret_ref;
51009 }
51010
51011 static inline uint64_t Ping_clone_ptr(LDKPing *NONNULL_PTR arg) {
51012         LDKPing ret_var = Ping_clone(arg);
51013         int64_t ret_ref = 0;
51014         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51015         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51016         return ret_ref;
51017 }
51018 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Ping_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
51019         LDKPing arg_conv;
51020         arg_conv.inner = untag_ptr(arg);
51021         arg_conv.is_owned = ptr_is_owned(arg);
51022         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
51023         arg_conv.is_owned = false;
51024         int64_t ret_conv = Ping_clone_ptr(&arg_conv);
51025         return ret_conv;
51026 }
51027
51028 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Ping_1clone(JNIEnv *env, jclass clz, int64_t orig) {
51029         LDKPing orig_conv;
51030         orig_conv.inner = untag_ptr(orig);
51031         orig_conv.is_owned = ptr_is_owned(orig);
51032         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
51033         orig_conv.is_owned = false;
51034         LDKPing ret_var = Ping_clone(&orig_conv);
51035         int64_t ret_ref = 0;
51036         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51037         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51038         return ret_ref;
51039 }
51040
51041 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Ping_1hash(JNIEnv *env, jclass clz, int64_t o) {
51042         LDKPing o_conv;
51043         o_conv.inner = untag_ptr(o);
51044         o_conv.is_owned = ptr_is_owned(o);
51045         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
51046         o_conv.is_owned = false;
51047         int64_t ret_conv = Ping_hash(&o_conv);
51048         return ret_conv;
51049 }
51050
51051 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Ping_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
51052         LDKPing a_conv;
51053         a_conv.inner = untag_ptr(a);
51054         a_conv.is_owned = ptr_is_owned(a);
51055         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
51056         a_conv.is_owned = false;
51057         LDKPing b_conv;
51058         b_conv.inner = untag_ptr(b);
51059         b_conv.is_owned = ptr_is_owned(b);
51060         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
51061         b_conv.is_owned = false;
51062         jboolean ret_conv = Ping_eq(&a_conv, &b_conv);
51063         return ret_conv;
51064 }
51065
51066 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Pong_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
51067         LDKPong this_obj_conv;
51068         this_obj_conv.inner = untag_ptr(this_obj);
51069         this_obj_conv.is_owned = ptr_is_owned(this_obj);
51070         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
51071         Pong_free(this_obj_conv);
51072 }
51073
51074 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_Pong_1get_1byteslen(JNIEnv *env, jclass clz, int64_t this_ptr) {
51075         LDKPong this_ptr_conv;
51076         this_ptr_conv.inner = untag_ptr(this_ptr);
51077         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51078         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51079         this_ptr_conv.is_owned = false;
51080         int16_t ret_conv = Pong_get_byteslen(&this_ptr_conv);
51081         return ret_conv;
51082 }
51083
51084 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Pong_1set_1byteslen(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
51085         LDKPong this_ptr_conv;
51086         this_ptr_conv.inner = untag_ptr(this_ptr);
51087         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51088         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51089         this_ptr_conv.is_owned = false;
51090         Pong_set_byteslen(&this_ptr_conv, val);
51091 }
51092
51093 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Pong_1new(JNIEnv *env, jclass clz, int16_t byteslen_arg) {
51094         LDKPong ret_var = Pong_new(byteslen_arg);
51095         int64_t ret_ref = 0;
51096         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51097         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51098         return ret_ref;
51099 }
51100
51101 static inline uint64_t Pong_clone_ptr(LDKPong *NONNULL_PTR arg) {
51102         LDKPong ret_var = Pong_clone(arg);
51103         int64_t ret_ref = 0;
51104         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51105         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51106         return ret_ref;
51107 }
51108 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Pong_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
51109         LDKPong arg_conv;
51110         arg_conv.inner = untag_ptr(arg);
51111         arg_conv.is_owned = ptr_is_owned(arg);
51112         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
51113         arg_conv.is_owned = false;
51114         int64_t ret_conv = Pong_clone_ptr(&arg_conv);
51115         return ret_conv;
51116 }
51117
51118 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Pong_1clone(JNIEnv *env, jclass clz, int64_t orig) {
51119         LDKPong orig_conv;
51120         orig_conv.inner = untag_ptr(orig);
51121         orig_conv.is_owned = ptr_is_owned(orig);
51122         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
51123         orig_conv.is_owned = false;
51124         LDKPong ret_var = Pong_clone(&orig_conv);
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 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Pong_1hash(JNIEnv *env, jclass clz, int64_t o) {
51132         LDKPong o_conv;
51133         o_conv.inner = untag_ptr(o);
51134         o_conv.is_owned = ptr_is_owned(o);
51135         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
51136         o_conv.is_owned = false;
51137         int64_t ret_conv = Pong_hash(&o_conv);
51138         return ret_conv;
51139 }
51140
51141 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Pong_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
51142         LDKPong a_conv;
51143         a_conv.inner = untag_ptr(a);
51144         a_conv.is_owned = ptr_is_owned(a);
51145         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
51146         a_conv.is_owned = false;
51147         LDKPong b_conv;
51148         b_conv.inner = untag_ptr(b);
51149         b_conv.is_owned = ptr_is_owned(b);
51150         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
51151         b_conv.is_owned = false;
51152         jboolean ret_conv = Pong_eq(&a_conv, &b_conv);
51153         return ret_conv;
51154 }
51155
51156 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommonOpenChannelFields_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
51157         LDKCommonOpenChannelFields this_obj_conv;
51158         this_obj_conv.inner = untag_ptr(this_obj);
51159         this_obj_conv.is_owned = ptr_is_owned(this_obj);
51160         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
51161         CommonOpenChannelFields_free(this_obj_conv);
51162 }
51163
51164 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CommonOpenChannelFields_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
51165         LDKCommonOpenChannelFields this_ptr_conv;
51166         this_ptr_conv.inner = untag_ptr(this_ptr);
51167         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51168         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51169         this_ptr_conv.is_owned = false;
51170         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
51171         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *CommonOpenChannelFields_get_chain_hash(&this_ptr_conv));
51172         return ret_arr;
51173 }
51174
51175 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommonOpenChannelFields_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
51176         LDKCommonOpenChannelFields this_ptr_conv;
51177         this_ptr_conv.inner = untag_ptr(this_ptr);
51178         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51179         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51180         this_ptr_conv.is_owned = false;
51181         LDKThirtyTwoBytes val_ref;
51182         CHECK((*env)->GetArrayLength(env, val) == 32);
51183         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
51184         CommonOpenChannelFields_set_chain_hash(&this_ptr_conv, val_ref);
51185 }
51186
51187 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommonOpenChannelFields_1get_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
51188         LDKCommonOpenChannelFields this_ptr_conv;
51189         this_ptr_conv.inner = untag_ptr(this_ptr);
51190         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51191         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51192         this_ptr_conv.is_owned = false;
51193         LDKChannelId ret_var = CommonOpenChannelFields_get_temporary_channel_id(&this_ptr_conv);
51194         int64_t ret_ref = 0;
51195         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51196         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51197         return ret_ref;
51198 }
51199
51200 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommonOpenChannelFields_1set_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
51201         LDKCommonOpenChannelFields this_ptr_conv;
51202         this_ptr_conv.inner = untag_ptr(this_ptr);
51203         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51204         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51205         this_ptr_conv.is_owned = false;
51206         LDKChannelId val_conv;
51207         val_conv.inner = untag_ptr(val);
51208         val_conv.is_owned = ptr_is_owned(val);
51209         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
51210         val_conv = ChannelId_clone(&val_conv);
51211         CommonOpenChannelFields_set_temporary_channel_id(&this_ptr_conv, val_conv);
51212 }
51213
51214 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommonOpenChannelFields_1get_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
51215         LDKCommonOpenChannelFields this_ptr_conv;
51216         this_ptr_conv.inner = untag_ptr(this_ptr);
51217         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51218         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51219         this_ptr_conv.is_owned = false;
51220         int64_t ret_conv = CommonOpenChannelFields_get_funding_satoshis(&this_ptr_conv);
51221         return ret_conv;
51222 }
51223
51224 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommonOpenChannelFields_1set_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
51225         LDKCommonOpenChannelFields this_ptr_conv;
51226         this_ptr_conv.inner = untag_ptr(this_ptr);
51227         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51228         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51229         this_ptr_conv.is_owned = false;
51230         CommonOpenChannelFields_set_funding_satoshis(&this_ptr_conv, val);
51231 }
51232
51233 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommonOpenChannelFields_1get_1dust_1limit_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
51234         LDKCommonOpenChannelFields this_ptr_conv;
51235         this_ptr_conv.inner = untag_ptr(this_ptr);
51236         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51237         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51238         this_ptr_conv.is_owned = false;
51239         int64_t ret_conv = CommonOpenChannelFields_get_dust_limit_satoshis(&this_ptr_conv);
51240         return ret_conv;
51241 }
51242
51243 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommonOpenChannelFields_1set_1dust_1limit_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
51244         LDKCommonOpenChannelFields this_ptr_conv;
51245         this_ptr_conv.inner = untag_ptr(this_ptr);
51246         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51247         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51248         this_ptr_conv.is_owned = false;
51249         CommonOpenChannelFields_set_dust_limit_satoshis(&this_ptr_conv, val);
51250 }
51251
51252 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommonOpenChannelFields_1get_1max_1htlc_1value_1in_1flight_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
51253         LDKCommonOpenChannelFields this_ptr_conv;
51254         this_ptr_conv.inner = untag_ptr(this_ptr);
51255         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51256         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51257         this_ptr_conv.is_owned = false;
51258         int64_t ret_conv = CommonOpenChannelFields_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
51259         return ret_conv;
51260 }
51261
51262 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommonOpenChannelFields_1set_1max_1htlc_1value_1in_1flight_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
51263         LDKCommonOpenChannelFields this_ptr_conv;
51264         this_ptr_conv.inner = untag_ptr(this_ptr);
51265         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51266         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51267         this_ptr_conv.is_owned = false;
51268         CommonOpenChannelFields_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
51269 }
51270
51271 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommonOpenChannelFields_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
51272         LDKCommonOpenChannelFields this_ptr_conv;
51273         this_ptr_conv.inner = untag_ptr(this_ptr);
51274         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51275         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51276         this_ptr_conv.is_owned = false;
51277         int64_t ret_conv = CommonOpenChannelFields_get_htlc_minimum_msat(&this_ptr_conv);
51278         return ret_conv;
51279 }
51280
51281 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommonOpenChannelFields_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
51282         LDKCommonOpenChannelFields this_ptr_conv;
51283         this_ptr_conv.inner = untag_ptr(this_ptr);
51284         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51285         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51286         this_ptr_conv.is_owned = false;
51287         CommonOpenChannelFields_set_htlc_minimum_msat(&this_ptr_conv, val);
51288 }
51289
51290 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_CommonOpenChannelFields_1get_1commitment_1feerate_1sat_1per_11000_1weight(JNIEnv *env, jclass clz, int64_t this_ptr) {
51291         LDKCommonOpenChannelFields this_ptr_conv;
51292         this_ptr_conv.inner = untag_ptr(this_ptr);
51293         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51294         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51295         this_ptr_conv.is_owned = false;
51296         int32_t ret_conv = CommonOpenChannelFields_get_commitment_feerate_sat_per_1000_weight(&this_ptr_conv);
51297         return ret_conv;
51298 }
51299
51300 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommonOpenChannelFields_1set_1commitment_1feerate_1sat_1per_11000_1weight(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
51301         LDKCommonOpenChannelFields this_ptr_conv;
51302         this_ptr_conv.inner = untag_ptr(this_ptr);
51303         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51304         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51305         this_ptr_conv.is_owned = false;
51306         CommonOpenChannelFields_set_commitment_feerate_sat_per_1000_weight(&this_ptr_conv, val);
51307 }
51308
51309 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_CommonOpenChannelFields_1get_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
51310         LDKCommonOpenChannelFields this_ptr_conv;
51311         this_ptr_conv.inner = untag_ptr(this_ptr);
51312         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51313         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51314         this_ptr_conv.is_owned = false;
51315         int16_t ret_conv = CommonOpenChannelFields_get_to_self_delay(&this_ptr_conv);
51316         return ret_conv;
51317 }
51318
51319 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommonOpenChannelFields_1set_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
51320         LDKCommonOpenChannelFields this_ptr_conv;
51321         this_ptr_conv.inner = untag_ptr(this_ptr);
51322         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51323         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51324         this_ptr_conv.is_owned = false;
51325         CommonOpenChannelFields_set_to_self_delay(&this_ptr_conv, val);
51326 }
51327
51328 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_CommonOpenChannelFields_1get_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
51329         LDKCommonOpenChannelFields this_ptr_conv;
51330         this_ptr_conv.inner = untag_ptr(this_ptr);
51331         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51332         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51333         this_ptr_conv.is_owned = false;
51334         int16_t ret_conv = CommonOpenChannelFields_get_max_accepted_htlcs(&this_ptr_conv);
51335         return ret_conv;
51336 }
51337
51338 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommonOpenChannelFields_1set_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
51339         LDKCommonOpenChannelFields this_ptr_conv;
51340         this_ptr_conv.inner = untag_ptr(this_ptr);
51341         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51342         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51343         this_ptr_conv.is_owned = false;
51344         CommonOpenChannelFields_set_max_accepted_htlcs(&this_ptr_conv, val);
51345 }
51346
51347 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CommonOpenChannelFields_1get_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
51348         LDKCommonOpenChannelFields this_ptr_conv;
51349         this_ptr_conv.inner = untag_ptr(this_ptr);
51350         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51351         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51352         this_ptr_conv.is_owned = false;
51353         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
51354         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, CommonOpenChannelFields_get_funding_pubkey(&this_ptr_conv).compressed_form);
51355         return ret_arr;
51356 }
51357
51358 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommonOpenChannelFields_1set_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
51359         LDKCommonOpenChannelFields this_ptr_conv;
51360         this_ptr_conv.inner = untag_ptr(this_ptr);
51361         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51362         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51363         this_ptr_conv.is_owned = false;
51364         LDKPublicKey val_ref;
51365         CHECK((*env)->GetArrayLength(env, val) == 33);
51366         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
51367         CommonOpenChannelFields_set_funding_pubkey(&this_ptr_conv, val_ref);
51368 }
51369
51370 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CommonOpenChannelFields_1get_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
51371         LDKCommonOpenChannelFields this_ptr_conv;
51372         this_ptr_conv.inner = untag_ptr(this_ptr);
51373         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51374         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51375         this_ptr_conv.is_owned = false;
51376         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
51377         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, CommonOpenChannelFields_get_revocation_basepoint(&this_ptr_conv).compressed_form);
51378         return ret_arr;
51379 }
51380
51381 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommonOpenChannelFields_1set_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
51382         LDKCommonOpenChannelFields this_ptr_conv;
51383         this_ptr_conv.inner = untag_ptr(this_ptr);
51384         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51385         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51386         this_ptr_conv.is_owned = false;
51387         LDKPublicKey val_ref;
51388         CHECK((*env)->GetArrayLength(env, val) == 33);
51389         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
51390         CommonOpenChannelFields_set_revocation_basepoint(&this_ptr_conv, val_ref);
51391 }
51392
51393 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CommonOpenChannelFields_1get_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
51394         LDKCommonOpenChannelFields this_ptr_conv;
51395         this_ptr_conv.inner = untag_ptr(this_ptr);
51396         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51397         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51398         this_ptr_conv.is_owned = false;
51399         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
51400         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, CommonOpenChannelFields_get_payment_basepoint(&this_ptr_conv).compressed_form);
51401         return ret_arr;
51402 }
51403
51404 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommonOpenChannelFields_1set_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
51405         LDKCommonOpenChannelFields this_ptr_conv;
51406         this_ptr_conv.inner = untag_ptr(this_ptr);
51407         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51408         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51409         this_ptr_conv.is_owned = false;
51410         LDKPublicKey val_ref;
51411         CHECK((*env)->GetArrayLength(env, val) == 33);
51412         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
51413         CommonOpenChannelFields_set_payment_basepoint(&this_ptr_conv, val_ref);
51414 }
51415
51416 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CommonOpenChannelFields_1get_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
51417         LDKCommonOpenChannelFields this_ptr_conv;
51418         this_ptr_conv.inner = untag_ptr(this_ptr);
51419         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51420         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51421         this_ptr_conv.is_owned = false;
51422         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
51423         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, CommonOpenChannelFields_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form);
51424         return ret_arr;
51425 }
51426
51427 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommonOpenChannelFields_1set_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
51428         LDKCommonOpenChannelFields this_ptr_conv;
51429         this_ptr_conv.inner = untag_ptr(this_ptr);
51430         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51431         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51432         this_ptr_conv.is_owned = false;
51433         LDKPublicKey val_ref;
51434         CHECK((*env)->GetArrayLength(env, val) == 33);
51435         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
51436         CommonOpenChannelFields_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
51437 }
51438
51439 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CommonOpenChannelFields_1get_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
51440         LDKCommonOpenChannelFields this_ptr_conv;
51441         this_ptr_conv.inner = untag_ptr(this_ptr);
51442         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51443         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51444         this_ptr_conv.is_owned = false;
51445         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
51446         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, CommonOpenChannelFields_get_htlc_basepoint(&this_ptr_conv).compressed_form);
51447         return ret_arr;
51448 }
51449
51450 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommonOpenChannelFields_1set_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
51451         LDKCommonOpenChannelFields this_ptr_conv;
51452         this_ptr_conv.inner = untag_ptr(this_ptr);
51453         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51454         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51455         this_ptr_conv.is_owned = false;
51456         LDKPublicKey val_ref;
51457         CHECK((*env)->GetArrayLength(env, val) == 33);
51458         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
51459         CommonOpenChannelFields_set_htlc_basepoint(&this_ptr_conv, val_ref);
51460 }
51461
51462 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CommonOpenChannelFields_1get_1first_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
51463         LDKCommonOpenChannelFields this_ptr_conv;
51464         this_ptr_conv.inner = untag_ptr(this_ptr);
51465         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51466         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51467         this_ptr_conv.is_owned = false;
51468         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
51469         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, CommonOpenChannelFields_get_first_per_commitment_point(&this_ptr_conv).compressed_form);
51470         return ret_arr;
51471 }
51472
51473 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommonOpenChannelFields_1set_1first_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
51474         LDKCommonOpenChannelFields this_ptr_conv;
51475         this_ptr_conv.inner = untag_ptr(this_ptr);
51476         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51477         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51478         this_ptr_conv.is_owned = false;
51479         LDKPublicKey val_ref;
51480         CHECK((*env)->GetArrayLength(env, val) == 33);
51481         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
51482         CommonOpenChannelFields_set_first_per_commitment_point(&this_ptr_conv, val_ref);
51483 }
51484
51485 JNIEXPORT int8_t JNICALL Java_org_ldk_impl_bindings_CommonOpenChannelFields_1get_1channel_1flags(JNIEnv *env, jclass clz, int64_t this_ptr) {
51486         LDKCommonOpenChannelFields this_ptr_conv;
51487         this_ptr_conv.inner = untag_ptr(this_ptr);
51488         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51489         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51490         this_ptr_conv.is_owned = false;
51491         int8_t ret_conv = CommonOpenChannelFields_get_channel_flags(&this_ptr_conv);
51492         return ret_conv;
51493 }
51494
51495 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommonOpenChannelFields_1set_1channel_1flags(JNIEnv *env, jclass clz, int64_t this_ptr, int8_t val) {
51496         LDKCommonOpenChannelFields 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         CommonOpenChannelFields_set_channel_flags(&this_ptr_conv, val);
51502 }
51503
51504 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommonOpenChannelFields_1get_1shutdown_1scriptpubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
51505         LDKCommonOpenChannelFields this_ptr_conv;
51506         this_ptr_conv.inner = untag_ptr(this_ptr);
51507         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51508         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51509         this_ptr_conv.is_owned = false;
51510         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
51511         *ret_copy = CommonOpenChannelFields_get_shutdown_scriptpubkey(&this_ptr_conv);
51512         int64_t ret_ref = tag_ptr(ret_copy, true);
51513         return ret_ref;
51514 }
51515
51516 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommonOpenChannelFields_1set_1shutdown_1scriptpubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
51517         LDKCommonOpenChannelFields this_ptr_conv;
51518         this_ptr_conv.inner = untag_ptr(this_ptr);
51519         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51520         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51521         this_ptr_conv.is_owned = false;
51522         void* val_ptr = untag_ptr(val);
51523         CHECK_ACCESS(val_ptr);
51524         LDKCOption_CVec_u8ZZ val_conv = *(LDKCOption_CVec_u8ZZ*)(val_ptr);
51525         val_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(val));
51526         CommonOpenChannelFields_set_shutdown_scriptpubkey(&this_ptr_conv, val_conv);
51527 }
51528
51529 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommonOpenChannelFields_1get_1channel_1type(JNIEnv *env, jclass clz, int64_t this_ptr) {
51530         LDKCommonOpenChannelFields this_ptr_conv;
51531         this_ptr_conv.inner = untag_ptr(this_ptr);
51532         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51533         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51534         this_ptr_conv.is_owned = false;
51535         LDKChannelTypeFeatures ret_var = CommonOpenChannelFields_get_channel_type(&this_ptr_conv);
51536         int64_t ret_ref = 0;
51537         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51538         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51539         return ret_ref;
51540 }
51541
51542 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommonOpenChannelFields_1set_1channel_1type(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
51543         LDKCommonOpenChannelFields this_ptr_conv;
51544         this_ptr_conv.inner = untag_ptr(this_ptr);
51545         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51546         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51547         this_ptr_conv.is_owned = false;
51548         LDKChannelTypeFeatures val_conv;
51549         val_conv.inner = untag_ptr(val);
51550         val_conv.is_owned = ptr_is_owned(val);
51551         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
51552         val_conv = ChannelTypeFeatures_clone(&val_conv);
51553         CommonOpenChannelFields_set_channel_type(&this_ptr_conv, val_conv);
51554 }
51555
51556 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommonOpenChannelFields_1new(JNIEnv *env, jclass clz, int8_tArray chain_hash_arg, int64_t temporary_channel_id_arg, int64_t funding_satoshis_arg, int64_t dust_limit_satoshis_arg, int64_t max_htlc_value_in_flight_msat_arg, int64_t htlc_minimum_msat_arg, int32_t commitment_feerate_sat_per_1000_weight_arg, int16_t to_self_delay_arg, int16_t max_accepted_htlcs_arg, int8_tArray funding_pubkey_arg, int8_tArray revocation_basepoint_arg, int8_tArray payment_basepoint_arg, int8_tArray delayed_payment_basepoint_arg, int8_tArray htlc_basepoint_arg, int8_tArray first_per_commitment_point_arg, int8_t channel_flags_arg, int64_t shutdown_scriptpubkey_arg, int64_t channel_type_arg) {
51557         LDKThirtyTwoBytes chain_hash_arg_ref;
51558         CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
51559         (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
51560         LDKChannelId temporary_channel_id_arg_conv;
51561         temporary_channel_id_arg_conv.inner = untag_ptr(temporary_channel_id_arg);
51562         temporary_channel_id_arg_conv.is_owned = ptr_is_owned(temporary_channel_id_arg);
51563         CHECK_INNER_FIELD_ACCESS_OR_NULL(temporary_channel_id_arg_conv);
51564         temporary_channel_id_arg_conv = ChannelId_clone(&temporary_channel_id_arg_conv);
51565         LDKPublicKey funding_pubkey_arg_ref;
51566         CHECK((*env)->GetArrayLength(env, funding_pubkey_arg) == 33);
51567         (*env)->GetByteArrayRegion(env, funding_pubkey_arg, 0, 33, funding_pubkey_arg_ref.compressed_form);
51568         LDKPublicKey revocation_basepoint_arg_ref;
51569         CHECK((*env)->GetArrayLength(env, revocation_basepoint_arg) == 33);
51570         (*env)->GetByteArrayRegion(env, revocation_basepoint_arg, 0, 33, revocation_basepoint_arg_ref.compressed_form);
51571         LDKPublicKey payment_basepoint_arg_ref;
51572         CHECK((*env)->GetArrayLength(env, payment_basepoint_arg) == 33);
51573         (*env)->GetByteArrayRegion(env, payment_basepoint_arg, 0, 33, payment_basepoint_arg_ref.compressed_form);
51574         LDKPublicKey delayed_payment_basepoint_arg_ref;
51575         CHECK((*env)->GetArrayLength(env, delayed_payment_basepoint_arg) == 33);
51576         (*env)->GetByteArrayRegion(env, delayed_payment_basepoint_arg, 0, 33, delayed_payment_basepoint_arg_ref.compressed_form);
51577         LDKPublicKey htlc_basepoint_arg_ref;
51578         CHECK((*env)->GetArrayLength(env, htlc_basepoint_arg) == 33);
51579         (*env)->GetByteArrayRegion(env, htlc_basepoint_arg, 0, 33, htlc_basepoint_arg_ref.compressed_form);
51580         LDKPublicKey first_per_commitment_point_arg_ref;
51581         CHECK((*env)->GetArrayLength(env, first_per_commitment_point_arg) == 33);
51582         (*env)->GetByteArrayRegion(env, first_per_commitment_point_arg, 0, 33, first_per_commitment_point_arg_ref.compressed_form);
51583         void* shutdown_scriptpubkey_arg_ptr = untag_ptr(shutdown_scriptpubkey_arg);
51584         CHECK_ACCESS(shutdown_scriptpubkey_arg_ptr);
51585         LDKCOption_CVec_u8ZZ shutdown_scriptpubkey_arg_conv = *(LDKCOption_CVec_u8ZZ*)(shutdown_scriptpubkey_arg_ptr);
51586         shutdown_scriptpubkey_arg_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(shutdown_scriptpubkey_arg));
51587         LDKChannelTypeFeatures channel_type_arg_conv;
51588         channel_type_arg_conv.inner = untag_ptr(channel_type_arg);
51589         channel_type_arg_conv.is_owned = ptr_is_owned(channel_type_arg);
51590         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_arg_conv);
51591         channel_type_arg_conv = ChannelTypeFeatures_clone(&channel_type_arg_conv);
51592         LDKCommonOpenChannelFields ret_var = CommonOpenChannelFields_new(chain_hash_arg_ref, temporary_channel_id_arg_conv, funding_satoshis_arg, dust_limit_satoshis_arg, max_htlc_value_in_flight_msat_arg, htlc_minimum_msat_arg, commitment_feerate_sat_per_1000_weight_arg, to_self_delay_arg, max_accepted_htlcs_arg, funding_pubkey_arg_ref, revocation_basepoint_arg_ref, payment_basepoint_arg_ref, delayed_payment_basepoint_arg_ref, htlc_basepoint_arg_ref, first_per_commitment_point_arg_ref, channel_flags_arg, shutdown_scriptpubkey_arg_conv, channel_type_arg_conv);
51593         int64_t ret_ref = 0;
51594         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51595         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51596         return ret_ref;
51597 }
51598
51599 static inline uint64_t CommonOpenChannelFields_clone_ptr(LDKCommonOpenChannelFields *NONNULL_PTR arg) {
51600         LDKCommonOpenChannelFields ret_var = CommonOpenChannelFields_clone(arg);
51601         int64_t ret_ref = 0;
51602         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51603         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51604         return ret_ref;
51605 }
51606 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommonOpenChannelFields_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
51607         LDKCommonOpenChannelFields arg_conv;
51608         arg_conv.inner = untag_ptr(arg);
51609         arg_conv.is_owned = ptr_is_owned(arg);
51610         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
51611         arg_conv.is_owned = false;
51612         int64_t ret_conv = CommonOpenChannelFields_clone_ptr(&arg_conv);
51613         return ret_conv;
51614 }
51615
51616 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommonOpenChannelFields_1clone(JNIEnv *env, jclass clz, int64_t orig) {
51617         LDKCommonOpenChannelFields orig_conv;
51618         orig_conv.inner = untag_ptr(orig);
51619         orig_conv.is_owned = ptr_is_owned(orig);
51620         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
51621         orig_conv.is_owned = false;
51622         LDKCommonOpenChannelFields ret_var = CommonOpenChannelFields_clone(&orig_conv);
51623         int64_t ret_ref = 0;
51624         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51625         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51626         return ret_ref;
51627 }
51628
51629 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommonOpenChannelFields_1hash(JNIEnv *env, jclass clz, int64_t o) {
51630         LDKCommonOpenChannelFields o_conv;
51631         o_conv.inner = untag_ptr(o);
51632         o_conv.is_owned = ptr_is_owned(o);
51633         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
51634         o_conv.is_owned = false;
51635         int64_t ret_conv = CommonOpenChannelFields_hash(&o_conv);
51636         return ret_conv;
51637 }
51638
51639 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CommonOpenChannelFields_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
51640         LDKCommonOpenChannelFields a_conv;
51641         a_conv.inner = untag_ptr(a);
51642         a_conv.is_owned = ptr_is_owned(a);
51643         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
51644         a_conv.is_owned = false;
51645         LDKCommonOpenChannelFields b_conv;
51646         b_conv.inner = untag_ptr(b);
51647         b_conv.is_owned = ptr_is_owned(b);
51648         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
51649         b_conv.is_owned = false;
51650         jboolean ret_conv = CommonOpenChannelFields_eq(&a_conv, &b_conv);
51651         return ret_conv;
51652 }
51653
51654 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
51655         LDKOpenChannel this_obj_conv;
51656         this_obj_conv.inner = untag_ptr(this_obj);
51657         this_obj_conv.is_owned = ptr_is_owned(this_obj);
51658         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
51659         OpenChannel_free(this_obj_conv);
51660 }
51661
51662 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1common_1fields(JNIEnv *env, jclass clz, int64_t this_ptr) {
51663         LDKOpenChannel this_ptr_conv;
51664         this_ptr_conv.inner = untag_ptr(this_ptr);
51665         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51666         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51667         this_ptr_conv.is_owned = false;
51668         LDKCommonOpenChannelFields ret_var = OpenChannel_get_common_fields(&this_ptr_conv);
51669         int64_t ret_ref = 0;
51670         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51671         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51672         return ret_ref;
51673 }
51674
51675 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1common_1fields(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
51676         LDKOpenChannel this_ptr_conv;
51677         this_ptr_conv.inner = untag_ptr(this_ptr);
51678         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51679         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51680         this_ptr_conv.is_owned = false;
51681         LDKCommonOpenChannelFields val_conv;
51682         val_conv.inner = untag_ptr(val);
51683         val_conv.is_owned = ptr_is_owned(val);
51684         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
51685         val_conv = CommonOpenChannelFields_clone(&val_conv);
51686         OpenChannel_set_common_fields(&this_ptr_conv, val_conv);
51687 }
51688
51689 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1push_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
51690         LDKOpenChannel this_ptr_conv;
51691         this_ptr_conv.inner = untag_ptr(this_ptr);
51692         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51693         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51694         this_ptr_conv.is_owned = false;
51695         int64_t ret_conv = OpenChannel_get_push_msat(&this_ptr_conv);
51696         return ret_conv;
51697 }
51698
51699 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1push_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
51700         LDKOpenChannel this_ptr_conv;
51701         this_ptr_conv.inner = untag_ptr(this_ptr);
51702         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51703         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51704         this_ptr_conv.is_owned = false;
51705         OpenChannel_set_push_msat(&this_ptr_conv, val);
51706 }
51707
51708 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1channel_1reserve_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
51709         LDKOpenChannel this_ptr_conv;
51710         this_ptr_conv.inner = untag_ptr(this_ptr);
51711         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51712         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51713         this_ptr_conv.is_owned = false;
51714         int64_t ret_conv = OpenChannel_get_channel_reserve_satoshis(&this_ptr_conv);
51715         return ret_conv;
51716 }
51717
51718 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1channel_1reserve_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
51719         LDKOpenChannel this_ptr_conv;
51720         this_ptr_conv.inner = untag_ptr(this_ptr);
51721         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51722         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51723         this_ptr_conv.is_owned = false;
51724         OpenChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
51725 }
51726
51727 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1new(JNIEnv *env, jclass clz, int64_t common_fields_arg, int64_t push_msat_arg, int64_t channel_reserve_satoshis_arg) {
51728         LDKCommonOpenChannelFields common_fields_arg_conv;
51729         common_fields_arg_conv.inner = untag_ptr(common_fields_arg);
51730         common_fields_arg_conv.is_owned = ptr_is_owned(common_fields_arg);
51731         CHECK_INNER_FIELD_ACCESS_OR_NULL(common_fields_arg_conv);
51732         common_fields_arg_conv = CommonOpenChannelFields_clone(&common_fields_arg_conv);
51733         LDKOpenChannel ret_var = OpenChannel_new(common_fields_arg_conv, push_msat_arg, channel_reserve_satoshis_arg);
51734         int64_t ret_ref = 0;
51735         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51736         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51737         return ret_ref;
51738 }
51739
51740 static inline uint64_t OpenChannel_clone_ptr(LDKOpenChannel *NONNULL_PTR arg) {
51741         LDKOpenChannel ret_var = OpenChannel_clone(arg);
51742         int64_t ret_ref = 0;
51743         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51744         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51745         return ret_ref;
51746 }
51747 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
51748         LDKOpenChannel arg_conv;
51749         arg_conv.inner = untag_ptr(arg);
51750         arg_conv.is_owned = ptr_is_owned(arg);
51751         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
51752         arg_conv.is_owned = false;
51753         int64_t ret_conv = OpenChannel_clone_ptr(&arg_conv);
51754         return ret_conv;
51755 }
51756
51757 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1clone(JNIEnv *env, jclass clz, int64_t orig) {
51758         LDKOpenChannel orig_conv;
51759         orig_conv.inner = untag_ptr(orig);
51760         orig_conv.is_owned = ptr_is_owned(orig);
51761         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
51762         orig_conv.is_owned = false;
51763         LDKOpenChannel ret_var = OpenChannel_clone(&orig_conv);
51764         int64_t ret_ref = 0;
51765         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51766         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51767         return ret_ref;
51768 }
51769
51770 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1hash(JNIEnv *env, jclass clz, int64_t o) {
51771         LDKOpenChannel o_conv;
51772         o_conv.inner = untag_ptr(o);
51773         o_conv.is_owned = ptr_is_owned(o);
51774         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
51775         o_conv.is_owned = false;
51776         int64_t ret_conv = OpenChannel_hash(&o_conv);
51777         return ret_conv;
51778 }
51779
51780 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_OpenChannel_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
51781         LDKOpenChannel a_conv;
51782         a_conv.inner = untag_ptr(a);
51783         a_conv.is_owned = ptr_is_owned(a);
51784         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
51785         a_conv.is_owned = false;
51786         LDKOpenChannel b_conv;
51787         b_conv.inner = untag_ptr(b);
51788         b_conv.is_owned = ptr_is_owned(b);
51789         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
51790         b_conv.is_owned = false;
51791         jboolean ret_conv = OpenChannel_eq(&a_conv, &b_conv);
51792         return ret_conv;
51793 }
51794
51795 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
51796         LDKOpenChannelV2 this_obj_conv;
51797         this_obj_conv.inner = untag_ptr(this_obj);
51798         this_obj_conv.is_owned = ptr_is_owned(this_obj);
51799         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
51800         OpenChannelV2_free(this_obj_conv);
51801 }
51802
51803 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1get_1common_1fields(JNIEnv *env, jclass clz, int64_t this_ptr) {
51804         LDKOpenChannelV2 this_ptr_conv;
51805         this_ptr_conv.inner = untag_ptr(this_ptr);
51806         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51807         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51808         this_ptr_conv.is_owned = false;
51809         LDKCommonOpenChannelFields ret_var = OpenChannelV2_get_common_fields(&this_ptr_conv);
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
51816 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1set_1common_1fields(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
51817         LDKOpenChannelV2 this_ptr_conv;
51818         this_ptr_conv.inner = untag_ptr(this_ptr);
51819         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51820         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51821         this_ptr_conv.is_owned = false;
51822         LDKCommonOpenChannelFields val_conv;
51823         val_conv.inner = untag_ptr(val);
51824         val_conv.is_owned = ptr_is_owned(val);
51825         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
51826         val_conv = CommonOpenChannelFields_clone(&val_conv);
51827         OpenChannelV2_set_common_fields(&this_ptr_conv, val_conv);
51828 }
51829
51830 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) {
51831         LDKOpenChannelV2 this_ptr_conv;
51832         this_ptr_conv.inner = untag_ptr(this_ptr);
51833         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51834         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51835         this_ptr_conv.is_owned = false;
51836         int32_t ret_conv = OpenChannelV2_get_funding_feerate_sat_per_1000_weight(&this_ptr_conv);
51837         return ret_conv;
51838 }
51839
51840 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) {
51841         LDKOpenChannelV2 this_ptr_conv;
51842         this_ptr_conv.inner = untag_ptr(this_ptr);
51843         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51844         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51845         this_ptr_conv.is_owned = false;
51846         OpenChannelV2_set_funding_feerate_sat_per_1000_weight(&this_ptr_conv, val);
51847 }
51848
51849 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1get_1locktime(JNIEnv *env, jclass clz, int64_t this_ptr) {
51850         LDKOpenChannelV2 this_ptr_conv;
51851         this_ptr_conv.inner = untag_ptr(this_ptr);
51852         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51853         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51854         this_ptr_conv.is_owned = false;
51855         int32_t ret_conv = OpenChannelV2_get_locktime(&this_ptr_conv);
51856         return ret_conv;
51857 }
51858
51859 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1set_1locktime(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
51860         LDKOpenChannelV2 this_ptr_conv;
51861         this_ptr_conv.inner = untag_ptr(this_ptr);
51862         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51863         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51864         this_ptr_conv.is_owned = false;
51865         OpenChannelV2_set_locktime(&this_ptr_conv, val);
51866 }
51867
51868 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1get_1second_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
51869         LDKOpenChannelV2 this_ptr_conv;
51870         this_ptr_conv.inner = untag_ptr(this_ptr);
51871         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51872         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51873         this_ptr_conv.is_owned = false;
51874         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
51875         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannelV2_get_second_per_commitment_point(&this_ptr_conv).compressed_form);
51876         return ret_arr;
51877 }
51878
51879 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) {
51880         LDKOpenChannelV2 this_ptr_conv;
51881         this_ptr_conv.inner = untag_ptr(this_ptr);
51882         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51883         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51884         this_ptr_conv.is_owned = false;
51885         LDKPublicKey val_ref;
51886         CHECK((*env)->GetArrayLength(env, val) == 33);
51887         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
51888         OpenChannelV2_set_second_per_commitment_point(&this_ptr_conv, val_ref);
51889 }
51890
51891 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1get_1require_1confirmed_1inputs(JNIEnv *env, jclass clz, int64_t this_ptr) {
51892         LDKOpenChannelV2 this_ptr_conv;
51893         this_ptr_conv.inner = untag_ptr(this_ptr);
51894         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51895         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51896         this_ptr_conv.is_owned = false;
51897         jclass ret_conv = LDKCOption_NoneZ_to_java(env, OpenChannelV2_get_require_confirmed_inputs(&this_ptr_conv));
51898         return ret_conv;
51899 }
51900
51901 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1set_1require_1confirmed_1inputs(JNIEnv *env, jclass clz, int64_t this_ptr, jclass val) {
51902         LDKOpenChannelV2 this_ptr_conv;
51903         this_ptr_conv.inner = untag_ptr(this_ptr);
51904         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51905         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51906         this_ptr_conv.is_owned = false;
51907         LDKCOption_NoneZ val_conv = LDKCOption_NoneZ_from_java(env, val);
51908         OpenChannelV2_set_require_confirmed_inputs(&this_ptr_conv, val_conv);
51909 }
51910
51911 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1new(JNIEnv *env, jclass clz, int64_t common_fields_arg, int32_t funding_feerate_sat_per_1000_weight_arg, int32_t locktime_arg, int8_tArray second_per_commitment_point_arg, jclass require_confirmed_inputs_arg) {
51912         LDKCommonOpenChannelFields common_fields_arg_conv;
51913         common_fields_arg_conv.inner = untag_ptr(common_fields_arg);
51914         common_fields_arg_conv.is_owned = ptr_is_owned(common_fields_arg);
51915         CHECK_INNER_FIELD_ACCESS_OR_NULL(common_fields_arg_conv);
51916         common_fields_arg_conv = CommonOpenChannelFields_clone(&common_fields_arg_conv);
51917         LDKPublicKey second_per_commitment_point_arg_ref;
51918         CHECK((*env)->GetArrayLength(env, second_per_commitment_point_arg) == 33);
51919         (*env)->GetByteArrayRegion(env, second_per_commitment_point_arg, 0, 33, second_per_commitment_point_arg_ref.compressed_form);
51920         LDKCOption_NoneZ require_confirmed_inputs_arg_conv = LDKCOption_NoneZ_from_java(env, require_confirmed_inputs_arg);
51921         LDKOpenChannelV2 ret_var = OpenChannelV2_new(common_fields_arg_conv, funding_feerate_sat_per_1000_weight_arg, locktime_arg, second_per_commitment_point_arg_ref, require_confirmed_inputs_arg_conv);
51922         int64_t ret_ref = 0;
51923         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51924         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51925         return ret_ref;
51926 }
51927
51928 static inline uint64_t OpenChannelV2_clone_ptr(LDKOpenChannelV2 *NONNULL_PTR arg) {
51929         LDKOpenChannelV2 ret_var = OpenChannelV2_clone(arg);
51930         int64_t ret_ref = 0;
51931         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51932         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51933         return ret_ref;
51934 }
51935 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
51936         LDKOpenChannelV2 arg_conv;
51937         arg_conv.inner = untag_ptr(arg);
51938         arg_conv.is_owned = ptr_is_owned(arg);
51939         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
51940         arg_conv.is_owned = false;
51941         int64_t ret_conv = OpenChannelV2_clone_ptr(&arg_conv);
51942         return ret_conv;
51943 }
51944
51945 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1clone(JNIEnv *env, jclass clz, int64_t orig) {
51946         LDKOpenChannelV2 orig_conv;
51947         orig_conv.inner = untag_ptr(orig);
51948         orig_conv.is_owned = ptr_is_owned(orig);
51949         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
51950         orig_conv.is_owned = false;
51951         LDKOpenChannelV2 ret_var = OpenChannelV2_clone(&orig_conv);
51952         int64_t ret_ref = 0;
51953         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
51954         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
51955         return ret_ref;
51956 }
51957
51958 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1hash(JNIEnv *env, jclass clz, int64_t o) {
51959         LDKOpenChannelV2 o_conv;
51960         o_conv.inner = untag_ptr(o);
51961         o_conv.is_owned = ptr_is_owned(o);
51962         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
51963         o_conv.is_owned = false;
51964         int64_t ret_conv = OpenChannelV2_hash(&o_conv);
51965         return ret_conv;
51966 }
51967
51968 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
51969         LDKOpenChannelV2 a_conv;
51970         a_conv.inner = untag_ptr(a);
51971         a_conv.is_owned = ptr_is_owned(a);
51972         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
51973         a_conv.is_owned = false;
51974         LDKOpenChannelV2 b_conv;
51975         b_conv.inner = untag_ptr(b);
51976         b_conv.is_owned = ptr_is_owned(b);
51977         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
51978         b_conv.is_owned = false;
51979         jboolean ret_conv = OpenChannelV2_eq(&a_conv, &b_conv);
51980         return ret_conv;
51981 }
51982
51983 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommonAcceptChannelFields_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
51984         LDKCommonAcceptChannelFields this_obj_conv;
51985         this_obj_conv.inner = untag_ptr(this_obj);
51986         this_obj_conv.is_owned = ptr_is_owned(this_obj);
51987         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
51988         CommonAcceptChannelFields_free(this_obj_conv);
51989 }
51990
51991 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommonAcceptChannelFields_1get_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
51992         LDKCommonAcceptChannelFields this_ptr_conv;
51993         this_ptr_conv.inner = untag_ptr(this_ptr);
51994         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
51995         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
51996         this_ptr_conv.is_owned = false;
51997         LDKChannelId ret_var = CommonAcceptChannelFields_get_temporary_channel_id(&this_ptr_conv);
51998         int64_t ret_ref = 0;
51999         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52000         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52001         return ret_ref;
52002 }
52003
52004 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommonAcceptChannelFields_1set_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
52005         LDKCommonAcceptChannelFields this_ptr_conv;
52006         this_ptr_conv.inner = untag_ptr(this_ptr);
52007         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52008         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52009         this_ptr_conv.is_owned = false;
52010         LDKChannelId val_conv;
52011         val_conv.inner = untag_ptr(val);
52012         val_conv.is_owned = ptr_is_owned(val);
52013         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
52014         val_conv = ChannelId_clone(&val_conv);
52015         CommonAcceptChannelFields_set_temporary_channel_id(&this_ptr_conv, val_conv);
52016 }
52017
52018 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommonAcceptChannelFields_1get_1dust_1limit_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
52019         LDKCommonAcceptChannelFields this_ptr_conv;
52020         this_ptr_conv.inner = untag_ptr(this_ptr);
52021         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52022         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52023         this_ptr_conv.is_owned = false;
52024         int64_t ret_conv = CommonAcceptChannelFields_get_dust_limit_satoshis(&this_ptr_conv);
52025         return ret_conv;
52026 }
52027
52028 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommonAcceptChannelFields_1set_1dust_1limit_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
52029         LDKCommonAcceptChannelFields this_ptr_conv;
52030         this_ptr_conv.inner = untag_ptr(this_ptr);
52031         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52032         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52033         this_ptr_conv.is_owned = false;
52034         CommonAcceptChannelFields_set_dust_limit_satoshis(&this_ptr_conv, val);
52035 }
52036
52037 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommonAcceptChannelFields_1get_1max_1htlc_1value_1in_1flight_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
52038         LDKCommonAcceptChannelFields this_ptr_conv;
52039         this_ptr_conv.inner = untag_ptr(this_ptr);
52040         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52041         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52042         this_ptr_conv.is_owned = false;
52043         int64_t ret_conv = CommonAcceptChannelFields_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
52044         return ret_conv;
52045 }
52046
52047 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommonAcceptChannelFields_1set_1max_1htlc_1value_1in_1flight_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
52048         LDKCommonAcceptChannelFields this_ptr_conv;
52049         this_ptr_conv.inner = untag_ptr(this_ptr);
52050         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52051         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52052         this_ptr_conv.is_owned = false;
52053         CommonAcceptChannelFields_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
52054 }
52055
52056 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommonAcceptChannelFields_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
52057         LDKCommonAcceptChannelFields this_ptr_conv;
52058         this_ptr_conv.inner = untag_ptr(this_ptr);
52059         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52060         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52061         this_ptr_conv.is_owned = false;
52062         int64_t ret_conv = CommonAcceptChannelFields_get_htlc_minimum_msat(&this_ptr_conv);
52063         return ret_conv;
52064 }
52065
52066 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommonAcceptChannelFields_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
52067         LDKCommonAcceptChannelFields this_ptr_conv;
52068         this_ptr_conv.inner = untag_ptr(this_ptr);
52069         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52070         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52071         this_ptr_conv.is_owned = false;
52072         CommonAcceptChannelFields_set_htlc_minimum_msat(&this_ptr_conv, val);
52073 }
52074
52075 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_CommonAcceptChannelFields_1get_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr) {
52076         LDKCommonAcceptChannelFields this_ptr_conv;
52077         this_ptr_conv.inner = untag_ptr(this_ptr);
52078         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52079         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52080         this_ptr_conv.is_owned = false;
52081         int32_t ret_conv = CommonAcceptChannelFields_get_minimum_depth(&this_ptr_conv);
52082         return ret_conv;
52083 }
52084
52085 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommonAcceptChannelFields_1set_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
52086         LDKCommonAcceptChannelFields this_ptr_conv;
52087         this_ptr_conv.inner = untag_ptr(this_ptr);
52088         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52089         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52090         this_ptr_conv.is_owned = false;
52091         CommonAcceptChannelFields_set_minimum_depth(&this_ptr_conv, val);
52092 }
52093
52094 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_CommonAcceptChannelFields_1get_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
52095         LDKCommonAcceptChannelFields this_ptr_conv;
52096         this_ptr_conv.inner = untag_ptr(this_ptr);
52097         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52098         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52099         this_ptr_conv.is_owned = false;
52100         int16_t ret_conv = CommonAcceptChannelFields_get_to_self_delay(&this_ptr_conv);
52101         return ret_conv;
52102 }
52103
52104 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommonAcceptChannelFields_1set_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
52105         LDKCommonAcceptChannelFields this_ptr_conv;
52106         this_ptr_conv.inner = untag_ptr(this_ptr);
52107         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52108         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52109         this_ptr_conv.is_owned = false;
52110         CommonAcceptChannelFields_set_to_self_delay(&this_ptr_conv, val);
52111 }
52112
52113 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_CommonAcceptChannelFields_1get_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
52114         LDKCommonAcceptChannelFields this_ptr_conv;
52115         this_ptr_conv.inner = untag_ptr(this_ptr);
52116         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52117         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52118         this_ptr_conv.is_owned = false;
52119         int16_t ret_conv = CommonAcceptChannelFields_get_max_accepted_htlcs(&this_ptr_conv);
52120         return ret_conv;
52121 }
52122
52123 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommonAcceptChannelFields_1set_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
52124         LDKCommonAcceptChannelFields this_ptr_conv;
52125         this_ptr_conv.inner = untag_ptr(this_ptr);
52126         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52127         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52128         this_ptr_conv.is_owned = false;
52129         CommonAcceptChannelFields_set_max_accepted_htlcs(&this_ptr_conv, val);
52130 }
52131
52132 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CommonAcceptChannelFields_1get_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
52133         LDKCommonAcceptChannelFields this_ptr_conv;
52134         this_ptr_conv.inner = untag_ptr(this_ptr);
52135         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52136         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52137         this_ptr_conv.is_owned = false;
52138         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
52139         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, CommonAcceptChannelFields_get_funding_pubkey(&this_ptr_conv).compressed_form);
52140         return ret_arr;
52141 }
52142
52143 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommonAcceptChannelFields_1set_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
52144         LDKCommonAcceptChannelFields this_ptr_conv;
52145         this_ptr_conv.inner = untag_ptr(this_ptr);
52146         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52147         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52148         this_ptr_conv.is_owned = false;
52149         LDKPublicKey val_ref;
52150         CHECK((*env)->GetArrayLength(env, val) == 33);
52151         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
52152         CommonAcceptChannelFields_set_funding_pubkey(&this_ptr_conv, val_ref);
52153 }
52154
52155 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CommonAcceptChannelFields_1get_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
52156         LDKCommonAcceptChannelFields this_ptr_conv;
52157         this_ptr_conv.inner = untag_ptr(this_ptr);
52158         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52159         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52160         this_ptr_conv.is_owned = false;
52161         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
52162         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, CommonAcceptChannelFields_get_revocation_basepoint(&this_ptr_conv).compressed_form);
52163         return ret_arr;
52164 }
52165
52166 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommonAcceptChannelFields_1set_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
52167         LDKCommonAcceptChannelFields this_ptr_conv;
52168         this_ptr_conv.inner = untag_ptr(this_ptr);
52169         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52170         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52171         this_ptr_conv.is_owned = false;
52172         LDKPublicKey val_ref;
52173         CHECK((*env)->GetArrayLength(env, val) == 33);
52174         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
52175         CommonAcceptChannelFields_set_revocation_basepoint(&this_ptr_conv, val_ref);
52176 }
52177
52178 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CommonAcceptChannelFields_1get_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
52179         LDKCommonAcceptChannelFields this_ptr_conv;
52180         this_ptr_conv.inner = untag_ptr(this_ptr);
52181         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52182         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52183         this_ptr_conv.is_owned = false;
52184         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
52185         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, CommonAcceptChannelFields_get_payment_basepoint(&this_ptr_conv).compressed_form);
52186         return ret_arr;
52187 }
52188
52189 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommonAcceptChannelFields_1set_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
52190         LDKCommonAcceptChannelFields this_ptr_conv;
52191         this_ptr_conv.inner = untag_ptr(this_ptr);
52192         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52193         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52194         this_ptr_conv.is_owned = false;
52195         LDKPublicKey val_ref;
52196         CHECK((*env)->GetArrayLength(env, val) == 33);
52197         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
52198         CommonAcceptChannelFields_set_payment_basepoint(&this_ptr_conv, val_ref);
52199 }
52200
52201 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CommonAcceptChannelFields_1get_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
52202         LDKCommonAcceptChannelFields this_ptr_conv;
52203         this_ptr_conv.inner = untag_ptr(this_ptr);
52204         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52205         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52206         this_ptr_conv.is_owned = false;
52207         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
52208         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, CommonAcceptChannelFields_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form);
52209         return ret_arr;
52210 }
52211
52212 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommonAcceptChannelFields_1set_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
52213         LDKCommonAcceptChannelFields this_ptr_conv;
52214         this_ptr_conv.inner = untag_ptr(this_ptr);
52215         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52216         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52217         this_ptr_conv.is_owned = false;
52218         LDKPublicKey val_ref;
52219         CHECK((*env)->GetArrayLength(env, val) == 33);
52220         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
52221         CommonAcceptChannelFields_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
52222 }
52223
52224 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CommonAcceptChannelFields_1get_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
52225         LDKCommonAcceptChannelFields this_ptr_conv;
52226         this_ptr_conv.inner = untag_ptr(this_ptr);
52227         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52228         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52229         this_ptr_conv.is_owned = false;
52230         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
52231         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, CommonAcceptChannelFields_get_htlc_basepoint(&this_ptr_conv).compressed_form);
52232         return ret_arr;
52233 }
52234
52235 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommonAcceptChannelFields_1set_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
52236         LDKCommonAcceptChannelFields this_ptr_conv;
52237         this_ptr_conv.inner = untag_ptr(this_ptr);
52238         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52239         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52240         this_ptr_conv.is_owned = false;
52241         LDKPublicKey val_ref;
52242         CHECK((*env)->GetArrayLength(env, val) == 33);
52243         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
52244         CommonAcceptChannelFields_set_htlc_basepoint(&this_ptr_conv, val_ref);
52245 }
52246
52247 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CommonAcceptChannelFields_1get_1first_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
52248         LDKCommonAcceptChannelFields 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, 33);
52254         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, CommonAcceptChannelFields_get_first_per_commitment_point(&this_ptr_conv).compressed_form);
52255         return ret_arr;
52256 }
52257
52258 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommonAcceptChannelFields_1set_1first_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
52259         LDKCommonAcceptChannelFields 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         LDKPublicKey val_ref;
52265         CHECK((*env)->GetArrayLength(env, val) == 33);
52266         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
52267         CommonAcceptChannelFields_set_first_per_commitment_point(&this_ptr_conv, val_ref);
52268 }
52269
52270 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommonAcceptChannelFields_1get_1shutdown_1scriptpubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
52271         LDKCommonAcceptChannelFields 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         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
52277         *ret_copy = CommonAcceptChannelFields_get_shutdown_scriptpubkey(&this_ptr_conv);
52278         int64_t ret_ref = tag_ptr(ret_copy, true);
52279         return ret_ref;
52280 }
52281
52282 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommonAcceptChannelFields_1set_1shutdown_1scriptpubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
52283         LDKCommonAcceptChannelFields this_ptr_conv;
52284         this_ptr_conv.inner = untag_ptr(this_ptr);
52285         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52286         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52287         this_ptr_conv.is_owned = false;
52288         void* val_ptr = untag_ptr(val);
52289         CHECK_ACCESS(val_ptr);
52290         LDKCOption_CVec_u8ZZ val_conv = *(LDKCOption_CVec_u8ZZ*)(val_ptr);
52291         val_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(val));
52292         CommonAcceptChannelFields_set_shutdown_scriptpubkey(&this_ptr_conv, val_conv);
52293 }
52294
52295 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommonAcceptChannelFields_1get_1channel_1type(JNIEnv *env, jclass clz, int64_t this_ptr) {
52296         LDKCommonAcceptChannelFields this_ptr_conv;
52297         this_ptr_conv.inner = untag_ptr(this_ptr);
52298         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52299         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52300         this_ptr_conv.is_owned = false;
52301         LDKChannelTypeFeatures ret_var = CommonAcceptChannelFields_get_channel_type(&this_ptr_conv);
52302         int64_t ret_ref = 0;
52303         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52304         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52305         return ret_ref;
52306 }
52307
52308 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommonAcceptChannelFields_1set_1channel_1type(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
52309         LDKCommonAcceptChannelFields this_ptr_conv;
52310         this_ptr_conv.inner = untag_ptr(this_ptr);
52311         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52312         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52313         this_ptr_conv.is_owned = false;
52314         LDKChannelTypeFeatures val_conv;
52315         val_conv.inner = untag_ptr(val);
52316         val_conv.is_owned = ptr_is_owned(val);
52317         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
52318         val_conv = ChannelTypeFeatures_clone(&val_conv);
52319         CommonAcceptChannelFields_set_channel_type(&this_ptr_conv, val_conv);
52320 }
52321
52322 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommonAcceptChannelFields_1new(JNIEnv *env, jclass clz, int64_t temporary_channel_id_arg, int64_t dust_limit_satoshis_arg, int64_t max_htlc_value_in_flight_msat_arg, int64_t htlc_minimum_msat_arg, int32_t minimum_depth_arg, int16_t to_self_delay_arg, int16_t max_accepted_htlcs_arg, int8_tArray funding_pubkey_arg, int8_tArray revocation_basepoint_arg, int8_tArray payment_basepoint_arg, int8_tArray delayed_payment_basepoint_arg, int8_tArray htlc_basepoint_arg, int8_tArray first_per_commitment_point_arg, int64_t shutdown_scriptpubkey_arg, int64_t channel_type_arg) {
52323         LDKChannelId temporary_channel_id_arg_conv;
52324         temporary_channel_id_arg_conv.inner = untag_ptr(temporary_channel_id_arg);
52325         temporary_channel_id_arg_conv.is_owned = ptr_is_owned(temporary_channel_id_arg);
52326         CHECK_INNER_FIELD_ACCESS_OR_NULL(temporary_channel_id_arg_conv);
52327         temporary_channel_id_arg_conv = ChannelId_clone(&temporary_channel_id_arg_conv);
52328         LDKPublicKey funding_pubkey_arg_ref;
52329         CHECK((*env)->GetArrayLength(env, funding_pubkey_arg) == 33);
52330         (*env)->GetByteArrayRegion(env, funding_pubkey_arg, 0, 33, funding_pubkey_arg_ref.compressed_form);
52331         LDKPublicKey revocation_basepoint_arg_ref;
52332         CHECK((*env)->GetArrayLength(env, revocation_basepoint_arg) == 33);
52333         (*env)->GetByteArrayRegion(env, revocation_basepoint_arg, 0, 33, revocation_basepoint_arg_ref.compressed_form);
52334         LDKPublicKey payment_basepoint_arg_ref;
52335         CHECK((*env)->GetArrayLength(env, payment_basepoint_arg) == 33);
52336         (*env)->GetByteArrayRegion(env, payment_basepoint_arg, 0, 33, payment_basepoint_arg_ref.compressed_form);
52337         LDKPublicKey delayed_payment_basepoint_arg_ref;
52338         CHECK((*env)->GetArrayLength(env, delayed_payment_basepoint_arg) == 33);
52339         (*env)->GetByteArrayRegion(env, delayed_payment_basepoint_arg, 0, 33, delayed_payment_basepoint_arg_ref.compressed_form);
52340         LDKPublicKey htlc_basepoint_arg_ref;
52341         CHECK((*env)->GetArrayLength(env, htlc_basepoint_arg) == 33);
52342         (*env)->GetByteArrayRegion(env, htlc_basepoint_arg, 0, 33, htlc_basepoint_arg_ref.compressed_form);
52343         LDKPublicKey first_per_commitment_point_arg_ref;
52344         CHECK((*env)->GetArrayLength(env, first_per_commitment_point_arg) == 33);
52345         (*env)->GetByteArrayRegion(env, first_per_commitment_point_arg, 0, 33, first_per_commitment_point_arg_ref.compressed_form);
52346         void* shutdown_scriptpubkey_arg_ptr = untag_ptr(shutdown_scriptpubkey_arg);
52347         CHECK_ACCESS(shutdown_scriptpubkey_arg_ptr);
52348         LDKCOption_CVec_u8ZZ shutdown_scriptpubkey_arg_conv = *(LDKCOption_CVec_u8ZZ*)(shutdown_scriptpubkey_arg_ptr);
52349         shutdown_scriptpubkey_arg_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(shutdown_scriptpubkey_arg));
52350         LDKChannelTypeFeatures channel_type_arg_conv;
52351         channel_type_arg_conv.inner = untag_ptr(channel_type_arg);
52352         channel_type_arg_conv.is_owned = ptr_is_owned(channel_type_arg);
52353         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_arg_conv);
52354         channel_type_arg_conv = ChannelTypeFeatures_clone(&channel_type_arg_conv);
52355         LDKCommonAcceptChannelFields ret_var = CommonAcceptChannelFields_new(temporary_channel_id_arg_conv, dust_limit_satoshis_arg, max_htlc_value_in_flight_msat_arg, htlc_minimum_msat_arg, minimum_depth_arg, to_self_delay_arg, max_accepted_htlcs_arg, funding_pubkey_arg_ref, revocation_basepoint_arg_ref, payment_basepoint_arg_ref, delayed_payment_basepoint_arg_ref, htlc_basepoint_arg_ref, first_per_commitment_point_arg_ref, shutdown_scriptpubkey_arg_conv, channel_type_arg_conv);
52356         int64_t ret_ref = 0;
52357         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52358         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52359         return ret_ref;
52360 }
52361
52362 static inline uint64_t CommonAcceptChannelFields_clone_ptr(LDKCommonAcceptChannelFields *NONNULL_PTR arg) {
52363         LDKCommonAcceptChannelFields ret_var = CommonAcceptChannelFields_clone(arg);
52364         int64_t ret_ref = 0;
52365         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52366         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52367         return ret_ref;
52368 }
52369 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommonAcceptChannelFields_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
52370         LDKCommonAcceptChannelFields arg_conv;
52371         arg_conv.inner = untag_ptr(arg);
52372         arg_conv.is_owned = ptr_is_owned(arg);
52373         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
52374         arg_conv.is_owned = false;
52375         int64_t ret_conv = CommonAcceptChannelFields_clone_ptr(&arg_conv);
52376         return ret_conv;
52377 }
52378
52379 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommonAcceptChannelFields_1clone(JNIEnv *env, jclass clz, int64_t orig) {
52380         LDKCommonAcceptChannelFields orig_conv;
52381         orig_conv.inner = untag_ptr(orig);
52382         orig_conv.is_owned = ptr_is_owned(orig);
52383         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
52384         orig_conv.is_owned = false;
52385         LDKCommonAcceptChannelFields ret_var = CommonAcceptChannelFields_clone(&orig_conv);
52386         int64_t ret_ref = 0;
52387         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52388         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52389         return ret_ref;
52390 }
52391
52392 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommonAcceptChannelFields_1hash(JNIEnv *env, jclass clz, int64_t o) {
52393         LDKCommonAcceptChannelFields o_conv;
52394         o_conv.inner = untag_ptr(o);
52395         o_conv.is_owned = ptr_is_owned(o);
52396         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
52397         o_conv.is_owned = false;
52398         int64_t ret_conv = CommonAcceptChannelFields_hash(&o_conv);
52399         return ret_conv;
52400 }
52401
52402 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CommonAcceptChannelFields_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
52403         LDKCommonAcceptChannelFields a_conv;
52404         a_conv.inner = untag_ptr(a);
52405         a_conv.is_owned = ptr_is_owned(a);
52406         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
52407         a_conv.is_owned = false;
52408         LDKCommonAcceptChannelFields b_conv;
52409         b_conv.inner = untag_ptr(b);
52410         b_conv.is_owned = ptr_is_owned(b);
52411         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
52412         b_conv.is_owned = false;
52413         jboolean ret_conv = CommonAcceptChannelFields_eq(&a_conv, &b_conv);
52414         return ret_conv;
52415 }
52416
52417 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
52418         LDKAcceptChannel this_obj_conv;
52419         this_obj_conv.inner = untag_ptr(this_obj);
52420         this_obj_conv.is_owned = ptr_is_owned(this_obj);
52421         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
52422         AcceptChannel_free(this_obj_conv);
52423 }
52424
52425 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1common_1fields(JNIEnv *env, jclass clz, int64_t this_ptr) {
52426         LDKAcceptChannel this_ptr_conv;
52427         this_ptr_conv.inner = untag_ptr(this_ptr);
52428         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52429         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52430         this_ptr_conv.is_owned = false;
52431         LDKCommonAcceptChannelFields ret_var = AcceptChannel_get_common_fields(&this_ptr_conv);
52432         int64_t ret_ref = 0;
52433         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52434         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52435         return ret_ref;
52436 }
52437
52438 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1common_1fields(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
52439         LDKAcceptChannel this_ptr_conv;
52440         this_ptr_conv.inner = untag_ptr(this_ptr);
52441         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52442         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52443         this_ptr_conv.is_owned = false;
52444         LDKCommonAcceptChannelFields val_conv;
52445         val_conv.inner = untag_ptr(val);
52446         val_conv.is_owned = ptr_is_owned(val);
52447         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
52448         val_conv = CommonAcceptChannelFields_clone(&val_conv);
52449         AcceptChannel_set_common_fields(&this_ptr_conv, val_conv);
52450 }
52451
52452 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1channel_1reserve_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
52453         LDKAcceptChannel this_ptr_conv;
52454         this_ptr_conv.inner = untag_ptr(this_ptr);
52455         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52456         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52457         this_ptr_conv.is_owned = false;
52458         int64_t ret_conv = AcceptChannel_get_channel_reserve_satoshis(&this_ptr_conv);
52459         return ret_conv;
52460 }
52461
52462 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1channel_1reserve_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
52463         LDKAcceptChannel this_ptr_conv;
52464         this_ptr_conv.inner = untag_ptr(this_ptr);
52465         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52466         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52467         this_ptr_conv.is_owned = false;
52468         AcceptChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
52469 }
52470
52471 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1new(JNIEnv *env, jclass clz, int64_t common_fields_arg, int64_t channel_reserve_satoshis_arg) {
52472         LDKCommonAcceptChannelFields common_fields_arg_conv;
52473         common_fields_arg_conv.inner = untag_ptr(common_fields_arg);
52474         common_fields_arg_conv.is_owned = ptr_is_owned(common_fields_arg);
52475         CHECK_INNER_FIELD_ACCESS_OR_NULL(common_fields_arg_conv);
52476         common_fields_arg_conv = CommonAcceptChannelFields_clone(&common_fields_arg_conv);
52477         LDKAcceptChannel ret_var = AcceptChannel_new(common_fields_arg_conv, channel_reserve_satoshis_arg);
52478         int64_t ret_ref = 0;
52479         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52480         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52481         return ret_ref;
52482 }
52483
52484 static inline uint64_t AcceptChannel_clone_ptr(LDKAcceptChannel *NONNULL_PTR arg) {
52485         LDKAcceptChannel ret_var = AcceptChannel_clone(arg);
52486         int64_t ret_ref = 0;
52487         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52488         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52489         return ret_ref;
52490 }
52491 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
52492         LDKAcceptChannel arg_conv;
52493         arg_conv.inner = untag_ptr(arg);
52494         arg_conv.is_owned = ptr_is_owned(arg);
52495         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
52496         arg_conv.is_owned = false;
52497         int64_t ret_conv = AcceptChannel_clone_ptr(&arg_conv);
52498         return ret_conv;
52499 }
52500
52501 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1clone(JNIEnv *env, jclass clz, int64_t orig) {
52502         LDKAcceptChannel orig_conv;
52503         orig_conv.inner = untag_ptr(orig);
52504         orig_conv.is_owned = ptr_is_owned(orig);
52505         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
52506         orig_conv.is_owned = false;
52507         LDKAcceptChannel ret_var = AcceptChannel_clone(&orig_conv);
52508         int64_t ret_ref = 0;
52509         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52510         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52511         return ret_ref;
52512 }
52513
52514 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1hash(JNIEnv *env, jclass clz, int64_t o) {
52515         LDKAcceptChannel o_conv;
52516         o_conv.inner = untag_ptr(o);
52517         o_conv.is_owned = ptr_is_owned(o);
52518         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
52519         o_conv.is_owned = false;
52520         int64_t ret_conv = AcceptChannel_hash(&o_conv);
52521         return ret_conv;
52522 }
52523
52524 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
52525         LDKAcceptChannel a_conv;
52526         a_conv.inner = untag_ptr(a);
52527         a_conv.is_owned = ptr_is_owned(a);
52528         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
52529         a_conv.is_owned = false;
52530         LDKAcceptChannel b_conv;
52531         b_conv.inner = untag_ptr(b);
52532         b_conv.is_owned = ptr_is_owned(b);
52533         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
52534         b_conv.is_owned = false;
52535         jboolean ret_conv = AcceptChannel_eq(&a_conv, &b_conv);
52536         return ret_conv;
52537 }
52538
52539 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
52540         LDKAcceptChannelV2 this_obj_conv;
52541         this_obj_conv.inner = untag_ptr(this_obj);
52542         this_obj_conv.is_owned = ptr_is_owned(this_obj);
52543         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
52544         AcceptChannelV2_free(this_obj_conv);
52545 }
52546
52547 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1get_1common_1fields(JNIEnv *env, jclass clz, int64_t this_ptr) {
52548         LDKAcceptChannelV2 this_ptr_conv;
52549         this_ptr_conv.inner = untag_ptr(this_ptr);
52550         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52551         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52552         this_ptr_conv.is_owned = false;
52553         LDKCommonAcceptChannelFields ret_var = AcceptChannelV2_get_common_fields(&this_ptr_conv);
52554         int64_t ret_ref = 0;
52555         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52556         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52557         return ret_ref;
52558 }
52559
52560 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1set_1common_1fields(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
52561         LDKAcceptChannelV2 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         LDKCommonAcceptChannelFields val_conv;
52567         val_conv.inner = untag_ptr(val);
52568         val_conv.is_owned = ptr_is_owned(val);
52569         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
52570         val_conv = CommonAcceptChannelFields_clone(&val_conv);
52571         AcceptChannelV2_set_common_fields(&this_ptr_conv, val_conv);
52572 }
52573
52574 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1get_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
52575         LDKAcceptChannelV2 this_ptr_conv;
52576         this_ptr_conv.inner = untag_ptr(this_ptr);
52577         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52578         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52579         this_ptr_conv.is_owned = false;
52580         int64_t ret_conv = AcceptChannelV2_get_funding_satoshis(&this_ptr_conv);
52581         return ret_conv;
52582 }
52583
52584 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1set_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
52585         LDKAcceptChannelV2 this_ptr_conv;
52586         this_ptr_conv.inner = untag_ptr(this_ptr);
52587         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52588         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52589         this_ptr_conv.is_owned = false;
52590         AcceptChannelV2_set_funding_satoshis(&this_ptr_conv, val);
52591 }
52592
52593 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1get_1second_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
52594         LDKAcceptChannelV2 this_ptr_conv;
52595         this_ptr_conv.inner = untag_ptr(this_ptr);
52596         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52597         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52598         this_ptr_conv.is_owned = false;
52599         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
52600         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannelV2_get_second_per_commitment_point(&this_ptr_conv).compressed_form);
52601         return ret_arr;
52602 }
52603
52604 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) {
52605         LDKAcceptChannelV2 this_ptr_conv;
52606         this_ptr_conv.inner = untag_ptr(this_ptr);
52607         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52608         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52609         this_ptr_conv.is_owned = false;
52610         LDKPublicKey val_ref;
52611         CHECK((*env)->GetArrayLength(env, val) == 33);
52612         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
52613         AcceptChannelV2_set_second_per_commitment_point(&this_ptr_conv, val_ref);
52614 }
52615
52616 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1get_1require_1confirmed_1inputs(JNIEnv *env, jclass clz, int64_t this_ptr) {
52617         LDKAcceptChannelV2 this_ptr_conv;
52618         this_ptr_conv.inner = untag_ptr(this_ptr);
52619         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52620         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52621         this_ptr_conv.is_owned = false;
52622         jclass ret_conv = LDKCOption_NoneZ_to_java(env, AcceptChannelV2_get_require_confirmed_inputs(&this_ptr_conv));
52623         return ret_conv;
52624 }
52625
52626 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1set_1require_1confirmed_1inputs(JNIEnv *env, jclass clz, int64_t this_ptr, jclass val) {
52627         LDKAcceptChannelV2 this_ptr_conv;
52628         this_ptr_conv.inner = untag_ptr(this_ptr);
52629         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52630         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52631         this_ptr_conv.is_owned = false;
52632         LDKCOption_NoneZ val_conv = LDKCOption_NoneZ_from_java(env, val);
52633         AcceptChannelV2_set_require_confirmed_inputs(&this_ptr_conv, val_conv);
52634 }
52635
52636 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1new(JNIEnv *env, jclass clz, int64_t common_fields_arg, int64_t funding_satoshis_arg, int8_tArray second_per_commitment_point_arg, jclass require_confirmed_inputs_arg) {
52637         LDKCommonAcceptChannelFields common_fields_arg_conv;
52638         common_fields_arg_conv.inner = untag_ptr(common_fields_arg);
52639         common_fields_arg_conv.is_owned = ptr_is_owned(common_fields_arg);
52640         CHECK_INNER_FIELD_ACCESS_OR_NULL(common_fields_arg_conv);
52641         common_fields_arg_conv = CommonAcceptChannelFields_clone(&common_fields_arg_conv);
52642         LDKPublicKey second_per_commitment_point_arg_ref;
52643         CHECK((*env)->GetArrayLength(env, second_per_commitment_point_arg) == 33);
52644         (*env)->GetByteArrayRegion(env, second_per_commitment_point_arg, 0, 33, second_per_commitment_point_arg_ref.compressed_form);
52645         LDKCOption_NoneZ require_confirmed_inputs_arg_conv = LDKCOption_NoneZ_from_java(env, require_confirmed_inputs_arg);
52646         LDKAcceptChannelV2 ret_var = AcceptChannelV2_new(common_fields_arg_conv, funding_satoshis_arg, second_per_commitment_point_arg_ref, require_confirmed_inputs_arg_conv);
52647         int64_t ret_ref = 0;
52648         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52649         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52650         return ret_ref;
52651 }
52652
52653 static inline uint64_t AcceptChannelV2_clone_ptr(LDKAcceptChannelV2 *NONNULL_PTR arg) {
52654         LDKAcceptChannelV2 ret_var = AcceptChannelV2_clone(arg);
52655         int64_t ret_ref = 0;
52656         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52657         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52658         return ret_ref;
52659 }
52660 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
52661         LDKAcceptChannelV2 arg_conv;
52662         arg_conv.inner = untag_ptr(arg);
52663         arg_conv.is_owned = ptr_is_owned(arg);
52664         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
52665         arg_conv.is_owned = false;
52666         int64_t ret_conv = AcceptChannelV2_clone_ptr(&arg_conv);
52667         return ret_conv;
52668 }
52669
52670 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1clone(JNIEnv *env, jclass clz, int64_t orig) {
52671         LDKAcceptChannelV2 orig_conv;
52672         orig_conv.inner = untag_ptr(orig);
52673         orig_conv.is_owned = ptr_is_owned(orig);
52674         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
52675         orig_conv.is_owned = false;
52676         LDKAcceptChannelV2 ret_var = AcceptChannelV2_clone(&orig_conv);
52677         int64_t ret_ref = 0;
52678         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52679         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52680         return ret_ref;
52681 }
52682
52683 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1hash(JNIEnv *env, jclass clz, int64_t o) {
52684         LDKAcceptChannelV2 o_conv;
52685         o_conv.inner = untag_ptr(o);
52686         o_conv.is_owned = ptr_is_owned(o);
52687         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
52688         o_conv.is_owned = false;
52689         int64_t ret_conv = AcceptChannelV2_hash(&o_conv);
52690         return ret_conv;
52691 }
52692
52693 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
52694         LDKAcceptChannelV2 a_conv;
52695         a_conv.inner = untag_ptr(a);
52696         a_conv.is_owned = ptr_is_owned(a);
52697         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
52698         a_conv.is_owned = false;
52699         LDKAcceptChannelV2 b_conv;
52700         b_conv.inner = untag_ptr(b);
52701         b_conv.is_owned = ptr_is_owned(b);
52702         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
52703         b_conv.is_owned = false;
52704         jboolean ret_conv = AcceptChannelV2_eq(&a_conv, &b_conv);
52705         return ret_conv;
52706 }
52707
52708 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
52709         LDKFundingCreated this_obj_conv;
52710         this_obj_conv.inner = untag_ptr(this_obj);
52711         this_obj_conv.is_owned = ptr_is_owned(this_obj);
52712         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
52713         FundingCreated_free(this_obj_conv);
52714 }
52715
52716 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
52717         LDKFundingCreated this_ptr_conv;
52718         this_ptr_conv.inner = untag_ptr(this_ptr);
52719         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52720         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52721         this_ptr_conv.is_owned = false;
52722         LDKChannelId ret_var = FundingCreated_get_temporary_channel_id(&this_ptr_conv);
52723         int64_t ret_ref = 0;
52724         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52725         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52726         return ret_ref;
52727 }
52728
52729 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
52730         LDKFundingCreated this_ptr_conv;
52731         this_ptr_conv.inner = untag_ptr(this_ptr);
52732         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52733         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52734         this_ptr_conv.is_owned = false;
52735         LDKChannelId val_conv;
52736         val_conv.inner = untag_ptr(val);
52737         val_conv.is_owned = ptr_is_owned(val);
52738         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
52739         val_conv = ChannelId_clone(&val_conv);
52740         FundingCreated_set_temporary_channel_id(&this_ptr_conv, val_conv);
52741 }
52742
52743 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1funding_1txid(JNIEnv *env, jclass clz, int64_t this_ptr) {
52744         LDKFundingCreated this_ptr_conv;
52745         this_ptr_conv.inner = untag_ptr(this_ptr);
52746         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52747         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52748         this_ptr_conv.is_owned = false;
52749         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
52750         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *FundingCreated_get_funding_txid(&this_ptr_conv));
52751         return ret_arr;
52752 }
52753
52754 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1funding_1txid(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
52755         LDKFundingCreated this_ptr_conv;
52756         this_ptr_conv.inner = untag_ptr(this_ptr);
52757         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52758         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52759         this_ptr_conv.is_owned = false;
52760         LDKThirtyTwoBytes val_ref;
52761         CHECK((*env)->GetArrayLength(env, val) == 32);
52762         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
52763         FundingCreated_set_funding_txid(&this_ptr_conv, val_ref);
52764 }
52765
52766 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1funding_1output_1index(JNIEnv *env, jclass clz, int64_t this_ptr) {
52767         LDKFundingCreated this_ptr_conv;
52768         this_ptr_conv.inner = untag_ptr(this_ptr);
52769         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52770         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52771         this_ptr_conv.is_owned = false;
52772         int16_t ret_conv = FundingCreated_get_funding_output_index(&this_ptr_conv);
52773         return ret_conv;
52774 }
52775
52776 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1funding_1output_1index(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
52777         LDKFundingCreated this_ptr_conv;
52778         this_ptr_conv.inner = untag_ptr(this_ptr);
52779         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52780         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52781         this_ptr_conv.is_owned = false;
52782         FundingCreated_set_funding_output_index(&this_ptr_conv, val);
52783 }
52784
52785 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
52786         LDKFundingCreated this_ptr_conv;
52787         this_ptr_conv.inner = untag_ptr(this_ptr);
52788         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52789         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52790         this_ptr_conv.is_owned = false;
52791         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
52792         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, FundingCreated_get_signature(&this_ptr_conv).compact_form);
52793         return ret_arr;
52794 }
52795
52796 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
52797         LDKFundingCreated this_ptr_conv;
52798         this_ptr_conv.inner = untag_ptr(this_ptr);
52799         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52800         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52801         this_ptr_conv.is_owned = false;
52802         LDKECDSASignature val_ref;
52803         CHECK((*env)->GetArrayLength(env, val) == 64);
52804         (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
52805         FundingCreated_set_signature(&this_ptr_conv, val_ref);
52806 }
52807
52808 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingCreated_1new(JNIEnv *env, jclass clz, int64_t temporary_channel_id_arg, int8_tArray funding_txid_arg, int16_t funding_output_index_arg, int8_tArray signature_arg) {
52809         LDKChannelId temporary_channel_id_arg_conv;
52810         temporary_channel_id_arg_conv.inner = untag_ptr(temporary_channel_id_arg);
52811         temporary_channel_id_arg_conv.is_owned = ptr_is_owned(temporary_channel_id_arg);
52812         CHECK_INNER_FIELD_ACCESS_OR_NULL(temporary_channel_id_arg_conv);
52813         temporary_channel_id_arg_conv = ChannelId_clone(&temporary_channel_id_arg_conv);
52814         LDKThirtyTwoBytes funding_txid_arg_ref;
52815         CHECK((*env)->GetArrayLength(env, funding_txid_arg) == 32);
52816         (*env)->GetByteArrayRegion(env, funding_txid_arg, 0, 32, funding_txid_arg_ref.data);
52817         LDKECDSASignature signature_arg_ref;
52818         CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
52819         (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
52820         LDKFundingCreated ret_var = FundingCreated_new(temporary_channel_id_arg_conv, funding_txid_arg_ref, funding_output_index_arg, signature_arg_ref);
52821         int64_t ret_ref = 0;
52822         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52823         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52824         return ret_ref;
52825 }
52826
52827 static inline uint64_t FundingCreated_clone_ptr(LDKFundingCreated *NONNULL_PTR arg) {
52828         LDKFundingCreated ret_var = FundingCreated_clone(arg);
52829         int64_t ret_ref = 0;
52830         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52831         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52832         return ret_ref;
52833 }
52834 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingCreated_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
52835         LDKFundingCreated arg_conv;
52836         arg_conv.inner = untag_ptr(arg);
52837         arg_conv.is_owned = ptr_is_owned(arg);
52838         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
52839         arg_conv.is_owned = false;
52840         int64_t ret_conv = FundingCreated_clone_ptr(&arg_conv);
52841         return ret_conv;
52842 }
52843
52844 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingCreated_1clone(JNIEnv *env, jclass clz, int64_t orig) {
52845         LDKFundingCreated orig_conv;
52846         orig_conv.inner = untag_ptr(orig);
52847         orig_conv.is_owned = ptr_is_owned(orig);
52848         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
52849         orig_conv.is_owned = false;
52850         LDKFundingCreated ret_var = FundingCreated_clone(&orig_conv);
52851         int64_t ret_ref = 0;
52852         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52853         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52854         return ret_ref;
52855 }
52856
52857 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingCreated_1hash(JNIEnv *env, jclass clz, int64_t o) {
52858         LDKFundingCreated o_conv;
52859         o_conv.inner = untag_ptr(o);
52860         o_conv.is_owned = ptr_is_owned(o);
52861         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
52862         o_conv.is_owned = false;
52863         int64_t ret_conv = FundingCreated_hash(&o_conv);
52864         return ret_conv;
52865 }
52866
52867 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_FundingCreated_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
52868         LDKFundingCreated a_conv;
52869         a_conv.inner = untag_ptr(a);
52870         a_conv.is_owned = ptr_is_owned(a);
52871         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
52872         a_conv.is_owned = false;
52873         LDKFundingCreated b_conv;
52874         b_conv.inner = untag_ptr(b);
52875         b_conv.is_owned = ptr_is_owned(b);
52876         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
52877         b_conv.is_owned = false;
52878         jboolean ret_conv = FundingCreated_eq(&a_conv, &b_conv);
52879         return ret_conv;
52880 }
52881
52882 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingSigned_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
52883         LDKFundingSigned this_obj_conv;
52884         this_obj_conv.inner = untag_ptr(this_obj);
52885         this_obj_conv.is_owned = ptr_is_owned(this_obj);
52886         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
52887         FundingSigned_free(this_obj_conv);
52888 }
52889
52890 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingSigned_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
52891         LDKFundingSigned this_ptr_conv;
52892         this_ptr_conv.inner = untag_ptr(this_ptr);
52893         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52894         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52895         this_ptr_conv.is_owned = false;
52896         LDKChannelId ret_var = FundingSigned_get_channel_id(&this_ptr_conv);
52897         int64_t ret_ref = 0;
52898         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52899         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52900         return ret_ref;
52901 }
52902
52903 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingSigned_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
52904         LDKFundingSigned this_ptr_conv;
52905         this_ptr_conv.inner = untag_ptr(this_ptr);
52906         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52907         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52908         this_ptr_conv.is_owned = false;
52909         LDKChannelId val_conv;
52910         val_conv.inner = untag_ptr(val);
52911         val_conv.is_owned = ptr_is_owned(val);
52912         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
52913         val_conv = ChannelId_clone(&val_conv);
52914         FundingSigned_set_channel_id(&this_ptr_conv, val_conv);
52915 }
52916
52917 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingSigned_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
52918         LDKFundingSigned this_ptr_conv;
52919         this_ptr_conv.inner = untag_ptr(this_ptr);
52920         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52921         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52922         this_ptr_conv.is_owned = false;
52923         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
52924         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, FundingSigned_get_signature(&this_ptr_conv).compact_form);
52925         return ret_arr;
52926 }
52927
52928 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingSigned_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
52929         LDKFundingSigned this_ptr_conv;
52930         this_ptr_conv.inner = untag_ptr(this_ptr);
52931         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
52932         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
52933         this_ptr_conv.is_owned = false;
52934         LDKECDSASignature val_ref;
52935         CHECK((*env)->GetArrayLength(env, val) == 64);
52936         (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
52937         FundingSigned_set_signature(&this_ptr_conv, val_ref);
52938 }
52939
52940 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingSigned_1new(JNIEnv *env, jclass clz, int64_t channel_id_arg, int8_tArray signature_arg) {
52941         LDKChannelId channel_id_arg_conv;
52942         channel_id_arg_conv.inner = untag_ptr(channel_id_arg);
52943         channel_id_arg_conv.is_owned = ptr_is_owned(channel_id_arg);
52944         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_arg_conv);
52945         channel_id_arg_conv = ChannelId_clone(&channel_id_arg_conv);
52946         LDKECDSASignature signature_arg_ref;
52947         CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
52948         (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
52949         LDKFundingSigned ret_var = FundingSigned_new(channel_id_arg_conv, signature_arg_ref);
52950         int64_t ret_ref = 0;
52951         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52952         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52953         return ret_ref;
52954 }
52955
52956 static inline uint64_t FundingSigned_clone_ptr(LDKFundingSigned *NONNULL_PTR arg) {
52957         LDKFundingSigned ret_var = FundingSigned_clone(arg);
52958         int64_t ret_ref = 0;
52959         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52960         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52961         return ret_ref;
52962 }
52963 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingSigned_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
52964         LDKFundingSigned arg_conv;
52965         arg_conv.inner = untag_ptr(arg);
52966         arg_conv.is_owned = ptr_is_owned(arg);
52967         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
52968         arg_conv.is_owned = false;
52969         int64_t ret_conv = FundingSigned_clone_ptr(&arg_conv);
52970         return ret_conv;
52971 }
52972
52973 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingSigned_1clone(JNIEnv *env, jclass clz, int64_t orig) {
52974         LDKFundingSigned orig_conv;
52975         orig_conv.inner = untag_ptr(orig);
52976         orig_conv.is_owned = ptr_is_owned(orig);
52977         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
52978         orig_conv.is_owned = false;
52979         LDKFundingSigned ret_var = FundingSigned_clone(&orig_conv);
52980         int64_t ret_ref = 0;
52981         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
52982         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
52983         return ret_ref;
52984 }
52985
52986 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingSigned_1hash(JNIEnv *env, jclass clz, int64_t o) {
52987         LDKFundingSigned o_conv;
52988         o_conv.inner = untag_ptr(o);
52989         o_conv.is_owned = ptr_is_owned(o);
52990         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
52991         o_conv.is_owned = false;
52992         int64_t ret_conv = FundingSigned_hash(&o_conv);
52993         return ret_conv;
52994 }
52995
52996 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_FundingSigned_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
52997         LDKFundingSigned a_conv;
52998         a_conv.inner = untag_ptr(a);
52999         a_conv.is_owned = ptr_is_owned(a);
53000         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
53001         a_conv.is_owned = false;
53002         LDKFundingSigned b_conv;
53003         b_conv.inner = untag_ptr(b);
53004         b_conv.is_owned = ptr_is_owned(b);
53005         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
53006         b_conv.is_owned = false;
53007         jboolean ret_conv = FundingSigned_eq(&a_conv, &b_conv);
53008         return ret_conv;
53009 }
53010
53011 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReady_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
53012         LDKChannelReady this_obj_conv;
53013         this_obj_conv.inner = untag_ptr(this_obj);
53014         this_obj_conv.is_owned = ptr_is_owned(this_obj);
53015         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
53016         ChannelReady_free(this_obj_conv);
53017 }
53018
53019 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReady_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
53020         LDKChannelReady this_ptr_conv;
53021         this_ptr_conv.inner = untag_ptr(this_ptr);
53022         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53023         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53024         this_ptr_conv.is_owned = false;
53025         LDKChannelId ret_var = ChannelReady_get_channel_id(&this_ptr_conv);
53026         int64_t ret_ref = 0;
53027         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53028         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53029         return ret_ref;
53030 }
53031
53032 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReady_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
53033         LDKChannelReady this_ptr_conv;
53034         this_ptr_conv.inner = untag_ptr(this_ptr);
53035         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53036         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53037         this_ptr_conv.is_owned = false;
53038         LDKChannelId val_conv;
53039         val_conv.inner = untag_ptr(val);
53040         val_conv.is_owned = ptr_is_owned(val);
53041         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
53042         val_conv = ChannelId_clone(&val_conv);
53043         ChannelReady_set_channel_id(&this_ptr_conv, val_conv);
53044 }
53045
53046 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelReady_1get_1next_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
53047         LDKChannelReady this_ptr_conv;
53048         this_ptr_conv.inner = untag_ptr(this_ptr);
53049         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53050         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53051         this_ptr_conv.is_owned = false;
53052         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
53053         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelReady_get_next_per_commitment_point(&this_ptr_conv).compressed_form);
53054         return ret_arr;
53055 }
53056
53057 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) {
53058         LDKChannelReady this_ptr_conv;
53059         this_ptr_conv.inner = untag_ptr(this_ptr);
53060         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53061         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53062         this_ptr_conv.is_owned = false;
53063         LDKPublicKey val_ref;
53064         CHECK((*env)->GetArrayLength(env, val) == 33);
53065         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
53066         ChannelReady_set_next_per_commitment_point(&this_ptr_conv, val_ref);
53067 }
53068
53069 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReady_1get_1short_1channel_1id_1alias(JNIEnv *env, jclass clz, int64_t this_ptr) {
53070         LDKChannelReady this_ptr_conv;
53071         this_ptr_conv.inner = untag_ptr(this_ptr);
53072         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53073         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53074         this_ptr_conv.is_owned = false;
53075         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
53076         *ret_copy = ChannelReady_get_short_channel_id_alias(&this_ptr_conv);
53077         int64_t ret_ref = tag_ptr(ret_copy, true);
53078         return ret_ref;
53079 }
53080
53081 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) {
53082         LDKChannelReady this_ptr_conv;
53083         this_ptr_conv.inner = untag_ptr(this_ptr);
53084         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53085         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53086         this_ptr_conv.is_owned = false;
53087         void* val_ptr = untag_ptr(val);
53088         CHECK_ACCESS(val_ptr);
53089         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
53090         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
53091         ChannelReady_set_short_channel_id_alias(&this_ptr_conv, val_conv);
53092 }
53093
53094 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReady_1new(JNIEnv *env, jclass clz, int64_t channel_id_arg, int8_tArray next_per_commitment_point_arg, int64_t short_channel_id_alias_arg) {
53095         LDKChannelId channel_id_arg_conv;
53096         channel_id_arg_conv.inner = untag_ptr(channel_id_arg);
53097         channel_id_arg_conv.is_owned = ptr_is_owned(channel_id_arg);
53098         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_arg_conv);
53099         channel_id_arg_conv = ChannelId_clone(&channel_id_arg_conv);
53100         LDKPublicKey next_per_commitment_point_arg_ref;
53101         CHECK((*env)->GetArrayLength(env, next_per_commitment_point_arg) == 33);
53102         (*env)->GetByteArrayRegion(env, next_per_commitment_point_arg, 0, 33, next_per_commitment_point_arg_ref.compressed_form);
53103         void* short_channel_id_alias_arg_ptr = untag_ptr(short_channel_id_alias_arg);
53104         CHECK_ACCESS(short_channel_id_alias_arg_ptr);
53105         LDKCOption_u64Z short_channel_id_alias_arg_conv = *(LDKCOption_u64Z*)(short_channel_id_alias_arg_ptr);
53106         short_channel_id_alias_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(short_channel_id_alias_arg));
53107         LDKChannelReady ret_var = ChannelReady_new(channel_id_arg_conv, next_per_commitment_point_arg_ref, short_channel_id_alias_arg_conv);
53108         int64_t ret_ref = 0;
53109         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53110         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53111         return ret_ref;
53112 }
53113
53114 static inline uint64_t ChannelReady_clone_ptr(LDKChannelReady *NONNULL_PTR arg) {
53115         LDKChannelReady ret_var = ChannelReady_clone(arg);
53116         int64_t ret_ref = 0;
53117         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53118         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53119         return ret_ref;
53120 }
53121 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReady_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
53122         LDKChannelReady arg_conv;
53123         arg_conv.inner = untag_ptr(arg);
53124         arg_conv.is_owned = ptr_is_owned(arg);
53125         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
53126         arg_conv.is_owned = false;
53127         int64_t ret_conv = ChannelReady_clone_ptr(&arg_conv);
53128         return ret_conv;
53129 }
53130
53131 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReady_1clone(JNIEnv *env, jclass clz, int64_t orig) {
53132         LDKChannelReady orig_conv;
53133         orig_conv.inner = untag_ptr(orig);
53134         orig_conv.is_owned = ptr_is_owned(orig);
53135         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
53136         orig_conv.is_owned = false;
53137         LDKChannelReady ret_var = ChannelReady_clone(&orig_conv);
53138         int64_t ret_ref = 0;
53139         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53140         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53141         return ret_ref;
53142 }
53143
53144 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReady_1hash(JNIEnv *env, jclass clz, int64_t o) {
53145         LDKChannelReady o_conv;
53146         o_conv.inner = untag_ptr(o);
53147         o_conv.is_owned = ptr_is_owned(o);
53148         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
53149         o_conv.is_owned = false;
53150         int64_t ret_conv = ChannelReady_hash(&o_conv);
53151         return ret_conv;
53152 }
53153
53154 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelReady_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
53155         LDKChannelReady a_conv;
53156         a_conv.inner = untag_ptr(a);
53157         a_conv.is_owned = ptr_is_owned(a);
53158         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
53159         a_conv.is_owned = false;
53160         LDKChannelReady b_conv;
53161         b_conv.inner = untag_ptr(b);
53162         b_conv.is_owned = ptr_is_owned(b);
53163         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
53164         b_conv.is_owned = false;
53165         jboolean ret_conv = ChannelReady_eq(&a_conv, &b_conv);
53166         return ret_conv;
53167 }
53168
53169 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Stfu_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
53170         LDKStfu this_obj_conv;
53171         this_obj_conv.inner = untag_ptr(this_obj);
53172         this_obj_conv.is_owned = ptr_is_owned(this_obj);
53173         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
53174         Stfu_free(this_obj_conv);
53175 }
53176
53177 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Stfu_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
53178         LDKStfu this_ptr_conv;
53179         this_ptr_conv.inner = untag_ptr(this_ptr);
53180         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53181         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53182         this_ptr_conv.is_owned = false;
53183         LDKChannelId ret_var = Stfu_get_channel_id(&this_ptr_conv);
53184         int64_t ret_ref = 0;
53185         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53186         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53187         return ret_ref;
53188 }
53189
53190 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Stfu_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
53191         LDKStfu this_ptr_conv;
53192         this_ptr_conv.inner = untag_ptr(this_ptr);
53193         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53194         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53195         this_ptr_conv.is_owned = false;
53196         LDKChannelId val_conv;
53197         val_conv.inner = untag_ptr(val);
53198         val_conv.is_owned = ptr_is_owned(val);
53199         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
53200         val_conv = ChannelId_clone(&val_conv);
53201         Stfu_set_channel_id(&this_ptr_conv, val_conv);
53202 }
53203
53204 JNIEXPORT int8_t JNICALL Java_org_ldk_impl_bindings_Stfu_1get_1initiator(JNIEnv *env, jclass clz, int64_t this_ptr) {
53205         LDKStfu this_ptr_conv;
53206         this_ptr_conv.inner = untag_ptr(this_ptr);
53207         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53208         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53209         this_ptr_conv.is_owned = false;
53210         int8_t ret_conv = Stfu_get_initiator(&this_ptr_conv);
53211         return ret_conv;
53212 }
53213
53214 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Stfu_1set_1initiator(JNIEnv *env, jclass clz, int64_t this_ptr, int8_t val) {
53215         LDKStfu this_ptr_conv;
53216         this_ptr_conv.inner = untag_ptr(this_ptr);
53217         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53218         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53219         this_ptr_conv.is_owned = false;
53220         Stfu_set_initiator(&this_ptr_conv, val);
53221 }
53222
53223 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Stfu_1new(JNIEnv *env, jclass clz, int64_t channel_id_arg, int8_t initiator_arg) {
53224         LDKChannelId channel_id_arg_conv;
53225         channel_id_arg_conv.inner = untag_ptr(channel_id_arg);
53226         channel_id_arg_conv.is_owned = ptr_is_owned(channel_id_arg);
53227         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_arg_conv);
53228         channel_id_arg_conv = ChannelId_clone(&channel_id_arg_conv);
53229         LDKStfu ret_var = Stfu_new(channel_id_arg_conv, initiator_arg);
53230         int64_t ret_ref = 0;
53231         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53232         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53233         return ret_ref;
53234 }
53235
53236 static inline uint64_t Stfu_clone_ptr(LDKStfu *NONNULL_PTR arg) {
53237         LDKStfu ret_var = Stfu_clone(arg);
53238         int64_t ret_ref = 0;
53239         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53240         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53241         return ret_ref;
53242 }
53243 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Stfu_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
53244         LDKStfu arg_conv;
53245         arg_conv.inner = untag_ptr(arg);
53246         arg_conv.is_owned = ptr_is_owned(arg);
53247         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
53248         arg_conv.is_owned = false;
53249         int64_t ret_conv = Stfu_clone_ptr(&arg_conv);
53250         return ret_conv;
53251 }
53252
53253 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Stfu_1clone(JNIEnv *env, jclass clz, int64_t orig) {
53254         LDKStfu orig_conv;
53255         orig_conv.inner = untag_ptr(orig);
53256         orig_conv.is_owned = ptr_is_owned(orig);
53257         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
53258         orig_conv.is_owned = false;
53259         LDKStfu ret_var = Stfu_clone(&orig_conv);
53260         int64_t ret_ref = 0;
53261         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53262         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53263         return ret_ref;
53264 }
53265
53266 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Stfu_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
53267         LDKStfu a_conv;
53268         a_conv.inner = untag_ptr(a);
53269         a_conv.is_owned = ptr_is_owned(a);
53270         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
53271         a_conv.is_owned = false;
53272         LDKStfu b_conv;
53273         b_conv.inner = untag_ptr(b);
53274         b_conv.is_owned = ptr_is_owned(b);
53275         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
53276         b_conv.is_owned = false;
53277         jboolean ret_conv = Stfu_eq(&a_conv, &b_conv);
53278         return ret_conv;
53279 }
53280
53281 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Splice_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
53282         LDKSplice this_obj_conv;
53283         this_obj_conv.inner = untag_ptr(this_obj);
53284         this_obj_conv.is_owned = ptr_is_owned(this_obj);
53285         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
53286         Splice_free(this_obj_conv);
53287 }
53288
53289 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Splice_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
53290         LDKSplice this_ptr_conv;
53291         this_ptr_conv.inner = untag_ptr(this_ptr);
53292         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53293         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53294         this_ptr_conv.is_owned = false;
53295         LDKChannelId ret_var = Splice_get_channel_id(&this_ptr_conv);
53296         int64_t ret_ref = 0;
53297         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53298         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53299         return ret_ref;
53300 }
53301
53302 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Splice_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
53303         LDKSplice this_ptr_conv;
53304         this_ptr_conv.inner = untag_ptr(this_ptr);
53305         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53306         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53307         this_ptr_conv.is_owned = false;
53308         LDKChannelId val_conv;
53309         val_conv.inner = untag_ptr(val);
53310         val_conv.is_owned = ptr_is_owned(val);
53311         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
53312         val_conv = ChannelId_clone(&val_conv);
53313         Splice_set_channel_id(&this_ptr_conv, val_conv);
53314 }
53315
53316 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Splice_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
53317         LDKSplice this_ptr_conv;
53318         this_ptr_conv.inner = untag_ptr(this_ptr);
53319         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53320         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53321         this_ptr_conv.is_owned = false;
53322         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
53323         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *Splice_get_chain_hash(&this_ptr_conv));
53324         return ret_arr;
53325 }
53326
53327 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Splice_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
53328         LDKSplice this_ptr_conv;
53329         this_ptr_conv.inner = untag_ptr(this_ptr);
53330         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53331         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53332         this_ptr_conv.is_owned = false;
53333         LDKThirtyTwoBytes val_ref;
53334         CHECK((*env)->GetArrayLength(env, val) == 32);
53335         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
53336         Splice_set_chain_hash(&this_ptr_conv, val_ref);
53337 }
53338
53339 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Splice_1get_1relative_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
53340         LDKSplice this_ptr_conv;
53341         this_ptr_conv.inner = untag_ptr(this_ptr);
53342         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53343         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53344         this_ptr_conv.is_owned = false;
53345         int64_t ret_conv = Splice_get_relative_satoshis(&this_ptr_conv);
53346         return ret_conv;
53347 }
53348
53349 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Splice_1set_1relative_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
53350         LDKSplice this_ptr_conv;
53351         this_ptr_conv.inner = untag_ptr(this_ptr);
53352         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53353         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53354         this_ptr_conv.is_owned = false;
53355         Splice_set_relative_satoshis(&this_ptr_conv, val);
53356 }
53357
53358 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_Splice_1get_1funding_1feerate_1perkw(JNIEnv *env, jclass clz, int64_t this_ptr) {
53359         LDKSplice this_ptr_conv;
53360         this_ptr_conv.inner = untag_ptr(this_ptr);
53361         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53362         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53363         this_ptr_conv.is_owned = false;
53364         int32_t ret_conv = Splice_get_funding_feerate_perkw(&this_ptr_conv);
53365         return ret_conv;
53366 }
53367
53368 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Splice_1set_1funding_1feerate_1perkw(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
53369         LDKSplice this_ptr_conv;
53370         this_ptr_conv.inner = untag_ptr(this_ptr);
53371         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53372         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53373         this_ptr_conv.is_owned = false;
53374         Splice_set_funding_feerate_perkw(&this_ptr_conv, val);
53375 }
53376
53377 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_Splice_1get_1locktime(JNIEnv *env, jclass clz, int64_t this_ptr) {
53378         LDKSplice this_ptr_conv;
53379         this_ptr_conv.inner = untag_ptr(this_ptr);
53380         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53381         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53382         this_ptr_conv.is_owned = false;
53383         int32_t ret_conv = Splice_get_locktime(&this_ptr_conv);
53384         return ret_conv;
53385 }
53386
53387 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Splice_1set_1locktime(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
53388         LDKSplice this_ptr_conv;
53389         this_ptr_conv.inner = untag_ptr(this_ptr);
53390         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53391         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53392         this_ptr_conv.is_owned = false;
53393         Splice_set_locktime(&this_ptr_conv, val);
53394 }
53395
53396 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Splice_1get_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
53397         LDKSplice this_ptr_conv;
53398         this_ptr_conv.inner = untag_ptr(this_ptr);
53399         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53400         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53401         this_ptr_conv.is_owned = false;
53402         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
53403         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, Splice_get_funding_pubkey(&this_ptr_conv).compressed_form);
53404         return ret_arr;
53405 }
53406
53407 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Splice_1set_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
53408         LDKSplice this_ptr_conv;
53409         this_ptr_conv.inner = untag_ptr(this_ptr);
53410         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53411         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53412         this_ptr_conv.is_owned = false;
53413         LDKPublicKey val_ref;
53414         CHECK((*env)->GetArrayLength(env, val) == 33);
53415         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
53416         Splice_set_funding_pubkey(&this_ptr_conv, val_ref);
53417 }
53418
53419 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Splice_1new(JNIEnv *env, jclass clz, int64_t channel_id_arg, int8_tArray chain_hash_arg, int64_t relative_satoshis_arg, int32_t funding_feerate_perkw_arg, int32_t locktime_arg, int8_tArray funding_pubkey_arg) {
53420         LDKChannelId channel_id_arg_conv;
53421         channel_id_arg_conv.inner = untag_ptr(channel_id_arg);
53422         channel_id_arg_conv.is_owned = ptr_is_owned(channel_id_arg);
53423         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_arg_conv);
53424         channel_id_arg_conv = ChannelId_clone(&channel_id_arg_conv);
53425         LDKThirtyTwoBytes chain_hash_arg_ref;
53426         CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
53427         (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
53428         LDKPublicKey funding_pubkey_arg_ref;
53429         CHECK((*env)->GetArrayLength(env, funding_pubkey_arg) == 33);
53430         (*env)->GetByteArrayRegion(env, funding_pubkey_arg, 0, 33, funding_pubkey_arg_ref.compressed_form);
53431         LDKSplice ret_var = Splice_new(channel_id_arg_conv, chain_hash_arg_ref, relative_satoshis_arg, funding_feerate_perkw_arg, locktime_arg, funding_pubkey_arg_ref);
53432         int64_t ret_ref = 0;
53433         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53434         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53435         return ret_ref;
53436 }
53437
53438 static inline uint64_t Splice_clone_ptr(LDKSplice *NONNULL_PTR arg) {
53439         LDKSplice ret_var = Splice_clone(arg);
53440         int64_t ret_ref = 0;
53441         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53442         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53443         return ret_ref;
53444 }
53445 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Splice_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
53446         LDKSplice arg_conv;
53447         arg_conv.inner = untag_ptr(arg);
53448         arg_conv.is_owned = ptr_is_owned(arg);
53449         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
53450         arg_conv.is_owned = false;
53451         int64_t ret_conv = Splice_clone_ptr(&arg_conv);
53452         return ret_conv;
53453 }
53454
53455 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Splice_1clone(JNIEnv *env, jclass clz, int64_t orig) {
53456         LDKSplice orig_conv;
53457         orig_conv.inner = untag_ptr(orig);
53458         orig_conv.is_owned = ptr_is_owned(orig);
53459         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
53460         orig_conv.is_owned = false;
53461         LDKSplice ret_var = Splice_clone(&orig_conv);
53462         int64_t ret_ref = 0;
53463         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53464         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53465         return ret_ref;
53466 }
53467
53468 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Splice_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
53469         LDKSplice a_conv;
53470         a_conv.inner = untag_ptr(a);
53471         a_conv.is_owned = ptr_is_owned(a);
53472         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
53473         a_conv.is_owned = false;
53474         LDKSplice b_conv;
53475         b_conv.inner = untag_ptr(b);
53476         b_conv.is_owned = ptr_is_owned(b);
53477         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
53478         b_conv.is_owned = false;
53479         jboolean ret_conv = Splice_eq(&a_conv, &b_conv);
53480         return ret_conv;
53481 }
53482
53483 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SpliceAck_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
53484         LDKSpliceAck this_obj_conv;
53485         this_obj_conv.inner = untag_ptr(this_obj);
53486         this_obj_conv.is_owned = ptr_is_owned(this_obj);
53487         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
53488         SpliceAck_free(this_obj_conv);
53489 }
53490
53491 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpliceAck_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
53492         LDKSpliceAck this_ptr_conv;
53493         this_ptr_conv.inner = untag_ptr(this_ptr);
53494         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53495         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53496         this_ptr_conv.is_owned = false;
53497         LDKChannelId ret_var = SpliceAck_get_channel_id(&this_ptr_conv);
53498         int64_t ret_ref = 0;
53499         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53500         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53501         return ret_ref;
53502 }
53503
53504 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SpliceAck_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
53505         LDKSpliceAck this_ptr_conv;
53506         this_ptr_conv.inner = untag_ptr(this_ptr);
53507         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53508         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53509         this_ptr_conv.is_owned = false;
53510         LDKChannelId val_conv;
53511         val_conv.inner = untag_ptr(val);
53512         val_conv.is_owned = ptr_is_owned(val);
53513         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
53514         val_conv = ChannelId_clone(&val_conv);
53515         SpliceAck_set_channel_id(&this_ptr_conv, val_conv);
53516 }
53517
53518 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_SpliceAck_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
53519         LDKSpliceAck this_ptr_conv;
53520         this_ptr_conv.inner = untag_ptr(this_ptr);
53521         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53522         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53523         this_ptr_conv.is_owned = false;
53524         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
53525         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *SpliceAck_get_chain_hash(&this_ptr_conv));
53526         return ret_arr;
53527 }
53528
53529 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SpliceAck_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
53530         LDKSpliceAck this_ptr_conv;
53531         this_ptr_conv.inner = untag_ptr(this_ptr);
53532         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53533         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53534         this_ptr_conv.is_owned = false;
53535         LDKThirtyTwoBytes val_ref;
53536         CHECK((*env)->GetArrayLength(env, val) == 32);
53537         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
53538         SpliceAck_set_chain_hash(&this_ptr_conv, val_ref);
53539 }
53540
53541 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpliceAck_1get_1relative_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
53542         LDKSpliceAck this_ptr_conv;
53543         this_ptr_conv.inner = untag_ptr(this_ptr);
53544         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53545         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53546         this_ptr_conv.is_owned = false;
53547         int64_t ret_conv = SpliceAck_get_relative_satoshis(&this_ptr_conv);
53548         return ret_conv;
53549 }
53550
53551 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SpliceAck_1set_1relative_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
53552         LDKSpliceAck this_ptr_conv;
53553         this_ptr_conv.inner = untag_ptr(this_ptr);
53554         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53555         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53556         this_ptr_conv.is_owned = false;
53557         SpliceAck_set_relative_satoshis(&this_ptr_conv, val);
53558 }
53559
53560 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_SpliceAck_1get_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
53561         LDKSpliceAck this_ptr_conv;
53562         this_ptr_conv.inner = untag_ptr(this_ptr);
53563         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53564         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53565         this_ptr_conv.is_owned = false;
53566         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
53567         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, SpliceAck_get_funding_pubkey(&this_ptr_conv).compressed_form);
53568         return ret_arr;
53569 }
53570
53571 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SpliceAck_1set_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
53572         LDKSpliceAck this_ptr_conv;
53573         this_ptr_conv.inner = untag_ptr(this_ptr);
53574         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53575         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53576         this_ptr_conv.is_owned = false;
53577         LDKPublicKey val_ref;
53578         CHECK((*env)->GetArrayLength(env, val) == 33);
53579         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
53580         SpliceAck_set_funding_pubkey(&this_ptr_conv, val_ref);
53581 }
53582
53583 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpliceAck_1new(JNIEnv *env, jclass clz, int64_t channel_id_arg, int8_tArray chain_hash_arg, int64_t relative_satoshis_arg, int8_tArray funding_pubkey_arg) {
53584         LDKChannelId channel_id_arg_conv;
53585         channel_id_arg_conv.inner = untag_ptr(channel_id_arg);
53586         channel_id_arg_conv.is_owned = ptr_is_owned(channel_id_arg);
53587         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_arg_conv);
53588         channel_id_arg_conv = ChannelId_clone(&channel_id_arg_conv);
53589         LDKThirtyTwoBytes chain_hash_arg_ref;
53590         CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
53591         (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
53592         LDKPublicKey funding_pubkey_arg_ref;
53593         CHECK((*env)->GetArrayLength(env, funding_pubkey_arg) == 33);
53594         (*env)->GetByteArrayRegion(env, funding_pubkey_arg, 0, 33, funding_pubkey_arg_ref.compressed_form);
53595         LDKSpliceAck ret_var = SpliceAck_new(channel_id_arg_conv, chain_hash_arg_ref, relative_satoshis_arg, funding_pubkey_arg_ref);
53596         int64_t ret_ref = 0;
53597         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53598         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53599         return ret_ref;
53600 }
53601
53602 static inline uint64_t SpliceAck_clone_ptr(LDKSpliceAck *NONNULL_PTR arg) {
53603         LDKSpliceAck ret_var = SpliceAck_clone(arg);
53604         int64_t ret_ref = 0;
53605         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53606         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53607         return ret_ref;
53608 }
53609 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpliceAck_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
53610         LDKSpliceAck arg_conv;
53611         arg_conv.inner = untag_ptr(arg);
53612         arg_conv.is_owned = ptr_is_owned(arg);
53613         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
53614         arg_conv.is_owned = false;
53615         int64_t ret_conv = SpliceAck_clone_ptr(&arg_conv);
53616         return ret_conv;
53617 }
53618
53619 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpliceAck_1clone(JNIEnv *env, jclass clz, int64_t orig) {
53620         LDKSpliceAck orig_conv;
53621         orig_conv.inner = untag_ptr(orig);
53622         orig_conv.is_owned = ptr_is_owned(orig);
53623         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
53624         orig_conv.is_owned = false;
53625         LDKSpliceAck ret_var = SpliceAck_clone(&orig_conv);
53626         int64_t ret_ref = 0;
53627         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53628         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53629         return ret_ref;
53630 }
53631
53632 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_SpliceAck_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
53633         LDKSpliceAck a_conv;
53634         a_conv.inner = untag_ptr(a);
53635         a_conv.is_owned = ptr_is_owned(a);
53636         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
53637         a_conv.is_owned = false;
53638         LDKSpliceAck b_conv;
53639         b_conv.inner = untag_ptr(b);
53640         b_conv.is_owned = ptr_is_owned(b);
53641         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
53642         b_conv.is_owned = false;
53643         jboolean ret_conv = SpliceAck_eq(&a_conv, &b_conv);
53644         return ret_conv;
53645 }
53646
53647 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SpliceLocked_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
53648         LDKSpliceLocked this_obj_conv;
53649         this_obj_conv.inner = untag_ptr(this_obj);
53650         this_obj_conv.is_owned = ptr_is_owned(this_obj);
53651         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
53652         SpliceLocked_free(this_obj_conv);
53653 }
53654
53655 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpliceLocked_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
53656         LDKSpliceLocked this_ptr_conv;
53657         this_ptr_conv.inner = untag_ptr(this_ptr);
53658         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53659         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53660         this_ptr_conv.is_owned = false;
53661         LDKChannelId ret_var = SpliceLocked_get_channel_id(&this_ptr_conv);
53662         int64_t ret_ref = 0;
53663         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53664         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53665         return ret_ref;
53666 }
53667
53668 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SpliceLocked_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
53669         LDKSpliceLocked this_ptr_conv;
53670         this_ptr_conv.inner = untag_ptr(this_ptr);
53671         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53672         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53673         this_ptr_conv.is_owned = false;
53674         LDKChannelId val_conv;
53675         val_conv.inner = untag_ptr(val);
53676         val_conv.is_owned = ptr_is_owned(val);
53677         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
53678         val_conv = ChannelId_clone(&val_conv);
53679         SpliceLocked_set_channel_id(&this_ptr_conv, val_conv);
53680 }
53681
53682 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpliceLocked_1new(JNIEnv *env, jclass clz, int64_t channel_id_arg) {
53683         LDKChannelId channel_id_arg_conv;
53684         channel_id_arg_conv.inner = untag_ptr(channel_id_arg);
53685         channel_id_arg_conv.is_owned = ptr_is_owned(channel_id_arg);
53686         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_arg_conv);
53687         channel_id_arg_conv = ChannelId_clone(&channel_id_arg_conv);
53688         LDKSpliceLocked ret_var = SpliceLocked_new(channel_id_arg_conv);
53689         int64_t ret_ref = 0;
53690         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53691         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53692         return ret_ref;
53693 }
53694
53695 static inline uint64_t SpliceLocked_clone_ptr(LDKSpliceLocked *NONNULL_PTR arg) {
53696         LDKSpliceLocked ret_var = SpliceLocked_clone(arg);
53697         int64_t ret_ref = 0;
53698         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53699         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53700         return ret_ref;
53701 }
53702 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpliceLocked_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
53703         LDKSpliceLocked arg_conv;
53704         arg_conv.inner = untag_ptr(arg);
53705         arg_conv.is_owned = ptr_is_owned(arg);
53706         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
53707         arg_conv.is_owned = false;
53708         int64_t ret_conv = SpliceLocked_clone_ptr(&arg_conv);
53709         return ret_conv;
53710 }
53711
53712 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpliceLocked_1clone(JNIEnv *env, jclass clz, int64_t orig) {
53713         LDKSpliceLocked orig_conv;
53714         orig_conv.inner = untag_ptr(orig);
53715         orig_conv.is_owned = ptr_is_owned(orig);
53716         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
53717         orig_conv.is_owned = false;
53718         LDKSpliceLocked ret_var = SpliceLocked_clone(&orig_conv);
53719         int64_t ret_ref = 0;
53720         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53721         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53722         return ret_ref;
53723 }
53724
53725 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_SpliceLocked_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
53726         LDKSpliceLocked a_conv;
53727         a_conv.inner = untag_ptr(a);
53728         a_conv.is_owned = ptr_is_owned(a);
53729         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
53730         a_conv.is_owned = false;
53731         LDKSpliceLocked b_conv;
53732         b_conv.inner = untag_ptr(b);
53733         b_conv.is_owned = ptr_is_owned(b);
53734         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
53735         b_conv.is_owned = false;
53736         jboolean ret_conv = SpliceLocked_eq(&a_conv, &b_conv);
53737         return ret_conv;
53738 }
53739
53740 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxAddInput_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
53741         LDKTxAddInput this_obj_conv;
53742         this_obj_conv.inner = untag_ptr(this_obj);
53743         this_obj_conv.is_owned = ptr_is_owned(this_obj);
53744         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
53745         TxAddInput_free(this_obj_conv);
53746 }
53747
53748 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxAddInput_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
53749         LDKTxAddInput this_ptr_conv;
53750         this_ptr_conv.inner = untag_ptr(this_ptr);
53751         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53752         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53753         this_ptr_conv.is_owned = false;
53754         LDKChannelId ret_var = TxAddInput_get_channel_id(&this_ptr_conv);
53755         int64_t ret_ref = 0;
53756         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53757         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53758         return ret_ref;
53759 }
53760
53761 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxAddInput_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
53762         LDKTxAddInput this_ptr_conv;
53763         this_ptr_conv.inner = untag_ptr(this_ptr);
53764         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53765         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53766         this_ptr_conv.is_owned = false;
53767         LDKChannelId val_conv;
53768         val_conv.inner = untag_ptr(val);
53769         val_conv.is_owned = ptr_is_owned(val);
53770         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
53771         val_conv = ChannelId_clone(&val_conv);
53772         TxAddInput_set_channel_id(&this_ptr_conv, val_conv);
53773 }
53774
53775 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxAddInput_1get_1serial_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
53776         LDKTxAddInput this_ptr_conv;
53777         this_ptr_conv.inner = untag_ptr(this_ptr);
53778         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53779         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53780         this_ptr_conv.is_owned = false;
53781         int64_t ret_conv = TxAddInput_get_serial_id(&this_ptr_conv);
53782         return ret_conv;
53783 }
53784
53785 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxAddInput_1set_1serial_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
53786         LDKTxAddInput this_ptr_conv;
53787         this_ptr_conv.inner = untag_ptr(this_ptr);
53788         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53789         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53790         this_ptr_conv.is_owned = false;
53791         TxAddInput_set_serial_id(&this_ptr_conv, val);
53792 }
53793
53794 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxAddInput_1get_1prevtx(JNIEnv *env, jclass clz, int64_t this_ptr) {
53795         LDKTxAddInput this_ptr_conv;
53796         this_ptr_conv.inner = untag_ptr(this_ptr);
53797         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53798         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53799         this_ptr_conv.is_owned = false;
53800         LDKTransactionU16LenLimited ret_var = TxAddInput_get_prevtx(&this_ptr_conv);
53801         int64_t ret_ref = 0;
53802         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53803         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53804         return ret_ref;
53805 }
53806
53807 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxAddInput_1set_1prevtx(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
53808         LDKTxAddInput 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         LDKTransactionU16LenLimited val_conv;
53814         val_conv.inner = untag_ptr(val);
53815         val_conv.is_owned = ptr_is_owned(val);
53816         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
53817         val_conv = TransactionU16LenLimited_clone(&val_conv);
53818         TxAddInput_set_prevtx(&this_ptr_conv, val_conv);
53819 }
53820
53821 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_TxAddInput_1get_1prevtx_1out(JNIEnv *env, jclass clz, int64_t this_ptr) {
53822         LDKTxAddInput this_ptr_conv;
53823         this_ptr_conv.inner = untag_ptr(this_ptr);
53824         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53825         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53826         this_ptr_conv.is_owned = false;
53827         int32_t ret_conv = TxAddInput_get_prevtx_out(&this_ptr_conv);
53828         return ret_conv;
53829 }
53830
53831 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxAddInput_1set_1prevtx_1out(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
53832         LDKTxAddInput this_ptr_conv;
53833         this_ptr_conv.inner = untag_ptr(this_ptr);
53834         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53835         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53836         this_ptr_conv.is_owned = false;
53837         TxAddInput_set_prevtx_out(&this_ptr_conv, val);
53838 }
53839
53840 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_TxAddInput_1get_1sequence(JNIEnv *env, jclass clz, int64_t this_ptr) {
53841         LDKTxAddInput this_ptr_conv;
53842         this_ptr_conv.inner = untag_ptr(this_ptr);
53843         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53844         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53845         this_ptr_conv.is_owned = false;
53846         int32_t ret_conv = TxAddInput_get_sequence(&this_ptr_conv);
53847         return ret_conv;
53848 }
53849
53850 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxAddInput_1set_1sequence(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
53851         LDKTxAddInput this_ptr_conv;
53852         this_ptr_conv.inner = untag_ptr(this_ptr);
53853         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53854         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53855         this_ptr_conv.is_owned = false;
53856         TxAddInput_set_sequence(&this_ptr_conv, val);
53857 }
53858
53859 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxAddInput_1new(JNIEnv *env, jclass clz, int64_t channel_id_arg, int64_t serial_id_arg, int64_t prevtx_arg, int32_t prevtx_out_arg, int32_t sequence_arg) {
53860         LDKChannelId channel_id_arg_conv;
53861         channel_id_arg_conv.inner = untag_ptr(channel_id_arg);
53862         channel_id_arg_conv.is_owned = ptr_is_owned(channel_id_arg);
53863         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_arg_conv);
53864         channel_id_arg_conv = ChannelId_clone(&channel_id_arg_conv);
53865         LDKTransactionU16LenLimited prevtx_arg_conv;
53866         prevtx_arg_conv.inner = untag_ptr(prevtx_arg);
53867         prevtx_arg_conv.is_owned = ptr_is_owned(prevtx_arg);
53868         CHECK_INNER_FIELD_ACCESS_OR_NULL(prevtx_arg_conv);
53869         prevtx_arg_conv = TransactionU16LenLimited_clone(&prevtx_arg_conv);
53870         LDKTxAddInput ret_var = TxAddInput_new(channel_id_arg_conv, serial_id_arg, prevtx_arg_conv, prevtx_out_arg, sequence_arg);
53871         int64_t ret_ref = 0;
53872         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53873         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53874         return ret_ref;
53875 }
53876
53877 static inline uint64_t TxAddInput_clone_ptr(LDKTxAddInput *NONNULL_PTR arg) {
53878         LDKTxAddInput ret_var = TxAddInput_clone(arg);
53879         int64_t ret_ref = 0;
53880         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53881         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53882         return ret_ref;
53883 }
53884 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxAddInput_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
53885         LDKTxAddInput arg_conv;
53886         arg_conv.inner = untag_ptr(arg);
53887         arg_conv.is_owned = ptr_is_owned(arg);
53888         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
53889         arg_conv.is_owned = false;
53890         int64_t ret_conv = TxAddInput_clone_ptr(&arg_conv);
53891         return ret_conv;
53892 }
53893
53894 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxAddInput_1clone(JNIEnv *env, jclass clz, int64_t orig) {
53895         LDKTxAddInput orig_conv;
53896         orig_conv.inner = untag_ptr(orig);
53897         orig_conv.is_owned = ptr_is_owned(orig);
53898         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
53899         orig_conv.is_owned = false;
53900         LDKTxAddInput ret_var = TxAddInput_clone(&orig_conv);
53901         int64_t ret_ref = 0;
53902         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53903         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53904         return ret_ref;
53905 }
53906
53907 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxAddInput_1hash(JNIEnv *env, jclass clz, int64_t o) {
53908         LDKTxAddInput o_conv;
53909         o_conv.inner = untag_ptr(o);
53910         o_conv.is_owned = ptr_is_owned(o);
53911         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
53912         o_conv.is_owned = false;
53913         int64_t ret_conv = TxAddInput_hash(&o_conv);
53914         return ret_conv;
53915 }
53916
53917 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_TxAddInput_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
53918         LDKTxAddInput a_conv;
53919         a_conv.inner = untag_ptr(a);
53920         a_conv.is_owned = ptr_is_owned(a);
53921         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
53922         a_conv.is_owned = false;
53923         LDKTxAddInput b_conv;
53924         b_conv.inner = untag_ptr(b);
53925         b_conv.is_owned = ptr_is_owned(b);
53926         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
53927         b_conv.is_owned = false;
53928         jboolean ret_conv = TxAddInput_eq(&a_conv, &b_conv);
53929         return ret_conv;
53930 }
53931
53932 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxAddOutput_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
53933         LDKTxAddOutput this_obj_conv;
53934         this_obj_conv.inner = untag_ptr(this_obj);
53935         this_obj_conv.is_owned = ptr_is_owned(this_obj);
53936         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
53937         TxAddOutput_free(this_obj_conv);
53938 }
53939
53940 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxAddOutput_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
53941         LDKTxAddOutput this_ptr_conv;
53942         this_ptr_conv.inner = untag_ptr(this_ptr);
53943         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53944         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53945         this_ptr_conv.is_owned = false;
53946         LDKChannelId ret_var = TxAddOutput_get_channel_id(&this_ptr_conv);
53947         int64_t ret_ref = 0;
53948         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
53949         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
53950         return ret_ref;
53951 }
53952
53953 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxAddOutput_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
53954         LDKTxAddOutput this_ptr_conv;
53955         this_ptr_conv.inner = untag_ptr(this_ptr);
53956         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53957         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53958         this_ptr_conv.is_owned = false;
53959         LDKChannelId val_conv;
53960         val_conv.inner = untag_ptr(val);
53961         val_conv.is_owned = ptr_is_owned(val);
53962         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
53963         val_conv = ChannelId_clone(&val_conv);
53964         TxAddOutput_set_channel_id(&this_ptr_conv, val_conv);
53965 }
53966
53967 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxAddOutput_1get_1serial_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
53968         LDKTxAddOutput this_ptr_conv;
53969         this_ptr_conv.inner = untag_ptr(this_ptr);
53970         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53971         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53972         this_ptr_conv.is_owned = false;
53973         int64_t ret_conv = TxAddOutput_get_serial_id(&this_ptr_conv);
53974         return ret_conv;
53975 }
53976
53977 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxAddOutput_1set_1serial_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
53978         LDKTxAddOutput this_ptr_conv;
53979         this_ptr_conv.inner = untag_ptr(this_ptr);
53980         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53981         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53982         this_ptr_conv.is_owned = false;
53983         TxAddOutput_set_serial_id(&this_ptr_conv, val);
53984 }
53985
53986 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxAddOutput_1get_1sats(JNIEnv *env, jclass clz, int64_t this_ptr) {
53987         LDKTxAddOutput this_ptr_conv;
53988         this_ptr_conv.inner = untag_ptr(this_ptr);
53989         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
53990         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
53991         this_ptr_conv.is_owned = false;
53992         int64_t ret_conv = TxAddOutput_get_sats(&this_ptr_conv);
53993         return ret_conv;
53994 }
53995
53996 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxAddOutput_1set_1sats(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
53997         LDKTxAddOutput this_ptr_conv;
53998         this_ptr_conv.inner = untag_ptr(this_ptr);
53999         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54000         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54001         this_ptr_conv.is_owned = false;
54002         TxAddOutput_set_sats(&this_ptr_conv, val);
54003 }
54004
54005 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxAddOutput_1get_1script(JNIEnv *env, jclass clz, int64_t this_ptr) {
54006         LDKTxAddOutput this_ptr_conv;
54007         this_ptr_conv.inner = untag_ptr(this_ptr);
54008         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54009         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54010         this_ptr_conv.is_owned = false;
54011         LDKCVec_u8Z ret_var = TxAddOutput_get_script(&this_ptr_conv);
54012         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
54013         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
54014         CVec_u8Z_free(ret_var);
54015         return ret_arr;
54016 }
54017
54018 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxAddOutput_1set_1script(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
54019         LDKTxAddOutput this_ptr_conv;
54020         this_ptr_conv.inner = untag_ptr(this_ptr);
54021         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54022         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54023         this_ptr_conv.is_owned = false;
54024         LDKCVec_u8Z val_ref;
54025         val_ref.datalen = (*env)->GetArrayLength(env, val);
54026         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
54027         (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
54028         TxAddOutput_set_script(&this_ptr_conv, val_ref);
54029 }
54030
54031 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxAddOutput_1new(JNIEnv *env, jclass clz, int64_t channel_id_arg, int64_t serial_id_arg, int64_t sats_arg, int8_tArray script_arg) {
54032         LDKChannelId channel_id_arg_conv;
54033         channel_id_arg_conv.inner = untag_ptr(channel_id_arg);
54034         channel_id_arg_conv.is_owned = ptr_is_owned(channel_id_arg);
54035         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_arg_conv);
54036         channel_id_arg_conv = ChannelId_clone(&channel_id_arg_conv);
54037         LDKCVec_u8Z script_arg_ref;
54038         script_arg_ref.datalen = (*env)->GetArrayLength(env, script_arg);
54039         script_arg_ref.data = MALLOC(script_arg_ref.datalen, "LDKCVec_u8Z Bytes");
54040         (*env)->GetByteArrayRegion(env, script_arg, 0, script_arg_ref.datalen, script_arg_ref.data);
54041         LDKTxAddOutput ret_var = TxAddOutput_new(channel_id_arg_conv, serial_id_arg, sats_arg, script_arg_ref);
54042         int64_t ret_ref = 0;
54043         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54044         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54045         return ret_ref;
54046 }
54047
54048 static inline uint64_t TxAddOutput_clone_ptr(LDKTxAddOutput *NONNULL_PTR arg) {
54049         LDKTxAddOutput ret_var = TxAddOutput_clone(arg);
54050         int64_t ret_ref = 0;
54051         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54052         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54053         return ret_ref;
54054 }
54055 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxAddOutput_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
54056         LDKTxAddOutput arg_conv;
54057         arg_conv.inner = untag_ptr(arg);
54058         arg_conv.is_owned = ptr_is_owned(arg);
54059         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
54060         arg_conv.is_owned = false;
54061         int64_t ret_conv = TxAddOutput_clone_ptr(&arg_conv);
54062         return ret_conv;
54063 }
54064
54065 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxAddOutput_1clone(JNIEnv *env, jclass clz, int64_t orig) {
54066         LDKTxAddOutput orig_conv;
54067         orig_conv.inner = untag_ptr(orig);
54068         orig_conv.is_owned = ptr_is_owned(orig);
54069         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
54070         orig_conv.is_owned = false;
54071         LDKTxAddOutput ret_var = TxAddOutput_clone(&orig_conv);
54072         int64_t ret_ref = 0;
54073         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54074         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54075         return ret_ref;
54076 }
54077
54078 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxAddOutput_1hash(JNIEnv *env, jclass clz, int64_t o) {
54079         LDKTxAddOutput o_conv;
54080         o_conv.inner = untag_ptr(o);
54081         o_conv.is_owned = ptr_is_owned(o);
54082         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
54083         o_conv.is_owned = false;
54084         int64_t ret_conv = TxAddOutput_hash(&o_conv);
54085         return ret_conv;
54086 }
54087
54088 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_TxAddOutput_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
54089         LDKTxAddOutput a_conv;
54090         a_conv.inner = untag_ptr(a);
54091         a_conv.is_owned = ptr_is_owned(a);
54092         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
54093         a_conv.is_owned = false;
54094         LDKTxAddOutput b_conv;
54095         b_conv.inner = untag_ptr(b);
54096         b_conv.is_owned = ptr_is_owned(b);
54097         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
54098         b_conv.is_owned = false;
54099         jboolean ret_conv = TxAddOutput_eq(&a_conv, &b_conv);
54100         return ret_conv;
54101 }
54102
54103 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxRemoveInput_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
54104         LDKTxRemoveInput this_obj_conv;
54105         this_obj_conv.inner = untag_ptr(this_obj);
54106         this_obj_conv.is_owned = ptr_is_owned(this_obj);
54107         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
54108         TxRemoveInput_free(this_obj_conv);
54109 }
54110
54111 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxRemoveInput_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
54112         LDKTxRemoveInput this_ptr_conv;
54113         this_ptr_conv.inner = untag_ptr(this_ptr);
54114         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54115         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54116         this_ptr_conv.is_owned = false;
54117         LDKChannelId ret_var = TxRemoveInput_get_channel_id(&this_ptr_conv);
54118         int64_t ret_ref = 0;
54119         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54120         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54121         return ret_ref;
54122 }
54123
54124 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxRemoveInput_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
54125         LDKTxRemoveInput 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         LDKChannelId val_conv;
54131         val_conv.inner = untag_ptr(val);
54132         val_conv.is_owned = ptr_is_owned(val);
54133         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
54134         val_conv = ChannelId_clone(&val_conv);
54135         TxRemoveInput_set_channel_id(&this_ptr_conv, val_conv);
54136 }
54137
54138 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxRemoveInput_1get_1serial_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
54139         LDKTxRemoveInput this_ptr_conv;
54140         this_ptr_conv.inner = untag_ptr(this_ptr);
54141         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54142         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54143         this_ptr_conv.is_owned = false;
54144         int64_t ret_conv = TxRemoveInput_get_serial_id(&this_ptr_conv);
54145         return ret_conv;
54146 }
54147
54148 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxRemoveInput_1set_1serial_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
54149         LDKTxRemoveInput this_ptr_conv;
54150         this_ptr_conv.inner = untag_ptr(this_ptr);
54151         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54152         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54153         this_ptr_conv.is_owned = false;
54154         TxRemoveInput_set_serial_id(&this_ptr_conv, val);
54155 }
54156
54157 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxRemoveInput_1new(JNIEnv *env, jclass clz, int64_t channel_id_arg, int64_t serial_id_arg) {
54158         LDKChannelId channel_id_arg_conv;
54159         channel_id_arg_conv.inner = untag_ptr(channel_id_arg);
54160         channel_id_arg_conv.is_owned = ptr_is_owned(channel_id_arg);
54161         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_arg_conv);
54162         channel_id_arg_conv = ChannelId_clone(&channel_id_arg_conv);
54163         LDKTxRemoveInput ret_var = TxRemoveInput_new(channel_id_arg_conv, serial_id_arg);
54164         int64_t ret_ref = 0;
54165         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54166         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54167         return ret_ref;
54168 }
54169
54170 static inline uint64_t TxRemoveInput_clone_ptr(LDKTxRemoveInput *NONNULL_PTR arg) {
54171         LDKTxRemoveInput ret_var = TxRemoveInput_clone(arg);
54172         int64_t ret_ref = 0;
54173         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54174         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54175         return ret_ref;
54176 }
54177 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxRemoveInput_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
54178         LDKTxRemoveInput arg_conv;
54179         arg_conv.inner = untag_ptr(arg);
54180         arg_conv.is_owned = ptr_is_owned(arg);
54181         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
54182         arg_conv.is_owned = false;
54183         int64_t ret_conv = TxRemoveInput_clone_ptr(&arg_conv);
54184         return ret_conv;
54185 }
54186
54187 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxRemoveInput_1clone(JNIEnv *env, jclass clz, int64_t orig) {
54188         LDKTxRemoveInput orig_conv;
54189         orig_conv.inner = untag_ptr(orig);
54190         orig_conv.is_owned = ptr_is_owned(orig);
54191         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
54192         orig_conv.is_owned = false;
54193         LDKTxRemoveInput ret_var = TxRemoveInput_clone(&orig_conv);
54194         int64_t ret_ref = 0;
54195         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54196         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54197         return ret_ref;
54198 }
54199
54200 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxRemoveInput_1hash(JNIEnv *env, jclass clz, int64_t o) {
54201         LDKTxRemoveInput o_conv;
54202         o_conv.inner = untag_ptr(o);
54203         o_conv.is_owned = ptr_is_owned(o);
54204         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
54205         o_conv.is_owned = false;
54206         int64_t ret_conv = TxRemoveInput_hash(&o_conv);
54207         return ret_conv;
54208 }
54209
54210 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_TxRemoveInput_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
54211         LDKTxRemoveInput a_conv;
54212         a_conv.inner = untag_ptr(a);
54213         a_conv.is_owned = ptr_is_owned(a);
54214         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
54215         a_conv.is_owned = false;
54216         LDKTxRemoveInput b_conv;
54217         b_conv.inner = untag_ptr(b);
54218         b_conv.is_owned = ptr_is_owned(b);
54219         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
54220         b_conv.is_owned = false;
54221         jboolean ret_conv = TxRemoveInput_eq(&a_conv, &b_conv);
54222         return ret_conv;
54223 }
54224
54225 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxRemoveOutput_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
54226         LDKTxRemoveOutput this_obj_conv;
54227         this_obj_conv.inner = untag_ptr(this_obj);
54228         this_obj_conv.is_owned = ptr_is_owned(this_obj);
54229         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
54230         TxRemoveOutput_free(this_obj_conv);
54231 }
54232
54233 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxRemoveOutput_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
54234         LDKTxRemoveOutput this_ptr_conv;
54235         this_ptr_conv.inner = untag_ptr(this_ptr);
54236         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54237         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54238         this_ptr_conv.is_owned = false;
54239         LDKChannelId ret_var = TxRemoveOutput_get_channel_id(&this_ptr_conv);
54240         int64_t ret_ref = 0;
54241         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54242         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54243         return ret_ref;
54244 }
54245
54246 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxRemoveOutput_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
54247         LDKTxRemoveOutput this_ptr_conv;
54248         this_ptr_conv.inner = untag_ptr(this_ptr);
54249         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54250         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54251         this_ptr_conv.is_owned = false;
54252         LDKChannelId val_conv;
54253         val_conv.inner = untag_ptr(val);
54254         val_conv.is_owned = ptr_is_owned(val);
54255         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
54256         val_conv = ChannelId_clone(&val_conv);
54257         TxRemoveOutput_set_channel_id(&this_ptr_conv, val_conv);
54258 }
54259
54260 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxRemoveOutput_1get_1serial_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
54261         LDKTxRemoveOutput this_ptr_conv;
54262         this_ptr_conv.inner = untag_ptr(this_ptr);
54263         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54264         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54265         this_ptr_conv.is_owned = false;
54266         int64_t ret_conv = TxRemoveOutput_get_serial_id(&this_ptr_conv);
54267         return ret_conv;
54268 }
54269
54270 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxRemoveOutput_1set_1serial_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
54271         LDKTxRemoveOutput this_ptr_conv;
54272         this_ptr_conv.inner = untag_ptr(this_ptr);
54273         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54274         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54275         this_ptr_conv.is_owned = false;
54276         TxRemoveOutput_set_serial_id(&this_ptr_conv, val);
54277 }
54278
54279 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxRemoveOutput_1new(JNIEnv *env, jclass clz, int64_t channel_id_arg, int64_t serial_id_arg) {
54280         LDKChannelId channel_id_arg_conv;
54281         channel_id_arg_conv.inner = untag_ptr(channel_id_arg);
54282         channel_id_arg_conv.is_owned = ptr_is_owned(channel_id_arg);
54283         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_arg_conv);
54284         channel_id_arg_conv = ChannelId_clone(&channel_id_arg_conv);
54285         LDKTxRemoveOutput ret_var = TxRemoveOutput_new(channel_id_arg_conv, serial_id_arg);
54286         int64_t ret_ref = 0;
54287         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54288         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54289         return ret_ref;
54290 }
54291
54292 static inline uint64_t TxRemoveOutput_clone_ptr(LDKTxRemoveOutput *NONNULL_PTR arg) {
54293         LDKTxRemoveOutput ret_var = TxRemoveOutput_clone(arg);
54294         int64_t ret_ref = 0;
54295         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54296         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54297         return ret_ref;
54298 }
54299 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxRemoveOutput_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
54300         LDKTxRemoveOutput arg_conv;
54301         arg_conv.inner = untag_ptr(arg);
54302         arg_conv.is_owned = ptr_is_owned(arg);
54303         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
54304         arg_conv.is_owned = false;
54305         int64_t ret_conv = TxRemoveOutput_clone_ptr(&arg_conv);
54306         return ret_conv;
54307 }
54308
54309 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxRemoveOutput_1clone(JNIEnv *env, jclass clz, int64_t orig) {
54310         LDKTxRemoveOutput orig_conv;
54311         orig_conv.inner = untag_ptr(orig);
54312         orig_conv.is_owned = ptr_is_owned(orig);
54313         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
54314         orig_conv.is_owned = false;
54315         LDKTxRemoveOutput ret_var = TxRemoveOutput_clone(&orig_conv);
54316         int64_t ret_ref = 0;
54317         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54318         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54319         return ret_ref;
54320 }
54321
54322 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxRemoveOutput_1hash(JNIEnv *env, jclass clz, int64_t o) {
54323         LDKTxRemoveOutput o_conv;
54324         o_conv.inner = untag_ptr(o);
54325         o_conv.is_owned = ptr_is_owned(o);
54326         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
54327         o_conv.is_owned = false;
54328         int64_t ret_conv = TxRemoveOutput_hash(&o_conv);
54329         return ret_conv;
54330 }
54331
54332 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_TxRemoveOutput_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
54333         LDKTxRemoveOutput a_conv;
54334         a_conv.inner = untag_ptr(a);
54335         a_conv.is_owned = ptr_is_owned(a);
54336         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
54337         a_conv.is_owned = false;
54338         LDKTxRemoveOutput b_conv;
54339         b_conv.inner = untag_ptr(b);
54340         b_conv.is_owned = ptr_is_owned(b);
54341         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
54342         b_conv.is_owned = false;
54343         jboolean ret_conv = TxRemoveOutput_eq(&a_conv, &b_conv);
54344         return ret_conv;
54345 }
54346
54347 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxComplete_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
54348         LDKTxComplete this_obj_conv;
54349         this_obj_conv.inner = untag_ptr(this_obj);
54350         this_obj_conv.is_owned = ptr_is_owned(this_obj);
54351         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
54352         TxComplete_free(this_obj_conv);
54353 }
54354
54355 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxComplete_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
54356         LDKTxComplete this_ptr_conv;
54357         this_ptr_conv.inner = untag_ptr(this_ptr);
54358         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54359         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54360         this_ptr_conv.is_owned = false;
54361         LDKChannelId ret_var = TxComplete_get_channel_id(&this_ptr_conv);
54362         int64_t ret_ref = 0;
54363         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54364         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54365         return ret_ref;
54366 }
54367
54368 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxComplete_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
54369         LDKTxComplete this_ptr_conv;
54370         this_ptr_conv.inner = untag_ptr(this_ptr);
54371         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54372         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54373         this_ptr_conv.is_owned = false;
54374         LDKChannelId val_conv;
54375         val_conv.inner = untag_ptr(val);
54376         val_conv.is_owned = ptr_is_owned(val);
54377         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
54378         val_conv = ChannelId_clone(&val_conv);
54379         TxComplete_set_channel_id(&this_ptr_conv, val_conv);
54380 }
54381
54382 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxComplete_1new(JNIEnv *env, jclass clz, int64_t channel_id_arg) {
54383         LDKChannelId channel_id_arg_conv;
54384         channel_id_arg_conv.inner = untag_ptr(channel_id_arg);
54385         channel_id_arg_conv.is_owned = ptr_is_owned(channel_id_arg);
54386         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_arg_conv);
54387         channel_id_arg_conv = ChannelId_clone(&channel_id_arg_conv);
54388         LDKTxComplete ret_var = TxComplete_new(channel_id_arg_conv);
54389         int64_t ret_ref = 0;
54390         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54391         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54392         return ret_ref;
54393 }
54394
54395 static inline uint64_t TxComplete_clone_ptr(LDKTxComplete *NONNULL_PTR arg) {
54396         LDKTxComplete ret_var = TxComplete_clone(arg);
54397         int64_t ret_ref = 0;
54398         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54399         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54400         return ret_ref;
54401 }
54402 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxComplete_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
54403         LDKTxComplete arg_conv;
54404         arg_conv.inner = untag_ptr(arg);
54405         arg_conv.is_owned = ptr_is_owned(arg);
54406         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
54407         arg_conv.is_owned = false;
54408         int64_t ret_conv = TxComplete_clone_ptr(&arg_conv);
54409         return ret_conv;
54410 }
54411
54412 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxComplete_1clone(JNIEnv *env, jclass clz, int64_t orig) {
54413         LDKTxComplete orig_conv;
54414         orig_conv.inner = untag_ptr(orig);
54415         orig_conv.is_owned = ptr_is_owned(orig);
54416         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
54417         orig_conv.is_owned = false;
54418         LDKTxComplete ret_var = TxComplete_clone(&orig_conv);
54419         int64_t ret_ref = 0;
54420         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54421         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54422         return ret_ref;
54423 }
54424
54425 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxComplete_1hash(JNIEnv *env, jclass clz, int64_t o) {
54426         LDKTxComplete o_conv;
54427         o_conv.inner = untag_ptr(o);
54428         o_conv.is_owned = ptr_is_owned(o);
54429         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
54430         o_conv.is_owned = false;
54431         int64_t ret_conv = TxComplete_hash(&o_conv);
54432         return ret_conv;
54433 }
54434
54435 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_TxComplete_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
54436         LDKTxComplete a_conv;
54437         a_conv.inner = untag_ptr(a);
54438         a_conv.is_owned = ptr_is_owned(a);
54439         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
54440         a_conv.is_owned = false;
54441         LDKTxComplete b_conv;
54442         b_conv.inner = untag_ptr(b);
54443         b_conv.is_owned = ptr_is_owned(b);
54444         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
54445         b_conv.is_owned = false;
54446         jboolean ret_conv = TxComplete_eq(&a_conv, &b_conv);
54447         return ret_conv;
54448 }
54449
54450 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxSignatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
54451         LDKTxSignatures this_obj_conv;
54452         this_obj_conv.inner = untag_ptr(this_obj);
54453         this_obj_conv.is_owned = ptr_is_owned(this_obj);
54454         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
54455         TxSignatures_free(this_obj_conv);
54456 }
54457
54458 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxSignatures_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
54459         LDKTxSignatures this_ptr_conv;
54460         this_ptr_conv.inner = untag_ptr(this_ptr);
54461         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54462         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54463         this_ptr_conv.is_owned = false;
54464         LDKChannelId ret_var = TxSignatures_get_channel_id(&this_ptr_conv);
54465         int64_t ret_ref = 0;
54466         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54467         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54468         return ret_ref;
54469 }
54470
54471 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxSignatures_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
54472         LDKTxSignatures this_ptr_conv;
54473         this_ptr_conv.inner = untag_ptr(this_ptr);
54474         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54475         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54476         this_ptr_conv.is_owned = false;
54477         LDKChannelId val_conv;
54478         val_conv.inner = untag_ptr(val);
54479         val_conv.is_owned = ptr_is_owned(val);
54480         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
54481         val_conv = ChannelId_clone(&val_conv);
54482         TxSignatures_set_channel_id(&this_ptr_conv, val_conv);
54483 }
54484
54485 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxSignatures_1get_1tx_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
54486         LDKTxSignatures this_ptr_conv;
54487         this_ptr_conv.inner = untag_ptr(this_ptr);
54488         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54489         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54490         this_ptr_conv.is_owned = false;
54491         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
54492         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *TxSignatures_get_tx_hash(&this_ptr_conv));
54493         return ret_arr;
54494 }
54495
54496 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxSignatures_1set_1tx_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
54497         LDKTxSignatures this_ptr_conv;
54498         this_ptr_conv.inner = untag_ptr(this_ptr);
54499         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54500         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54501         this_ptr_conv.is_owned = false;
54502         LDKThirtyTwoBytes val_ref;
54503         CHECK((*env)->GetArrayLength(env, val) == 32);
54504         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
54505         TxSignatures_set_tx_hash(&this_ptr_conv, val_ref);
54506 }
54507
54508 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_TxSignatures_1get_1witnesses(JNIEnv *env, jclass clz, int64_t this_ptr) {
54509         LDKTxSignatures 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_WitnessZ ret_var = TxSignatures_get_witnesses(&this_ptr_conv);
54515         jobjectArray ret_arr = NULL;
54516         ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
54517         ;
54518         for (size_t i = 0; i < ret_var.datalen; i++) {
54519                 LDKWitness ret_conv_8_var = ret_var.data[i];
54520                 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, ret_conv_8_var.datalen);
54521                 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, ret_conv_8_var.datalen, ret_conv_8_var.data);
54522                 Witness_free(ret_conv_8_var);
54523                 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
54524         }
54525         
54526         FREE(ret_var.data);
54527         return ret_arr;
54528 }
54529
54530 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxSignatures_1set_1witnesses(JNIEnv *env, jclass clz, int64_t this_ptr, jobjectArray val) {
54531         LDKTxSignatures this_ptr_conv;
54532         this_ptr_conv.inner = untag_ptr(this_ptr);
54533         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54534         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54535         this_ptr_conv.is_owned = false;
54536         LDKCVec_WitnessZ val_constr;
54537         val_constr.datalen = (*env)->GetArrayLength(env, val);
54538         if (val_constr.datalen > 0)
54539                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKWitness), "LDKCVec_WitnessZ Elements");
54540         else
54541                 val_constr.data = NULL;
54542         for (size_t i = 0; i < val_constr.datalen; i++) {
54543                 int8_tArray val_conv_8 = (*env)->GetObjectArrayElement(env, val, i);
54544                 LDKWitness val_conv_8_ref;
54545                 val_conv_8_ref.datalen = (*env)->GetArrayLength(env, val_conv_8);
54546                 val_conv_8_ref.data = MALLOC(val_conv_8_ref.datalen, "LDKWitness Bytes");
54547                 (*env)->GetByteArrayRegion(env, val_conv_8, 0, val_conv_8_ref.datalen, val_conv_8_ref.data);
54548                 val_conv_8_ref.data_is_owned = true;
54549                 val_constr.data[i] = val_conv_8_ref;
54550         }
54551         TxSignatures_set_witnesses(&this_ptr_conv, val_constr);
54552 }
54553
54554 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxSignatures_1get_1funding_1outpoint_1sig(JNIEnv *env, jclass clz, int64_t this_ptr) {
54555         LDKTxSignatures this_ptr_conv;
54556         this_ptr_conv.inner = untag_ptr(this_ptr);
54557         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54558         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54559         this_ptr_conv.is_owned = false;
54560         LDKCOption_ECDSASignatureZ *ret_copy = MALLOC(sizeof(LDKCOption_ECDSASignatureZ), "LDKCOption_ECDSASignatureZ");
54561         *ret_copy = TxSignatures_get_funding_outpoint_sig(&this_ptr_conv);
54562         int64_t ret_ref = tag_ptr(ret_copy, true);
54563         return ret_ref;
54564 }
54565
54566 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxSignatures_1set_1funding_1outpoint_1sig(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
54567         LDKTxSignatures this_ptr_conv;
54568         this_ptr_conv.inner = untag_ptr(this_ptr);
54569         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54570         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54571         this_ptr_conv.is_owned = false;
54572         void* val_ptr = untag_ptr(val);
54573         CHECK_ACCESS(val_ptr);
54574         LDKCOption_ECDSASignatureZ val_conv = *(LDKCOption_ECDSASignatureZ*)(val_ptr);
54575         val_conv = COption_ECDSASignatureZ_clone((LDKCOption_ECDSASignatureZ*)untag_ptr(val));
54576         TxSignatures_set_funding_outpoint_sig(&this_ptr_conv, val_conv);
54577 }
54578
54579 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxSignatures_1new(JNIEnv *env, jclass clz, int64_t channel_id_arg, int8_tArray tx_hash_arg, jobjectArray witnesses_arg, int64_t funding_outpoint_sig_arg) {
54580         LDKChannelId channel_id_arg_conv;
54581         channel_id_arg_conv.inner = untag_ptr(channel_id_arg);
54582         channel_id_arg_conv.is_owned = ptr_is_owned(channel_id_arg);
54583         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_arg_conv);
54584         channel_id_arg_conv = ChannelId_clone(&channel_id_arg_conv);
54585         LDKThirtyTwoBytes tx_hash_arg_ref;
54586         CHECK((*env)->GetArrayLength(env, tx_hash_arg) == 32);
54587         (*env)->GetByteArrayRegion(env, tx_hash_arg, 0, 32, tx_hash_arg_ref.data);
54588         LDKCVec_WitnessZ witnesses_arg_constr;
54589         witnesses_arg_constr.datalen = (*env)->GetArrayLength(env, witnesses_arg);
54590         if (witnesses_arg_constr.datalen > 0)
54591                 witnesses_arg_constr.data = MALLOC(witnesses_arg_constr.datalen * sizeof(LDKWitness), "LDKCVec_WitnessZ Elements");
54592         else
54593                 witnesses_arg_constr.data = NULL;
54594         for (size_t i = 0; i < witnesses_arg_constr.datalen; i++) {
54595                 int8_tArray witnesses_arg_conv_8 = (*env)->GetObjectArrayElement(env, witnesses_arg, i);
54596                 LDKWitness witnesses_arg_conv_8_ref;
54597                 witnesses_arg_conv_8_ref.datalen = (*env)->GetArrayLength(env, witnesses_arg_conv_8);
54598                 witnesses_arg_conv_8_ref.data = MALLOC(witnesses_arg_conv_8_ref.datalen, "LDKWitness Bytes");
54599                 (*env)->GetByteArrayRegion(env, witnesses_arg_conv_8, 0, witnesses_arg_conv_8_ref.datalen, witnesses_arg_conv_8_ref.data);
54600                 witnesses_arg_conv_8_ref.data_is_owned = true;
54601                 witnesses_arg_constr.data[i] = witnesses_arg_conv_8_ref;
54602         }
54603         void* funding_outpoint_sig_arg_ptr = untag_ptr(funding_outpoint_sig_arg);
54604         CHECK_ACCESS(funding_outpoint_sig_arg_ptr);
54605         LDKCOption_ECDSASignatureZ funding_outpoint_sig_arg_conv = *(LDKCOption_ECDSASignatureZ*)(funding_outpoint_sig_arg_ptr);
54606         funding_outpoint_sig_arg_conv = COption_ECDSASignatureZ_clone((LDKCOption_ECDSASignatureZ*)untag_ptr(funding_outpoint_sig_arg));
54607         LDKTxSignatures ret_var = TxSignatures_new(channel_id_arg_conv, tx_hash_arg_ref, witnesses_arg_constr, funding_outpoint_sig_arg_conv);
54608         int64_t ret_ref = 0;
54609         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54610         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54611         return ret_ref;
54612 }
54613
54614 static inline uint64_t TxSignatures_clone_ptr(LDKTxSignatures *NONNULL_PTR arg) {
54615         LDKTxSignatures ret_var = TxSignatures_clone(arg);
54616         int64_t ret_ref = 0;
54617         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54618         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54619         return ret_ref;
54620 }
54621 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxSignatures_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
54622         LDKTxSignatures arg_conv;
54623         arg_conv.inner = untag_ptr(arg);
54624         arg_conv.is_owned = ptr_is_owned(arg);
54625         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
54626         arg_conv.is_owned = false;
54627         int64_t ret_conv = TxSignatures_clone_ptr(&arg_conv);
54628         return ret_conv;
54629 }
54630
54631 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxSignatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
54632         LDKTxSignatures orig_conv;
54633         orig_conv.inner = untag_ptr(orig);
54634         orig_conv.is_owned = ptr_is_owned(orig);
54635         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
54636         orig_conv.is_owned = false;
54637         LDKTxSignatures ret_var = TxSignatures_clone(&orig_conv);
54638         int64_t ret_ref = 0;
54639         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54640         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54641         return ret_ref;
54642 }
54643
54644 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxSignatures_1hash(JNIEnv *env, jclass clz, int64_t o) {
54645         LDKTxSignatures o_conv;
54646         o_conv.inner = untag_ptr(o);
54647         o_conv.is_owned = ptr_is_owned(o);
54648         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
54649         o_conv.is_owned = false;
54650         int64_t ret_conv = TxSignatures_hash(&o_conv);
54651         return ret_conv;
54652 }
54653
54654 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_TxSignatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
54655         LDKTxSignatures a_conv;
54656         a_conv.inner = untag_ptr(a);
54657         a_conv.is_owned = ptr_is_owned(a);
54658         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
54659         a_conv.is_owned = false;
54660         LDKTxSignatures b_conv;
54661         b_conv.inner = untag_ptr(b);
54662         b_conv.is_owned = ptr_is_owned(b);
54663         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
54664         b_conv.is_owned = false;
54665         jboolean ret_conv = TxSignatures_eq(&a_conv, &b_conv);
54666         return ret_conv;
54667 }
54668
54669 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxInitRbf_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
54670         LDKTxInitRbf this_obj_conv;
54671         this_obj_conv.inner = untag_ptr(this_obj);
54672         this_obj_conv.is_owned = ptr_is_owned(this_obj);
54673         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
54674         TxInitRbf_free(this_obj_conv);
54675 }
54676
54677 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxInitRbf_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
54678         LDKTxInitRbf this_ptr_conv;
54679         this_ptr_conv.inner = untag_ptr(this_ptr);
54680         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54681         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54682         this_ptr_conv.is_owned = false;
54683         LDKChannelId ret_var = TxInitRbf_get_channel_id(&this_ptr_conv);
54684         int64_t ret_ref = 0;
54685         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54686         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54687         return ret_ref;
54688 }
54689
54690 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxInitRbf_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
54691         LDKTxInitRbf this_ptr_conv;
54692         this_ptr_conv.inner = untag_ptr(this_ptr);
54693         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54694         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54695         this_ptr_conv.is_owned = false;
54696         LDKChannelId val_conv;
54697         val_conv.inner = untag_ptr(val);
54698         val_conv.is_owned = ptr_is_owned(val);
54699         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
54700         val_conv = ChannelId_clone(&val_conv);
54701         TxInitRbf_set_channel_id(&this_ptr_conv, val_conv);
54702 }
54703
54704 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_TxInitRbf_1get_1locktime(JNIEnv *env, jclass clz, int64_t this_ptr) {
54705         LDKTxInitRbf this_ptr_conv;
54706         this_ptr_conv.inner = untag_ptr(this_ptr);
54707         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54708         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54709         this_ptr_conv.is_owned = false;
54710         int32_t ret_conv = TxInitRbf_get_locktime(&this_ptr_conv);
54711         return ret_conv;
54712 }
54713
54714 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxInitRbf_1set_1locktime(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
54715         LDKTxInitRbf this_ptr_conv;
54716         this_ptr_conv.inner = untag_ptr(this_ptr);
54717         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54718         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54719         this_ptr_conv.is_owned = false;
54720         TxInitRbf_set_locktime(&this_ptr_conv, val);
54721 }
54722
54723 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_TxInitRbf_1get_1feerate_1sat_1per_11000_1weight(JNIEnv *env, jclass clz, int64_t this_ptr) {
54724         LDKTxInitRbf this_ptr_conv;
54725         this_ptr_conv.inner = untag_ptr(this_ptr);
54726         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54727         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54728         this_ptr_conv.is_owned = false;
54729         int32_t ret_conv = TxInitRbf_get_feerate_sat_per_1000_weight(&this_ptr_conv);
54730         return ret_conv;
54731 }
54732
54733 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) {
54734         LDKTxInitRbf this_ptr_conv;
54735         this_ptr_conv.inner = untag_ptr(this_ptr);
54736         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54737         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54738         this_ptr_conv.is_owned = false;
54739         TxInitRbf_set_feerate_sat_per_1000_weight(&this_ptr_conv, val);
54740 }
54741
54742 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxInitRbf_1get_1funding_1output_1contribution(JNIEnv *env, jclass clz, int64_t this_ptr) {
54743         LDKTxInitRbf this_ptr_conv;
54744         this_ptr_conv.inner = untag_ptr(this_ptr);
54745         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54746         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54747         this_ptr_conv.is_owned = false;
54748         LDKCOption_i64Z *ret_copy = MALLOC(sizeof(LDKCOption_i64Z), "LDKCOption_i64Z");
54749         *ret_copy = TxInitRbf_get_funding_output_contribution(&this_ptr_conv);
54750         int64_t ret_ref = tag_ptr(ret_copy, true);
54751         return ret_ref;
54752 }
54753
54754 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxInitRbf_1set_1funding_1output_1contribution(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
54755         LDKTxInitRbf this_ptr_conv;
54756         this_ptr_conv.inner = untag_ptr(this_ptr);
54757         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54758         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54759         this_ptr_conv.is_owned = false;
54760         void* val_ptr = untag_ptr(val);
54761         CHECK_ACCESS(val_ptr);
54762         LDKCOption_i64Z val_conv = *(LDKCOption_i64Z*)(val_ptr);
54763         val_conv = COption_i64Z_clone((LDKCOption_i64Z*)untag_ptr(val));
54764         TxInitRbf_set_funding_output_contribution(&this_ptr_conv, val_conv);
54765 }
54766
54767 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxInitRbf_1new(JNIEnv *env, jclass clz, int64_t channel_id_arg, int32_t locktime_arg, int32_t feerate_sat_per_1000_weight_arg, int64_t funding_output_contribution_arg) {
54768         LDKChannelId channel_id_arg_conv;
54769         channel_id_arg_conv.inner = untag_ptr(channel_id_arg);
54770         channel_id_arg_conv.is_owned = ptr_is_owned(channel_id_arg);
54771         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_arg_conv);
54772         channel_id_arg_conv = ChannelId_clone(&channel_id_arg_conv);
54773         void* funding_output_contribution_arg_ptr = untag_ptr(funding_output_contribution_arg);
54774         CHECK_ACCESS(funding_output_contribution_arg_ptr);
54775         LDKCOption_i64Z funding_output_contribution_arg_conv = *(LDKCOption_i64Z*)(funding_output_contribution_arg_ptr);
54776         funding_output_contribution_arg_conv = COption_i64Z_clone((LDKCOption_i64Z*)untag_ptr(funding_output_contribution_arg));
54777         LDKTxInitRbf ret_var = TxInitRbf_new(channel_id_arg_conv, locktime_arg, feerate_sat_per_1000_weight_arg, funding_output_contribution_arg_conv);
54778         int64_t ret_ref = 0;
54779         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54780         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54781         return ret_ref;
54782 }
54783
54784 static inline uint64_t TxInitRbf_clone_ptr(LDKTxInitRbf *NONNULL_PTR arg) {
54785         LDKTxInitRbf ret_var = TxInitRbf_clone(arg);
54786         int64_t ret_ref = 0;
54787         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54788         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54789         return ret_ref;
54790 }
54791 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxInitRbf_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
54792         LDKTxInitRbf arg_conv;
54793         arg_conv.inner = untag_ptr(arg);
54794         arg_conv.is_owned = ptr_is_owned(arg);
54795         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
54796         arg_conv.is_owned = false;
54797         int64_t ret_conv = TxInitRbf_clone_ptr(&arg_conv);
54798         return ret_conv;
54799 }
54800
54801 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxInitRbf_1clone(JNIEnv *env, jclass clz, int64_t orig) {
54802         LDKTxInitRbf orig_conv;
54803         orig_conv.inner = untag_ptr(orig);
54804         orig_conv.is_owned = ptr_is_owned(orig);
54805         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
54806         orig_conv.is_owned = false;
54807         LDKTxInitRbf ret_var = TxInitRbf_clone(&orig_conv);
54808         int64_t ret_ref = 0;
54809         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54810         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54811         return ret_ref;
54812 }
54813
54814 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxInitRbf_1hash(JNIEnv *env, jclass clz, int64_t o) {
54815         LDKTxInitRbf o_conv;
54816         o_conv.inner = untag_ptr(o);
54817         o_conv.is_owned = ptr_is_owned(o);
54818         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
54819         o_conv.is_owned = false;
54820         int64_t ret_conv = TxInitRbf_hash(&o_conv);
54821         return ret_conv;
54822 }
54823
54824 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_TxInitRbf_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
54825         LDKTxInitRbf a_conv;
54826         a_conv.inner = untag_ptr(a);
54827         a_conv.is_owned = ptr_is_owned(a);
54828         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
54829         a_conv.is_owned = false;
54830         LDKTxInitRbf b_conv;
54831         b_conv.inner = untag_ptr(b);
54832         b_conv.is_owned = ptr_is_owned(b);
54833         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
54834         b_conv.is_owned = false;
54835         jboolean ret_conv = TxInitRbf_eq(&a_conv, &b_conv);
54836         return ret_conv;
54837 }
54838
54839 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxAckRbf_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
54840         LDKTxAckRbf this_obj_conv;
54841         this_obj_conv.inner = untag_ptr(this_obj);
54842         this_obj_conv.is_owned = ptr_is_owned(this_obj);
54843         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
54844         TxAckRbf_free(this_obj_conv);
54845 }
54846
54847 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxAckRbf_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
54848         LDKTxAckRbf this_ptr_conv;
54849         this_ptr_conv.inner = untag_ptr(this_ptr);
54850         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54851         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54852         this_ptr_conv.is_owned = false;
54853         LDKChannelId ret_var = TxAckRbf_get_channel_id(&this_ptr_conv);
54854         int64_t ret_ref = 0;
54855         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54856         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54857         return ret_ref;
54858 }
54859
54860 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxAckRbf_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
54861         LDKTxAckRbf this_ptr_conv;
54862         this_ptr_conv.inner = untag_ptr(this_ptr);
54863         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54864         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54865         this_ptr_conv.is_owned = false;
54866         LDKChannelId val_conv;
54867         val_conv.inner = untag_ptr(val);
54868         val_conv.is_owned = ptr_is_owned(val);
54869         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
54870         val_conv = ChannelId_clone(&val_conv);
54871         TxAckRbf_set_channel_id(&this_ptr_conv, val_conv);
54872 }
54873
54874 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxAckRbf_1get_1funding_1output_1contribution(JNIEnv *env, jclass clz, int64_t this_ptr) {
54875         LDKTxAckRbf 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         LDKCOption_i64Z *ret_copy = MALLOC(sizeof(LDKCOption_i64Z), "LDKCOption_i64Z");
54881         *ret_copy = TxAckRbf_get_funding_output_contribution(&this_ptr_conv);
54882         int64_t ret_ref = tag_ptr(ret_copy, true);
54883         return ret_ref;
54884 }
54885
54886 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxAckRbf_1set_1funding_1output_1contribution(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
54887         LDKTxAckRbf 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         void* val_ptr = untag_ptr(val);
54893         CHECK_ACCESS(val_ptr);
54894         LDKCOption_i64Z val_conv = *(LDKCOption_i64Z*)(val_ptr);
54895         val_conv = COption_i64Z_clone((LDKCOption_i64Z*)untag_ptr(val));
54896         TxAckRbf_set_funding_output_contribution(&this_ptr_conv, val_conv);
54897 }
54898
54899 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxAckRbf_1new(JNIEnv *env, jclass clz, int64_t channel_id_arg, int64_t funding_output_contribution_arg) {
54900         LDKChannelId channel_id_arg_conv;
54901         channel_id_arg_conv.inner = untag_ptr(channel_id_arg);
54902         channel_id_arg_conv.is_owned = ptr_is_owned(channel_id_arg);
54903         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_arg_conv);
54904         channel_id_arg_conv = ChannelId_clone(&channel_id_arg_conv);
54905         void* funding_output_contribution_arg_ptr = untag_ptr(funding_output_contribution_arg);
54906         CHECK_ACCESS(funding_output_contribution_arg_ptr);
54907         LDKCOption_i64Z funding_output_contribution_arg_conv = *(LDKCOption_i64Z*)(funding_output_contribution_arg_ptr);
54908         funding_output_contribution_arg_conv = COption_i64Z_clone((LDKCOption_i64Z*)untag_ptr(funding_output_contribution_arg));
54909         LDKTxAckRbf ret_var = TxAckRbf_new(channel_id_arg_conv, funding_output_contribution_arg_conv);
54910         int64_t ret_ref = 0;
54911         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54912         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54913         return ret_ref;
54914 }
54915
54916 static inline uint64_t TxAckRbf_clone_ptr(LDKTxAckRbf *NONNULL_PTR arg) {
54917         LDKTxAckRbf ret_var = TxAckRbf_clone(arg);
54918         int64_t ret_ref = 0;
54919         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54920         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54921         return ret_ref;
54922 }
54923 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxAckRbf_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
54924         LDKTxAckRbf arg_conv;
54925         arg_conv.inner = untag_ptr(arg);
54926         arg_conv.is_owned = ptr_is_owned(arg);
54927         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
54928         arg_conv.is_owned = false;
54929         int64_t ret_conv = TxAckRbf_clone_ptr(&arg_conv);
54930         return ret_conv;
54931 }
54932
54933 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxAckRbf_1clone(JNIEnv *env, jclass clz, int64_t orig) {
54934         LDKTxAckRbf orig_conv;
54935         orig_conv.inner = untag_ptr(orig);
54936         orig_conv.is_owned = ptr_is_owned(orig);
54937         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
54938         orig_conv.is_owned = false;
54939         LDKTxAckRbf ret_var = TxAckRbf_clone(&orig_conv);
54940         int64_t ret_ref = 0;
54941         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54942         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54943         return ret_ref;
54944 }
54945
54946 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxAckRbf_1hash(JNIEnv *env, jclass clz, int64_t o) {
54947         LDKTxAckRbf o_conv;
54948         o_conv.inner = untag_ptr(o);
54949         o_conv.is_owned = ptr_is_owned(o);
54950         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
54951         o_conv.is_owned = false;
54952         int64_t ret_conv = TxAckRbf_hash(&o_conv);
54953         return ret_conv;
54954 }
54955
54956 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_TxAckRbf_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
54957         LDKTxAckRbf a_conv;
54958         a_conv.inner = untag_ptr(a);
54959         a_conv.is_owned = ptr_is_owned(a);
54960         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
54961         a_conv.is_owned = false;
54962         LDKTxAckRbf b_conv;
54963         b_conv.inner = untag_ptr(b);
54964         b_conv.is_owned = ptr_is_owned(b);
54965         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
54966         b_conv.is_owned = false;
54967         jboolean ret_conv = TxAckRbf_eq(&a_conv, &b_conv);
54968         return ret_conv;
54969 }
54970
54971 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxAbort_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
54972         LDKTxAbort this_obj_conv;
54973         this_obj_conv.inner = untag_ptr(this_obj);
54974         this_obj_conv.is_owned = ptr_is_owned(this_obj);
54975         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
54976         TxAbort_free(this_obj_conv);
54977 }
54978
54979 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxAbort_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
54980         LDKTxAbort this_ptr_conv;
54981         this_ptr_conv.inner = untag_ptr(this_ptr);
54982         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54983         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54984         this_ptr_conv.is_owned = false;
54985         LDKChannelId ret_var = TxAbort_get_channel_id(&this_ptr_conv);
54986         int64_t ret_ref = 0;
54987         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
54988         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
54989         return ret_ref;
54990 }
54991
54992 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxAbort_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
54993         LDKTxAbort this_ptr_conv;
54994         this_ptr_conv.inner = untag_ptr(this_ptr);
54995         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
54996         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
54997         this_ptr_conv.is_owned = false;
54998         LDKChannelId val_conv;
54999         val_conv.inner = untag_ptr(val);
55000         val_conv.is_owned = ptr_is_owned(val);
55001         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
55002         val_conv = ChannelId_clone(&val_conv);
55003         TxAbort_set_channel_id(&this_ptr_conv, val_conv);
55004 }
55005
55006 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxAbort_1get_1data(JNIEnv *env, jclass clz, int64_t this_ptr) {
55007         LDKTxAbort this_ptr_conv;
55008         this_ptr_conv.inner = untag_ptr(this_ptr);
55009         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55010         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55011         this_ptr_conv.is_owned = false;
55012         LDKCVec_u8Z ret_var = TxAbort_get_data(&this_ptr_conv);
55013         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
55014         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
55015         CVec_u8Z_free(ret_var);
55016         return ret_arr;
55017 }
55018
55019 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxAbort_1set_1data(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
55020         LDKTxAbort this_ptr_conv;
55021         this_ptr_conv.inner = untag_ptr(this_ptr);
55022         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55023         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55024         this_ptr_conv.is_owned = false;
55025         LDKCVec_u8Z val_ref;
55026         val_ref.datalen = (*env)->GetArrayLength(env, val);
55027         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
55028         (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
55029         TxAbort_set_data(&this_ptr_conv, val_ref);
55030 }
55031
55032 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxAbort_1new(JNIEnv *env, jclass clz, int64_t channel_id_arg, int8_tArray data_arg) {
55033         LDKChannelId channel_id_arg_conv;
55034         channel_id_arg_conv.inner = untag_ptr(channel_id_arg);
55035         channel_id_arg_conv.is_owned = ptr_is_owned(channel_id_arg);
55036         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_arg_conv);
55037         channel_id_arg_conv = ChannelId_clone(&channel_id_arg_conv);
55038         LDKCVec_u8Z data_arg_ref;
55039         data_arg_ref.datalen = (*env)->GetArrayLength(env, data_arg);
55040         data_arg_ref.data = MALLOC(data_arg_ref.datalen, "LDKCVec_u8Z Bytes");
55041         (*env)->GetByteArrayRegion(env, data_arg, 0, data_arg_ref.datalen, data_arg_ref.data);
55042         LDKTxAbort ret_var = TxAbort_new(channel_id_arg_conv, data_arg_ref);
55043         int64_t ret_ref = 0;
55044         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55045         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55046         return ret_ref;
55047 }
55048
55049 static inline uint64_t TxAbort_clone_ptr(LDKTxAbort *NONNULL_PTR arg) {
55050         LDKTxAbort ret_var = TxAbort_clone(arg);
55051         int64_t ret_ref = 0;
55052         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55053         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55054         return ret_ref;
55055 }
55056 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxAbort_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
55057         LDKTxAbort arg_conv;
55058         arg_conv.inner = untag_ptr(arg);
55059         arg_conv.is_owned = ptr_is_owned(arg);
55060         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
55061         arg_conv.is_owned = false;
55062         int64_t ret_conv = TxAbort_clone_ptr(&arg_conv);
55063         return ret_conv;
55064 }
55065
55066 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxAbort_1clone(JNIEnv *env, jclass clz, int64_t orig) {
55067         LDKTxAbort orig_conv;
55068         orig_conv.inner = untag_ptr(orig);
55069         orig_conv.is_owned = ptr_is_owned(orig);
55070         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
55071         orig_conv.is_owned = false;
55072         LDKTxAbort ret_var = TxAbort_clone(&orig_conv);
55073         int64_t ret_ref = 0;
55074         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55075         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55076         return ret_ref;
55077 }
55078
55079 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxAbort_1hash(JNIEnv *env, jclass clz, int64_t o) {
55080         LDKTxAbort o_conv;
55081         o_conv.inner = untag_ptr(o);
55082         o_conv.is_owned = ptr_is_owned(o);
55083         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
55084         o_conv.is_owned = false;
55085         int64_t ret_conv = TxAbort_hash(&o_conv);
55086         return ret_conv;
55087 }
55088
55089 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_TxAbort_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
55090         LDKTxAbort a_conv;
55091         a_conv.inner = untag_ptr(a);
55092         a_conv.is_owned = ptr_is_owned(a);
55093         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
55094         a_conv.is_owned = false;
55095         LDKTxAbort b_conv;
55096         b_conv.inner = untag_ptr(b);
55097         b_conv.is_owned = ptr_is_owned(b);
55098         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
55099         b_conv.is_owned = false;
55100         jboolean ret_conv = TxAbort_eq(&a_conv, &b_conv);
55101         return ret_conv;
55102 }
55103
55104 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Shutdown_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
55105         LDKShutdown this_obj_conv;
55106         this_obj_conv.inner = untag_ptr(this_obj);
55107         this_obj_conv.is_owned = ptr_is_owned(this_obj);
55108         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
55109         Shutdown_free(this_obj_conv);
55110 }
55111
55112 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Shutdown_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
55113         LDKShutdown this_ptr_conv;
55114         this_ptr_conv.inner = untag_ptr(this_ptr);
55115         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55116         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55117         this_ptr_conv.is_owned = false;
55118         LDKChannelId ret_var = Shutdown_get_channel_id(&this_ptr_conv);
55119         int64_t ret_ref = 0;
55120         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55121         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55122         return ret_ref;
55123 }
55124
55125 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Shutdown_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
55126         LDKShutdown this_ptr_conv;
55127         this_ptr_conv.inner = untag_ptr(this_ptr);
55128         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55129         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55130         this_ptr_conv.is_owned = false;
55131         LDKChannelId val_conv;
55132         val_conv.inner = untag_ptr(val);
55133         val_conv.is_owned = ptr_is_owned(val);
55134         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
55135         val_conv = ChannelId_clone(&val_conv);
55136         Shutdown_set_channel_id(&this_ptr_conv, val_conv);
55137 }
55138
55139 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Shutdown_1get_1scriptpubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
55140         LDKShutdown this_ptr_conv;
55141         this_ptr_conv.inner = untag_ptr(this_ptr);
55142         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55143         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55144         this_ptr_conv.is_owned = false;
55145         LDKCVec_u8Z ret_var = Shutdown_get_scriptpubkey(&this_ptr_conv);
55146         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
55147         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
55148         CVec_u8Z_free(ret_var);
55149         return ret_arr;
55150 }
55151
55152 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Shutdown_1set_1scriptpubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
55153         LDKShutdown this_ptr_conv;
55154         this_ptr_conv.inner = untag_ptr(this_ptr);
55155         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55156         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55157         this_ptr_conv.is_owned = false;
55158         LDKCVec_u8Z val_ref;
55159         val_ref.datalen = (*env)->GetArrayLength(env, val);
55160         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
55161         (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
55162         Shutdown_set_scriptpubkey(&this_ptr_conv, val_ref);
55163 }
55164
55165 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Shutdown_1new(JNIEnv *env, jclass clz, int64_t channel_id_arg, int8_tArray scriptpubkey_arg) {
55166         LDKChannelId channel_id_arg_conv;
55167         channel_id_arg_conv.inner = untag_ptr(channel_id_arg);
55168         channel_id_arg_conv.is_owned = ptr_is_owned(channel_id_arg);
55169         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_arg_conv);
55170         channel_id_arg_conv = ChannelId_clone(&channel_id_arg_conv);
55171         LDKCVec_u8Z scriptpubkey_arg_ref;
55172         scriptpubkey_arg_ref.datalen = (*env)->GetArrayLength(env, scriptpubkey_arg);
55173         scriptpubkey_arg_ref.data = MALLOC(scriptpubkey_arg_ref.datalen, "LDKCVec_u8Z Bytes");
55174         (*env)->GetByteArrayRegion(env, scriptpubkey_arg, 0, scriptpubkey_arg_ref.datalen, scriptpubkey_arg_ref.data);
55175         LDKShutdown ret_var = Shutdown_new(channel_id_arg_conv, scriptpubkey_arg_ref);
55176         int64_t ret_ref = 0;
55177         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55178         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55179         return ret_ref;
55180 }
55181
55182 static inline uint64_t Shutdown_clone_ptr(LDKShutdown *NONNULL_PTR arg) {
55183         LDKShutdown ret_var = Shutdown_clone(arg);
55184         int64_t ret_ref = 0;
55185         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55186         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55187         return ret_ref;
55188 }
55189 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Shutdown_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
55190         LDKShutdown arg_conv;
55191         arg_conv.inner = untag_ptr(arg);
55192         arg_conv.is_owned = ptr_is_owned(arg);
55193         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
55194         arg_conv.is_owned = false;
55195         int64_t ret_conv = Shutdown_clone_ptr(&arg_conv);
55196         return ret_conv;
55197 }
55198
55199 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Shutdown_1clone(JNIEnv *env, jclass clz, int64_t orig) {
55200         LDKShutdown orig_conv;
55201         orig_conv.inner = untag_ptr(orig);
55202         orig_conv.is_owned = ptr_is_owned(orig);
55203         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
55204         orig_conv.is_owned = false;
55205         LDKShutdown ret_var = Shutdown_clone(&orig_conv);
55206         int64_t ret_ref = 0;
55207         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55208         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55209         return ret_ref;
55210 }
55211
55212 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Shutdown_1hash(JNIEnv *env, jclass clz, int64_t o) {
55213         LDKShutdown o_conv;
55214         o_conv.inner = untag_ptr(o);
55215         o_conv.is_owned = ptr_is_owned(o);
55216         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
55217         o_conv.is_owned = false;
55218         int64_t ret_conv = Shutdown_hash(&o_conv);
55219         return ret_conv;
55220 }
55221
55222 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Shutdown_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
55223         LDKShutdown a_conv;
55224         a_conv.inner = untag_ptr(a);
55225         a_conv.is_owned = ptr_is_owned(a);
55226         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
55227         a_conv.is_owned = false;
55228         LDKShutdown b_conv;
55229         b_conv.inner = untag_ptr(b);
55230         b_conv.is_owned = ptr_is_owned(b);
55231         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
55232         b_conv.is_owned = false;
55233         jboolean ret_conv = Shutdown_eq(&a_conv, &b_conv);
55234         return ret_conv;
55235 }
55236
55237 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
55238         LDKClosingSignedFeeRange this_obj_conv;
55239         this_obj_conv.inner = untag_ptr(this_obj);
55240         this_obj_conv.is_owned = ptr_is_owned(this_obj);
55241         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
55242         ClosingSignedFeeRange_free(this_obj_conv);
55243 }
55244
55245 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1get_1min_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
55246         LDKClosingSignedFeeRange this_ptr_conv;
55247         this_ptr_conv.inner = untag_ptr(this_ptr);
55248         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55249         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55250         this_ptr_conv.is_owned = false;
55251         int64_t ret_conv = ClosingSignedFeeRange_get_min_fee_satoshis(&this_ptr_conv);
55252         return ret_conv;
55253 }
55254
55255 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1set_1min_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
55256         LDKClosingSignedFeeRange this_ptr_conv;
55257         this_ptr_conv.inner = untag_ptr(this_ptr);
55258         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55259         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55260         this_ptr_conv.is_owned = false;
55261         ClosingSignedFeeRange_set_min_fee_satoshis(&this_ptr_conv, val);
55262 }
55263
55264 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1get_1max_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
55265         LDKClosingSignedFeeRange this_ptr_conv;
55266         this_ptr_conv.inner = untag_ptr(this_ptr);
55267         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55268         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55269         this_ptr_conv.is_owned = false;
55270         int64_t ret_conv = ClosingSignedFeeRange_get_max_fee_satoshis(&this_ptr_conv);
55271         return ret_conv;
55272 }
55273
55274 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1set_1max_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
55275         LDKClosingSignedFeeRange this_ptr_conv;
55276         this_ptr_conv.inner = untag_ptr(this_ptr);
55277         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55278         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55279         this_ptr_conv.is_owned = false;
55280         ClosingSignedFeeRange_set_max_fee_satoshis(&this_ptr_conv, val);
55281 }
55282
55283 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) {
55284         LDKClosingSignedFeeRange ret_var = ClosingSignedFeeRange_new(min_fee_satoshis_arg, max_fee_satoshis_arg);
55285         int64_t ret_ref = 0;
55286         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55287         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55288         return ret_ref;
55289 }
55290
55291 static inline uint64_t ClosingSignedFeeRange_clone_ptr(LDKClosingSignedFeeRange *NONNULL_PTR arg) {
55292         LDKClosingSignedFeeRange ret_var = ClosingSignedFeeRange_clone(arg);
55293         int64_t ret_ref = 0;
55294         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55295         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55296         return ret_ref;
55297 }
55298 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
55299         LDKClosingSignedFeeRange arg_conv;
55300         arg_conv.inner = untag_ptr(arg);
55301         arg_conv.is_owned = ptr_is_owned(arg);
55302         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
55303         arg_conv.is_owned = false;
55304         int64_t ret_conv = ClosingSignedFeeRange_clone_ptr(&arg_conv);
55305         return ret_conv;
55306 }
55307
55308 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1clone(JNIEnv *env, jclass clz, int64_t orig) {
55309         LDKClosingSignedFeeRange orig_conv;
55310         orig_conv.inner = untag_ptr(orig);
55311         orig_conv.is_owned = ptr_is_owned(orig);
55312         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
55313         orig_conv.is_owned = false;
55314         LDKClosingSignedFeeRange ret_var = ClosingSignedFeeRange_clone(&orig_conv);
55315         int64_t ret_ref = 0;
55316         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55317         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55318         return ret_ref;
55319 }
55320
55321 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1hash(JNIEnv *env, jclass clz, int64_t o) {
55322         LDKClosingSignedFeeRange o_conv;
55323         o_conv.inner = untag_ptr(o);
55324         o_conv.is_owned = ptr_is_owned(o);
55325         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
55326         o_conv.is_owned = false;
55327         int64_t ret_conv = ClosingSignedFeeRange_hash(&o_conv);
55328         return ret_conv;
55329 }
55330
55331 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
55332         LDKClosingSignedFeeRange a_conv;
55333         a_conv.inner = untag_ptr(a);
55334         a_conv.is_owned = ptr_is_owned(a);
55335         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
55336         a_conv.is_owned = false;
55337         LDKClosingSignedFeeRange b_conv;
55338         b_conv.inner = untag_ptr(b);
55339         b_conv.is_owned = ptr_is_owned(b);
55340         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
55341         b_conv.is_owned = false;
55342         jboolean ret_conv = ClosingSignedFeeRange_eq(&a_conv, &b_conv);
55343         return ret_conv;
55344 }
55345
55346 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
55347         LDKClosingSigned this_obj_conv;
55348         this_obj_conv.inner = untag_ptr(this_obj);
55349         this_obj_conv.is_owned = ptr_is_owned(this_obj);
55350         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
55351         ClosingSigned_free(this_obj_conv);
55352 }
55353
55354 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
55355         LDKClosingSigned this_ptr_conv;
55356         this_ptr_conv.inner = untag_ptr(this_ptr);
55357         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55358         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55359         this_ptr_conv.is_owned = false;
55360         LDKChannelId ret_var = ClosingSigned_get_channel_id(&this_ptr_conv);
55361         int64_t ret_ref = 0;
55362         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55363         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55364         return ret_ref;
55365 }
55366
55367 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
55368         LDKClosingSigned 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         LDKChannelId val_conv;
55374         val_conv.inner = untag_ptr(val);
55375         val_conv.is_owned = ptr_is_owned(val);
55376         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
55377         val_conv = ChannelId_clone(&val_conv);
55378         ClosingSigned_set_channel_id(&this_ptr_conv, val_conv);
55379 }
55380
55381 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
55382         LDKClosingSigned this_ptr_conv;
55383         this_ptr_conv.inner = untag_ptr(this_ptr);
55384         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55385         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55386         this_ptr_conv.is_owned = false;
55387         int64_t ret_conv = ClosingSigned_get_fee_satoshis(&this_ptr_conv);
55388         return ret_conv;
55389 }
55390
55391 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
55392         LDKClosingSigned this_ptr_conv;
55393         this_ptr_conv.inner = untag_ptr(this_ptr);
55394         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55395         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55396         this_ptr_conv.is_owned = false;
55397         ClosingSigned_set_fee_satoshis(&this_ptr_conv, val);
55398 }
55399
55400 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
55401         LDKClosingSigned this_ptr_conv;
55402         this_ptr_conv.inner = untag_ptr(this_ptr);
55403         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55404         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55405         this_ptr_conv.is_owned = false;
55406         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
55407         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ClosingSigned_get_signature(&this_ptr_conv).compact_form);
55408         return ret_arr;
55409 }
55410
55411 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
55412         LDKClosingSigned this_ptr_conv;
55413         this_ptr_conv.inner = untag_ptr(this_ptr);
55414         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55415         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55416         this_ptr_conv.is_owned = false;
55417         LDKECDSASignature val_ref;
55418         CHECK((*env)->GetArrayLength(env, val) == 64);
55419         (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
55420         ClosingSigned_set_signature(&this_ptr_conv, val_ref);
55421 }
55422
55423 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1fee_1range(JNIEnv *env, jclass clz, int64_t this_ptr) {
55424         LDKClosingSigned this_ptr_conv;
55425         this_ptr_conv.inner = untag_ptr(this_ptr);
55426         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55427         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55428         this_ptr_conv.is_owned = false;
55429         LDKClosingSignedFeeRange ret_var = ClosingSigned_get_fee_range(&this_ptr_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 void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1fee_1range(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
55437         LDKClosingSigned this_ptr_conv;
55438         this_ptr_conv.inner = untag_ptr(this_ptr);
55439         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55440         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55441         this_ptr_conv.is_owned = false;
55442         LDKClosingSignedFeeRange val_conv;
55443         val_conv.inner = untag_ptr(val);
55444         val_conv.is_owned = ptr_is_owned(val);
55445         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
55446         val_conv = ClosingSignedFeeRange_clone(&val_conv);
55447         ClosingSigned_set_fee_range(&this_ptr_conv, val_conv);
55448 }
55449
55450 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1new(JNIEnv *env, jclass clz, int64_t channel_id_arg, int64_t fee_satoshis_arg, int8_tArray signature_arg, int64_t fee_range_arg) {
55451         LDKChannelId channel_id_arg_conv;
55452         channel_id_arg_conv.inner = untag_ptr(channel_id_arg);
55453         channel_id_arg_conv.is_owned = ptr_is_owned(channel_id_arg);
55454         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_arg_conv);
55455         channel_id_arg_conv = ChannelId_clone(&channel_id_arg_conv);
55456         LDKECDSASignature signature_arg_ref;
55457         CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
55458         (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
55459         LDKClosingSignedFeeRange fee_range_arg_conv;
55460         fee_range_arg_conv.inner = untag_ptr(fee_range_arg);
55461         fee_range_arg_conv.is_owned = ptr_is_owned(fee_range_arg);
55462         CHECK_INNER_FIELD_ACCESS_OR_NULL(fee_range_arg_conv);
55463         fee_range_arg_conv = ClosingSignedFeeRange_clone(&fee_range_arg_conv);
55464         LDKClosingSigned ret_var = ClosingSigned_new(channel_id_arg_conv, fee_satoshis_arg, signature_arg_ref, fee_range_arg_conv);
55465         int64_t ret_ref = 0;
55466         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55467         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55468         return ret_ref;
55469 }
55470
55471 static inline uint64_t ClosingSigned_clone_ptr(LDKClosingSigned *NONNULL_PTR arg) {
55472         LDKClosingSigned ret_var = ClosingSigned_clone(arg);
55473         int64_t ret_ref = 0;
55474         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55475         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55476         return ret_ref;
55477 }
55478 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
55479         LDKClosingSigned arg_conv;
55480         arg_conv.inner = untag_ptr(arg);
55481         arg_conv.is_owned = ptr_is_owned(arg);
55482         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
55483         arg_conv.is_owned = false;
55484         int64_t ret_conv = ClosingSigned_clone_ptr(&arg_conv);
55485         return ret_conv;
55486 }
55487
55488 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1clone(JNIEnv *env, jclass clz, int64_t orig) {
55489         LDKClosingSigned orig_conv;
55490         orig_conv.inner = untag_ptr(orig);
55491         orig_conv.is_owned = ptr_is_owned(orig);
55492         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
55493         orig_conv.is_owned = false;
55494         LDKClosingSigned ret_var = ClosingSigned_clone(&orig_conv);
55495         int64_t ret_ref = 0;
55496         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55497         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55498         return ret_ref;
55499 }
55500
55501 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1hash(JNIEnv *env, jclass clz, int64_t o) {
55502         LDKClosingSigned o_conv;
55503         o_conv.inner = untag_ptr(o);
55504         o_conv.is_owned = ptr_is_owned(o);
55505         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
55506         o_conv.is_owned = false;
55507         int64_t ret_conv = ClosingSigned_hash(&o_conv);
55508         return ret_conv;
55509 }
55510
55511 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
55512         LDKClosingSigned a_conv;
55513         a_conv.inner = untag_ptr(a);
55514         a_conv.is_owned = ptr_is_owned(a);
55515         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
55516         a_conv.is_owned = false;
55517         LDKClosingSigned b_conv;
55518         b_conv.inner = untag_ptr(b);
55519         b_conv.is_owned = ptr_is_owned(b);
55520         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
55521         b_conv.is_owned = false;
55522         jboolean ret_conv = ClosingSigned_eq(&a_conv, &b_conv);
55523         return ret_conv;
55524 }
55525
55526 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
55527         LDKUpdateAddHTLC this_obj_conv;
55528         this_obj_conv.inner = untag_ptr(this_obj);
55529         this_obj_conv.is_owned = ptr_is_owned(this_obj);
55530         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
55531         UpdateAddHTLC_free(this_obj_conv);
55532 }
55533
55534 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
55535         LDKUpdateAddHTLC this_ptr_conv;
55536         this_ptr_conv.inner = untag_ptr(this_ptr);
55537         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55538         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55539         this_ptr_conv.is_owned = false;
55540         LDKChannelId ret_var = UpdateAddHTLC_get_channel_id(&this_ptr_conv);
55541         int64_t ret_ref = 0;
55542         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55543         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55544         return ret_ref;
55545 }
55546
55547 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
55548         LDKUpdateAddHTLC this_ptr_conv;
55549         this_ptr_conv.inner = untag_ptr(this_ptr);
55550         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55551         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55552         this_ptr_conv.is_owned = false;
55553         LDKChannelId val_conv;
55554         val_conv.inner = untag_ptr(val);
55555         val_conv.is_owned = ptr_is_owned(val);
55556         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
55557         val_conv = ChannelId_clone(&val_conv);
55558         UpdateAddHTLC_set_channel_id(&this_ptr_conv, val_conv);
55559 }
55560
55561 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
55562         LDKUpdateAddHTLC this_ptr_conv;
55563         this_ptr_conv.inner = untag_ptr(this_ptr);
55564         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55565         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55566         this_ptr_conv.is_owned = false;
55567         int64_t ret_conv = UpdateAddHTLC_get_htlc_id(&this_ptr_conv);
55568         return ret_conv;
55569 }
55570
55571 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
55572         LDKUpdateAddHTLC this_ptr_conv;
55573         this_ptr_conv.inner = untag_ptr(this_ptr);
55574         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55575         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55576         this_ptr_conv.is_owned = false;
55577         UpdateAddHTLC_set_htlc_id(&this_ptr_conv, val);
55578 }
55579
55580 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1amount_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
55581         LDKUpdateAddHTLC this_ptr_conv;
55582         this_ptr_conv.inner = untag_ptr(this_ptr);
55583         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55584         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55585         this_ptr_conv.is_owned = false;
55586         int64_t ret_conv = UpdateAddHTLC_get_amount_msat(&this_ptr_conv);
55587         return ret_conv;
55588 }
55589
55590 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1amount_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
55591         LDKUpdateAddHTLC this_ptr_conv;
55592         this_ptr_conv.inner = untag_ptr(this_ptr);
55593         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55594         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55595         this_ptr_conv.is_owned = false;
55596         UpdateAddHTLC_set_amount_msat(&this_ptr_conv, val);
55597 }
55598
55599 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
55600         LDKUpdateAddHTLC this_ptr_conv;
55601         this_ptr_conv.inner = untag_ptr(this_ptr);
55602         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55603         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55604         this_ptr_conv.is_owned = false;
55605         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
55606         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateAddHTLC_get_payment_hash(&this_ptr_conv));
55607         return ret_arr;
55608 }
55609
55610 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
55611         LDKUpdateAddHTLC this_ptr_conv;
55612         this_ptr_conv.inner = untag_ptr(this_ptr);
55613         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55614         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55615         this_ptr_conv.is_owned = false;
55616         LDKThirtyTwoBytes val_ref;
55617         CHECK((*env)->GetArrayLength(env, val) == 32);
55618         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
55619         UpdateAddHTLC_set_payment_hash(&this_ptr_conv, val_ref);
55620 }
55621
55622 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_ptr) {
55623         LDKUpdateAddHTLC this_ptr_conv;
55624         this_ptr_conv.inner = untag_ptr(this_ptr);
55625         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55626         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55627         this_ptr_conv.is_owned = false;
55628         int32_t ret_conv = UpdateAddHTLC_get_cltv_expiry(&this_ptr_conv);
55629         return ret_conv;
55630 }
55631
55632 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
55633         LDKUpdateAddHTLC this_ptr_conv;
55634         this_ptr_conv.inner = untag_ptr(this_ptr);
55635         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55636         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55637         this_ptr_conv.is_owned = false;
55638         UpdateAddHTLC_set_cltv_expiry(&this_ptr_conv, val);
55639 }
55640
55641 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1skimmed_1fee_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
55642         LDKUpdateAddHTLC this_ptr_conv;
55643         this_ptr_conv.inner = untag_ptr(this_ptr);
55644         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55645         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55646         this_ptr_conv.is_owned = false;
55647         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
55648         *ret_copy = UpdateAddHTLC_get_skimmed_fee_msat(&this_ptr_conv);
55649         int64_t ret_ref = tag_ptr(ret_copy, true);
55650         return ret_ref;
55651 }
55652
55653 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1skimmed_1fee_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
55654         LDKUpdateAddHTLC this_ptr_conv;
55655         this_ptr_conv.inner = untag_ptr(this_ptr);
55656         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55657         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55658         this_ptr_conv.is_owned = false;
55659         void* val_ptr = untag_ptr(val);
55660         CHECK_ACCESS(val_ptr);
55661         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
55662         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
55663         UpdateAddHTLC_set_skimmed_fee_msat(&this_ptr_conv, val_conv);
55664 }
55665
55666 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1onion_1routing_1packet(JNIEnv *env, jclass clz, int64_t this_ptr) {
55667         LDKUpdateAddHTLC this_ptr_conv;
55668         this_ptr_conv.inner = untag_ptr(this_ptr);
55669         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55670         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55671         this_ptr_conv.is_owned = false;
55672         LDKOnionPacket ret_var = UpdateAddHTLC_get_onion_routing_packet(&this_ptr_conv);
55673         int64_t ret_ref = 0;
55674         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55675         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55676         return ret_ref;
55677 }
55678
55679 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1onion_1routing_1packet(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
55680         LDKUpdateAddHTLC this_ptr_conv;
55681         this_ptr_conv.inner = untag_ptr(this_ptr);
55682         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55683         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55684         this_ptr_conv.is_owned = false;
55685         LDKOnionPacket val_conv;
55686         val_conv.inner = untag_ptr(val);
55687         val_conv.is_owned = ptr_is_owned(val);
55688         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
55689         val_conv = OnionPacket_clone(&val_conv);
55690         UpdateAddHTLC_set_onion_routing_packet(&this_ptr_conv, val_conv);
55691 }
55692
55693 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1blinding_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
55694         LDKUpdateAddHTLC this_ptr_conv;
55695         this_ptr_conv.inner = untag_ptr(this_ptr);
55696         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55697         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55698         this_ptr_conv.is_owned = false;
55699         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
55700         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, UpdateAddHTLC_get_blinding_point(&this_ptr_conv).compressed_form);
55701         return ret_arr;
55702 }
55703
55704 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1blinding_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
55705         LDKUpdateAddHTLC this_ptr_conv;
55706         this_ptr_conv.inner = untag_ptr(this_ptr);
55707         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55708         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55709         this_ptr_conv.is_owned = false;
55710         LDKPublicKey val_ref;
55711         CHECK((*env)->GetArrayLength(env, val) == 33);
55712         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
55713         UpdateAddHTLC_set_blinding_point(&this_ptr_conv, val_ref);
55714 }
55715
55716 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1new(JNIEnv *env, jclass clz, int64_t channel_id_arg, int64_t htlc_id_arg, int64_t amount_msat_arg, int8_tArray payment_hash_arg, int32_t cltv_expiry_arg, int64_t skimmed_fee_msat_arg, int64_t onion_routing_packet_arg, int8_tArray blinding_point_arg) {
55717         LDKChannelId channel_id_arg_conv;
55718         channel_id_arg_conv.inner = untag_ptr(channel_id_arg);
55719         channel_id_arg_conv.is_owned = ptr_is_owned(channel_id_arg);
55720         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_arg_conv);
55721         channel_id_arg_conv = ChannelId_clone(&channel_id_arg_conv);
55722         LDKThirtyTwoBytes payment_hash_arg_ref;
55723         CHECK((*env)->GetArrayLength(env, payment_hash_arg) == 32);
55724         (*env)->GetByteArrayRegion(env, payment_hash_arg, 0, 32, payment_hash_arg_ref.data);
55725         void* skimmed_fee_msat_arg_ptr = untag_ptr(skimmed_fee_msat_arg);
55726         CHECK_ACCESS(skimmed_fee_msat_arg_ptr);
55727         LDKCOption_u64Z skimmed_fee_msat_arg_conv = *(LDKCOption_u64Z*)(skimmed_fee_msat_arg_ptr);
55728         skimmed_fee_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(skimmed_fee_msat_arg));
55729         LDKOnionPacket onion_routing_packet_arg_conv;
55730         onion_routing_packet_arg_conv.inner = untag_ptr(onion_routing_packet_arg);
55731         onion_routing_packet_arg_conv.is_owned = ptr_is_owned(onion_routing_packet_arg);
55732         CHECK_INNER_FIELD_ACCESS_OR_NULL(onion_routing_packet_arg_conv);
55733         onion_routing_packet_arg_conv = OnionPacket_clone(&onion_routing_packet_arg_conv);
55734         LDKPublicKey blinding_point_arg_ref;
55735         CHECK((*env)->GetArrayLength(env, blinding_point_arg) == 33);
55736         (*env)->GetByteArrayRegion(env, blinding_point_arg, 0, 33, blinding_point_arg_ref.compressed_form);
55737         LDKUpdateAddHTLC ret_var = UpdateAddHTLC_new(channel_id_arg_conv, htlc_id_arg, amount_msat_arg, payment_hash_arg_ref, cltv_expiry_arg, skimmed_fee_msat_arg_conv, onion_routing_packet_arg_conv, blinding_point_arg_ref);
55738         int64_t ret_ref = 0;
55739         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55740         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55741         return ret_ref;
55742 }
55743
55744 static inline uint64_t UpdateAddHTLC_clone_ptr(LDKUpdateAddHTLC *NONNULL_PTR arg) {
55745         LDKUpdateAddHTLC ret_var = UpdateAddHTLC_clone(arg);
55746         int64_t ret_ref = 0;
55747         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55748         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55749         return ret_ref;
55750 }
55751 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
55752         LDKUpdateAddHTLC arg_conv;
55753         arg_conv.inner = untag_ptr(arg);
55754         arg_conv.is_owned = ptr_is_owned(arg);
55755         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
55756         arg_conv.is_owned = false;
55757         int64_t ret_conv = UpdateAddHTLC_clone_ptr(&arg_conv);
55758         return ret_conv;
55759 }
55760
55761 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1clone(JNIEnv *env, jclass clz, int64_t orig) {
55762         LDKUpdateAddHTLC orig_conv;
55763         orig_conv.inner = untag_ptr(orig);
55764         orig_conv.is_owned = ptr_is_owned(orig);
55765         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
55766         orig_conv.is_owned = false;
55767         LDKUpdateAddHTLC ret_var = UpdateAddHTLC_clone(&orig_conv);
55768         int64_t ret_ref = 0;
55769         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55770         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55771         return ret_ref;
55772 }
55773
55774 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1hash(JNIEnv *env, jclass clz, int64_t o) {
55775         LDKUpdateAddHTLC o_conv;
55776         o_conv.inner = untag_ptr(o);
55777         o_conv.is_owned = ptr_is_owned(o);
55778         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
55779         o_conv.is_owned = false;
55780         int64_t ret_conv = UpdateAddHTLC_hash(&o_conv);
55781         return ret_conv;
55782 }
55783
55784 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
55785         LDKUpdateAddHTLC a_conv;
55786         a_conv.inner = untag_ptr(a);
55787         a_conv.is_owned = ptr_is_owned(a);
55788         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
55789         a_conv.is_owned = false;
55790         LDKUpdateAddHTLC b_conv;
55791         b_conv.inner = untag_ptr(b);
55792         b_conv.is_owned = ptr_is_owned(b);
55793         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
55794         b_conv.is_owned = false;
55795         jboolean ret_conv = UpdateAddHTLC_eq(&a_conv, &b_conv);
55796         return ret_conv;
55797 }
55798
55799 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OnionMessage_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
55800         LDKOnionMessage this_obj_conv;
55801         this_obj_conv.inner = untag_ptr(this_obj);
55802         this_obj_conv.is_owned = ptr_is_owned(this_obj);
55803         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
55804         OnionMessage_free(this_obj_conv);
55805 }
55806
55807 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OnionMessage_1get_1blinding_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
55808         LDKOnionMessage this_ptr_conv;
55809         this_ptr_conv.inner = untag_ptr(this_ptr);
55810         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55811         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55812         this_ptr_conv.is_owned = false;
55813         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
55814         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OnionMessage_get_blinding_point(&this_ptr_conv).compressed_form);
55815         return ret_arr;
55816 }
55817
55818 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OnionMessage_1set_1blinding_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
55819         LDKOnionMessage this_ptr_conv;
55820         this_ptr_conv.inner = untag_ptr(this_ptr);
55821         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55822         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55823         this_ptr_conv.is_owned = false;
55824         LDKPublicKey val_ref;
55825         CHECK((*env)->GetArrayLength(env, val) == 33);
55826         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
55827         OnionMessage_set_blinding_point(&this_ptr_conv, val_ref);
55828 }
55829
55830 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OnionMessage_1get_1onion_1routing_1packet(JNIEnv *env, jclass clz, int64_t this_ptr) {
55831         LDKOnionMessage this_ptr_conv;
55832         this_ptr_conv.inner = untag_ptr(this_ptr);
55833         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55834         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55835         this_ptr_conv.is_owned = false;
55836         LDKPacket ret_var = OnionMessage_get_onion_routing_packet(&this_ptr_conv);
55837         int64_t ret_ref = 0;
55838         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55839         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55840         return ret_ref;
55841 }
55842
55843 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OnionMessage_1set_1onion_1routing_1packet(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
55844         LDKOnionMessage this_ptr_conv;
55845         this_ptr_conv.inner = untag_ptr(this_ptr);
55846         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55847         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55848         this_ptr_conv.is_owned = false;
55849         LDKPacket val_conv;
55850         val_conv.inner = untag_ptr(val);
55851         val_conv.is_owned = ptr_is_owned(val);
55852         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
55853         val_conv = Packet_clone(&val_conv);
55854         OnionMessage_set_onion_routing_packet(&this_ptr_conv, val_conv);
55855 }
55856
55857 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) {
55858         LDKPublicKey blinding_point_arg_ref;
55859         CHECK((*env)->GetArrayLength(env, blinding_point_arg) == 33);
55860         (*env)->GetByteArrayRegion(env, blinding_point_arg, 0, 33, blinding_point_arg_ref.compressed_form);
55861         LDKPacket onion_routing_packet_arg_conv;
55862         onion_routing_packet_arg_conv.inner = untag_ptr(onion_routing_packet_arg);
55863         onion_routing_packet_arg_conv.is_owned = ptr_is_owned(onion_routing_packet_arg);
55864         CHECK_INNER_FIELD_ACCESS_OR_NULL(onion_routing_packet_arg_conv);
55865         onion_routing_packet_arg_conv = Packet_clone(&onion_routing_packet_arg_conv);
55866         LDKOnionMessage ret_var = OnionMessage_new(blinding_point_arg_ref, onion_routing_packet_arg_conv);
55867         int64_t ret_ref = 0;
55868         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55869         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55870         return ret_ref;
55871 }
55872
55873 static inline uint64_t OnionMessage_clone_ptr(LDKOnionMessage *NONNULL_PTR arg) {
55874         LDKOnionMessage ret_var = OnionMessage_clone(arg);
55875         int64_t ret_ref = 0;
55876         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55877         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55878         return ret_ref;
55879 }
55880 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OnionMessage_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
55881         LDKOnionMessage arg_conv;
55882         arg_conv.inner = untag_ptr(arg);
55883         arg_conv.is_owned = ptr_is_owned(arg);
55884         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
55885         arg_conv.is_owned = false;
55886         int64_t ret_conv = OnionMessage_clone_ptr(&arg_conv);
55887         return ret_conv;
55888 }
55889
55890 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OnionMessage_1clone(JNIEnv *env, jclass clz, int64_t orig) {
55891         LDKOnionMessage orig_conv;
55892         orig_conv.inner = untag_ptr(orig);
55893         orig_conv.is_owned = ptr_is_owned(orig);
55894         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
55895         orig_conv.is_owned = false;
55896         LDKOnionMessage ret_var = OnionMessage_clone(&orig_conv);
55897         int64_t ret_ref = 0;
55898         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55899         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55900         return ret_ref;
55901 }
55902
55903 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OnionMessage_1hash(JNIEnv *env, jclass clz, int64_t o) {
55904         LDKOnionMessage o_conv;
55905         o_conv.inner = untag_ptr(o);
55906         o_conv.is_owned = ptr_is_owned(o);
55907         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
55908         o_conv.is_owned = false;
55909         int64_t ret_conv = OnionMessage_hash(&o_conv);
55910         return ret_conv;
55911 }
55912
55913 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_OnionMessage_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
55914         LDKOnionMessage a_conv;
55915         a_conv.inner = untag_ptr(a);
55916         a_conv.is_owned = ptr_is_owned(a);
55917         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
55918         a_conv.is_owned = false;
55919         LDKOnionMessage b_conv;
55920         b_conv.inner = untag_ptr(b);
55921         b_conv.is_owned = ptr_is_owned(b);
55922         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
55923         b_conv.is_owned = false;
55924         jboolean ret_conv = OnionMessage_eq(&a_conv, &b_conv);
55925         return ret_conv;
55926 }
55927
55928 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
55929         LDKUpdateFulfillHTLC this_obj_conv;
55930         this_obj_conv.inner = untag_ptr(this_obj);
55931         this_obj_conv.is_owned = ptr_is_owned(this_obj);
55932         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
55933         UpdateFulfillHTLC_free(this_obj_conv);
55934 }
55935
55936 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
55937         LDKUpdateFulfillHTLC this_ptr_conv;
55938         this_ptr_conv.inner = untag_ptr(this_ptr);
55939         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55940         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55941         this_ptr_conv.is_owned = false;
55942         LDKChannelId ret_var = UpdateFulfillHTLC_get_channel_id(&this_ptr_conv);
55943         int64_t ret_ref = 0;
55944         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
55945         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
55946         return ret_ref;
55947 }
55948
55949 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
55950         LDKUpdateFulfillHTLC this_ptr_conv;
55951         this_ptr_conv.inner = untag_ptr(this_ptr);
55952         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55953         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55954         this_ptr_conv.is_owned = false;
55955         LDKChannelId val_conv;
55956         val_conv.inner = untag_ptr(val);
55957         val_conv.is_owned = ptr_is_owned(val);
55958         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
55959         val_conv = ChannelId_clone(&val_conv);
55960         UpdateFulfillHTLC_set_channel_id(&this_ptr_conv, val_conv);
55961 }
55962
55963 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1get_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
55964         LDKUpdateFulfillHTLC this_ptr_conv;
55965         this_ptr_conv.inner = untag_ptr(this_ptr);
55966         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55967         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55968         this_ptr_conv.is_owned = false;
55969         int64_t ret_conv = UpdateFulfillHTLC_get_htlc_id(&this_ptr_conv);
55970         return ret_conv;
55971 }
55972
55973 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1set_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
55974         LDKUpdateFulfillHTLC this_ptr_conv;
55975         this_ptr_conv.inner = untag_ptr(this_ptr);
55976         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55977         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55978         this_ptr_conv.is_owned = false;
55979         UpdateFulfillHTLC_set_htlc_id(&this_ptr_conv, val);
55980 }
55981
55982 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1get_1payment_1preimage(JNIEnv *env, jclass clz, int64_t this_ptr) {
55983         LDKUpdateFulfillHTLC this_ptr_conv;
55984         this_ptr_conv.inner = untag_ptr(this_ptr);
55985         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55986         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55987         this_ptr_conv.is_owned = false;
55988         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
55989         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateFulfillHTLC_get_payment_preimage(&this_ptr_conv));
55990         return ret_arr;
55991 }
55992
55993 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1set_1payment_1preimage(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
55994         LDKUpdateFulfillHTLC this_ptr_conv;
55995         this_ptr_conv.inner = untag_ptr(this_ptr);
55996         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
55997         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
55998         this_ptr_conv.is_owned = false;
55999         LDKThirtyTwoBytes val_ref;
56000         CHECK((*env)->GetArrayLength(env, val) == 32);
56001         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
56002         UpdateFulfillHTLC_set_payment_preimage(&this_ptr_conv, val_ref);
56003 }
56004
56005 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1new(JNIEnv *env, jclass clz, int64_t channel_id_arg, int64_t htlc_id_arg, int8_tArray payment_preimage_arg) {
56006         LDKChannelId channel_id_arg_conv;
56007         channel_id_arg_conv.inner = untag_ptr(channel_id_arg);
56008         channel_id_arg_conv.is_owned = ptr_is_owned(channel_id_arg);
56009         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_arg_conv);
56010         channel_id_arg_conv = ChannelId_clone(&channel_id_arg_conv);
56011         LDKThirtyTwoBytes payment_preimage_arg_ref;
56012         CHECK((*env)->GetArrayLength(env, payment_preimage_arg) == 32);
56013         (*env)->GetByteArrayRegion(env, payment_preimage_arg, 0, 32, payment_preimage_arg_ref.data);
56014         LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_new(channel_id_arg_conv, htlc_id_arg, payment_preimage_arg_ref);
56015         int64_t ret_ref = 0;
56016         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56017         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56018         return ret_ref;
56019 }
56020
56021 static inline uint64_t UpdateFulfillHTLC_clone_ptr(LDKUpdateFulfillHTLC *NONNULL_PTR arg) {
56022         LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_clone(arg);
56023         int64_t ret_ref = 0;
56024         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56025         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56026         return ret_ref;
56027 }
56028 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
56029         LDKUpdateFulfillHTLC arg_conv;
56030         arg_conv.inner = untag_ptr(arg);
56031         arg_conv.is_owned = ptr_is_owned(arg);
56032         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
56033         arg_conv.is_owned = false;
56034         int64_t ret_conv = UpdateFulfillHTLC_clone_ptr(&arg_conv);
56035         return ret_conv;
56036 }
56037
56038 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1clone(JNIEnv *env, jclass clz, int64_t orig) {
56039         LDKUpdateFulfillHTLC orig_conv;
56040         orig_conv.inner = untag_ptr(orig);
56041         orig_conv.is_owned = ptr_is_owned(orig);
56042         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
56043         orig_conv.is_owned = false;
56044         LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_clone(&orig_conv);
56045         int64_t ret_ref = 0;
56046         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56047         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56048         return ret_ref;
56049 }
56050
56051 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1hash(JNIEnv *env, jclass clz, int64_t o) {
56052         LDKUpdateFulfillHTLC o_conv;
56053         o_conv.inner = untag_ptr(o);
56054         o_conv.is_owned = ptr_is_owned(o);
56055         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
56056         o_conv.is_owned = false;
56057         int64_t ret_conv = UpdateFulfillHTLC_hash(&o_conv);
56058         return ret_conv;
56059 }
56060
56061 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
56062         LDKUpdateFulfillHTLC a_conv;
56063         a_conv.inner = untag_ptr(a);
56064         a_conv.is_owned = ptr_is_owned(a);
56065         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
56066         a_conv.is_owned = false;
56067         LDKUpdateFulfillHTLC b_conv;
56068         b_conv.inner = untag_ptr(b);
56069         b_conv.is_owned = ptr_is_owned(b);
56070         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
56071         b_conv.is_owned = false;
56072         jboolean ret_conv = UpdateFulfillHTLC_eq(&a_conv, &b_conv);
56073         return ret_conv;
56074 }
56075
56076 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
56077         LDKUpdateFailHTLC this_obj_conv;
56078         this_obj_conv.inner = untag_ptr(this_obj);
56079         this_obj_conv.is_owned = ptr_is_owned(this_obj);
56080         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
56081         UpdateFailHTLC_free(this_obj_conv);
56082 }
56083
56084 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
56085         LDKUpdateFailHTLC this_ptr_conv;
56086         this_ptr_conv.inner = untag_ptr(this_ptr);
56087         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56088         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56089         this_ptr_conv.is_owned = false;
56090         LDKChannelId ret_var = UpdateFailHTLC_get_channel_id(&this_ptr_conv);
56091         int64_t ret_ref = 0;
56092         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56093         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56094         return ret_ref;
56095 }
56096
56097 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
56098         LDKUpdateFailHTLC this_ptr_conv;
56099         this_ptr_conv.inner = untag_ptr(this_ptr);
56100         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56101         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56102         this_ptr_conv.is_owned = false;
56103         LDKChannelId val_conv;
56104         val_conv.inner = untag_ptr(val);
56105         val_conv.is_owned = ptr_is_owned(val);
56106         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
56107         val_conv = ChannelId_clone(&val_conv);
56108         UpdateFailHTLC_set_channel_id(&this_ptr_conv, val_conv);
56109 }
56110
56111 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1get_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
56112         LDKUpdateFailHTLC this_ptr_conv;
56113         this_ptr_conv.inner = untag_ptr(this_ptr);
56114         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56115         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56116         this_ptr_conv.is_owned = false;
56117         int64_t ret_conv = UpdateFailHTLC_get_htlc_id(&this_ptr_conv);
56118         return ret_conv;
56119 }
56120
56121 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1set_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
56122         LDKUpdateFailHTLC this_ptr_conv;
56123         this_ptr_conv.inner = untag_ptr(this_ptr);
56124         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56125         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56126         this_ptr_conv.is_owned = false;
56127         UpdateFailHTLC_set_htlc_id(&this_ptr_conv, val);
56128 }
56129
56130 static inline uint64_t UpdateFailHTLC_clone_ptr(LDKUpdateFailHTLC *NONNULL_PTR arg) {
56131         LDKUpdateFailHTLC ret_var = UpdateFailHTLC_clone(arg);
56132         int64_t ret_ref = 0;
56133         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56134         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56135         return ret_ref;
56136 }
56137 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
56138         LDKUpdateFailHTLC arg_conv;
56139         arg_conv.inner = untag_ptr(arg);
56140         arg_conv.is_owned = ptr_is_owned(arg);
56141         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
56142         arg_conv.is_owned = false;
56143         int64_t ret_conv = UpdateFailHTLC_clone_ptr(&arg_conv);
56144         return ret_conv;
56145 }
56146
56147 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1clone(JNIEnv *env, jclass clz, int64_t orig) {
56148         LDKUpdateFailHTLC orig_conv;
56149         orig_conv.inner = untag_ptr(orig);
56150         orig_conv.is_owned = ptr_is_owned(orig);
56151         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
56152         orig_conv.is_owned = false;
56153         LDKUpdateFailHTLC ret_var = UpdateFailHTLC_clone(&orig_conv);
56154         int64_t ret_ref = 0;
56155         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56156         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56157         return ret_ref;
56158 }
56159
56160 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1hash(JNIEnv *env, jclass clz, int64_t o) {
56161         LDKUpdateFailHTLC o_conv;
56162         o_conv.inner = untag_ptr(o);
56163         o_conv.is_owned = ptr_is_owned(o);
56164         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
56165         o_conv.is_owned = false;
56166         int64_t ret_conv = UpdateFailHTLC_hash(&o_conv);
56167         return ret_conv;
56168 }
56169
56170 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
56171         LDKUpdateFailHTLC a_conv;
56172         a_conv.inner = untag_ptr(a);
56173         a_conv.is_owned = ptr_is_owned(a);
56174         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
56175         a_conv.is_owned = false;
56176         LDKUpdateFailHTLC b_conv;
56177         b_conv.inner = untag_ptr(b);
56178         b_conv.is_owned = ptr_is_owned(b);
56179         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
56180         b_conv.is_owned = false;
56181         jboolean ret_conv = UpdateFailHTLC_eq(&a_conv, &b_conv);
56182         return ret_conv;
56183 }
56184
56185 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
56186         LDKUpdateFailMalformedHTLC this_obj_conv;
56187         this_obj_conv.inner = untag_ptr(this_obj);
56188         this_obj_conv.is_owned = ptr_is_owned(this_obj);
56189         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
56190         UpdateFailMalformedHTLC_free(this_obj_conv);
56191 }
56192
56193 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
56194         LDKUpdateFailMalformedHTLC this_ptr_conv;
56195         this_ptr_conv.inner = untag_ptr(this_ptr);
56196         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56197         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56198         this_ptr_conv.is_owned = false;
56199         LDKChannelId ret_var = UpdateFailMalformedHTLC_get_channel_id(&this_ptr_conv);
56200         int64_t ret_ref = 0;
56201         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56202         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56203         return ret_ref;
56204 }
56205
56206 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
56207         LDKUpdateFailMalformedHTLC this_ptr_conv;
56208         this_ptr_conv.inner = untag_ptr(this_ptr);
56209         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56210         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56211         this_ptr_conv.is_owned = false;
56212         LDKChannelId val_conv;
56213         val_conv.inner = untag_ptr(val);
56214         val_conv.is_owned = ptr_is_owned(val);
56215         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
56216         val_conv = ChannelId_clone(&val_conv);
56217         UpdateFailMalformedHTLC_set_channel_id(&this_ptr_conv, val_conv);
56218 }
56219
56220 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1get_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
56221         LDKUpdateFailMalformedHTLC this_ptr_conv;
56222         this_ptr_conv.inner = untag_ptr(this_ptr);
56223         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56224         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56225         this_ptr_conv.is_owned = false;
56226         int64_t ret_conv = UpdateFailMalformedHTLC_get_htlc_id(&this_ptr_conv);
56227         return ret_conv;
56228 }
56229
56230 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1set_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
56231         LDKUpdateFailMalformedHTLC this_ptr_conv;
56232         this_ptr_conv.inner = untag_ptr(this_ptr);
56233         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56234         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56235         this_ptr_conv.is_owned = false;
56236         UpdateFailMalformedHTLC_set_htlc_id(&this_ptr_conv, val);
56237 }
56238
56239 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1get_1failure_1code(JNIEnv *env, jclass clz, int64_t this_ptr) {
56240         LDKUpdateFailMalformedHTLC this_ptr_conv;
56241         this_ptr_conv.inner = untag_ptr(this_ptr);
56242         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56243         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56244         this_ptr_conv.is_owned = false;
56245         int16_t ret_conv = UpdateFailMalformedHTLC_get_failure_code(&this_ptr_conv);
56246         return ret_conv;
56247 }
56248
56249 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1set_1failure_1code(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
56250         LDKUpdateFailMalformedHTLC this_ptr_conv;
56251         this_ptr_conv.inner = untag_ptr(this_ptr);
56252         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56253         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56254         this_ptr_conv.is_owned = false;
56255         UpdateFailMalformedHTLC_set_failure_code(&this_ptr_conv, val);
56256 }
56257
56258 static inline uint64_t UpdateFailMalformedHTLC_clone_ptr(LDKUpdateFailMalformedHTLC *NONNULL_PTR arg) {
56259         LDKUpdateFailMalformedHTLC ret_var = UpdateFailMalformedHTLC_clone(arg);
56260         int64_t ret_ref = 0;
56261         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56262         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56263         return ret_ref;
56264 }
56265 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
56266         LDKUpdateFailMalformedHTLC arg_conv;
56267         arg_conv.inner = untag_ptr(arg);
56268         arg_conv.is_owned = ptr_is_owned(arg);
56269         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
56270         arg_conv.is_owned = false;
56271         int64_t ret_conv = UpdateFailMalformedHTLC_clone_ptr(&arg_conv);
56272         return ret_conv;
56273 }
56274
56275 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1clone(JNIEnv *env, jclass clz, int64_t orig) {
56276         LDKUpdateFailMalformedHTLC orig_conv;
56277         orig_conv.inner = untag_ptr(orig);
56278         orig_conv.is_owned = ptr_is_owned(orig);
56279         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
56280         orig_conv.is_owned = false;
56281         LDKUpdateFailMalformedHTLC ret_var = UpdateFailMalformedHTLC_clone(&orig_conv);
56282         int64_t ret_ref = 0;
56283         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56284         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56285         return ret_ref;
56286 }
56287
56288 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1hash(JNIEnv *env, jclass clz, int64_t o) {
56289         LDKUpdateFailMalformedHTLC o_conv;
56290         o_conv.inner = untag_ptr(o);
56291         o_conv.is_owned = ptr_is_owned(o);
56292         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
56293         o_conv.is_owned = false;
56294         int64_t ret_conv = UpdateFailMalformedHTLC_hash(&o_conv);
56295         return ret_conv;
56296 }
56297
56298 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
56299         LDKUpdateFailMalformedHTLC a_conv;
56300         a_conv.inner = untag_ptr(a);
56301         a_conv.is_owned = ptr_is_owned(a);
56302         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
56303         a_conv.is_owned = false;
56304         LDKUpdateFailMalformedHTLC b_conv;
56305         b_conv.inner = untag_ptr(b);
56306         b_conv.is_owned = ptr_is_owned(b);
56307         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
56308         b_conv.is_owned = false;
56309         jboolean ret_conv = UpdateFailMalformedHTLC_eq(&a_conv, &b_conv);
56310         return ret_conv;
56311 }
56312
56313 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
56314         LDKCommitmentSigned this_obj_conv;
56315         this_obj_conv.inner = untag_ptr(this_obj);
56316         this_obj_conv.is_owned = ptr_is_owned(this_obj);
56317         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
56318         CommitmentSigned_free(this_obj_conv);
56319 }
56320
56321 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
56322         LDKCommitmentSigned this_ptr_conv;
56323         this_ptr_conv.inner = untag_ptr(this_ptr);
56324         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56325         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56326         this_ptr_conv.is_owned = false;
56327         LDKChannelId ret_var = CommitmentSigned_get_channel_id(&this_ptr_conv);
56328         int64_t ret_ref = 0;
56329         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56330         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56331         return ret_ref;
56332 }
56333
56334 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
56335         LDKCommitmentSigned this_ptr_conv;
56336         this_ptr_conv.inner = untag_ptr(this_ptr);
56337         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56338         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56339         this_ptr_conv.is_owned = false;
56340         LDKChannelId val_conv;
56341         val_conv.inner = untag_ptr(val);
56342         val_conv.is_owned = ptr_is_owned(val);
56343         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
56344         val_conv = ChannelId_clone(&val_conv);
56345         CommitmentSigned_set_channel_id(&this_ptr_conv, val_conv);
56346 }
56347
56348 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
56349         LDKCommitmentSigned this_ptr_conv;
56350         this_ptr_conv.inner = untag_ptr(this_ptr);
56351         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56352         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56353         this_ptr_conv.is_owned = false;
56354         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
56355         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, CommitmentSigned_get_signature(&this_ptr_conv).compact_form);
56356         return ret_arr;
56357 }
56358
56359 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
56360         LDKCommitmentSigned this_ptr_conv;
56361         this_ptr_conv.inner = untag_ptr(this_ptr);
56362         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56363         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56364         this_ptr_conv.is_owned = false;
56365         LDKECDSASignature val_ref;
56366         CHECK((*env)->GetArrayLength(env, val) == 64);
56367         (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
56368         CommitmentSigned_set_signature(&this_ptr_conv, val_ref);
56369 }
56370
56371 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1get_1htlc_1signatures(JNIEnv *env, jclass clz, int64_t this_ptr) {
56372         LDKCommitmentSigned this_ptr_conv;
56373         this_ptr_conv.inner = untag_ptr(this_ptr);
56374         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56375         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56376         this_ptr_conv.is_owned = false;
56377         LDKCVec_ECDSASignatureZ ret_var = CommitmentSigned_get_htlc_signatures(&this_ptr_conv);
56378         jobjectArray ret_arr = NULL;
56379         ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
56380         ;
56381         for (size_t i = 0; i < ret_var.datalen; i++) {
56382                 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, 64);
56383                 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, 64, ret_var.data[i].compact_form);
56384                 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
56385         }
56386         
56387         FREE(ret_var.data);
56388         return ret_arr;
56389 }
56390
56391 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1set_1htlc_1signatures(JNIEnv *env, jclass clz, int64_t this_ptr, jobjectArray val) {
56392         LDKCommitmentSigned this_ptr_conv;
56393         this_ptr_conv.inner = untag_ptr(this_ptr);
56394         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56395         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56396         this_ptr_conv.is_owned = false;
56397         LDKCVec_ECDSASignatureZ val_constr;
56398         val_constr.datalen = (*env)->GetArrayLength(env, val);
56399         if (val_constr.datalen > 0)
56400                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKECDSASignature), "LDKCVec_ECDSASignatureZ Elements");
56401         else
56402                 val_constr.data = NULL;
56403         for (size_t i = 0; i < val_constr.datalen; i++) {
56404                 int8_tArray val_conv_8 = (*env)->GetObjectArrayElement(env, val, i);
56405                 LDKECDSASignature val_conv_8_ref;
56406                 CHECK((*env)->GetArrayLength(env, val_conv_8) == 64);
56407                 (*env)->GetByteArrayRegion(env, val_conv_8, 0, 64, val_conv_8_ref.compact_form);
56408                 val_constr.data[i] = val_conv_8_ref;
56409         }
56410         CommitmentSigned_set_htlc_signatures(&this_ptr_conv, val_constr);
56411 }
56412
56413 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1new(JNIEnv *env, jclass clz, int64_t channel_id_arg, int8_tArray signature_arg, jobjectArray htlc_signatures_arg) {
56414         LDKChannelId channel_id_arg_conv;
56415         channel_id_arg_conv.inner = untag_ptr(channel_id_arg);
56416         channel_id_arg_conv.is_owned = ptr_is_owned(channel_id_arg);
56417         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_arg_conv);
56418         channel_id_arg_conv = ChannelId_clone(&channel_id_arg_conv);
56419         LDKECDSASignature signature_arg_ref;
56420         CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
56421         (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
56422         LDKCVec_ECDSASignatureZ htlc_signatures_arg_constr;
56423         htlc_signatures_arg_constr.datalen = (*env)->GetArrayLength(env, htlc_signatures_arg);
56424         if (htlc_signatures_arg_constr.datalen > 0)
56425                 htlc_signatures_arg_constr.data = MALLOC(htlc_signatures_arg_constr.datalen * sizeof(LDKECDSASignature), "LDKCVec_ECDSASignatureZ Elements");
56426         else
56427                 htlc_signatures_arg_constr.data = NULL;
56428         for (size_t i = 0; i < htlc_signatures_arg_constr.datalen; i++) {
56429                 int8_tArray htlc_signatures_arg_conv_8 = (*env)->GetObjectArrayElement(env, htlc_signatures_arg, i);
56430                 LDKECDSASignature htlc_signatures_arg_conv_8_ref;
56431                 CHECK((*env)->GetArrayLength(env, htlc_signatures_arg_conv_8) == 64);
56432                 (*env)->GetByteArrayRegion(env, htlc_signatures_arg_conv_8, 0, 64, htlc_signatures_arg_conv_8_ref.compact_form);
56433                 htlc_signatures_arg_constr.data[i] = htlc_signatures_arg_conv_8_ref;
56434         }
56435         LDKCommitmentSigned ret_var = CommitmentSigned_new(channel_id_arg_conv, signature_arg_ref, htlc_signatures_arg_constr);
56436         int64_t ret_ref = 0;
56437         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56438         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56439         return ret_ref;
56440 }
56441
56442 static inline uint64_t CommitmentSigned_clone_ptr(LDKCommitmentSigned *NONNULL_PTR arg) {
56443         LDKCommitmentSigned ret_var = CommitmentSigned_clone(arg);
56444         int64_t ret_ref = 0;
56445         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56446         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56447         return ret_ref;
56448 }
56449 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
56450         LDKCommitmentSigned arg_conv;
56451         arg_conv.inner = untag_ptr(arg);
56452         arg_conv.is_owned = ptr_is_owned(arg);
56453         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
56454         arg_conv.is_owned = false;
56455         int64_t ret_conv = CommitmentSigned_clone_ptr(&arg_conv);
56456         return ret_conv;
56457 }
56458
56459 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1clone(JNIEnv *env, jclass clz, int64_t orig) {
56460         LDKCommitmentSigned orig_conv;
56461         orig_conv.inner = untag_ptr(orig);
56462         orig_conv.is_owned = ptr_is_owned(orig);
56463         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
56464         orig_conv.is_owned = false;
56465         LDKCommitmentSigned ret_var = CommitmentSigned_clone(&orig_conv);
56466         int64_t ret_ref = 0;
56467         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56468         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56469         return ret_ref;
56470 }
56471
56472 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1hash(JNIEnv *env, jclass clz, int64_t o) {
56473         LDKCommitmentSigned o_conv;
56474         o_conv.inner = untag_ptr(o);
56475         o_conv.is_owned = ptr_is_owned(o);
56476         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
56477         o_conv.is_owned = false;
56478         int64_t ret_conv = CommitmentSigned_hash(&o_conv);
56479         return ret_conv;
56480 }
56481
56482 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
56483         LDKCommitmentSigned a_conv;
56484         a_conv.inner = untag_ptr(a);
56485         a_conv.is_owned = ptr_is_owned(a);
56486         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
56487         a_conv.is_owned = false;
56488         LDKCommitmentSigned b_conv;
56489         b_conv.inner = untag_ptr(b);
56490         b_conv.is_owned = ptr_is_owned(b);
56491         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
56492         b_conv.is_owned = false;
56493         jboolean ret_conv = CommitmentSigned_eq(&a_conv, &b_conv);
56494         return ret_conv;
56495 }
56496
56497 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
56498         LDKRevokeAndACK this_obj_conv;
56499         this_obj_conv.inner = untag_ptr(this_obj);
56500         this_obj_conv.is_owned = ptr_is_owned(this_obj);
56501         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
56502         RevokeAndACK_free(this_obj_conv);
56503 }
56504
56505 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
56506         LDKRevokeAndACK this_ptr_conv;
56507         this_ptr_conv.inner = untag_ptr(this_ptr);
56508         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56509         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56510         this_ptr_conv.is_owned = false;
56511         LDKChannelId ret_var = RevokeAndACK_get_channel_id(&this_ptr_conv);
56512         int64_t ret_ref = 0;
56513         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56514         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56515         return ret_ref;
56516 }
56517
56518 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
56519         LDKRevokeAndACK this_ptr_conv;
56520         this_ptr_conv.inner = untag_ptr(this_ptr);
56521         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56522         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56523         this_ptr_conv.is_owned = false;
56524         LDKChannelId val_conv;
56525         val_conv.inner = untag_ptr(val);
56526         val_conv.is_owned = ptr_is_owned(val);
56527         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
56528         val_conv = ChannelId_clone(&val_conv);
56529         RevokeAndACK_set_channel_id(&this_ptr_conv, val_conv);
56530 }
56531
56532 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1get_1per_1commitment_1secret(JNIEnv *env, jclass clz, int64_t this_ptr) {
56533         LDKRevokeAndACK this_ptr_conv;
56534         this_ptr_conv.inner = untag_ptr(this_ptr);
56535         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56536         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56537         this_ptr_conv.is_owned = false;
56538         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
56539         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *RevokeAndACK_get_per_commitment_secret(&this_ptr_conv));
56540         return ret_arr;
56541 }
56542
56543 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1set_1per_1commitment_1secret(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
56544         LDKRevokeAndACK this_ptr_conv;
56545         this_ptr_conv.inner = untag_ptr(this_ptr);
56546         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56547         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56548         this_ptr_conv.is_owned = false;
56549         LDKThirtyTwoBytes val_ref;
56550         CHECK((*env)->GetArrayLength(env, val) == 32);
56551         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
56552         RevokeAndACK_set_per_commitment_secret(&this_ptr_conv, val_ref);
56553 }
56554
56555 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1get_1next_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
56556         LDKRevokeAndACK this_ptr_conv;
56557         this_ptr_conv.inner = untag_ptr(this_ptr);
56558         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56559         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56560         this_ptr_conv.is_owned = false;
56561         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
56562         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, RevokeAndACK_get_next_per_commitment_point(&this_ptr_conv).compressed_form);
56563         return ret_arr;
56564 }
56565
56566 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) {
56567         LDKRevokeAndACK this_ptr_conv;
56568         this_ptr_conv.inner = untag_ptr(this_ptr);
56569         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56570         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56571         this_ptr_conv.is_owned = false;
56572         LDKPublicKey val_ref;
56573         CHECK((*env)->GetArrayLength(env, val) == 33);
56574         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
56575         RevokeAndACK_set_next_per_commitment_point(&this_ptr_conv, val_ref);
56576 }
56577
56578 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1new(JNIEnv *env, jclass clz, int64_t channel_id_arg, int8_tArray per_commitment_secret_arg, int8_tArray next_per_commitment_point_arg) {
56579         LDKChannelId channel_id_arg_conv;
56580         channel_id_arg_conv.inner = untag_ptr(channel_id_arg);
56581         channel_id_arg_conv.is_owned = ptr_is_owned(channel_id_arg);
56582         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_arg_conv);
56583         channel_id_arg_conv = ChannelId_clone(&channel_id_arg_conv);
56584         LDKThirtyTwoBytes per_commitment_secret_arg_ref;
56585         CHECK((*env)->GetArrayLength(env, per_commitment_secret_arg) == 32);
56586         (*env)->GetByteArrayRegion(env, per_commitment_secret_arg, 0, 32, per_commitment_secret_arg_ref.data);
56587         LDKPublicKey next_per_commitment_point_arg_ref;
56588         CHECK((*env)->GetArrayLength(env, next_per_commitment_point_arg) == 33);
56589         (*env)->GetByteArrayRegion(env, next_per_commitment_point_arg, 0, 33, next_per_commitment_point_arg_ref.compressed_form);
56590         LDKRevokeAndACK ret_var = RevokeAndACK_new(channel_id_arg_conv, per_commitment_secret_arg_ref, next_per_commitment_point_arg_ref);
56591         int64_t ret_ref = 0;
56592         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56593         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56594         return ret_ref;
56595 }
56596
56597 static inline uint64_t RevokeAndACK_clone_ptr(LDKRevokeAndACK *NONNULL_PTR arg) {
56598         LDKRevokeAndACK ret_var = RevokeAndACK_clone(arg);
56599         int64_t ret_ref = 0;
56600         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56601         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56602         return ret_ref;
56603 }
56604 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
56605         LDKRevokeAndACK arg_conv;
56606         arg_conv.inner = untag_ptr(arg);
56607         arg_conv.is_owned = ptr_is_owned(arg);
56608         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
56609         arg_conv.is_owned = false;
56610         int64_t ret_conv = RevokeAndACK_clone_ptr(&arg_conv);
56611         return ret_conv;
56612 }
56613
56614 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1clone(JNIEnv *env, jclass clz, int64_t orig) {
56615         LDKRevokeAndACK orig_conv;
56616         orig_conv.inner = untag_ptr(orig);
56617         orig_conv.is_owned = ptr_is_owned(orig);
56618         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
56619         orig_conv.is_owned = false;
56620         LDKRevokeAndACK ret_var = RevokeAndACK_clone(&orig_conv);
56621         int64_t ret_ref = 0;
56622         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56623         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56624         return ret_ref;
56625 }
56626
56627 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1hash(JNIEnv *env, jclass clz, int64_t o) {
56628         LDKRevokeAndACK o_conv;
56629         o_conv.inner = untag_ptr(o);
56630         o_conv.is_owned = ptr_is_owned(o);
56631         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
56632         o_conv.is_owned = false;
56633         int64_t ret_conv = RevokeAndACK_hash(&o_conv);
56634         return ret_conv;
56635 }
56636
56637 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
56638         LDKRevokeAndACK a_conv;
56639         a_conv.inner = untag_ptr(a);
56640         a_conv.is_owned = ptr_is_owned(a);
56641         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
56642         a_conv.is_owned = false;
56643         LDKRevokeAndACK b_conv;
56644         b_conv.inner = untag_ptr(b);
56645         b_conv.is_owned = ptr_is_owned(b);
56646         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
56647         b_conv.is_owned = false;
56648         jboolean ret_conv = RevokeAndACK_eq(&a_conv, &b_conv);
56649         return ret_conv;
56650 }
56651
56652 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFee_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
56653         LDKUpdateFee this_obj_conv;
56654         this_obj_conv.inner = untag_ptr(this_obj);
56655         this_obj_conv.is_owned = ptr_is_owned(this_obj);
56656         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
56657         UpdateFee_free(this_obj_conv);
56658 }
56659
56660 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFee_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
56661         LDKUpdateFee this_ptr_conv;
56662         this_ptr_conv.inner = untag_ptr(this_ptr);
56663         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56664         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56665         this_ptr_conv.is_owned = false;
56666         LDKChannelId ret_var = UpdateFee_get_channel_id(&this_ptr_conv);
56667         int64_t ret_ref = 0;
56668         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56669         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56670         return ret_ref;
56671 }
56672
56673 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFee_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
56674         LDKUpdateFee this_ptr_conv;
56675         this_ptr_conv.inner = untag_ptr(this_ptr);
56676         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56677         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56678         this_ptr_conv.is_owned = false;
56679         LDKChannelId val_conv;
56680         val_conv.inner = untag_ptr(val);
56681         val_conv.is_owned = ptr_is_owned(val);
56682         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
56683         val_conv = ChannelId_clone(&val_conv);
56684         UpdateFee_set_channel_id(&this_ptr_conv, val_conv);
56685 }
56686
56687 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UpdateFee_1get_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_ptr) {
56688         LDKUpdateFee this_ptr_conv;
56689         this_ptr_conv.inner = untag_ptr(this_ptr);
56690         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56691         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56692         this_ptr_conv.is_owned = false;
56693         int32_t ret_conv = UpdateFee_get_feerate_per_kw(&this_ptr_conv);
56694         return ret_conv;
56695 }
56696
56697 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFee_1set_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
56698         LDKUpdateFee this_ptr_conv;
56699         this_ptr_conv.inner = untag_ptr(this_ptr);
56700         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56701         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56702         this_ptr_conv.is_owned = false;
56703         UpdateFee_set_feerate_per_kw(&this_ptr_conv, val);
56704 }
56705
56706 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFee_1new(JNIEnv *env, jclass clz, int64_t channel_id_arg, int32_t feerate_per_kw_arg) {
56707         LDKChannelId channel_id_arg_conv;
56708         channel_id_arg_conv.inner = untag_ptr(channel_id_arg);
56709         channel_id_arg_conv.is_owned = ptr_is_owned(channel_id_arg);
56710         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_arg_conv);
56711         channel_id_arg_conv = ChannelId_clone(&channel_id_arg_conv);
56712         LDKUpdateFee ret_var = UpdateFee_new(channel_id_arg_conv, feerate_per_kw_arg);
56713         int64_t ret_ref = 0;
56714         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56715         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56716         return ret_ref;
56717 }
56718
56719 static inline uint64_t UpdateFee_clone_ptr(LDKUpdateFee *NONNULL_PTR arg) {
56720         LDKUpdateFee ret_var = UpdateFee_clone(arg);
56721         int64_t ret_ref = 0;
56722         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56723         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56724         return ret_ref;
56725 }
56726 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFee_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
56727         LDKUpdateFee arg_conv;
56728         arg_conv.inner = untag_ptr(arg);
56729         arg_conv.is_owned = ptr_is_owned(arg);
56730         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
56731         arg_conv.is_owned = false;
56732         int64_t ret_conv = UpdateFee_clone_ptr(&arg_conv);
56733         return ret_conv;
56734 }
56735
56736 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFee_1clone(JNIEnv *env, jclass clz, int64_t orig) {
56737         LDKUpdateFee orig_conv;
56738         orig_conv.inner = untag_ptr(orig);
56739         orig_conv.is_owned = ptr_is_owned(orig);
56740         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
56741         orig_conv.is_owned = false;
56742         LDKUpdateFee ret_var = UpdateFee_clone(&orig_conv);
56743         int64_t ret_ref = 0;
56744         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56745         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56746         return ret_ref;
56747 }
56748
56749 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFee_1hash(JNIEnv *env, jclass clz, int64_t o) {
56750         LDKUpdateFee o_conv;
56751         o_conv.inner = untag_ptr(o);
56752         o_conv.is_owned = ptr_is_owned(o);
56753         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
56754         o_conv.is_owned = false;
56755         int64_t ret_conv = UpdateFee_hash(&o_conv);
56756         return ret_conv;
56757 }
56758
56759 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_UpdateFee_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
56760         LDKUpdateFee a_conv;
56761         a_conv.inner = untag_ptr(a);
56762         a_conv.is_owned = ptr_is_owned(a);
56763         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
56764         a_conv.is_owned = false;
56765         LDKUpdateFee b_conv;
56766         b_conv.inner = untag_ptr(b);
56767         b_conv.is_owned = ptr_is_owned(b);
56768         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
56769         b_conv.is_owned = false;
56770         jboolean ret_conv = UpdateFee_eq(&a_conv, &b_conv);
56771         return ret_conv;
56772 }
56773
56774 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
56775         LDKChannelReestablish this_obj_conv;
56776         this_obj_conv.inner = untag_ptr(this_obj);
56777         this_obj_conv.is_owned = ptr_is_owned(this_obj);
56778         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
56779         ChannelReestablish_free(this_obj_conv);
56780 }
56781
56782 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
56783         LDKChannelReestablish this_ptr_conv;
56784         this_ptr_conv.inner = untag_ptr(this_ptr);
56785         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56786         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56787         this_ptr_conv.is_owned = false;
56788         LDKChannelId ret_var = ChannelReestablish_get_channel_id(&this_ptr_conv);
56789         int64_t ret_ref = 0;
56790         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56791         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56792         return ret_ref;
56793 }
56794
56795 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
56796         LDKChannelReestablish this_ptr_conv;
56797         this_ptr_conv.inner = untag_ptr(this_ptr);
56798         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56799         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56800         this_ptr_conv.is_owned = false;
56801         LDKChannelId val_conv;
56802         val_conv.inner = untag_ptr(val);
56803         val_conv.is_owned = ptr_is_owned(val);
56804         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
56805         val_conv = ChannelId_clone(&val_conv);
56806         ChannelReestablish_set_channel_id(&this_ptr_conv, val_conv);
56807 }
56808
56809 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1next_1local_1commitment_1number(JNIEnv *env, jclass clz, int64_t this_ptr) {
56810         LDKChannelReestablish this_ptr_conv;
56811         this_ptr_conv.inner = untag_ptr(this_ptr);
56812         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56813         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56814         this_ptr_conv.is_owned = false;
56815         int64_t ret_conv = ChannelReestablish_get_next_local_commitment_number(&this_ptr_conv);
56816         return ret_conv;
56817 }
56818
56819 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) {
56820         LDKChannelReestablish this_ptr_conv;
56821         this_ptr_conv.inner = untag_ptr(this_ptr);
56822         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56823         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56824         this_ptr_conv.is_owned = false;
56825         ChannelReestablish_set_next_local_commitment_number(&this_ptr_conv, val);
56826 }
56827
56828 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1next_1remote_1commitment_1number(JNIEnv *env, jclass clz, int64_t this_ptr) {
56829         LDKChannelReestablish this_ptr_conv;
56830         this_ptr_conv.inner = untag_ptr(this_ptr);
56831         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56832         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56833         this_ptr_conv.is_owned = false;
56834         int64_t ret_conv = ChannelReestablish_get_next_remote_commitment_number(&this_ptr_conv);
56835         return ret_conv;
56836 }
56837
56838 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) {
56839         LDKChannelReestablish this_ptr_conv;
56840         this_ptr_conv.inner = untag_ptr(this_ptr);
56841         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56842         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56843         this_ptr_conv.is_owned = false;
56844         ChannelReestablish_set_next_remote_commitment_number(&this_ptr_conv, val);
56845 }
56846
56847 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1your_1last_1per_1commitment_1secret(JNIEnv *env, jclass clz, int64_t this_ptr) {
56848         LDKChannelReestablish this_ptr_conv;
56849         this_ptr_conv.inner = untag_ptr(this_ptr);
56850         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56851         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56852         this_ptr_conv.is_owned = false;
56853         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
56854         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ChannelReestablish_get_your_last_per_commitment_secret(&this_ptr_conv));
56855         return ret_arr;
56856 }
56857
56858 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) {
56859         LDKChannelReestablish this_ptr_conv;
56860         this_ptr_conv.inner = untag_ptr(this_ptr);
56861         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56862         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56863         this_ptr_conv.is_owned = false;
56864         LDKThirtyTwoBytes val_ref;
56865         CHECK((*env)->GetArrayLength(env, val) == 32);
56866         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
56867         ChannelReestablish_set_your_last_per_commitment_secret(&this_ptr_conv, val_ref);
56868 }
56869
56870 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1my_1current_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
56871         LDKChannelReestablish this_ptr_conv;
56872         this_ptr_conv.inner = untag_ptr(this_ptr);
56873         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56874         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56875         this_ptr_conv.is_owned = false;
56876         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
56877         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelReestablish_get_my_current_per_commitment_point(&this_ptr_conv).compressed_form);
56878         return ret_arr;
56879 }
56880
56881 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) {
56882         LDKChannelReestablish this_ptr_conv;
56883         this_ptr_conv.inner = untag_ptr(this_ptr);
56884         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56885         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56886         this_ptr_conv.is_owned = false;
56887         LDKPublicKey val_ref;
56888         CHECK((*env)->GetArrayLength(env, val) == 33);
56889         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
56890         ChannelReestablish_set_my_current_per_commitment_point(&this_ptr_conv, val_ref);
56891 }
56892
56893 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1next_1funding_1txid(JNIEnv *env, jclass clz, int64_t this_ptr) {
56894         LDKChannelReestablish this_ptr_conv;
56895         this_ptr_conv.inner = untag_ptr(this_ptr);
56896         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56897         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56898         this_ptr_conv.is_owned = false;
56899         LDKCOption_ThirtyTwoBytesZ *ret_copy = MALLOC(sizeof(LDKCOption_ThirtyTwoBytesZ), "LDKCOption_ThirtyTwoBytesZ");
56900         *ret_copy = ChannelReestablish_get_next_funding_txid(&this_ptr_conv);
56901         int64_t ret_ref = tag_ptr(ret_copy, true);
56902         return ret_ref;
56903 }
56904
56905 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1set_1next_1funding_1txid(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
56906         LDKChannelReestablish this_ptr_conv;
56907         this_ptr_conv.inner = untag_ptr(this_ptr);
56908         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
56909         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
56910         this_ptr_conv.is_owned = false;
56911         void* val_ptr = untag_ptr(val);
56912         CHECK_ACCESS(val_ptr);
56913         LDKCOption_ThirtyTwoBytesZ val_conv = *(LDKCOption_ThirtyTwoBytesZ*)(val_ptr);
56914         val_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(val));
56915         ChannelReestablish_set_next_funding_txid(&this_ptr_conv, val_conv);
56916 }
56917
56918 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1new(JNIEnv *env, jclass clz, int64_t channel_id_arg, int64_t next_local_commitment_number_arg, int64_t next_remote_commitment_number_arg, int8_tArray your_last_per_commitment_secret_arg, int8_tArray my_current_per_commitment_point_arg, int64_t next_funding_txid_arg) {
56919         LDKChannelId channel_id_arg_conv;
56920         channel_id_arg_conv.inner = untag_ptr(channel_id_arg);
56921         channel_id_arg_conv.is_owned = ptr_is_owned(channel_id_arg);
56922         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_arg_conv);
56923         channel_id_arg_conv = ChannelId_clone(&channel_id_arg_conv);
56924         LDKThirtyTwoBytes your_last_per_commitment_secret_arg_ref;
56925         CHECK((*env)->GetArrayLength(env, your_last_per_commitment_secret_arg) == 32);
56926         (*env)->GetByteArrayRegion(env, your_last_per_commitment_secret_arg, 0, 32, your_last_per_commitment_secret_arg_ref.data);
56927         LDKPublicKey my_current_per_commitment_point_arg_ref;
56928         CHECK((*env)->GetArrayLength(env, my_current_per_commitment_point_arg) == 33);
56929         (*env)->GetByteArrayRegion(env, my_current_per_commitment_point_arg, 0, 33, my_current_per_commitment_point_arg_ref.compressed_form);
56930         void* next_funding_txid_arg_ptr = untag_ptr(next_funding_txid_arg);
56931         CHECK_ACCESS(next_funding_txid_arg_ptr);
56932         LDKCOption_ThirtyTwoBytesZ next_funding_txid_arg_conv = *(LDKCOption_ThirtyTwoBytesZ*)(next_funding_txid_arg_ptr);
56933         next_funding_txid_arg_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(next_funding_txid_arg));
56934         LDKChannelReestablish ret_var = ChannelReestablish_new(channel_id_arg_conv, next_local_commitment_number_arg, next_remote_commitment_number_arg, your_last_per_commitment_secret_arg_ref, my_current_per_commitment_point_arg_ref, next_funding_txid_arg_conv);
56935         int64_t ret_ref = 0;
56936         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56937         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56938         return ret_ref;
56939 }
56940
56941 static inline uint64_t ChannelReestablish_clone_ptr(LDKChannelReestablish *NONNULL_PTR arg) {
56942         LDKChannelReestablish ret_var = ChannelReestablish_clone(arg);
56943         int64_t ret_ref = 0;
56944         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56945         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56946         return ret_ref;
56947 }
56948 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
56949         LDKChannelReestablish arg_conv;
56950         arg_conv.inner = untag_ptr(arg);
56951         arg_conv.is_owned = ptr_is_owned(arg);
56952         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
56953         arg_conv.is_owned = false;
56954         int64_t ret_conv = ChannelReestablish_clone_ptr(&arg_conv);
56955         return ret_conv;
56956 }
56957
56958 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1clone(JNIEnv *env, jclass clz, int64_t orig) {
56959         LDKChannelReestablish orig_conv;
56960         orig_conv.inner = untag_ptr(orig);
56961         orig_conv.is_owned = ptr_is_owned(orig);
56962         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
56963         orig_conv.is_owned = false;
56964         LDKChannelReestablish ret_var = ChannelReestablish_clone(&orig_conv);
56965         int64_t ret_ref = 0;
56966         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
56967         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
56968         return ret_ref;
56969 }
56970
56971 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1hash(JNIEnv *env, jclass clz, int64_t o) {
56972         LDKChannelReestablish o_conv;
56973         o_conv.inner = untag_ptr(o);
56974         o_conv.is_owned = ptr_is_owned(o);
56975         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
56976         o_conv.is_owned = false;
56977         int64_t ret_conv = ChannelReestablish_hash(&o_conv);
56978         return ret_conv;
56979 }
56980
56981 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
56982         LDKChannelReestablish a_conv;
56983         a_conv.inner = untag_ptr(a);
56984         a_conv.is_owned = ptr_is_owned(a);
56985         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
56986         a_conv.is_owned = false;
56987         LDKChannelReestablish b_conv;
56988         b_conv.inner = untag_ptr(b);
56989         b_conv.is_owned = ptr_is_owned(b);
56990         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
56991         b_conv.is_owned = false;
56992         jboolean ret_conv = ChannelReestablish_eq(&a_conv, &b_conv);
56993         return ret_conv;
56994 }
56995
56996 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
56997         LDKAnnouncementSignatures this_obj_conv;
56998         this_obj_conv.inner = untag_ptr(this_obj);
56999         this_obj_conv.is_owned = ptr_is_owned(this_obj);
57000         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
57001         AnnouncementSignatures_free(this_obj_conv);
57002 }
57003
57004 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
57005         LDKAnnouncementSignatures this_ptr_conv;
57006         this_ptr_conv.inner = untag_ptr(this_ptr);
57007         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57008         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57009         this_ptr_conv.is_owned = false;
57010         LDKChannelId ret_var = AnnouncementSignatures_get_channel_id(&this_ptr_conv);
57011         int64_t ret_ref = 0;
57012         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57013         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57014         return ret_ref;
57015 }
57016
57017 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
57018         LDKAnnouncementSignatures this_ptr_conv;
57019         this_ptr_conv.inner = untag_ptr(this_ptr);
57020         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57021         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57022         this_ptr_conv.is_owned = false;
57023         LDKChannelId val_conv;
57024         val_conv.inner = untag_ptr(val);
57025         val_conv.is_owned = ptr_is_owned(val);
57026         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
57027         val_conv = ChannelId_clone(&val_conv);
57028         AnnouncementSignatures_set_channel_id(&this_ptr_conv, val_conv);
57029 }
57030
57031 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
57032         LDKAnnouncementSignatures this_ptr_conv;
57033         this_ptr_conv.inner = untag_ptr(this_ptr);
57034         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57035         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57036         this_ptr_conv.is_owned = false;
57037         int64_t ret_conv = AnnouncementSignatures_get_short_channel_id(&this_ptr_conv);
57038         return ret_conv;
57039 }
57040
57041 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
57042         LDKAnnouncementSignatures this_ptr_conv;
57043         this_ptr_conv.inner = untag_ptr(this_ptr);
57044         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57045         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57046         this_ptr_conv.is_owned = false;
57047         AnnouncementSignatures_set_short_channel_id(&this_ptr_conv, val);
57048 }
57049
57050 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1node_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
57051         LDKAnnouncementSignatures this_ptr_conv;
57052         this_ptr_conv.inner = untag_ptr(this_ptr);
57053         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57054         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57055         this_ptr_conv.is_owned = false;
57056         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
57057         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, AnnouncementSignatures_get_node_signature(&this_ptr_conv).compact_form);
57058         return ret_arr;
57059 }
57060
57061 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1node_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
57062         LDKAnnouncementSignatures this_ptr_conv;
57063         this_ptr_conv.inner = untag_ptr(this_ptr);
57064         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57065         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57066         this_ptr_conv.is_owned = false;
57067         LDKECDSASignature val_ref;
57068         CHECK((*env)->GetArrayLength(env, val) == 64);
57069         (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
57070         AnnouncementSignatures_set_node_signature(&this_ptr_conv, val_ref);
57071 }
57072
57073 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1bitcoin_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
57074         LDKAnnouncementSignatures this_ptr_conv;
57075         this_ptr_conv.inner = untag_ptr(this_ptr);
57076         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57077         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57078         this_ptr_conv.is_owned = false;
57079         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
57080         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, AnnouncementSignatures_get_bitcoin_signature(&this_ptr_conv).compact_form);
57081         return ret_arr;
57082 }
57083
57084 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1bitcoin_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
57085         LDKAnnouncementSignatures this_ptr_conv;
57086         this_ptr_conv.inner = untag_ptr(this_ptr);
57087         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57088         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57089         this_ptr_conv.is_owned = false;
57090         LDKECDSASignature val_ref;
57091         CHECK((*env)->GetArrayLength(env, val) == 64);
57092         (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
57093         AnnouncementSignatures_set_bitcoin_signature(&this_ptr_conv, val_ref);
57094 }
57095
57096 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1new(JNIEnv *env, jclass clz, int64_t channel_id_arg, int64_t short_channel_id_arg, int8_tArray node_signature_arg, int8_tArray bitcoin_signature_arg) {
57097         LDKChannelId channel_id_arg_conv;
57098         channel_id_arg_conv.inner = untag_ptr(channel_id_arg);
57099         channel_id_arg_conv.is_owned = ptr_is_owned(channel_id_arg);
57100         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_arg_conv);
57101         channel_id_arg_conv = ChannelId_clone(&channel_id_arg_conv);
57102         LDKECDSASignature node_signature_arg_ref;
57103         CHECK((*env)->GetArrayLength(env, node_signature_arg) == 64);
57104         (*env)->GetByteArrayRegion(env, node_signature_arg, 0, 64, node_signature_arg_ref.compact_form);
57105         LDKECDSASignature bitcoin_signature_arg_ref;
57106         CHECK((*env)->GetArrayLength(env, bitcoin_signature_arg) == 64);
57107         (*env)->GetByteArrayRegion(env, bitcoin_signature_arg, 0, 64, bitcoin_signature_arg_ref.compact_form);
57108         LDKAnnouncementSignatures ret_var = AnnouncementSignatures_new(channel_id_arg_conv, short_channel_id_arg, node_signature_arg_ref, bitcoin_signature_arg_ref);
57109         int64_t ret_ref = 0;
57110         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57111         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57112         return ret_ref;
57113 }
57114
57115 static inline uint64_t AnnouncementSignatures_clone_ptr(LDKAnnouncementSignatures *NONNULL_PTR arg) {
57116         LDKAnnouncementSignatures ret_var = AnnouncementSignatures_clone(arg);
57117         int64_t ret_ref = 0;
57118         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57119         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57120         return ret_ref;
57121 }
57122 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
57123         LDKAnnouncementSignatures arg_conv;
57124         arg_conv.inner = untag_ptr(arg);
57125         arg_conv.is_owned = ptr_is_owned(arg);
57126         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
57127         arg_conv.is_owned = false;
57128         int64_t ret_conv = AnnouncementSignatures_clone_ptr(&arg_conv);
57129         return ret_conv;
57130 }
57131
57132 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
57133         LDKAnnouncementSignatures orig_conv;
57134         orig_conv.inner = untag_ptr(orig);
57135         orig_conv.is_owned = ptr_is_owned(orig);
57136         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
57137         orig_conv.is_owned = false;
57138         LDKAnnouncementSignatures ret_var = AnnouncementSignatures_clone(&orig_conv);
57139         int64_t ret_ref = 0;
57140         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57141         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57142         return ret_ref;
57143 }
57144
57145 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1hash(JNIEnv *env, jclass clz, int64_t o) {
57146         LDKAnnouncementSignatures o_conv;
57147         o_conv.inner = untag_ptr(o);
57148         o_conv.is_owned = ptr_is_owned(o);
57149         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
57150         o_conv.is_owned = false;
57151         int64_t ret_conv = AnnouncementSignatures_hash(&o_conv);
57152         return ret_conv;
57153 }
57154
57155 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
57156         LDKAnnouncementSignatures a_conv;
57157         a_conv.inner = untag_ptr(a);
57158         a_conv.is_owned = ptr_is_owned(a);
57159         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
57160         a_conv.is_owned = false;
57161         LDKAnnouncementSignatures b_conv;
57162         b_conv.inner = untag_ptr(b);
57163         b_conv.is_owned = ptr_is_owned(b);
57164         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
57165         b_conv.is_owned = false;
57166         jboolean ret_conv = AnnouncementSignatures_eq(&a_conv, &b_conv);
57167         return ret_conv;
57168 }
57169
57170 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SocketAddress_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
57171         if (!ptr_is_owned(this_ptr)) return;
57172         void* this_ptr_ptr = untag_ptr(this_ptr);
57173         CHECK_ACCESS(this_ptr_ptr);
57174         LDKSocketAddress this_ptr_conv = *(LDKSocketAddress*)(this_ptr_ptr);
57175         FREE(untag_ptr(this_ptr));
57176         SocketAddress_free(this_ptr_conv);
57177 }
57178
57179 static inline uint64_t SocketAddress_clone_ptr(LDKSocketAddress *NONNULL_PTR arg) {
57180         LDKSocketAddress *ret_copy = MALLOC(sizeof(LDKSocketAddress), "LDKSocketAddress");
57181         *ret_copy = SocketAddress_clone(arg);
57182         int64_t ret_ref = tag_ptr(ret_copy, true);
57183         return ret_ref;
57184 }
57185 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SocketAddress_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
57186         LDKSocketAddress* arg_conv = (LDKSocketAddress*)untag_ptr(arg);
57187         int64_t ret_conv = SocketAddress_clone_ptr(arg_conv);
57188         return ret_conv;
57189 }
57190
57191 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SocketAddress_1clone(JNIEnv *env, jclass clz, int64_t orig) {
57192         LDKSocketAddress* orig_conv = (LDKSocketAddress*)untag_ptr(orig);
57193         LDKSocketAddress *ret_copy = MALLOC(sizeof(LDKSocketAddress), "LDKSocketAddress");
57194         *ret_copy = SocketAddress_clone(orig_conv);
57195         int64_t ret_ref = tag_ptr(ret_copy, true);
57196         return ret_ref;
57197 }
57198
57199 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SocketAddress_1tcp_1ip_1v4(JNIEnv *env, jclass clz, int8_tArray addr, int16_t port) {
57200         LDKFourBytes addr_ref;
57201         CHECK((*env)->GetArrayLength(env, addr) == 4);
57202         (*env)->GetByteArrayRegion(env, addr, 0, 4, addr_ref.data);
57203         LDKSocketAddress *ret_copy = MALLOC(sizeof(LDKSocketAddress), "LDKSocketAddress");
57204         *ret_copy = SocketAddress_tcp_ip_v4(addr_ref, port);
57205         int64_t ret_ref = tag_ptr(ret_copy, true);
57206         return ret_ref;
57207 }
57208
57209 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SocketAddress_1tcp_1ip_1v6(JNIEnv *env, jclass clz, int8_tArray addr, int16_t port) {
57210         LDKSixteenBytes addr_ref;
57211         CHECK((*env)->GetArrayLength(env, addr) == 16);
57212         (*env)->GetByteArrayRegion(env, addr, 0, 16, addr_ref.data);
57213         LDKSocketAddress *ret_copy = MALLOC(sizeof(LDKSocketAddress), "LDKSocketAddress");
57214         *ret_copy = SocketAddress_tcp_ip_v6(addr_ref, port);
57215         int64_t ret_ref = tag_ptr(ret_copy, true);
57216         return ret_ref;
57217 }
57218
57219 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SocketAddress_1onion_1v2(JNIEnv *env, jclass clz, int8_tArray a) {
57220         LDKTwelveBytes a_ref;
57221         CHECK((*env)->GetArrayLength(env, a) == 12);
57222         (*env)->GetByteArrayRegion(env, a, 0, 12, a_ref.data);
57223         LDKSocketAddress *ret_copy = MALLOC(sizeof(LDKSocketAddress), "LDKSocketAddress");
57224         *ret_copy = SocketAddress_onion_v2(a_ref);
57225         int64_t ret_ref = tag_ptr(ret_copy, true);
57226         return ret_ref;
57227 }
57228
57229 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) {
57230         LDKThirtyTwoBytes ed25519_pubkey_ref;
57231         CHECK((*env)->GetArrayLength(env, ed25519_pubkey) == 32);
57232         (*env)->GetByteArrayRegion(env, ed25519_pubkey, 0, 32, ed25519_pubkey_ref.data);
57233         LDKSocketAddress *ret_copy = MALLOC(sizeof(LDKSocketAddress), "LDKSocketAddress");
57234         *ret_copy = SocketAddress_onion_v3(ed25519_pubkey_ref, checksum, version, port);
57235         int64_t ret_ref = tag_ptr(ret_copy, true);
57236         return ret_ref;
57237 }
57238
57239 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SocketAddress_1hostname(JNIEnv *env, jclass clz, int64_t hostname, int16_t port) {
57240         LDKHostname hostname_conv;
57241         hostname_conv.inner = untag_ptr(hostname);
57242         hostname_conv.is_owned = ptr_is_owned(hostname);
57243         CHECK_INNER_FIELD_ACCESS_OR_NULL(hostname_conv);
57244         hostname_conv = Hostname_clone(&hostname_conv);
57245         LDKSocketAddress *ret_copy = MALLOC(sizeof(LDKSocketAddress), "LDKSocketAddress");
57246         *ret_copy = SocketAddress_hostname(hostname_conv, port);
57247         int64_t ret_ref = tag_ptr(ret_copy, true);
57248         return ret_ref;
57249 }
57250
57251 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SocketAddress_1hash(JNIEnv *env, jclass clz, int64_t o) {
57252         LDKSocketAddress* o_conv = (LDKSocketAddress*)untag_ptr(o);
57253         int64_t ret_conv = SocketAddress_hash(o_conv);
57254         return ret_conv;
57255 }
57256
57257 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_SocketAddress_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
57258         LDKSocketAddress* a_conv = (LDKSocketAddress*)untag_ptr(a);
57259         LDKSocketAddress* b_conv = (LDKSocketAddress*)untag_ptr(b);
57260         jboolean ret_conv = SocketAddress_eq(a_conv, b_conv);
57261         return ret_conv;
57262 }
57263
57264 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_SocketAddress_1write(JNIEnv *env, jclass clz, int64_t obj) {
57265         LDKSocketAddress* obj_conv = (LDKSocketAddress*)untag_ptr(obj);
57266         LDKCVec_u8Z ret_var = SocketAddress_write(obj_conv);
57267         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
57268         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
57269         CVec_u8Z_free(ret_var);
57270         return ret_arr;
57271 }
57272
57273 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SocketAddress_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
57274         LDKu8slice ser_ref;
57275         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
57276         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
57277         LDKCResult_SocketAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SocketAddressDecodeErrorZ), "LDKCResult_SocketAddressDecodeErrorZ");
57278         *ret_conv = SocketAddress_read(ser_ref);
57279         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
57280         return tag_ptr(ret_conv, true);
57281 }
57282
57283 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SocketAddressParseError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
57284         LDKSocketAddressParseError* orig_conv = (LDKSocketAddressParseError*)untag_ptr(orig);
57285         jclass ret_conv = LDKSocketAddressParseError_to_java(env, SocketAddressParseError_clone(orig_conv));
57286         return ret_conv;
57287 }
57288
57289 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SocketAddressParseError_1socket_1addr_1parse(JNIEnv *env, jclass clz) {
57290         jclass ret_conv = LDKSocketAddressParseError_to_java(env, SocketAddressParseError_socket_addr_parse());
57291         return ret_conv;
57292 }
57293
57294 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SocketAddressParseError_1invalid_1input(JNIEnv *env, jclass clz) {
57295         jclass ret_conv = LDKSocketAddressParseError_to_java(env, SocketAddressParseError_invalid_input());
57296         return ret_conv;
57297 }
57298
57299 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SocketAddressParseError_1invalid_1port(JNIEnv *env, jclass clz) {
57300         jclass ret_conv = LDKSocketAddressParseError_to_java(env, SocketAddressParseError_invalid_port());
57301         return ret_conv;
57302 }
57303
57304 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SocketAddressParseError_1invalid_1onion_1v3(JNIEnv *env, jclass clz) {
57305         jclass ret_conv = LDKSocketAddressParseError_to_java(env, SocketAddressParseError_invalid_onion_v3());
57306         return ret_conv;
57307 }
57308
57309 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SocketAddressParseError_1hash(JNIEnv *env, jclass clz, int64_t o) {
57310         LDKSocketAddressParseError* o_conv = (LDKSocketAddressParseError*)untag_ptr(o);
57311         int64_t ret_conv = SocketAddressParseError_hash(o_conv);
57312         return ret_conv;
57313 }
57314
57315 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_SocketAddressParseError_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
57316         LDKSocketAddressParseError* a_conv = (LDKSocketAddressParseError*)untag_ptr(a);
57317         LDKSocketAddressParseError* b_conv = (LDKSocketAddressParseError*)untag_ptr(b);
57318         jboolean ret_conv = SocketAddressParseError_eq(a_conv, b_conv);
57319         return ret_conv;
57320 }
57321
57322 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_parse_1onion_1address(JNIEnv *env, jclass clz, jstring host, int16_t port) {
57323         LDKStr host_conv = java_to_owned_str(env, host);
57324         LDKCResult_SocketAddressSocketAddressParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SocketAddressSocketAddressParseErrorZ), "LDKCResult_SocketAddressSocketAddressParseErrorZ");
57325         *ret_conv = parse_onion_address(host_conv, port);
57326         return tag_ptr(ret_conv, true);
57327 }
57328
57329 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_SocketAddress_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
57330         LDKSocketAddress* o_conv = (LDKSocketAddress*)untag_ptr(o);
57331         LDKStr ret_str = SocketAddress_to_str(o_conv);
57332         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
57333         Str_free(ret_str);
57334         return ret_conv;
57335 }
57336
57337 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SocketAddress_1from_1str(JNIEnv *env, jclass clz, jstring s) {
57338         LDKStr s_conv = java_to_owned_str(env, s);
57339         LDKCResult_SocketAddressSocketAddressParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SocketAddressSocketAddressParseErrorZ), "LDKCResult_SocketAddressSocketAddressParseErrorZ");
57340         *ret_conv = SocketAddress_from_str(s_conv);
57341         return tag_ptr(ret_conv, true);
57342 }
57343
57344 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedGossipMessage_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
57345         if (!ptr_is_owned(this_ptr)) return;
57346         void* this_ptr_ptr = untag_ptr(this_ptr);
57347         CHECK_ACCESS(this_ptr_ptr);
57348         LDKUnsignedGossipMessage this_ptr_conv = *(LDKUnsignedGossipMessage*)(this_ptr_ptr);
57349         FREE(untag_ptr(this_ptr));
57350         UnsignedGossipMessage_free(this_ptr_conv);
57351 }
57352
57353 static inline uint64_t UnsignedGossipMessage_clone_ptr(LDKUnsignedGossipMessage *NONNULL_PTR arg) {
57354         LDKUnsignedGossipMessage *ret_copy = MALLOC(sizeof(LDKUnsignedGossipMessage), "LDKUnsignedGossipMessage");
57355         *ret_copy = UnsignedGossipMessage_clone(arg);
57356         int64_t ret_ref = tag_ptr(ret_copy, true);
57357         return ret_ref;
57358 }
57359 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedGossipMessage_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
57360         LDKUnsignedGossipMessage* arg_conv = (LDKUnsignedGossipMessage*)untag_ptr(arg);
57361         int64_t ret_conv = UnsignedGossipMessage_clone_ptr(arg_conv);
57362         return ret_conv;
57363 }
57364
57365 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedGossipMessage_1clone(JNIEnv *env, jclass clz, int64_t orig) {
57366         LDKUnsignedGossipMessage* orig_conv = (LDKUnsignedGossipMessage*)untag_ptr(orig);
57367         LDKUnsignedGossipMessage *ret_copy = MALLOC(sizeof(LDKUnsignedGossipMessage), "LDKUnsignedGossipMessage");
57368         *ret_copy = UnsignedGossipMessage_clone(orig_conv);
57369         int64_t ret_ref = tag_ptr(ret_copy, true);
57370         return ret_ref;
57371 }
57372
57373 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedGossipMessage_1channel_1announcement(JNIEnv *env, jclass clz, int64_t a) {
57374         LDKUnsignedChannelAnnouncement a_conv;
57375         a_conv.inner = untag_ptr(a);
57376         a_conv.is_owned = ptr_is_owned(a);
57377         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
57378         a_conv = UnsignedChannelAnnouncement_clone(&a_conv);
57379         LDKUnsignedGossipMessage *ret_copy = MALLOC(sizeof(LDKUnsignedGossipMessage), "LDKUnsignedGossipMessage");
57380         *ret_copy = UnsignedGossipMessage_channel_announcement(a_conv);
57381         int64_t ret_ref = tag_ptr(ret_copy, true);
57382         return ret_ref;
57383 }
57384
57385 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedGossipMessage_1channel_1update(JNIEnv *env, jclass clz, int64_t a) {
57386         LDKUnsignedChannelUpdate a_conv;
57387         a_conv.inner = untag_ptr(a);
57388         a_conv.is_owned = ptr_is_owned(a);
57389         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
57390         a_conv = UnsignedChannelUpdate_clone(&a_conv);
57391         LDKUnsignedGossipMessage *ret_copy = MALLOC(sizeof(LDKUnsignedGossipMessage), "LDKUnsignedGossipMessage");
57392         *ret_copy = UnsignedGossipMessage_channel_update(a_conv);
57393         int64_t ret_ref = tag_ptr(ret_copy, true);
57394         return ret_ref;
57395 }
57396
57397 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedGossipMessage_1node_1announcement(JNIEnv *env, jclass clz, int64_t a) {
57398         LDKUnsignedNodeAnnouncement a_conv;
57399         a_conv.inner = untag_ptr(a);
57400         a_conv.is_owned = ptr_is_owned(a);
57401         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
57402         a_conv = UnsignedNodeAnnouncement_clone(&a_conv);
57403         LDKUnsignedGossipMessage *ret_copy = MALLOC(sizeof(LDKUnsignedGossipMessage), "LDKUnsignedGossipMessage");
57404         *ret_copy = UnsignedGossipMessage_node_announcement(a_conv);
57405         int64_t ret_ref = tag_ptr(ret_copy, true);
57406         return ret_ref;
57407 }
57408
57409 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedGossipMessage_1write(JNIEnv *env, jclass clz, int64_t obj) {
57410         LDKUnsignedGossipMessage* obj_conv = (LDKUnsignedGossipMessage*)untag_ptr(obj);
57411         LDKCVec_u8Z ret_var = UnsignedGossipMessage_write(obj_conv);
57412         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
57413         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
57414         CVec_u8Z_free(ret_var);
57415         return ret_arr;
57416 }
57417
57418 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
57419         LDKUnsignedNodeAnnouncement this_obj_conv;
57420         this_obj_conv.inner = untag_ptr(this_obj);
57421         this_obj_conv.is_owned = ptr_is_owned(this_obj);
57422         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
57423         UnsignedNodeAnnouncement_free(this_obj_conv);
57424 }
57425
57426 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
57427         LDKUnsignedNodeAnnouncement this_ptr_conv;
57428         this_ptr_conv.inner = untag_ptr(this_ptr);
57429         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57430         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57431         this_ptr_conv.is_owned = false;
57432         LDKNodeFeatures ret_var = UnsignedNodeAnnouncement_get_features(&this_ptr_conv);
57433         int64_t ret_ref = 0;
57434         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57435         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57436         return ret_ref;
57437 }
57438
57439 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
57440         LDKUnsignedNodeAnnouncement this_ptr_conv;
57441         this_ptr_conv.inner = untag_ptr(this_ptr);
57442         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57443         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57444         this_ptr_conv.is_owned = false;
57445         LDKNodeFeatures val_conv;
57446         val_conv.inner = untag_ptr(val);
57447         val_conv.is_owned = ptr_is_owned(val);
57448         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
57449         val_conv = NodeFeatures_clone(&val_conv);
57450         UnsignedNodeAnnouncement_set_features(&this_ptr_conv, val_conv);
57451 }
57452
57453 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr) {
57454         LDKUnsignedNodeAnnouncement this_ptr_conv;
57455         this_ptr_conv.inner = untag_ptr(this_ptr);
57456         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57457         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57458         this_ptr_conv.is_owned = false;
57459         int32_t ret_conv = UnsignedNodeAnnouncement_get_timestamp(&this_ptr_conv);
57460         return ret_conv;
57461 }
57462
57463 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
57464         LDKUnsignedNodeAnnouncement this_ptr_conv;
57465         this_ptr_conv.inner = untag_ptr(this_ptr);
57466         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57467         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57468         this_ptr_conv.is_owned = false;
57469         UnsignedNodeAnnouncement_set_timestamp(&this_ptr_conv, val);
57470 }
57471
57472 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
57473         LDKUnsignedNodeAnnouncement this_ptr_conv;
57474         this_ptr_conv.inner = untag_ptr(this_ptr);
57475         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57476         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57477         this_ptr_conv.is_owned = false;
57478         LDKNodeId ret_var = UnsignedNodeAnnouncement_get_node_id(&this_ptr_conv);
57479         int64_t ret_ref = 0;
57480         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57481         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57482         return ret_ref;
57483 }
57484
57485 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
57486         LDKUnsignedNodeAnnouncement this_ptr_conv;
57487         this_ptr_conv.inner = untag_ptr(this_ptr);
57488         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57489         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57490         this_ptr_conv.is_owned = false;
57491         LDKNodeId val_conv;
57492         val_conv.inner = untag_ptr(val);
57493         val_conv.is_owned = ptr_is_owned(val);
57494         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
57495         val_conv = NodeId_clone(&val_conv);
57496         UnsignedNodeAnnouncement_set_node_id(&this_ptr_conv, val_conv);
57497 }
57498
57499 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1rgb(JNIEnv *env, jclass clz, int64_t this_ptr) {
57500         LDKUnsignedNodeAnnouncement this_ptr_conv;
57501         this_ptr_conv.inner = untag_ptr(this_ptr);
57502         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57503         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57504         this_ptr_conv.is_owned = false;
57505         int8_tArray ret_arr = (*env)->NewByteArray(env, 3);
57506         (*env)->SetByteArrayRegion(env, ret_arr, 0, 3, *UnsignedNodeAnnouncement_get_rgb(&this_ptr_conv));
57507         return ret_arr;
57508 }
57509
57510 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1rgb(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
57511         LDKUnsignedNodeAnnouncement this_ptr_conv;
57512         this_ptr_conv.inner = untag_ptr(this_ptr);
57513         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57514         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57515         this_ptr_conv.is_owned = false;
57516         LDKThreeBytes val_ref;
57517         CHECK((*env)->GetArrayLength(env, val) == 3);
57518         (*env)->GetByteArrayRegion(env, val, 0, 3, val_ref.data);
57519         UnsignedNodeAnnouncement_set_rgb(&this_ptr_conv, val_ref);
57520 }
57521
57522 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1alias(JNIEnv *env, jclass clz, int64_t this_ptr) {
57523         LDKUnsignedNodeAnnouncement this_ptr_conv;
57524         this_ptr_conv.inner = untag_ptr(this_ptr);
57525         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57526         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57527         this_ptr_conv.is_owned = false;
57528         LDKNodeAlias ret_var = UnsignedNodeAnnouncement_get_alias(&this_ptr_conv);
57529         int64_t ret_ref = 0;
57530         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57531         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57532         return ret_ref;
57533 }
57534
57535 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1alias(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
57536         LDKUnsignedNodeAnnouncement this_ptr_conv;
57537         this_ptr_conv.inner = untag_ptr(this_ptr);
57538         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57539         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57540         this_ptr_conv.is_owned = false;
57541         LDKNodeAlias val_conv;
57542         val_conv.inner = untag_ptr(val);
57543         val_conv.is_owned = ptr_is_owned(val);
57544         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
57545         val_conv = NodeAlias_clone(&val_conv);
57546         UnsignedNodeAnnouncement_set_alias(&this_ptr_conv, val_conv);
57547 }
57548
57549 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1addresses(JNIEnv *env, jclass clz, int64_t this_ptr) {
57550         LDKUnsignedNodeAnnouncement this_ptr_conv;
57551         this_ptr_conv.inner = untag_ptr(this_ptr);
57552         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57553         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57554         this_ptr_conv.is_owned = false;
57555         LDKCVec_SocketAddressZ ret_var = UnsignedNodeAnnouncement_get_addresses(&this_ptr_conv);
57556         int64_tArray ret_arr = NULL;
57557         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
57558         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
57559         for (size_t p = 0; p < ret_var.datalen; p++) {
57560                 LDKSocketAddress *ret_conv_15_copy = MALLOC(sizeof(LDKSocketAddress), "LDKSocketAddress");
57561                 *ret_conv_15_copy = ret_var.data[p];
57562                 int64_t ret_conv_15_ref = tag_ptr(ret_conv_15_copy, true);
57563                 ret_arr_ptr[p] = ret_conv_15_ref;
57564         }
57565         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
57566         FREE(ret_var.data);
57567         return ret_arr;
57568 }
57569
57570 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1addresses(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
57571         LDKUnsignedNodeAnnouncement this_ptr_conv;
57572         this_ptr_conv.inner = untag_ptr(this_ptr);
57573         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57574         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57575         this_ptr_conv.is_owned = false;
57576         LDKCVec_SocketAddressZ val_constr;
57577         val_constr.datalen = (*env)->GetArrayLength(env, val);
57578         if (val_constr.datalen > 0)
57579                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKSocketAddress), "LDKCVec_SocketAddressZ Elements");
57580         else
57581                 val_constr.data = NULL;
57582         int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
57583         for (size_t p = 0; p < val_constr.datalen; p++) {
57584                 int64_t val_conv_15 = val_vals[p];
57585                 void* val_conv_15_ptr = untag_ptr(val_conv_15);
57586                 CHECK_ACCESS(val_conv_15_ptr);
57587                 LDKSocketAddress val_conv_15_conv = *(LDKSocketAddress*)(val_conv_15_ptr);
57588                 val_conv_15_conv = SocketAddress_clone((LDKSocketAddress*)untag_ptr(val_conv_15));
57589                 val_constr.data[p] = val_conv_15_conv;
57590         }
57591         (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
57592         UnsignedNodeAnnouncement_set_addresses(&this_ptr_conv, val_constr);
57593 }
57594
57595 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1excess_1address_1data(JNIEnv *env, jclass clz, int64_t this_ptr) {
57596         LDKUnsignedNodeAnnouncement this_ptr_conv;
57597         this_ptr_conv.inner = untag_ptr(this_ptr);
57598         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57599         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57600         this_ptr_conv.is_owned = false;
57601         LDKCVec_u8Z ret_var = UnsignedNodeAnnouncement_get_excess_address_data(&this_ptr_conv);
57602         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
57603         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
57604         CVec_u8Z_free(ret_var);
57605         return ret_arr;
57606 }
57607
57608 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1excess_1address_1data(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
57609         LDKUnsignedNodeAnnouncement this_ptr_conv;
57610         this_ptr_conv.inner = untag_ptr(this_ptr);
57611         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57612         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57613         this_ptr_conv.is_owned = false;
57614         LDKCVec_u8Z val_ref;
57615         val_ref.datalen = (*env)->GetArrayLength(env, val);
57616         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
57617         (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
57618         UnsignedNodeAnnouncement_set_excess_address_data(&this_ptr_conv, val_ref);
57619 }
57620
57621 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1excess_1data(JNIEnv *env, jclass clz, int64_t this_ptr) {
57622         LDKUnsignedNodeAnnouncement this_ptr_conv;
57623         this_ptr_conv.inner = untag_ptr(this_ptr);
57624         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57625         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57626         this_ptr_conv.is_owned = false;
57627         LDKCVec_u8Z ret_var = UnsignedNodeAnnouncement_get_excess_data(&this_ptr_conv);
57628         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
57629         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
57630         CVec_u8Z_free(ret_var);
57631         return ret_arr;
57632 }
57633
57634 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1excess_1data(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
57635         LDKUnsignedNodeAnnouncement this_ptr_conv;
57636         this_ptr_conv.inner = untag_ptr(this_ptr);
57637         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57638         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57639         this_ptr_conv.is_owned = false;
57640         LDKCVec_u8Z val_ref;
57641         val_ref.datalen = (*env)->GetArrayLength(env, val);
57642         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
57643         (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
57644         UnsignedNodeAnnouncement_set_excess_data(&this_ptr_conv, val_ref);
57645 }
57646
57647 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1new(JNIEnv *env, jclass clz, int64_t features_arg, int32_t timestamp_arg, int64_t node_id_arg, int8_tArray rgb_arg, int64_t alias_arg, int64_tArray addresses_arg, int8_tArray excess_address_data_arg, int8_tArray excess_data_arg) {
57648         LDKNodeFeatures features_arg_conv;
57649         features_arg_conv.inner = untag_ptr(features_arg);
57650         features_arg_conv.is_owned = ptr_is_owned(features_arg);
57651         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
57652         features_arg_conv = NodeFeatures_clone(&features_arg_conv);
57653         LDKNodeId node_id_arg_conv;
57654         node_id_arg_conv.inner = untag_ptr(node_id_arg);
57655         node_id_arg_conv.is_owned = ptr_is_owned(node_id_arg);
57656         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_arg_conv);
57657         node_id_arg_conv = NodeId_clone(&node_id_arg_conv);
57658         LDKThreeBytes rgb_arg_ref;
57659         CHECK((*env)->GetArrayLength(env, rgb_arg) == 3);
57660         (*env)->GetByteArrayRegion(env, rgb_arg, 0, 3, rgb_arg_ref.data);
57661         LDKNodeAlias alias_arg_conv;
57662         alias_arg_conv.inner = untag_ptr(alias_arg);
57663         alias_arg_conv.is_owned = ptr_is_owned(alias_arg);
57664         CHECK_INNER_FIELD_ACCESS_OR_NULL(alias_arg_conv);
57665         alias_arg_conv = NodeAlias_clone(&alias_arg_conv);
57666         LDKCVec_SocketAddressZ addresses_arg_constr;
57667         addresses_arg_constr.datalen = (*env)->GetArrayLength(env, addresses_arg);
57668         if (addresses_arg_constr.datalen > 0)
57669                 addresses_arg_constr.data = MALLOC(addresses_arg_constr.datalen * sizeof(LDKSocketAddress), "LDKCVec_SocketAddressZ Elements");
57670         else
57671                 addresses_arg_constr.data = NULL;
57672         int64_t* addresses_arg_vals = (*env)->GetLongArrayElements (env, addresses_arg, NULL);
57673         for (size_t p = 0; p < addresses_arg_constr.datalen; p++) {
57674                 int64_t addresses_arg_conv_15 = addresses_arg_vals[p];
57675                 void* addresses_arg_conv_15_ptr = untag_ptr(addresses_arg_conv_15);
57676                 CHECK_ACCESS(addresses_arg_conv_15_ptr);
57677                 LDKSocketAddress addresses_arg_conv_15_conv = *(LDKSocketAddress*)(addresses_arg_conv_15_ptr);
57678                 addresses_arg_constr.data[p] = addresses_arg_conv_15_conv;
57679         }
57680         (*env)->ReleaseLongArrayElements(env, addresses_arg, addresses_arg_vals, 0);
57681         LDKCVec_u8Z excess_address_data_arg_ref;
57682         excess_address_data_arg_ref.datalen = (*env)->GetArrayLength(env, excess_address_data_arg);
57683         excess_address_data_arg_ref.data = MALLOC(excess_address_data_arg_ref.datalen, "LDKCVec_u8Z Bytes");
57684         (*env)->GetByteArrayRegion(env, excess_address_data_arg, 0, excess_address_data_arg_ref.datalen, excess_address_data_arg_ref.data);
57685         LDKCVec_u8Z excess_data_arg_ref;
57686         excess_data_arg_ref.datalen = (*env)->GetArrayLength(env, excess_data_arg);
57687         excess_data_arg_ref.data = MALLOC(excess_data_arg_ref.datalen, "LDKCVec_u8Z Bytes");
57688         (*env)->GetByteArrayRegion(env, excess_data_arg, 0, excess_data_arg_ref.datalen, excess_data_arg_ref.data);
57689         LDKUnsignedNodeAnnouncement ret_var = UnsignedNodeAnnouncement_new(features_arg_conv, timestamp_arg, node_id_arg_conv, rgb_arg_ref, alias_arg_conv, addresses_arg_constr, excess_address_data_arg_ref, excess_data_arg_ref);
57690         int64_t ret_ref = 0;
57691         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57692         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57693         return ret_ref;
57694 }
57695
57696 static inline uint64_t UnsignedNodeAnnouncement_clone_ptr(LDKUnsignedNodeAnnouncement *NONNULL_PTR arg) {
57697         LDKUnsignedNodeAnnouncement ret_var = UnsignedNodeAnnouncement_clone(arg);
57698         int64_t ret_ref = 0;
57699         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57700         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57701         return ret_ref;
57702 }
57703 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
57704         LDKUnsignedNodeAnnouncement arg_conv;
57705         arg_conv.inner = untag_ptr(arg);
57706         arg_conv.is_owned = ptr_is_owned(arg);
57707         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
57708         arg_conv.is_owned = false;
57709         int64_t ret_conv = UnsignedNodeAnnouncement_clone_ptr(&arg_conv);
57710         return ret_conv;
57711 }
57712
57713 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1clone(JNIEnv *env, jclass clz, int64_t orig) {
57714         LDKUnsignedNodeAnnouncement orig_conv;
57715         orig_conv.inner = untag_ptr(orig);
57716         orig_conv.is_owned = ptr_is_owned(orig);
57717         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
57718         orig_conv.is_owned = false;
57719         LDKUnsignedNodeAnnouncement ret_var = UnsignedNodeAnnouncement_clone(&orig_conv);
57720         int64_t ret_ref = 0;
57721         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57722         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57723         return ret_ref;
57724 }
57725
57726 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1hash(JNIEnv *env, jclass clz, int64_t o) {
57727         LDKUnsignedNodeAnnouncement o_conv;
57728         o_conv.inner = untag_ptr(o);
57729         o_conv.is_owned = ptr_is_owned(o);
57730         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
57731         o_conv.is_owned = false;
57732         int64_t ret_conv = UnsignedNodeAnnouncement_hash(&o_conv);
57733         return ret_conv;
57734 }
57735
57736 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
57737         LDKUnsignedNodeAnnouncement a_conv;
57738         a_conv.inner = untag_ptr(a);
57739         a_conv.is_owned = ptr_is_owned(a);
57740         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
57741         a_conv.is_owned = false;
57742         LDKUnsignedNodeAnnouncement b_conv;
57743         b_conv.inner = untag_ptr(b);
57744         b_conv.is_owned = ptr_is_owned(b);
57745         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
57746         b_conv.is_owned = false;
57747         jboolean ret_conv = UnsignedNodeAnnouncement_eq(&a_conv, &b_conv);
57748         return ret_conv;
57749 }
57750
57751 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
57752         LDKNodeAnnouncement this_obj_conv;
57753         this_obj_conv.inner = untag_ptr(this_obj);
57754         this_obj_conv.is_owned = ptr_is_owned(this_obj);
57755         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
57756         NodeAnnouncement_free(this_obj_conv);
57757 }
57758
57759 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
57760         LDKNodeAnnouncement this_ptr_conv;
57761         this_ptr_conv.inner = untag_ptr(this_ptr);
57762         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57763         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57764         this_ptr_conv.is_owned = false;
57765         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
57766         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, NodeAnnouncement_get_signature(&this_ptr_conv).compact_form);
57767         return ret_arr;
57768 }
57769
57770 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
57771         LDKNodeAnnouncement this_ptr_conv;
57772         this_ptr_conv.inner = untag_ptr(this_ptr);
57773         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57774         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57775         this_ptr_conv.is_owned = false;
57776         LDKECDSASignature val_ref;
57777         CHECK((*env)->GetArrayLength(env, val) == 64);
57778         (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
57779         NodeAnnouncement_set_signature(&this_ptr_conv, val_ref);
57780 }
57781
57782 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1get_1contents(JNIEnv *env, jclass clz, int64_t this_ptr) {
57783         LDKNodeAnnouncement this_ptr_conv;
57784         this_ptr_conv.inner = untag_ptr(this_ptr);
57785         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57786         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57787         this_ptr_conv.is_owned = false;
57788         LDKUnsignedNodeAnnouncement ret_var = NodeAnnouncement_get_contents(&this_ptr_conv);
57789         int64_t ret_ref = 0;
57790         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57791         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57792         return ret_ref;
57793 }
57794
57795 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1set_1contents(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
57796         LDKNodeAnnouncement this_ptr_conv;
57797         this_ptr_conv.inner = untag_ptr(this_ptr);
57798         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57799         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57800         this_ptr_conv.is_owned = false;
57801         LDKUnsignedNodeAnnouncement val_conv;
57802         val_conv.inner = untag_ptr(val);
57803         val_conv.is_owned = ptr_is_owned(val);
57804         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
57805         val_conv = UnsignedNodeAnnouncement_clone(&val_conv);
57806         NodeAnnouncement_set_contents(&this_ptr_conv, val_conv);
57807 }
57808
57809 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1new(JNIEnv *env, jclass clz, int8_tArray signature_arg, int64_t contents_arg) {
57810         LDKECDSASignature signature_arg_ref;
57811         CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
57812         (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
57813         LDKUnsignedNodeAnnouncement contents_arg_conv;
57814         contents_arg_conv.inner = untag_ptr(contents_arg);
57815         contents_arg_conv.is_owned = ptr_is_owned(contents_arg);
57816         CHECK_INNER_FIELD_ACCESS_OR_NULL(contents_arg_conv);
57817         contents_arg_conv = UnsignedNodeAnnouncement_clone(&contents_arg_conv);
57818         LDKNodeAnnouncement ret_var = NodeAnnouncement_new(signature_arg_ref, contents_arg_conv);
57819         int64_t ret_ref = 0;
57820         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57821         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57822         return ret_ref;
57823 }
57824
57825 static inline uint64_t NodeAnnouncement_clone_ptr(LDKNodeAnnouncement *NONNULL_PTR arg) {
57826         LDKNodeAnnouncement ret_var = NodeAnnouncement_clone(arg);
57827         int64_t ret_ref = 0;
57828         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57829         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57830         return ret_ref;
57831 }
57832 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
57833         LDKNodeAnnouncement arg_conv;
57834         arg_conv.inner = untag_ptr(arg);
57835         arg_conv.is_owned = ptr_is_owned(arg);
57836         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
57837         arg_conv.is_owned = false;
57838         int64_t ret_conv = NodeAnnouncement_clone_ptr(&arg_conv);
57839         return ret_conv;
57840 }
57841
57842 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1clone(JNIEnv *env, jclass clz, int64_t orig) {
57843         LDKNodeAnnouncement orig_conv;
57844         orig_conv.inner = untag_ptr(orig);
57845         orig_conv.is_owned = ptr_is_owned(orig);
57846         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
57847         orig_conv.is_owned = false;
57848         LDKNodeAnnouncement ret_var = NodeAnnouncement_clone(&orig_conv);
57849         int64_t ret_ref = 0;
57850         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57851         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57852         return ret_ref;
57853 }
57854
57855 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1hash(JNIEnv *env, jclass clz, int64_t o) {
57856         LDKNodeAnnouncement o_conv;
57857         o_conv.inner = untag_ptr(o);
57858         o_conv.is_owned = ptr_is_owned(o);
57859         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
57860         o_conv.is_owned = false;
57861         int64_t ret_conv = NodeAnnouncement_hash(&o_conv);
57862         return ret_conv;
57863 }
57864
57865 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
57866         LDKNodeAnnouncement a_conv;
57867         a_conv.inner = untag_ptr(a);
57868         a_conv.is_owned = ptr_is_owned(a);
57869         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
57870         a_conv.is_owned = false;
57871         LDKNodeAnnouncement b_conv;
57872         b_conv.inner = untag_ptr(b);
57873         b_conv.is_owned = ptr_is_owned(b);
57874         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
57875         b_conv.is_owned = false;
57876         jboolean ret_conv = NodeAnnouncement_eq(&a_conv, &b_conv);
57877         return ret_conv;
57878 }
57879
57880 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
57881         LDKUnsignedChannelAnnouncement this_obj_conv;
57882         this_obj_conv.inner = untag_ptr(this_obj);
57883         this_obj_conv.is_owned = ptr_is_owned(this_obj);
57884         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
57885         UnsignedChannelAnnouncement_free(this_obj_conv);
57886 }
57887
57888 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
57889         LDKUnsignedChannelAnnouncement this_ptr_conv;
57890         this_ptr_conv.inner = untag_ptr(this_ptr);
57891         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57892         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57893         this_ptr_conv.is_owned = false;
57894         LDKChannelFeatures ret_var = UnsignedChannelAnnouncement_get_features(&this_ptr_conv);
57895         int64_t ret_ref = 0;
57896         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57897         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57898         return ret_ref;
57899 }
57900
57901 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
57902         LDKUnsignedChannelAnnouncement this_ptr_conv;
57903         this_ptr_conv.inner = untag_ptr(this_ptr);
57904         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57905         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57906         this_ptr_conv.is_owned = false;
57907         LDKChannelFeatures val_conv;
57908         val_conv.inner = untag_ptr(val);
57909         val_conv.is_owned = ptr_is_owned(val);
57910         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
57911         val_conv = ChannelFeatures_clone(&val_conv);
57912         UnsignedChannelAnnouncement_set_features(&this_ptr_conv, val_conv);
57913 }
57914
57915 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
57916         LDKUnsignedChannelAnnouncement this_ptr_conv;
57917         this_ptr_conv.inner = untag_ptr(this_ptr);
57918         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57919         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57920         this_ptr_conv.is_owned = false;
57921         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
57922         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UnsignedChannelAnnouncement_get_chain_hash(&this_ptr_conv));
57923         return ret_arr;
57924 }
57925
57926 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
57927         LDKUnsignedChannelAnnouncement this_ptr_conv;
57928         this_ptr_conv.inner = untag_ptr(this_ptr);
57929         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57930         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57931         this_ptr_conv.is_owned = false;
57932         LDKThirtyTwoBytes val_ref;
57933         CHECK((*env)->GetArrayLength(env, val) == 32);
57934         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
57935         UnsignedChannelAnnouncement_set_chain_hash(&this_ptr_conv, val_ref);
57936 }
57937
57938 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
57939         LDKUnsignedChannelAnnouncement this_ptr_conv;
57940         this_ptr_conv.inner = untag_ptr(this_ptr);
57941         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57942         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57943         this_ptr_conv.is_owned = false;
57944         int64_t ret_conv = UnsignedChannelAnnouncement_get_short_channel_id(&this_ptr_conv);
57945         return ret_conv;
57946 }
57947
57948 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
57949         LDKUnsignedChannelAnnouncement this_ptr_conv;
57950         this_ptr_conv.inner = untag_ptr(this_ptr);
57951         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57952         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57953         this_ptr_conv.is_owned = false;
57954         UnsignedChannelAnnouncement_set_short_channel_id(&this_ptr_conv, val);
57955 }
57956
57957 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1node_1id_11(JNIEnv *env, jclass clz, int64_t this_ptr) {
57958         LDKUnsignedChannelAnnouncement this_ptr_conv;
57959         this_ptr_conv.inner = untag_ptr(this_ptr);
57960         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57961         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57962         this_ptr_conv.is_owned = false;
57963         LDKNodeId ret_var = UnsignedChannelAnnouncement_get_node_id_1(&this_ptr_conv);
57964         int64_t ret_ref = 0;
57965         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57966         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57967         return ret_ref;
57968 }
57969
57970 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1node_1id_11(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
57971         LDKUnsignedChannelAnnouncement this_ptr_conv;
57972         this_ptr_conv.inner = untag_ptr(this_ptr);
57973         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57974         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57975         this_ptr_conv.is_owned = false;
57976         LDKNodeId val_conv;
57977         val_conv.inner = untag_ptr(val);
57978         val_conv.is_owned = ptr_is_owned(val);
57979         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
57980         val_conv = NodeId_clone(&val_conv);
57981         UnsignedChannelAnnouncement_set_node_id_1(&this_ptr_conv, val_conv);
57982 }
57983
57984 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1node_1id_12(JNIEnv *env, jclass clz, int64_t this_ptr) {
57985         LDKUnsignedChannelAnnouncement this_ptr_conv;
57986         this_ptr_conv.inner = untag_ptr(this_ptr);
57987         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
57988         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
57989         this_ptr_conv.is_owned = false;
57990         LDKNodeId ret_var = UnsignedChannelAnnouncement_get_node_id_2(&this_ptr_conv);
57991         int64_t ret_ref = 0;
57992         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
57993         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
57994         return ret_ref;
57995 }
57996
57997 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1node_1id_12(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
57998         LDKUnsignedChannelAnnouncement this_ptr_conv;
57999         this_ptr_conv.inner = untag_ptr(this_ptr);
58000         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58001         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58002         this_ptr_conv.is_owned = false;
58003         LDKNodeId val_conv;
58004         val_conv.inner = untag_ptr(val);
58005         val_conv.is_owned = ptr_is_owned(val);
58006         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
58007         val_conv = NodeId_clone(&val_conv);
58008         UnsignedChannelAnnouncement_set_node_id_2(&this_ptr_conv, val_conv);
58009 }
58010
58011 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1bitcoin_1key_11(JNIEnv *env, jclass clz, int64_t this_ptr) {
58012         LDKUnsignedChannelAnnouncement this_ptr_conv;
58013         this_ptr_conv.inner = untag_ptr(this_ptr);
58014         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58015         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58016         this_ptr_conv.is_owned = false;
58017         LDKNodeId ret_var = UnsignedChannelAnnouncement_get_bitcoin_key_1(&this_ptr_conv);
58018         int64_t ret_ref = 0;
58019         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58020         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58021         return ret_ref;
58022 }
58023
58024 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1bitcoin_1key_11(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
58025         LDKUnsignedChannelAnnouncement this_ptr_conv;
58026         this_ptr_conv.inner = untag_ptr(this_ptr);
58027         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58028         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58029         this_ptr_conv.is_owned = false;
58030         LDKNodeId val_conv;
58031         val_conv.inner = untag_ptr(val);
58032         val_conv.is_owned = ptr_is_owned(val);
58033         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
58034         val_conv = NodeId_clone(&val_conv);
58035         UnsignedChannelAnnouncement_set_bitcoin_key_1(&this_ptr_conv, val_conv);
58036 }
58037
58038 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1bitcoin_1key_12(JNIEnv *env, jclass clz, int64_t this_ptr) {
58039         LDKUnsignedChannelAnnouncement this_ptr_conv;
58040         this_ptr_conv.inner = untag_ptr(this_ptr);
58041         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58042         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58043         this_ptr_conv.is_owned = false;
58044         LDKNodeId ret_var = UnsignedChannelAnnouncement_get_bitcoin_key_2(&this_ptr_conv);
58045         int64_t ret_ref = 0;
58046         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58047         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58048         return ret_ref;
58049 }
58050
58051 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1bitcoin_1key_12(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
58052         LDKUnsignedChannelAnnouncement this_ptr_conv;
58053         this_ptr_conv.inner = untag_ptr(this_ptr);
58054         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58055         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58056         this_ptr_conv.is_owned = false;
58057         LDKNodeId val_conv;
58058         val_conv.inner = untag_ptr(val);
58059         val_conv.is_owned = ptr_is_owned(val);
58060         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
58061         val_conv = NodeId_clone(&val_conv);
58062         UnsignedChannelAnnouncement_set_bitcoin_key_2(&this_ptr_conv, val_conv);
58063 }
58064
58065 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1excess_1data(JNIEnv *env, jclass clz, int64_t this_ptr) {
58066         LDKUnsignedChannelAnnouncement this_ptr_conv;
58067         this_ptr_conv.inner = untag_ptr(this_ptr);
58068         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58069         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58070         this_ptr_conv.is_owned = false;
58071         LDKCVec_u8Z ret_var = UnsignedChannelAnnouncement_get_excess_data(&this_ptr_conv);
58072         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
58073         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
58074         CVec_u8Z_free(ret_var);
58075         return ret_arr;
58076 }
58077
58078 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1excess_1data(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
58079         LDKUnsignedChannelAnnouncement this_ptr_conv;
58080         this_ptr_conv.inner = untag_ptr(this_ptr);
58081         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58082         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58083         this_ptr_conv.is_owned = false;
58084         LDKCVec_u8Z val_ref;
58085         val_ref.datalen = (*env)->GetArrayLength(env, val);
58086         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
58087         (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
58088         UnsignedChannelAnnouncement_set_excess_data(&this_ptr_conv, val_ref);
58089 }
58090
58091 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) {
58092         LDKChannelFeatures features_arg_conv;
58093         features_arg_conv.inner = untag_ptr(features_arg);
58094         features_arg_conv.is_owned = ptr_is_owned(features_arg);
58095         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
58096         features_arg_conv = ChannelFeatures_clone(&features_arg_conv);
58097         LDKThirtyTwoBytes chain_hash_arg_ref;
58098         CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
58099         (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
58100         LDKNodeId node_id_1_arg_conv;
58101         node_id_1_arg_conv.inner = untag_ptr(node_id_1_arg);
58102         node_id_1_arg_conv.is_owned = ptr_is_owned(node_id_1_arg);
58103         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_1_arg_conv);
58104         node_id_1_arg_conv = NodeId_clone(&node_id_1_arg_conv);
58105         LDKNodeId node_id_2_arg_conv;
58106         node_id_2_arg_conv.inner = untag_ptr(node_id_2_arg);
58107         node_id_2_arg_conv.is_owned = ptr_is_owned(node_id_2_arg);
58108         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_2_arg_conv);
58109         node_id_2_arg_conv = NodeId_clone(&node_id_2_arg_conv);
58110         LDKNodeId bitcoin_key_1_arg_conv;
58111         bitcoin_key_1_arg_conv.inner = untag_ptr(bitcoin_key_1_arg);
58112         bitcoin_key_1_arg_conv.is_owned = ptr_is_owned(bitcoin_key_1_arg);
58113         CHECK_INNER_FIELD_ACCESS_OR_NULL(bitcoin_key_1_arg_conv);
58114         bitcoin_key_1_arg_conv = NodeId_clone(&bitcoin_key_1_arg_conv);
58115         LDKNodeId bitcoin_key_2_arg_conv;
58116         bitcoin_key_2_arg_conv.inner = untag_ptr(bitcoin_key_2_arg);
58117         bitcoin_key_2_arg_conv.is_owned = ptr_is_owned(bitcoin_key_2_arg);
58118         CHECK_INNER_FIELD_ACCESS_OR_NULL(bitcoin_key_2_arg_conv);
58119         bitcoin_key_2_arg_conv = NodeId_clone(&bitcoin_key_2_arg_conv);
58120         LDKCVec_u8Z excess_data_arg_ref;
58121         excess_data_arg_ref.datalen = (*env)->GetArrayLength(env, excess_data_arg);
58122         excess_data_arg_ref.data = MALLOC(excess_data_arg_ref.datalen, "LDKCVec_u8Z Bytes");
58123         (*env)->GetByteArrayRegion(env, excess_data_arg, 0, excess_data_arg_ref.datalen, excess_data_arg_ref.data);
58124         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);
58125         int64_t ret_ref = 0;
58126         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58127         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58128         return ret_ref;
58129 }
58130
58131 static inline uint64_t UnsignedChannelAnnouncement_clone_ptr(LDKUnsignedChannelAnnouncement *NONNULL_PTR arg) {
58132         LDKUnsignedChannelAnnouncement ret_var = UnsignedChannelAnnouncement_clone(arg);
58133         int64_t ret_ref = 0;
58134         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58135         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58136         return ret_ref;
58137 }
58138 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
58139         LDKUnsignedChannelAnnouncement arg_conv;
58140         arg_conv.inner = untag_ptr(arg);
58141         arg_conv.is_owned = ptr_is_owned(arg);
58142         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
58143         arg_conv.is_owned = false;
58144         int64_t ret_conv = UnsignedChannelAnnouncement_clone_ptr(&arg_conv);
58145         return ret_conv;
58146 }
58147
58148 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1clone(JNIEnv *env, jclass clz, int64_t orig) {
58149         LDKUnsignedChannelAnnouncement orig_conv;
58150         orig_conv.inner = untag_ptr(orig);
58151         orig_conv.is_owned = ptr_is_owned(orig);
58152         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
58153         orig_conv.is_owned = false;
58154         LDKUnsignedChannelAnnouncement ret_var = UnsignedChannelAnnouncement_clone(&orig_conv);
58155         int64_t ret_ref = 0;
58156         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58157         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58158         return ret_ref;
58159 }
58160
58161 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1hash(JNIEnv *env, jclass clz, int64_t o) {
58162         LDKUnsignedChannelAnnouncement o_conv;
58163         o_conv.inner = untag_ptr(o);
58164         o_conv.is_owned = ptr_is_owned(o);
58165         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
58166         o_conv.is_owned = false;
58167         int64_t ret_conv = UnsignedChannelAnnouncement_hash(&o_conv);
58168         return ret_conv;
58169 }
58170
58171 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
58172         LDKUnsignedChannelAnnouncement a_conv;
58173         a_conv.inner = untag_ptr(a);
58174         a_conv.is_owned = ptr_is_owned(a);
58175         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
58176         a_conv.is_owned = false;
58177         LDKUnsignedChannelAnnouncement b_conv;
58178         b_conv.inner = untag_ptr(b);
58179         b_conv.is_owned = ptr_is_owned(b);
58180         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
58181         b_conv.is_owned = false;
58182         jboolean ret_conv = UnsignedChannelAnnouncement_eq(&a_conv, &b_conv);
58183         return ret_conv;
58184 }
58185
58186 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
58187         LDKChannelAnnouncement this_obj_conv;
58188         this_obj_conv.inner = untag_ptr(this_obj);
58189         this_obj_conv.is_owned = ptr_is_owned(this_obj);
58190         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
58191         ChannelAnnouncement_free(this_obj_conv);
58192 }
58193
58194 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1node_1signature_11(JNIEnv *env, jclass clz, int64_t this_ptr) {
58195         LDKChannelAnnouncement this_ptr_conv;
58196         this_ptr_conv.inner = untag_ptr(this_ptr);
58197         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58198         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58199         this_ptr_conv.is_owned = false;
58200         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
58201         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ChannelAnnouncement_get_node_signature_1(&this_ptr_conv).compact_form);
58202         return ret_arr;
58203 }
58204
58205 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1node_1signature_11(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
58206         LDKChannelAnnouncement this_ptr_conv;
58207         this_ptr_conv.inner = untag_ptr(this_ptr);
58208         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58209         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58210         this_ptr_conv.is_owned = false;
58211         LDKECDSASignature val_ref;
58212         CHECK((*env)->GetArrayLength(env, val) == 64);
58213         (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
58214         ChannelAnnouncement_set_node_signature_1(&this_ptr_conv, val_ref);
58215 }
58216
58217 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1node_1signature_12(JNIEnv *env, jclass clz, int64_t this_ptr) {
58218         LDKChannelAnnouncement this_ptr_conv;
58219         this_ptr_conv.inner = untag_ptr(this_ptr);
58220         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58221         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58222         this_ptr_conv.is_owned = false;
58223         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
58224         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ChannelAnnouncement_get_node_signature_2(&this_ptr_conv).compact_form);
58225         return ret_arr;
58226 }
58227
58228 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1node_1signature_12(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
58229         LDKChannelAnnouncement this_ptr_conv;
58230         this_ptr_conv.inner = untag_ptr(this_ptr);
58231         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58232         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58233         this_ptr_conv.is_owned = false;
58234         LDKECDSASignature val_ref;
58235         CHECK((*env)->GetArrayLength(env, val) == 64);
58236         (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
58237         ChannelAnnouncement_set_node_signature_2(&this_ptr_conv, val_ref);
58238 }
58239
58240 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1bitcoin_1signature_11(JNIEnv *env, jclass clz, int64_t this_ptr) {
58241         LDKChannelAnnouncement this_ptr_conv;
58242         this_ptr_conv.inner = untag_ptr(this_ptr);
58243         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58244         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58245         this_ptr_conv.is_owned = false;
58246         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
58247         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ChannelAnnouncement_get_bitcoin_signature_1(&this_ptr_conv).compact_form);
58248         return ret_arr;
58249 }
58250
58251 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1bitcoin_1signature_11(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
58252         LDKChannelAnnouncement this_ptr_conv;
58253         this_ptr_conv.inner = untag_ptr(this_ptr);
58254         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58255         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58256         this_ptr_conv.is_owned = false;
58257         LDKECDSASignature val_ref;
58258         CHECK((*env)->GetArrayLength(env, val) == 64);
58259         (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
58260         ChannelAnnouncement_set_bitcoin_signature_1(&this_ptr_conv, val_ref);
58261 }
58262
58263 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1bitcoin_1signature_12(JNIEnv *env, jclass clz, int64_t this_ptr) {
58264         LDKChannelAnnouncement this_ptr_conv;
58265         this_ptr_conv.inner = untag_ptr(this_ptr);
58266         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58267         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58268         this_ptr_conv.is_owned = false;
58269         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
58270         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ChannelAnnouncement_get_bitcoin_signature_2(&this_ptr_conv).compact_form);
58271         return ret_arr;
58272 }
58273
58274 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1bitcoin_1signature_12(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
58275         LDKChannelAnnouncement this_ptr_conv;
58276         this_ptr_conv.inner = untag_ptr(this_ptr);
58277         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58278         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58279         this_ptr_conv.is_owned = false;
58280         LDKECDSASignature val_ref;
58281         CHECK((*env)->GetArrayLength(env, val) == 64);
58282         (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
58283         ChannelAnnouncement_set_bitcoin_signature_2(&this_ptr_conv, val_ref);
58284 }
58285
58286 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1contents(JNIEnv *env, jclass clz, int64_t this_ptr) {
58287         LDKChannelAnnouncement this_ptr_conv;
58288         this_ptr_conv.inner = untag_ptr(this_ptr);
58289         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58290         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58291         this_ptr_conv.is_owned = false;
58292         LDKUnsignedChannelAnnouncement ret_var = ChannelAnnouncement_get_contents(&this_ptr_conv);
58293         int64_t ret_ref = 0;
58294         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58295         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58296         return ret_ref;
58297 }
58298
58299 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1contents(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
58300         LDKChannelAnnouncement this_ptr_conv;
58301         this_ptr_conv.inner = untag_ptr(this_ptr);
58302         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58303         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58304         this_ptr_conv.is_owned = false;
58305         LDKUnsignedChannelAnnouncement val_conv;
58306         val_conv.inner = untag_ptr(val);
58307         val_conv.is_owned = ptr_is_owned(val);
58308         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
58309         val_conv = UnsignedChannelAnnouncement_clone(&val_conv);
58310         ChannelAnnouncement_set_contents(&this_ptr_conv, val_conv);
58311 }
58312
58313 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) {
58314         LDKECDSASignature node_signature_1_arg_ref;
58315         CHECK((*env)->GetArrayLength(env, node_signature_1_arg) == 64);
58316         (*env)->GetByteArrayRegion(env, node_signature_1_arg, 0, 64, node_signature_1_arg_ref.compact_form);
58317         LDKECDSASignature node_signature_2_arg_ref;
58318         CHECK((*env)->GetArrayLength(env, node_signature_2_arg) == 64);
58319         (*env)->GetByteArrayRegion(env, node_signature_2_arg, 0, 64, node_signature_2_arg_ref.compact_form);
58320         LDKECDSASignature bitcoin_signature_1_arg_ref;
58321         CHECK((*env)->GetArrayLength(env, bitcoin_signature_1_arg) == 64);
58322         (*env)->GetByteArrayRegion(env, bitcoin_signature_1_arg, 0, 64, bitcoin_signature_1_arg_ref.compact_form);
58323         LDKECDSASignature bitcoin_signature_2_arg_ref;
58324         CHECK((*env)->GetArrayLength(env, bitcoin_signature_2_arg) == 64);
58325         (*env)->GetByteArrayRegion(env, bitcoin_signature_2_arg, 0, 64, bitcoin_signature_2_arg_ref.compact_form);
58326         LDKUnsignedChannelAnnouncement contents_arg_conv;
58327         contents_arg_conv.inner = untag_ptr(contents_arg);
58328         contents_arg_conv.is_owned = ptr_is_owned(contents_arg);
58329         CHECK_INNER_FIELD_ACCESS_OR_NULL(contents_arg_conv);
58330         contents_arg_conv = UnsignedChannelAnnouncement_clone(&contents_arg_conv);
58331         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);
58332         int64_t ret_ref = 0;
58333         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58334         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58335         return ret_ref;
58336 }
58337
58338 static inline uint64_t ChannelAnnouncement_clone_ptr(LDKChannelAnnouncement *NONNULL_PTR arg) {
58339         LDKChannelAnnouncement ret_var = ChannelAnnouncement_clone(arg);
58340         int64_t ret_ref = 0;
58341         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58342         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58343         return ret_ref;
58344 }
58345 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
58346         LDKChannelAnnouncement arg_conv;
58347         arg_conv.inner = untag_ptr(arg);
58348         arg_conv.is_owned = ptr_is_owned(arg);
58349         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
58350         arg_conv.is_owned = false;
58351         int64_t ret_conv = ChannelAnnouncement_clone_ptr(&arg_conv);
58352         return ret_conv;
58353 }
58354
58355 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1clone(JNIEnv *env, jclass clz, int64_t orig) {
58356         LDKChannelAnnouncement orig_conv;
58357         orig_conv.inner = untag_ptr(orig);
58358         orig_conv.is_owned = ptr_is_owned(orig);
58359         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
58360         orig_conv.is_owned = false;
58361         LDKChannelAnnouncement ret_var = ChannelAnnouncement_clone(&orig_conv);
58362         int64_t ret_ref = 0;
58363         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58364         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58365         return ret_ref;
58366 }
58367
58368 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1hash(JNIEnv *env, jclass clz, int64_t o) {
58369         LDKChannelAnnouncement o_conv;
58370         o_conv.inner = untag_ptr(o);
58371         o_conv.is_owned = ptr_is_owned(o);
58372         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
58373         o_conv.is_owned = false;
58374         int64_t ret_conv = ChannelAnnouncement_hash(&o_conv);
58375         return ret_conv;
58376 }
58377
58378 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
58379         LDKChannelAnnouncement a_conv;
58380         a_conv.inner = untag_ptr(a);
58381         a_conv.is_owned = ptr_is_owned(a);
58382         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
58383         a_conv.is_owned = false;
58384         LDKChannelAnnouncement b_conv;
58385         b_conv.inner = untag_ptr(b);
58386         b_conv.is_owned = ptr_is_owned(b);
58387         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
58388         b_conv.is_owned = false;
58389         jboolean ret_conv = ChannelAnnouncement_eq(&a_conv, &b_conv);
58390         return ret_conv;
58391 }
58392
58393 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
58394         LDKUnsignedChannelUpdate this_obj_conv;
58395         this_obj_conv.inner = untag_ptr(this_obj);
58396         this_obj_conv.is_owned = ptr_is_owned(this_obj);
58397         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
58398         UnsignedChannelUpdate_free(this_obj_conv);
58399 }
58400
58401 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
58402         LDKUnsignedChannelUpdate this_ptr_conv;
58403         this_ptr_conv.inner = untag_ptr(this_ptr);
58404         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58405         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58406         this_ptr_conv.is_owned = false;
58407         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
58408         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UnsignedChannelUpdate_get_chain_hash(&this_ptr_conv));
58409         return ret_arr;
58410 }
58411
58412 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
58413         LDKUnsignedChannelUpdate this_ptr_conv;
58414         this_ptr_conv.inner = untag_ptr(this_ptr);
58415         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58416         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58417         this_ptr_conv.is_owned = false;
58418         LDKThirtyTwoBytes val_ref;
58419         CHECK((*env)->GetArrayLength(env, val) == 32);
58420         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
58421         UnsignedChannelUpdate_set_chain_hash(&this_ptr_conv, val_ref);
58422 }
58423
58424 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
58425         LDKUnsignedChannelUpdate this_ptr_conv;
58426         this_ptr_conv.inner = untag_ptr(this_ptr);
58427         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58428         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58429         this_ptr_conv.is_owned = false;
58430         int64_t ret_conv = UnsignedChannelUpdate_get_short_channel_id(&this_ptr_conv);
58431         return ret_conv;
58432 }
58433
58434 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
58435         LDKUnsignedChannelUpdate this_ptr_conv;
58436         this_ptr_conv.inner = untag_ptr(this_ptr);
58437         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58438         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58439         this_ptr_conv.is_owned = false;
58440         UnsignedChannelUpdate_set_short_channel_id(&this_ptr_conv, val);
58441 }
58442
58443 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr) {
58444         LDKUnsignedChannelUpdate this_ptr_conv;
58445         this_ptr_conv.inner = untag_ptr(this_ptr);
58446         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58447         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58448         this_ptr_conv.is_owned = false;
58449         int32_t ret_conv = UnsignedChannelUpdate_get_timestamp(&this_ptr_conv);
58450         return ret_conv;
58451 }
58452
58453 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
58454         LDKUnsignedChannelUpdate this_ptr_conv;
58455         this_ptr_conv.inner = untag_ptr(this_ptr);
58456         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58457         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58458         this_ptr_conv.is_owned = false;
58459         UnsignedChannelUpdate_set_timestamp(&this_ptr_conv, val);
58460 }
58461
58462 JNIEXPORT int8_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1flags(JNIEnv *env, jclass clz, int64_t this_ptr) {
58463         LDKUnsignedChannelUpdate this_ptr_conv;
58464         this_ptr_conv.inner = untag_ptr(this_ptr);
58465         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58466         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58467         this_ptr_conv.is_owned = false;
58468         int8_t ret_conv = UnsignedChannelUpdate_get_flags(&this_ptr_conv);
58469         return ret_conv;
58470 }
58471
58472 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1flags(JNIEnv *env, jclass clz, int64_t this_ptr, int8_t val) {
58473         LDKUnsignedChannelUpdate this_ptr_conv;
58474         this_ptr_conv.inner = untag_ptr(this_ptr);
58475         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58476         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58477         this_ptr_conv.is_owned = false;
58478         UnsignedChannelUpdate_set_flags(&this_ptr_conv, val);
58479 }
58480
58481 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
58482         LDKUnsignedChannelUpdate this_ptr_conv;
58483         this_ptr_conv.inner = untag_ptr(this_ptr);
58484         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58485         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58486         this_ptr_conv.is_owned = false;
58487         int16_t ret_conv = UnsignedChannelUpdate_get_cltv_expiry_delta(&this_ptr_conv);
58488         return ret_conv;
58489 }
58490
58491 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
58492         LDKUnsignedChannelUpdate this_ptr_conv;
58493         this_ptr_conv.inner = untag_ptr(this_ptr);
58494         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58495         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58496         this_ptr_conv.is_owned = false;
58497         UnsignedChannelUpdate_set_cltv_expiry_delta(&this_ptr_conv, val);
58498 }
58499
58500 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
58501         LDKUnsignedChannelUpdate this_ptr_conv;
58502         this_ptr_conv.inner = untag_ptr(this_ptr);
58503         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58504         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58505         this_ptr_conv.is_owned = false;
58506         int64_t ret_conv = UnsignedChannelUpdate_get_htlc_minimum_msat(&this_ptr_conv);
58507         return ret_conv;
58508 }
58509
58510 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
58511         LDKUnsignedChannelUpdate this_ptr_conv;
58512         this_ptr_conv.inner = untag_ptr(this_ptr);
58513         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58514         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58515         this_ptr_conv.is_owned = false;
58516         UnsignedChannelUpdate_set_htlc_minimum_msat(&this_ptr_conv, val);
58517 }
58518
58519 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
58520         LDKUnsignedChannelUpdate this_ptr_conv;
58521         this_ptr_conv.inner = untag_ptr(this_ptr);
58522         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58523         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58524         this_ptr_conv.is_owned = false;
58525         int64_t ret_conv = UnsignedChannelUpdate_get_htlc_maximum_msat(&this_ptr_conv);
58526         return ret_conv;
58527 }
58528
58529 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
58530         LDKUnsignedChannelUpdate this_ptr_conv;
58531         this_ptr_conv.inner = untag_ptr(this_ptr);
58532         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58533         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58534         this_ptr_conv.is_owned = false;
58535         UnsignedChannelUpdate_set_htlc_maximum_msat(&this_ptr_conv, val);
58536 }
58537
58538 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
58539         LDKUnsignedChannelUpdate this_ptr_conv;
58540         this_ptr_conv.inner = untag_ptr(this_ptr);
58541         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58542         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58543         this_ptr_conv.is_owned = false;
58544         int32_t ret_conv = UnsignedChannelUpdate_get_fee_base_msat(&this_ptr_conv);
58545         return ret_conv;
58546 }
58547
58548 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
58549         LDKUnsignedChannelUpdate this_ptr_conv;
58550         this_ptr_conv.inner = untag_ptr(this_ptr);
58551         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58552         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58553         this_ptr_conv.is_owned = false;
58554         UnsignedChannelUpdate_set_fee_base_msat(&this_ptr_conv, val);
58555 }
58556
58557 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr) {
58558         LDKUnsignedChannelUpdate this_ptr_conv;
58559         this_ptr_conv.inner = untag_ptr(this_ptr);
58560         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58561         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58562         this_ptr_conv.is_owned = false;
58563         int32_t ret_conv = UnsignedChannelUpdate_get_fee_proportional_millionths(&this_ptr_conv);
58564         return ret_conv;
58565 }
58566
58567 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
58568         LDKUnsignedChannelUpdate this_ptr_conv;
58569         this_ptr_conv.inner = untag_ptr(this_ptr);
58570         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58571         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58572         this_ptr_conv.is_owned = false;
58573         UnsignedChannelUpdate_set_fee_proportional_millionths(&this_ptr_conv, val);
58574 }
58575
58576 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1excess_1data(JNIEnv *env, jclass clz, int64_t this_ptr) {
58577         LDKUnsignedChannelUpdate this_ptr_conv;
58578         this_ptr_conv.inner = untag_ptr(this_ptr);
58579         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58580         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58581         this_ptr_conv.is_owned = false;
58582         LDKCVec_u8Z ret_var = UnsignedChannelUpdate_get_excess_data(&this_ptr_conv);
58583         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
58584         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
58585         CVec_u8Z_free(ret_var);
58586         return ret_arr;
58587 }
58588
58589 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1excess_1data(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
58590         LDKUnsignedChannelUpdate 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         LDKCVec_u8Z val_ref;
58596         val_ref.datalen = (*env)->GetArrayLength(env, val);
58597         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
58598         (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
58599         UnsignedChannelUpdate_set_excess_data(&this_ptr_conv, val_ref);
58600 }
58601
58602 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) {
58603         LDKThirtyTwoBytes chain_hash_arg_ref;
58604         CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
58605         (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
58606         LDKCVec_u8Z excess_data_arg_ref;
58607         excess_data_arg_ref.datalen = (*env)->GetArrayLength(env, excess_data_arg);
58608         excess_data_arg_ref.data = MALLOC(excess_data_arg_ref.datalen, "LDKCVec_u8Z Bytes");
58609         (*env)->GetByteArrayRegion(env, excess_data_arg, 0, excess_data_arg_ref.datalen, excess_data_arg_ref.data);
58610         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);
58611         int64_t ret_ref = 0;
58612         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58613         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58614         return ret_ref;
58615 }
58616
58617 static inline uint64_t UnsignedChannelUpdate_clone_ptr(LDKUnsignedChannelUpdate *NONNULL_PTR arg) {
58618         LDKUnsignedChannelUpdate ret_var = UnsignedChannelUpdate_clone(arg);
58619         int64_t ret_ref = 0;
58620         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58621         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58622         return ret_ref;
58623 }
58624 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
58625         LDKUnsignedChannelUpdate arg_conv;
58626         arg_conv.inner = untag_ptr(arg);
58627         arg_conv.is_owned = ptr_is_owned(arg);
58628         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
58629         arg_conv.is_owned = false;
58630         int64_t ret_conv = UnsignedChannelUpdate_clone_ptr(&arg_conv);
58631         return ret_conv;
58632 }
58633
58634 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
58635         LDKUnsignedChannelUpdate orig_conv;
58636         orig_conv.inner = untag_ptr(orig);
58637         orig_conv.is_owned = ptr_is_owned(orig);
58638         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
58639         orig_conv.is_owned = false;
58640         LDKUnsignedChannelUpdate ret_var = UnsignedChannelUpdate_clone(&orig_conv);
58641         int64_t ret_ref = 0;
58642         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58643         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58644         return ret_ref;
58645 }
58646
58647 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1hash(JNIEnv *env, jclass clz, int64_t o) {
58648         LDKUnsignedChannelUpdate o_conv;
58649         o_conv.inner = untag_ptr(o);
58650         o_conv.is_owned = ptr_is_owned(o);
58651         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
58652         o_conv.is_owned = false;
58653         int64_t ret_conv = UnsignedChannelUpdate_hash(&o_conv);
58654         return ret_conv;
58655 }
58656
58657 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
58658         LDKUnsignedChannelUpdate a_conv;
58659         a_conv.inner = untag_ptr(a);
58660         a_conv.is_owned = ptr_is_owned(a);
58661         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
58662         a_conv.is_owned = false;
58663         LDKUnsignedChannelUpdate b_conv;
58664         b_conv.inner = untag_ptr(b);
58665         b_conv.is_owned = ptr_is_owned(b);
58666         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
58667         b_conv.is_owned = false;
58668         jboolean ret_conv = UnsignedChannelUpdate_eq(&a_conv, &b_conv);
58669         return ret_conv;
58670 }
58671
58672 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
58673         LDKChannelUpdate this_obj_conv;
58674         this_obj_conv.inner = untag_ptr(this_obj);
58675         this_obj_conv.is_owned = ptr_is_owned(this_obj);
58676         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
58677         ChannelUpdate_free(this_obj_conv);
58678 }
58679
58680 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
58681         LDKChannelUpdate this_ptr_conv;
58682         this_ptr_conv.inner = untag_ptr(this_ptr);
58683         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58684         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58685         this_ptr_conv.is_owned = false;
58686         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
58687         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ChannelUpdate_get_signature(&this_ptr_conv).compact_form);
58688         return ret_arr;
58689 }
58690
58691 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
58692         LDKChannelUpdate this_ptr_conv;
58693         this_ptr_conv.inner = untag_ptr(this_ptr);
58694         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58695         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58696         this_ptr_conv.is_owned = false;
58697         LDKECDSASignature val_ref;
58698         CHECK((*env)->GetArrayLength(env, val) == 64);
58699         (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
58700         ChannelUpdate_set_signature(&this_ptr_conv, val_ref);
58701 }
58702
58703 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1get_1contents(JNIEnv *env, jclass clz, int64_t this_ptr) {
58704         LDKChannelUpdate this_ptr_conv;
58705         this_ptr_conv.inner = untag_ptr(this_ptr);
58706         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58707         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58708         this_ptr_conv.is_owned = false;
58709         LDKUnsignedChannelUpdate ret_var = ChannelUpdate_get_contents(&this_ptr_conv);
58710         int64_t ret_ref = 0;
58711         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58712         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58713         return ret_ref;
58714 }
58715
58716 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1set_1contents(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
58717         LDKChannelUpdate this_ptr_conv;
58718         this_ptr_conv.inner = untag_ptr(this_ptr);
58719         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58720         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58721         this_ptr_conv.is_owned = false;
58722         LDKUnsignedChannelUpdate val_conv;
58723         val_conv.inner = untag_ptr(val);
58724         val_conv.is_owned = ptr_is_owned(val);
58725         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
58726         val_conv = UnsignedChannelUpdate_clone(&val_conv);
58727         ChannelUpdate_set_contents(&this_ptr_conv, val_conv);
58728 }
58729
58730 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1new(JNIEnv *env, jclass clz, int8_tArray signature_arg, int64_t contents_arg) {
58731         LDKECDSASignature signature_arg_ref;
58732         CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
58733         (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
58734         LDKUnsignedChannelUpdate contents_arg_conv;
58735         contents_arg_conv.inner = untag_ptr(contents_arg);
58736         contents_arg_conv.is_owned = ptr_is_owned(contents_arg);
58737         CHECK_INNER_FIELD_ACCESS_OR_NULL(contents_arg_conv);
58738         contents_arg_conv = UnsignedChannelUpdate_clone(&contents_arg_conv);
58739         LDKChannelUpdate ret_var = ChannelUpdate_new(signature_arg_ref, contents_arg_conv);
58740         int64_t ret_ref = 0;
58741         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58742         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58743         return ret_ref;
58744 }
58745
58746 static inline uint64_t ChannelUpdate_clone_ptr(LDKChannelUpdate *NONNULL_PTR arg) {
58747         LDKChannelUpdate ret_var = ChannelUpdate_clone(arg);
58748         int64_t ret_ref = 0;
58749         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58750         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58751         return ret_ref;
58752 }
58753 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
58754         LDKChannelUpdate arg_conv;
58755         arg_conv.inner = untag_ptr(arg);
58756         arg_conv.is_owned = ptr_is_owned(arg);
58757         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
58758         arg_conv.is_owned = false;
58759         int64_t ret_conv = ChannelUpdate_clone_ptr(&arg_conv);
58760         return ret_conv;
58761 }
58762
58763 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
58764         LDKChannelUpdate orig_conv;
58765         orig_conv.inner = untag_ptr(orig);
58766         orig_conv.is_owned = ptr_is_owned(orig);
58767         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
58768         orig_conv.is_owned = false;
58769         LDKChannelUpdate ret_var = ChannelUpdate_clone(&orig_conv);
58770         int64_t ret_ref = 0;
58771         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58772         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58773         return ret_ref;
58774 }
58775
58776 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1hash(JNIEnv *env, jclass clz, int64_t o) {
58777         LDKChannelUpdate o_conv;
58778         o_conv.inner = untag_ptr(o);
58779         o_conv.is_owned = ptr_is_owned(o);
58780         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
58781         o_conv.is_owned = false;
58782         int64_t ret_conv = ChannelUpdate_hash(&o_conv);
58783         return ret_conv;
58784 }
58785
58786 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
58787         LDKChannelUpdate a_conv;
58788         a_conv.inner = untag_ptr(a);
58789         a_conv.is_owned = ptr_is_owned(a);
58790         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
58791         a_conv.is_owned = false;
58792         LDKChannelUpdate b_conv;
58793         b_conv.inner = untag_ptr(b);
58794         b_conv.is_owned = ptr_is_owned(b);
58795         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
58796         b_conv.is_owned = false;
58797         jboolean ret_conv = ChannelUpdate_eq(&a_conv, &b_conv);
58798         return ret_conv;
58799 }
58800
58801 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
58802         LDKQueryChannelRange this_obj_conv;
58803         this_obj_conv.inner = untag_ptr(this_obj);
58804         this_obj_conv.is_owned = ptr_is_owned(this_obj);
58805         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
58806         QueryChannelRange_free(this_obj_conv);
58807 }
58808
58809 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
58810         LDKQueryChannelRange this_ptr_conv;
58811         this_ptr_conv.inner = untag_ptr(this_ptr);
58812         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58813         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58814         this_ptr_conv.is_owned = false;
58815         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
58816         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *QueryChannelRange_get_chain_hash(&this_ptr_conv));
58817         return ret_arr;
58818 }
58819
58820 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
58821         LDKQueryChannelRange this_ptr_conv;
58822         this_ptr_conv.inner = untag_ptr(this_ptr);
58823         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58824         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58825         this_ptr_conv.is_owned = false;
58826         LDKThirtyTwoBytes val_ref;
58827         CHECK((*env)->GetArrayLength(env, val) == 32);
58828         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
58829         QueryChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
58830 }
58831
58832 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1get_1first_1blocknum(JNIEnv *env, jclass clz, int64_t this_ptr) {
58833         LDKQueryChannelRange this_ptr_conv;
58834         this_ptr_conv.inner = untag_ptr(this_ptr);
58835         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58836         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58837         this_ptr_conv.is_owned = false;
58838         int32_t ret_conv = QueryChannelRange_get_first_blocknum(&this_ptr_conv);
58839         return ret_conv;
58840 }
58841
58842 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1set_1first_1blocknum(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
58843         LDKQueryChannelRange this_ptr_conv;
58844         this_ptr_conv.inner = untag_ptr(this_ptr);
58845         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58846         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58847         this_ptr_conv.is_owned = false;
58848         QueryChannelRange_set_first_blocknum(&this_ptr_conv, val);
58849 }
58850
58851 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1get_1number_1of_1blocks(JNIEnv *env, jclass clz, int64_t this_ptr) {
58852         LDKQueryChannelRange this_ptr_conv;
58853         this_ptr_conv.inner = untag_ptr(this_ptr);
58854         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58855         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58856         this_ptr_conv.is_owned = false;
58857         int32_t ret_conv = QueryChannelRange_get_number_of_blocks(&this_ptr_conv);
58858         return ret_conv;
58859 }
58860
58861 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1set_1number_1of_1blocks(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
58862         LDKQueryChannelRange this_ptr_conv;
58863         this_ptr_conv.inner = untag_ptr(this_ptr);
58864         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58865         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58866         this_ptr_conv.is_owned = false;
58867         QueryChannelRange_set_number_of_blocks(&this_ptr_conv, val);
58868 }
58869
58870 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) {
58871         LDKThirtyTwoBytes chain_hash_arg_ref;
58872         CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
58873         (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
58874         LDKQueryChannelRange ret_var = QueryChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg);
58875         int64_t ret_ref = 0;
58876         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58877         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58878         return ret_ref;
58879 }
58880
58881 static inline uint64_t QueryChannelRange_clone_ptr(LDKQueryChannelRange *NONNULL_PTR arg) {
58882         LDKQueryChannelRange ret_var = QueryChannelRange_clone(arg);
58883         int64_t ret_ref = 0;
58884         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58885         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58886         return ret_ref;
58887 }
58888 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
58889         LDKQueryChannelRange arg_conv;
58890         arg_conv.inner = untag_ptr(arg);
58891         arg_conv.is_owned = ptr_is_owned(arg);
58892         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
58893         arg_conv.is_owned = false;
58894         int64_t ret_conv = QueryChannelRange_clone_ptr(&arg_conv);
58895         return ret_conv;
58896 }
58897
58898 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1clone(JNIEnv *env, jclass clz, int64_t orig) {
58899         LDKQueryChannelRange orig_conv;
58900         orig_conv.inner = untag_ptr(orig);
58901         orig_conv.is_owned = ptr_is_owned(orig);
58902         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
58903         orig_conv.is_owned = false;
58904         LDKQueryChannelRange ret_var = QueryChannelRange_clone(&orig_conv);
58905         int64_t ret_ref = 0;
58906         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
58907         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
58908         return ret_ref;
58909 }
58910
58911 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1hash(JNIEnv *env, jclass clz, int64_t o) {
58912         LDKQueryChannelRange o_conv;
58913         o_conv.inner = untag_ptr(o);
58914         o_conv.is_owned = ptr_is_owned(o);
58915         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
58916         o_conv.is_owned = false;
58917         int64_t ret_conv = QueryChannelRange_hash(&o_conv);
58918         return ret_conv;
58919 }
58920
58921 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
58922         LDKQueryChannelRange a_conv;
58923         a_conv.inner = untag_ptr(a);
58924         a_conv.is_owned = ptr_is_owned(a);
58925         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
58926         a_conv.is_owned = false;
58927         LDKQueryChannelRange b_conv;
58928         b_conv.inner = untag_ptr(b);
58929         b_conv.is_owned = ptr_is_owned(b);
58930         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
58931         b_conv.is_owned = false;
58932         jboolean ret_conv = QueryChannelRange_eq(&a_conv, &b_conv);
58933         return ret_conv;
58934 }
58935
58936 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
58937         LDKReplyChannelRange this_obj_conv;
58938         this_obj_conv.inner = untag_ptr(this_obj);
58939         this_obj_conv.is_owned = ptr_is_owned(this_obj);
58940         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
58941         ReplyChannelRange_free(this_obj_conv);
58942 }
58943
58944 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
58945         LDKReplyChannelRange this_ptr_conv;
58946         this_ptr_conv.inner = untag_ptr(this_ptr);
58947         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58948         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58949         this_ptr_conv.is_owned = false;
58950         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
58951         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ReplyChannelRange_get_chain_hash(&this_ptr_conv));
58952         return ret_arr;
58953 }
58954
58955 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
58956         LDKReplyChannelRange this_ptr_conv;
58957         this_ptr_conv.inner = untag_ptr(this_ptr);
58958         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58959         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58960         this_ptr_conv.is_owned = false;
58961         LDKThirtyTwoBytes val_ref;
58962         CHECK((*env)->GetArrayLength(env, val) == 32);
58963         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
58964         ReplyChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
58965 }
58966
58967 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1first_1blocknum(JNIEnv *env, jclass clz, int64_t this_ptr) {
58968         LDKReplyChannelRange this_ptr_conv;
58969         this_ptr_conv.inner = untag_ptr(this_ptr);
58970         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58971         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58972         this_ptr_conv.is_owned = false;
58973         int32_t ret_conv = ReplyChannelRange_get_first_blocknum(&this_ptr_conv);
58974         return ret_conv;
58975 }
58976
58977 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1first_1blocknum(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
58978         LDKReplyChannelRange this_ptr_conv;
58979         this_ptr_conv.inner = untag_ptr(this_ptr);
58980         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
58981         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
58982         this_ptr_conv.is_owned = false;
58983         ReplyChannelRange_set_first_blocknum(&this_ptr_conv, val);
58984 }
58985
58986 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1number_1of_1blocks(JNIEnv *env, jclass clz, int64_t this_ptr) {
58987         LDKReplyChannelRange 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         int32_t ret_conv = ReplyChannelRange_get_number_of_blocks(&this_ptr_conv);
58993         return ret_conv;
58994 }
58995
58996 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1number_1of_1blocks(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
58997         LDKReplyChannelRange this_ptr_conv;
58998         this_ptr_conv.inner = untag_ptr(this_ptr);
58999         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59000         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59001         this_ptr_conv.is_owned = false;
59002         ReplyChannelRange_set_number_of_blocks(&this_ptr_conv, val);
59003 }
59004
59005 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1sync_1complete(JNIEnv *env, jclass clz, int64_t this_ptr) {
59006         LDKReplyChannelRange this_ptr_conv;
59007         this_ptr_conv.inner = untag_ptr(this_ptr);
59008         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59009         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59010         this_ptr_conv.is_owned = false;
59011         jboolean ret_conv = ReplyChannelRange_get_sync_complete(&this_ptr_conv);
59012         return ret_conv;
59013 }
59014
59015 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1sync_1complete(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
59016         LDKReplyChannelRange this_ptr_conv;
59017         this_ptr_conv.inner = untag_ptr(this_ptr);
59018         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59019         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59020         this_ptr_conv.is_owned = false;
59021         ReplyChannelRange_set_sync_complete(&this_ptr_conv, val);
59022 }
59023
59024 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1short_1channel_1ids(JNIEnv *env, jclass clz, int64_t this_ptr) {
59025         LDKReplyChannelRange this_ptr_conv;
59026         this_ptr_conv.inner = untag_ptr(this_ptr);
59027         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59028         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59029         this_ptr_conv.is_owned = false;
59030         LDKCVec_u64Z ret_var = ReplyChannelRange_get_short_channel_ids(&this_ptr_conv);
59031         int64_tArray ret_arr = NULL;
59032         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
59033         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
59034         for (size_t g = 0; g < ret_var.datalen; g++) {
59035                 int64_t ret_conv_6_conv = ret_var.data[g];
59036                 ret_arr_ptr[g] = ret_conv_6_conv;
59037         }
59038         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
59039         FREE(ret_var.data);
59040         return ret_arr;
59041 }
59042
59043 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1short_1channel_1ids(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
59044         LDKReplyChannelRange this_ptr_conv;
59045         this_ptr_conv.inner = untag_ptr(this_ptr);
59046         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59047         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59048         this_ptr_conv.is_owned = false;
59049         LDKCVec_u64Z val_constr;
59050         val_constr.datalen = (*env)->GetArrayLength(env, val);
59051         if (val_constr.datalen > 0)
59052                 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
59053         else
59054                 val_constr.data = NULL;
59055         int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
59056         for (size_t g = 0; g < val_constr.datalen; g++) {
59057                 int64_t val_conv_6 = val_vals[g];
59058                 val_constr.data[g] = val_conv_6;
59059         }
59060         (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
59061         ReplyChannelRange_set_short_channel_ids(&this_ptr_conv, val_constr);
59062 }
59063
59064 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) {
59065         LDKThirtyTwoBytes chain_hash_arg_ref;
59066         CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
59067         (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
59068         LDKCVec_u64Z short_channel_ids_arg_constr;
59069         short_channel_ids_arg_constr.datalen = (*env)->GetArrayLength(env, short_channel_ids_arg);
59070         if (short_channel_ids_arg_constr.datalen > 0)
59071                 short_channel_ids_arg_constr.data = MALLOC(short_channel_ids_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
59072         else
59073                 short_channel_ids_arg_constr.data = NULL;
59074         int64_t* short_channel_ids_arg_vals = (*env)->GetLongArrayElements (env, short_channel_ids_arg, NULL);
59075         for (size_t g = 0; g < short_channel_ids_arg_constr.datalen; g++) {
59076                 int64_t short_channel_ids_arg_conv_6 = short_channel_ids_arg_vals[g];
59077                 short_channel_ids_arg_constr.data[g] = short_channel_ids_arg_conv_6;
59078         }
59079         (*env)->ReleaseLongArrayElements(env, short_channel_ids_arg, short_channel_ids_arg_vals, 0);
59080         LDKReplyChannelRange ret_var = ReplyChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg, sync_complete_arg, short_channel_ids_arg_constr);
59081         int64_t ret_ref = 0;
59082         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59083         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59084         return ret_ref;
59085 }
59086
59087 static inline uint64_t ReplyChannelRange_clone_ptr(LDKReplyChannelRange *NONNULL_PTR arg) {
59088         LDKReplyChannelRange ret_var = ReplyChannelRange_clone(arg);
59089         int64_t ret_ref = 0;
59090         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59091         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59092         return ret_ref;
59093 }
59094 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
59095         LDKReplyChannelRange arg_conv;
59096         arg_conv.inner = untag_ptr(arg);
59097         arg_conv.is_owned = ptr_is_owned(arg);
59098         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
59099         arg_conv.is_owned = false;
59100         int64_t ret_conv = ReplyChannelRange_clone_ptr(&arg_conv);
59101         return ret_conv;
59102 }
59103
59104 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1clone(JNIEnv *env, jclass clz, int64_t orig) {
59105         LDKReplyChannelRange orig_conv;
59106         orig_conv.inner = untag_ptr(orig);
59107         orig_conv.is_owned = ptr_is_owned(orig);
59108         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
59109         orig_conv.is_owned = false;
59110         LDKReplyChannelRange ret_var = ReplyChannelRange_clone(&orig_conv);
59111         int64_t ret_ref = 0;
59112         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59113         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59114         return ret_ref;
59115 }
59116
59117 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1hash(JNIEnv *env, jclass clz, int64_t o) {
59118         LDKReplyChannelRange o_conv;
59119         o_conv.inner = untag_ptr(o);
59120         o_conv.is_owned = ptr_is_owned(o);
59121         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
59122         o_conv.is_owned = false;
59123         int64_t ret_conv = ReplyChannelRange_hash(&o_conv);
59124         return ret_conv;
59125 }
59126
59127 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
59128         LDKReplyChannelRange a_conv;
59129         a_conv.inner = untag_ptr(a);
59130         a_conv.is_owned = ptr_is_owned(a);
59131         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
59132         a_conv.is_owned = false;
59133         LDKReplyChannelRange b_conv;
59134         b_conv.inner = untag_ptr(b);
59135         b_conv.is_owned = ptr_is_owned(b);
59136         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
59137         b_conv.is_owned = false;
59138         jboolean ret_conv = ReplyChannelRange_eq(&a_conv, &b_conv);
59139         return ret_conv;
59140 }
59141
59142 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
59143         LDKQueryShortChannelIds this_obj_conv;
59144         this_obj_conv.inner = untag_ptr(this_obj);
59145         this_obj_conv.is_owned = ptr_is_owned(this_obj);
59146         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
59147         QueryShortChannelIds_free(this_obj_conv);
59148 }
59149
59150 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
59151         LDKQueryShortChannelIds this_ptr_conv;
59152         this_ptr_conv.inner = untag_ptr(this_ptr);
59153         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59154         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59155         this_ptr_conv.is_owned = false;
59156         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
59157         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *QueryShortChannelIds_get_chain_hash(&this_ptr_conv));
59158         return ret_arr;
59159 }
59160
59161 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
59162         LDKQueryShortChannelIds this_ptr_conv;
59163         this_ptr_conv.inner = untag_ptr(this_ptr);
59164         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59165         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59166         this_ptr_conv.is_owned = false;
59167         LDKThirtyTwoBytes val_ref;
59168         CHECK((*env)->GetArrayLength(env, val) == 32);
59169         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
59170         QueryShortChannelIds_set_chain_hash(&this_ptr_conv, val_ref);
59171 }
59172
59173 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1get_1short_1channel_1ids(JNIEnv *env, jclass clz, int64_t this_ptr) {
59174         LDKQueryShortChannelIds this_ptr_conv;
59175         this_ptr_conv.inner = untag_ptr(this_ptr);
59176         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59177         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59178         this_ptr_conv.is_owned = false;
59179         LDKCVec_u64Z ret_var = QueryShortChannelIds_get_short_channel_ids(&this_ptr_conv);
59180         int64_tArray ret_arr = NULL;
59181         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
59182         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
59183         for (size_t g = 0; g < ret_var.datalen; g++) {
59184                 int64_t ret_conv_6_conv = ret_var.data[g];
59185                 ret_arr_ptr[g] = ret_conv_6_conv;
59186         }
59187         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
59188         FREE(ret_var.data);
59189         return ret_arr;
59190 }
59191
59192 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1set_1short_1channel_1ids(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
59193         LDKQueryShortChannelIds this_ptr_conv;
59194         this_ptr_conv.inner = untag_ptr(this_ptr);
59195         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59196         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59197         this_ptr_conv.is_owned = false;
59198         LDKCVec_u64Z val_constr;
59199         val_constr.datalen = (*env)->GetArrayLength(env, val);
59200         if (val_constr.datalen > 0)
59201                 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
59202         else
59203                 val_constr.data = NULL;
59204         int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
59205         for (size_t g = 0; g < val_constr.datalen; g++) {
59206                 int64_t val_conv_6 = val_vals[g];
59207                 val_constr.data[g] = val_conv_6;
59208         }
59209         (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
59210         QueryShortChannelIds_set_short_channel_ids(&this_ptr_conv, val_constr);
59211 }
59212
59213 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) {
59214         LDKThirtyTwoBytes chain_hash_arg_ref;
59215         CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
59216         (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
59217         LDKCVec_u64Z short_channel_ids_arg_constr;
59218         short_channel_ids_arg_constr.datalen = (*env)->GetArrayLength(env, short_channel_ids_arg);
59219         if (short_channel_ids_arg_constr.datalen > 0)
59220                 short_channel_ids_arg_constr.data = MALLOC(short_channel_ids_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
59221         else
59222                 short_channel_ids_arg_constr.data = NULL;
59223         int64_t* short_channel_ids_arg_vals = (*env)->GetLongArrayElements (env, short_channel_ids_arg, NULL);
59224         for (size_t g = 0; g < short_channel_ids_arg_constr.datalen; g++) {
59225                 int64_t short_channel_ids_arg_conv_6 = short_channel_ids_arg_vals[g];
59226                 short_channel_ids_arg_constr.data[g] = short_channel_ids_arg_conv_6;
59227         }
59228         (*env)->ReleaseLongArrayElements(env, short_channel_ids_arg, short_channel_ids_arg_vals, 0);
59229         LDKQueryShortChannelIds ret_var = QueryShortChannelIds_new(chain_hash_arg_ref, short_channel_ids_arg_constr);
59230         int64_t ret_ref = 0;
59231         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59232         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59233         return ret_ref;
59234 }
59235
59236 static inline uint64_t QueryShortChannelIds_clone_ptr(LDKQueryShortChannelIds *NONNULL_PTR arg) {
59237         LDKQueryShortChannelIds ret_var = QueryShortChannelIds_clone(arg);
59238         int64_t ret_ref = 0;
59239         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59240         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59241         return ret_ref;
59242 }
59243 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
59244         LDKQueryShortChannelIds arg_conv;
59245         arg_conv.inner = untag_ptr(arg);
59246         arg_conv.is_owned = ptr_is_owned(arg);
59247         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
59248         arg_conv.is_owned = false;
59249         int64_t ret_conv = QueryShortChannelIds_clone_ptr(&arg_conv);
59250         return ret_conv;
59251 }
59252
59253 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1clone(JNIEnv *env, jclass clz, int64_t orig) {
59254         LDKQueryShortChannelIds orig_conv;
59255         orig_conv.inner = untag_ptr(orig);
59256         orig_conv.is_owned = ptr_is_owned(orig);
59257         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
59258         orig_conv.is_owned = false;
59259         LDKQueryShortChannelIds ret_var = QueryShortChannelIds_clone(&orig_conv);
59260         int64_t ret_ref = 0;
59261         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59262         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59263         return ret_ref;
59264 }
59265
59266 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1hash(JNIEnv *env, jclass clz, int64_t o) {
59267         LDKQueryShortChannelIds o_conv;
59268         o_conv.inner = untag_ptr(o);
59269         o_conv.is_owned = ptr_is_owned(o);
59270         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
59271         o_conv.is_owned = false;
59272         int64_t ret_conv = QueryShortChannelIds_hash(&o_conv);
59273         return ret_conv;
59274 }
59275
59276 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
59277         LDKQueryShortChannelIds a_conv;
59278         a_conv.inner = untag_ptr(a);
59279         a_conv.is_owned = ptr_is_owned(a);
59280         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
59281         a_conv.is_owned = false;
59282         LDKQueryShortChannelIds b_conv;
59283         b_conv.inner = untag_ptr(b);
59284         b_conv.is_owned = ptr_is_owned(b);
59285         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
59286         b_conv.is_owned = false;
59287         jboolean ret_conv = QueryShortChannelIds_eq(&a_conv, &b_conv);
59288         return ret_conv;
59289 }
59290
59291 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
59292         LDKReplyShortChannelIdsEnd this_obj_conv;
59293         this_obj_conv.inner = untag_ptr(this_obj);
59294         this_obj_conv.is_owned = ptr_is_owned(this_obj);
59295         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
59296         ReplyShortChannelIdsEnd_free(this_obj_conv);
59297 }
59298
59299 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
59300         LDKReplyShortChannelIdsEnd this_ptr_conv;
59301         this_ptr_conv.inner = untag_ptr(this_ptr);
59302         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59303         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59304         this_ptr_conv.is_owned = false;
59305         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
59306         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ReplyShortChannelIdsEnd_get_chain_hash(&this_ptr_conv));
59307         return ret_arr;
59308 }
59309
59310 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
59311         LDKReplyShortChannelIdsEnd this_ptr_conv;
59312         this_ptr_conv.inner = untag_ptr(this_ptr);
59313         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59314         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59315         this_ptr_conv.is_owned = false;
59316         LDKThirtyTwoBytes val_ref;
59317         CHECK((*env)->GetArrayLength(env, val) == 32);
59318         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
59319         ReplyShortChannelIdsEnd_set_chain_hash(&this_ptr_conv, val_ref);
59320 }
59321
59322 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1get_1full_1information(JNIEnv *env, jclass clz, int64_t this_ptr) {
59323         LDKReplyShortChannelIdsEnd this_ptr_conv;
59324         this_ptr_conv.inner = untag_ptr(this_ptr);
59325         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59326         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59327         this_ptr_conv.is_owned = false;
59328         jboolean ret_conv = ReplyShortChannelIdsEnd_get_full_information(&this_ptr_conv);
59329         return ret_conv;
59330 }
59331
59332 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1set_1full_1information(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
59333         LDKReplyShortChannelIdsEnd this_ptr_conv;
59334         this_ptr_conv.inner = untag_ptr(this_ptr);
59335         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59336         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59337         this_ptr_conv.is_owned = false;
59338         ReplyShortChannelIdsEnd_set_full_information(&this_ptr_conv, val);
59339 }
59340
59341 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1new(JNIEnv *env, jclass clz, int8_tArray chain_hash_arg, jboolean full_information_arg) {
59342         LDKThirtyTwoBytes chain_hash_arg_ref;
59343         CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
59344         (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
59345         LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_new(chain_hash_arg_ref, full_information_arg);
59346         int64_t ret_ref = 0;
59347         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59348         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59349         return ret_ref;
59350 }
59351
59352 static inline uint64_t ReplyShortChannelIdsEnd_clone_ptr(LDKReplyShortChannelIdsEnd *NONNULL_PTR arg) {
59353         LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_clone(arg);
59354         int64_t ret_ref = 0;
59355         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59356         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59357         return ret_ref;
59358 }
59359 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
59360         LDKReplyShortChannelIdsEnd arg_conv;
59361         arg_conv.inner = untag_ptr(arg);
59362         arg_conv.is_owned = ptr_is_owned(arg);
59363         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
59364         arg_conv.is_owned = false;
59365         int64_t ret_conv = ReplyShortChannelIdsEnd_clone_ptr(&arg_conv);
59366         return ret_conv;
59367 }
59368
59369 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1clone(JNIEnv *env, jclass clz, int64_t orig) {
59370         LDKReplyShortChannelIdsEnd orig_conv;
59371         orig_conv.inner = untag_ptr(orig);
59372         orig_conv.is_owned = ptr_is_owned(orig);
59373         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
59374         orig_conv.is_owned = false;
59375         LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_clone(&orig_conv);
59376         int64_t ret_ref = 0;
59377         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59378         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59379         return ret_ref;
59380 }
59381
59382 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1hash(JNIEnv *env, jclass clz, int64_t o) {
59383         LDKReplyShortChannelIdsEnd o_conv;
59384         o_conv.inner = untag_ptr(o);
59385         o_conv.is_owned = ptr_is_owned(o);
59386         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
59387         o_conv.is_owned = false;
59388         int64_t ret_conv = ReplyShortChannelIdsEnd_hash(&o_conv);
59389         return ret_conv;
59390 }
59391
59392 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
59393         LDKReplyShortChannelIdsEnd a_conv;
59394         a_conv.inner = untag_ptr(a);
59395         a_conv.is_owned = ptr_is_owned(a);
59396         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
59397         a_conv.is_owned = false;
59398         LDKReplyShortChannelIdsEnd b_conv;
59399         b_conv.inner = untag_ptr(b);
59400         b_conv.is_owned = ptr_is_owned(b);
59401         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
59402         b_conv.is_owned = false;
59403         jboolean ret_conv = ReplyShortChannelIdsEnd_eq(&a_conv, &b_conv);
59404         return ret_conv;
59405 }
59406
59407 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
59408         LDKGossipTimestampFilter this_obj_conv;
59409         this_obj_conv.inner = untag_ptr(this_obj);
59410         this_obj_conv.is_owned = ptr_is_owned(this_obj);
59411         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
59412         GossipTimestampFilter_free(this_obj_conv);
59413 }
59414
59415 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
59416         LDKGossipTimestampFilter this_ptr_conv;
59417         this_ptr_conv.inner = untag_ptr(this_ptr);
59418         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59419         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59420         this_ptr_conv.is_owned = false;
59421         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
59422         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *GossipTimestampFilter_get_chain_hash(&this_ptr_conv));
59423         return ret_arr;
59424 }
59425
59426 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
59427         LDKGossipTimestampFilter this_ptr_conv;
59428         this_ptr_conv.inner = untag_ptr(this_ptr);
59429         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59430         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59431         this_ptr_conv.is_owned = false;
59432         LDKThirtyTwoBytes val_ref;
59433         CHECK((*env)->GetArrayLength(env, val) == 32);
59434         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
59435         GossipTimestampFilter_set_chain_hash(&this_ptr_conv, val_ref);
59436 }
59437
59438 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1get_1first_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr) {
59439         LDKGossipTimestampFilter this_ptr_conv;
59440         this_ptr_conv.inner = untag_ptr(this_ptr);
59441         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59442         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59443         this_ptr_conv.is_owned = false;
59444         int32_t ret_conv = GossipTimestampFilter_get_first_timestamp(&this_ptr_conv);
59445         return ret_conv;
59446 }
59447
59448 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1set_1first_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
59449         LDKGossipTimestampFilter this_ptr_conv;
59450         this_ptr_conv.inner = untag_ptr(this_ptr);
59451         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59452         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59453         this_ptr_conv.is_owned = false;
59454         GossipTimestampFilter_set_first_timestamp(&this_ptr_conv, val);
59455 }
59456
59457 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1get_1timestamp_1range(JNIEnv *env, jclass clz, int64_t this_ptr) {
59458         LDKGossipTimestampFilter this_ptr_conv;
59459         this_ptr_conv.inner = untag_ptr(this_ptr);
59460         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59461         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59462         this_ptr_conv.is_owned = false;
59463         int32_t ret_conv = GossipTimestampFilter_get_timestamp_range(&this_ptr_conv);
59464         return ret_conv;
59465 }
59466
59467 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1set_1timestamp_1range(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
59468         LDKGossipTimestampFilter this_ptr_conv;
59469         this_ptr_conv.inner = untag_ptr(this_ptr);
59470         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59471         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59472         this_ptr_conv.is_owned = false;
59473         GossipTimestampFilter_set_timestamp_range(&this_ptr_conv, val);
59474 }
59475
59476 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) {
59477         LDKThirtyTwoBytes chain_hash_arg_ref;
59478         CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
59479         (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
59480         LDKGossipTimestampFilter ret_var = GossipTimestampFilter_new(chain_hash_arg_ref, first_timestamp_arg, timestamp_range_arg);
59481         int64_t ret_ref = 0;
59482         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59483         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59484         return ret_ref;
59485 }
59486
59487 static inline uint64_t GossipTimestampFilter_clone_ptr(LDKGossipTimestampFilter *NONNULL_PTR arg) {
59488         LDKGossipTimestampFilter ret_var = GossipTimestampFilter_clone(arg);
59489         int64_t ret_ref = 0;
59490         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59491         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59492         return ret_ref;
59493 }
59494 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
59495         LDKGossipTimestampFilter arg_conv;
59496         arg_conv.inner = untag_ptr(arg);
59497         arg_conv.is_owned = ptr_is_owned(arg);
59498         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
59499         arg_conv.is_owned = false;
59500         int64_t ret_conv = GossipTimestampFilter_clone_ptr(&arg_conv);
59501         return ret_conv;
59502 }
59503
59504 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1clone(JNIEnv *env, jclass clz, int64_t orig) {
59505         LDKGossipTimestampFilter orig_conv;
59506         orig_conv.inner = untag_ptr(orig);
59507         orig_conv.is_owned = ptr_is_owned(orig);
59508         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
59509         orig_conv.is_owned = false;
59510         LDKGossipTimestampFilter ret_var = GossipTimestampFilter_clone(&orig_conv);
59511         int64_t ret_ref = 0;
59512         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59513         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59514         return ret_ref;
59515 }
59516
59517 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1hash(JNIEnv *env, jclass clz, int64_t o) {
59518         LDKGossipTimestampFilter o_conv;
59519         o_conv.inner = untag_ptr(o);
59520         o_conv.is_owned = ptr_is_owned(o);
59521         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
59522         o_conv.is_owned = false;
59523         int64_t ret_conv = GossipTimestampFilter_hash(&o_conv);
59524         return ret_conv;
59525 }
59526
59527 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
59528         LDKGossipTimestampFilter a_conv;
59529         a_conv.inner = untag_ptr(a);
59530         a_conv.is_owned = ptr_is_owned(a);
59531         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
59532         a_conv.is_owned = false;
59533         LDKGossipTimestampFilter b_conv;
59534         b_conv.inner = untag_ptr(b);
59535         b_conv.is_owned = ptr_is_owned(b);
59536         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
59537         b_conv.is_owned = false;
59538         jboolean ret_conv = GossipTimestampFilter_eq(&a_conv, &b_conv);
59539         return ret_conv;
59540 }
59541
59542 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorAction_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
59543         if (!ptr_is_owned(this_ptr)) return;
59544         void* this_ptr_ptr = untag_ptr(this_ptr);
59545         CHECK_ACCESS(this_ptr_ptr);
59546         LDKErrorAction this_ptr_conv = *(LDKErrorAction*)(this_ptr_ptr);
59547         FREE(untag_ptr(this_ptr));
59548         ErrorAction_free(this_ptr_conv);
59549 }
59550
59551 static inline uint64_t ErrorAction_clone_ptr(LDKErrorAction *NONNULL_PTR arg) {
59552         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
59553         *ret_copy = ErrorAction_clone(arg);
59554         int64_t ret_ref = tag_ptr(ret_copy, true);
59555         return ret_ref;
59556 }
59557 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
59558         LDKErrorAction* arg_conv = (LDKErrorAction*)untag_ptr(arg);
59559         int64_t ret_conv = ErrorAction_clone_ptr(arg_conv);
59560         return ret_conv;
59561 }
59562
59563 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1clone(JNIEnv *env, jclass clz, int64_t orig) {
59564         LDKErrorAction* orig_conv = (LDKErrorAction*)untag_ptr(orig);
59565         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
59566         *ret_copy = ErrorAction_clone(orig_conv);
59567         int64_t ret_ref = tag_ptr(ret_copy, true);
59568         return ret_ref;
59569 }
59570
59571 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1disconnect_1peer(JNIEnv *env, jclass clz, int64_t msg) {
59572         LDKErrorMessage msg_conv;
59573         msg_conv.inner = untag_ptr(msg);
59574         msg_conv.is_owned = ptr_is_owned(msg);
59575         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
59576         msg_conv = ErrorMessage_clone(&msg_conv);
59577         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
59578         *ret_copy = ErrorAction_disconnect_peer(msg_conv);
59579         int64_t ret_ref = tag_ptr(ret_copy, true);
59580         return ret_ref;
59581 }
59582
59583 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1disconnect_1peer_1with_1warning(JNIEnv *env, jclass clz, int64_t msg) {
59584         LDKWarningMessage msg_conv;
59585         msg_conv.inner = untag_ptr(msg);
59586         msg_conv.is_owned = ptr_is_owned(msg);
59587         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
59588         msg_conv = WarningMessage_clone(&msg_conv);
59589         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
59590         *ret_copy = ErrorAction_disconnect_peer_with_warning(msg_conv);
59591         int64_t ret_ref = tag_ptr(ret_copy, true);
59592         return ret_ref;
59593 }
59594
59595 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1ignore_1error(JNIEnv *env, jclass clz) {
59596         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
59597         *ret_copy = ErrorAction_ignore_error();
59598         int64_t ret_ref = tag_ptr(ret_copy, true);
59599         return ret_ref;
59600 }
59601
59602 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1ignore_1and_1log(JNIEnv *env, jclass clz, jclass a) {
59603         LDKLevel a_conv = LDKLevel_from_java(env, a);
59604         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
59605         *ret_copy = ErrorAction_ignore_and_log(a_conv);
59606         int64_t ret_ref = tag_ptr(ret_copy, true);
59607         return ret_ref;
59608 }
59609
59610 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1ignore_1duplicate_1gossip(JNIEnv *env, jclass clz) {
59611         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
59612         *ret_copy = ErrorAction_ignore_duplicate_gossip();
59613         int64_t ret_ref = tag_ptr(ret_copy, true);
59614         return ret_ref;
59615 }
59616
59617 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1send_1error_1message(JNIEnv *env, jclass clz, int64_t msg) {
59618         LDKErrorMessage msg_conv;
59619         msg_conv.inner = untag_ptr(msg);
59620         msg_conv.is_owned = ptr_is_owned(msg);
59621         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
59622         msg_conv = ErrorMessage_clone(&msg_conv);
59623         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
59624         *ret_copy = ErrorAction_send_error_message(msg_conv);
59625         int64_t ret_ref = tag_ptr(ret_copy, true);
59626         return ret_ref;
59627 }
59628
59629 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1send_1warning_1message(JNIEnv *env, jclass clz, int64_t msg, jclass log_level) {
59630         LDKWarningMessage msg_conv;
59631         msg_conv.inner = untag_ptr(msg);
59632         msg_conv.is_owned = ptr_is_owned(msg);
59633         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
59634         msg_conv = WarningMessage_clone(&msg_conv);
59635         LDKLevel log_level_conv = LDKLevel_from_java(env, log_level);
59636         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
59637         *ret_copy = ErrorAction_send_warning_message(msg_conv, log_level_conv);
59638         int64_t ret_ref = tag_ptr(ret_copy, true);
59639         return ret_ref;
59640 }
59641
59642 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1hash(JNIEnv *env, jclass clz, int64_t o) {
59643         LDKErrorAction* o_conv = (LDKErrorAction*)untag_ptr(o);
59644         int64_t ret_conv = ErrorAction_hash(o_conv);
59645         return ret_conv;
59646 }
59647
59648 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LightningError_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
59649         LDKLightningError this_obj_conv;
59650         this_obj_conv.inner = untag_ptr(this_obj);
59651         this_obj_conv.is_owned = ptr_is_owned(this_obj);
59652         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
59653         LightningError_free(this_obj_conv);
59654 }
59655
59656 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_LightningError_1get_1err(JNIEnv *env, jclass clz, int64_t this_ptr) {
59657         LDKLightningError this_ptr_conv;
59658         this_ptr_conv.inner = untag_ptr(this_ptr);
59659         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59660         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59661         this_ptr_conv.is_owned = false;
59662         LDKStr ret_str = LightningError_get_err(&this_ptr_conv);
59663         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
59664         Str_free(ret_str);
59665         return ret_conv;
59666 }
59667
59668 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LightningError_1set_1err(JNIEnv *env, jclass clz, int64_t this_ptr, jstring val) {
59669         LDKLightningError this_ptr_conv;
59670         this_ptr_conv.inner = untag_ptr(this_ptr);
59671         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59672         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59673         this_ptr_conv.is_owned = false;
59674         LDKStr val_conv = java_to_owned_str(env, val);
59675         LightningError_set_err(&this_ptr_conv, val_conv);
59676 }
59677
59678 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LightningError_1get_1action(JNIEnv *env, jclass clz, int64_t this_ptr) {
59679         LDKLightningError this_ptr_conv;
59680         this_ptr_conv.inner = untag_ptr(this_ptr);
59681         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59682         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59683         this_ptr_conv.is_owned = false;
59684         LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
59685         *ret_copy = LightningError_get_action(&this_ptr_conv);
59686         int64_t ret_ref = tag_ptr(ret_copy, true);
59687         return ret_ref;
59688 }
59689
59690 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LightningError_1set_1action(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
59691         LDKLightningError this_ptr_conv;
59692         this_ptr_conv.inner = untag_ptr(this_ptr);
59693         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59694         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59695         this_ptr_conv.is_owned = false;
59696         void* val_ptr = untag_ptr(val);
59697         CHECK_ACCESS(val_ptr);
59698         LDKErrorAction val_conv = *(LDKErrorAction*)(val_ptr);
59699         val_conv = ErrorAction_clone((LDKErrorAction*)untag_ptr(val));
59700         LightningError_set_action(&this_ptr_conv, val_conv);
59701 }
59702
59703 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LightningError_1new(JNIEnv *env, jclass clz, jstring err_arg, int64_t action_arg) {
59704         LDKStr err_arg_conv = java_to_owned_str(env, err_arg);
59705         void* action_arg_ptr = untag_ptr(action_arg);
59706         CHECK_ACCESS(action_arg_ptr);
59707         LDKErrorAction action_arg_conv = *(LDKErrorAction*)(action_arg_ptr);
59708         action_arg_conv = ErrorAction_clone((LDKErrorAction*)untag_ptr(action_arg));
59709         LDKLightningError ret_var = LightningError_new(err_arg_conv, action_arg_conv);
59710         int64_t ret_ref = 0;
59711         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59712         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59713         return ret_ref;
59714 }
59715
59716 static inline uint64_t LightningError_clone_ptr(LDKLightningError *NONNULL_PTR arg) {
59717         LDKLightningError ret_var = LightningError_clone(arg);
59718         int64_t ret_ref = 0;
59719         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59720         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59721         return ret_ref;
59722 }
59723 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LightningError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
59724         LDKLightningError arg_conv;
59725         arg_conv.inner = untag_ptr(arg);
59726         arg_conv.is_owned = ptr_is_owned(arg);
59727         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
59728         arg_conv.is_owned = false;
59729         int64_t ret_conv = LightningError_clone_ptr(&arg_conv);
59730         return ret_conv;
59731 }
59732
59733 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LightningError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
59734         LDKLightningError orig_conv;
59735         orig_conv.inner = untag_ptr(orig);
59736         orig_conv.is_owned = ptr_is_owned(orig);
59737         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
59738         orig_conv.is_owned = false;
59739         LDKLightningError ret_var = LightningError_clone(&orig_conv);
59740         int64_t ret_ref = 0;
59741         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59742         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59743         return ret_ref;
59744 }
59745
59746 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
59747         LDKCommitmentUpdate this_obj_conv;
59748         this_obj_conv.inner = untag_ptr(this_obj);
59749         this_obj_conv.is_owned = ptr_is_owned(this_obj);
59750         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
59751         CommitmentUpdate_free(this_obj_conv);
59752 }
59753
59754 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1update_1add_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
59755         LDKCommitmentUpdate 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         LDKCVec_UpdateAddHTLCZ ret_var = CommitmentUpdate_get_update_add_htlcs(&this_ptr_conv);
59761         int64_tArray ret_arr = NULL;
59762         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
59763         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
59764         for (size_t p = 0; p < ret_var.datalen; p++) {
59765                 LDKUpdateAddHTLC ret_conv_15_var = ret_var.data[p];
59766                 int64_t ret_conv_15_ref = 0;
59767                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_15_var);
59768                 ret_conv_15_ref = tag_ptr(ret_conv_15_var.inner, ret_conv_15_var.is_owned);
59769                 ret_arr_ptr[p] = ret_conv_15_ref;
59770         }
59771         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
59772         FREE(ret_var.data);
59773         return ret_arr;
59774 }
59775
59776 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1add_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
59777         LDKCommitmentUpdate this_ptr_conv;
59778         this_ptr_conv.inner = untag_ptr(this_ptr);
59779         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59780         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59781         this_ptr_conv.is_owned = false;
59782         LDKCVec_UpdateAddHTLCZ val_constr;
59783         val_constr.datalen = (*env)->GetArrayLength(env, val);
59784         if (val_constr.datalen > 0)
59785                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
59786         else
59787                 val_constr.data = NULL;
59788         int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
59789         for (size_t p = 0; p < val_constr.datalen; p++) {
59790                 int64_t val_conv_15 = val_vals[p];
59791                 LDKUpdateAddHTLC val_conv_15_conv;
59792                 val_conv_15_conv.inner = untag_ptr(val_conv_15);
59793                 val_conv_15_conv.is_owned = ptr_is_owned(val_conv_15);
59794                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_15_conv);
59795                 val_conv_15_conv = UpdateAddHTLC_clone(&val_conv_15_conv);
59796                 val_constr.data[p] = val_conv_15_conv;
59797         }
59798         (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
59799         CommitmentUpdate_set_update_add_htlcs(&this_ptr_conv, val_constr);
59800 }
59801
59802 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1update_1fulfill_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
59803         LDKCommitmentUpdate this_ptr_conv;
59804         this_ptr_conv.inner = untag_ptr(this_ptr);
59805         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59806         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59807         this_ptr_conv.is_owned = false;
59808         LDKCVec_UpdateFulfillHTLCZ ret_var = CommitmentUpdate_get_update_fulfill_htlcs(&this_ptr_conv);
59809         int64_tArray ret_arr = NULL;
59810         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
59811         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
59812         for (size_t t = 0; t < ret_var.datalen; t++) {
59813                 LDKUpdateFulfillHTLC ret_conv_19_var = ret_var.data[t];
59814                 int64_t ret_conv_19_ref = 0;
59815                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_19_var);
59816                 ret_conv_19_ref = tag_ptr(ret_conv_19_var.inner, ret_conv_19_var.is_owned);
59817                 ret_arr_ptr[t] = ret_conv_19_ref;
59818         }
59819         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
59820         FREE(ret_var.data);
59821         return ret_arr;
59822 }
59823
59824 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fulfill_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
59825         LDKCommitmentUpdate this_ptr_conv;
59826         this_ptr_conv.inner = untag_ptr(this_ptr);
59827         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59828         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59829         this_ptr_conv.is_owned = false;
59830         LDKCVec_UpdateFulfillHTLCZ val_constr;
59831         val_constr.datalen = (*env)->GetArrayLength(env, val);
59832         if (val_constr.datalen > 0)
59833                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
59834         else
59835                 val_constr.data = NULL;
59836         int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
59837         for (size_t t = 0; t < val_constr.datalen; t++) {
59838                 int64_t val_conv_19 = val_vals[t];
59839                 LDKUpdateFulfillHTLC val_conv_19_conv;
59840                 val_conv_19_conv.inner = untag_ptr(val_conv_19);
59841                 val_conv_19_conv.is_owned = ptr_is_owned(val_conv_19);
59842                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_19_conv);
59843                 val_conv_19_conv = UpdateFulfillHTLC_clone(&val_conv_19_conv);
59844                 val_constr.data[t] = val_conv_19_conv;
59845         }
59846         (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
59847         CommitmentUpdate_set_update_fulfill_htlcs(&this_ptr_conv, val_constr);
59848 }
59849
59850 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1update_1fail_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
59851         LDKCommitmentUpdate this_ptr_conv;
59852         this_ptr_conv.inner = untag_ptr(this_ptr);
59853         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59854         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59855         this_ptr_conv.is_owned = false;
59856         LDKCVec_UpdateFailHTLCZ ret_var = CommitmentUpdate_get_update_fail_htlcs(&this_ptr_conv);
59857         int64_tArray ret_arr = NULL;
59858         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
59859         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
59860         for (size_t q = 0; q < ret_var.datalen; q++) {
59861                 LDKUpdateFailHTLC ret_conv_16_var = ret_var.data[q];
59862                 int64_t ret_conv_16_ref = 0;
59863                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var);
59864                 ret_conv_16_ref = tag_ptr(ret_conv_16_var.inner, ret_conv_16_var.is_owned);
59865                 ret_arr_ptr[q] = ret_conv_16_ref;
59866         }
59867         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
59868         FREE(ret_var.data);
59869         return ret_arr;
59870 }
59871
59872 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fail_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
59873         LDKCommitmentUpdate this_ptr_conv;
59874         this_ptr_conv.inner = untag_ptr(this_ptr);
59875         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59876         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59877         this_ptr_conv.is_owned = false;
59878         LDKCVec_UpdateFailHTLCZ val_constr;
59879         val_constr.datalen = (*env)->GetArrayLength(env, val);
59880         if (val_constr.datalen > 0)
59881                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
59882         else
59883                 val_constr.data = NULL;
59884         int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
59885         for (size_t q = 0; q < val_constr.datalen; q++) {
59886                 int64_t val_conv_16 = val_vals[q];
59887                 LDKUpdateFailHTLC val_conv_16_conv;
59888                 val_conv_16_conv.inner = untag_ptr(val_conv_16);
59889                 val_conv_16_conv.is_owned = ptr_is_owned(val_conv_16);
59890                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_16_conv);
59891                 val_conv_16_conv = UpdateFailHTLC_clone(&val_conv_16_conv);
59892                 val_constr.data[q] = val_conv_16_conv;
59893         }
59894         (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
59895         CommitmentUpdate_set_update_fail_htlcs(&this_ptr_conv, val_constr);
59896 }
59897
59898 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1update_1fail_1malformed_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
59899         LDKCommitmentUpdate this_ptr_conv;
59900         this_ptr_conv.inner = untag_ptr(this_ptr);
59901         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59902         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59903         this_ptr_conv.is_owned = false;
59904         LDKCVec_UpdateFailMalformedHTLCZ ret_var = CommitmentUpdate_get_update_fail_malformed_htlcs(&this_ptr_conv);
59905         int64_tArray ret_arr = NULL;
59906         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
59907         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
59908         for (size_t z = 0; z < ret_var.datalen; z++) {
59909                 LDKUpdateFailMalformedHTLC ret_conv_25_var = ret_var.data[z];
59910                 int64_t ret_conv_25_ref = 0;
59911                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_25_var);
59912                 ret_conv_25_ref = tag_ptr(ret_conv_25_var.inner, ret_conv_25_var.is_owned);
59913                 ret_arr_ptr[z] = ret_conv_25_ref;
59914         }
59915         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
59916         FREE(ret_var.data);
59917         return ret_arr;
59918 }
59919
59920 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) {
59921         LDKCommitmentUpdate this_ptr_conv;
59922         this_ptr_conv.inner = untag_ptr(this_ptr);
59923         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59924         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59925         this_ptr_conv.is_owned = false;
59926         LDKCVec_UpdateFailMalformedHTLCZ val_constr;
59927         val_constr.datalen = (*env)->GetArrayLength(env, val);
59928         if (val_constr.datalen > 0)
59929                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
59930         else
59931                 val_constr.data = NULL;
59932         int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
59933         for (size_t z = 0; z < val_constr.datalen; z++) {
59934                 int64_t val_conv_25 = val_vals[z];
59935                 LDKUpdateFailMalformedHTLC val_conv_25_conv;
59936                 val_conv_25_conv.inner = untag_ptr(val_conv_25);
59937                 val_conv_25_conv.is_owned = ptr_is_owned(val_conv_25);
59938                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_25_conv);
59939                 val_conv_25_conv = UpdateFailMalformedHTLC_clone(&val_conv_25_conv);
59940                 val_constr.data[z] = val_conv_25_conv;
59941         }
59942         (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
59943         CommitmentUpdate_set_update_fail_malformed_htlcs(&this_ptr_conv, val_constr);
59944 }
59945
59946 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1update_1fee(JNIEnv *env, jclass clz, int64_t this_ptr) {
59947         LDKCommitmentUpdate this_ptr_conv;
59948         this_ptr_conv.inner = untag_ptr(this_ptr);
59949         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59950         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59951         this_ptr_conv.is_owned = false;
59952         LDKUpdateFee ret_var = CommitmentUpdate_get_update_fee(&this_ptr_conv);
59953         int64_t ret_ref = 0;
59954         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59955         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59956         return ret_ref;
59957 }
59958
59959 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fee(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
59960         LDKCommitmentUpdate this_ptr_conv;
59961         this_ptr_conv.inner = untag_ptr(this_ptr);
59962         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59963         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59964         this_ptr_conv.is_owned = false;
59965         LDKUpdateFee val_conv;
59966         val_conv.inner = untag_ptr(val);
59967         val_conv.is_owned = ptr_is_owned(val);
59968         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
59969         val_conv = UpdateFee_clone(&val_conv);
59970         CommitmentUpdate_set_update_fee(&this_ptr_conv, val_conv);
59971 }
59972
59973 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1commitment_1signed(JNIEnv *env, jclass clz, int64_t this_ptr) {
59974         LDKCommitmentUpdate this_ptr_conv;
59975         this_ptr_conv.inner = untag_ptr(this_ptr);
59976         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59977         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59978         this_ptr_conv.is_owned = false;
59979         LDKCommitmentSigned ret_var = CommitmentUpdate_get_commitment_signed(&this_ptr_conv);
59980         int64_t ret_ref = 0;
59981         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
59982         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
59983         return ret_ref;
59984 }
59985
59986 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1commitment_1signed(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
59987         LDKCommitmentUpdate this_ptr_conv;
59988         this_ptr_conv.inner = untag_ptr(this_ptr);
59989         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
59990         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
59991         this_ptr_conv.is_owned = false;
59992         LDKCommitmentSigned val_conv;
59993         val_conv.inner = untag_ptr(val);
59994         val_conv.is_owned = ptr_is_owned(val);
59995         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
59996         val_conv = CommitmentSigned_clone(&val_conv);
59997         CommitmentUpdate_set_commitment_signed(&this_ptr_conv, val_conv);
59998 }
59999
60000 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) {
60001         LDKCVec_UpdateAddHTLCZ update_add_htlcs_arg_constr;
60002         update_add_htlcs_arg_constr.datalen = (*env)->GetArrayLength(env, update_add_htlcs_arg);
60003         if (update_add_htlcs_arg_constr.datalen > 0)
60004                 update_add_htlcs_arg_constr.data = MALLOC(update_add_htlcs_arg_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
60005         else
60006                 update_add_htlcs_arg_constr.data = NULL;
60007         int64_t* update_add_htlcs_arg_vals = (*env)->GetLongArrayElements (env, update_add_htlcs_arg, NULL);
60008         for (size_t p = 0; p < update_add_htlcs_arg_constr.datalen; p++) {
60009                 int64_t update_add_htlcs_arg_conv_15 = update_add_htlcs_arg_vals[p];
60010                 LDKUpdateAddHTLC update_add_htlcs_arg_conv_15_conv;
60011                 update_add_htlcs_arg_conv_15_conv.inner = untag_ptr(update_add_htlcs_arg_conv_15);
60012                 update_add_htlcs_arg_conv_15_conv.is_owned = ptr_is_owned(update_add_htlcs_arg_conv_15);
60013                 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_add_htlcs_arg_conv_15_conv);
60014                 update_add_htlcs_arg_conv_15_conv = UpdateAddHTLC_clone(&update_add_htlcs_arg_conv_15_conv);
60015                 update_add_htlcs_arg_constr.data[p] = update_add_htlcs_arg_conv_15_conv;
60016         }
60017         (*env)->ReleaseLongArrayElements(env, update_add_htlcs_arg, update_add_htlcs_arg_vals, 0);
60018         LDKCVec_UpdateFulfillHTLCZ update_fulfill_htlcs_arg_constr;
60019         update_fulfill_htlcs_arg_constr.datalen = (*env)->GetArrayLength(env, update_fulfill_htlcs_arg);
60020         if (update_fulfill_htlcs_arg_constr.datalen > 0)
60021                 update_fulfill_htlcs_arg_constr.data = MALLOC(update_fulfill_htlcs_arg_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
60022         else
60023                 update_fulfill_htlcs_arg_constr.data = NULL;
60024         int64_t* update_fulfill_htlcs_arg_vals = (*env)->GetLongArrayElements (env, update_fulfill_htlcs_arg, NULL);
60025         for (size_t t = 0; t < update_fulfill_htlcs_arg_constr.datalen; t++) {
60026                 int64_t update_fulfill_htlcs_arg_conv_19 = update_fulfill_htlcs_arg_vals[t];
60027                 LDKUpdateFulfillHTLC update_fulfill_htlcs_arg_conv_19_conv;
60028                 update_fulfill_htlcs_arg_conv_19_conv.inner = untag_ptr(update_fulfill_htlcs_arg_conv_19);
60029                 update_fulfill_htlcs_arg_conv_19_conv.is_owned = ptr_is_owned(update_fulfill_htlcs_arg_conv_19);
60030                 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fulfill_htlcs_arg_conv_19_conv);
60031                 update_fulfill_htlcs_arg_conv_19_conv = UpdateFulfillHTLC_clone(&update_fulfill_htlcs_arg_conv_19_conv);
60032                 update_fulfill_htlcs_arg_constr.data[t] = update_fulfill_htlcs_arg_conv_19_conv;
60033         }
60034         (*env)->ReleaseLongArrayElements(env, update_fulfill_htlcs_arg, update_fulfill_htlcs_arg_vals, 0);
60035         LDKCVec_UpdateFailHTLCZ update_fail_htlcs_arg_constr;
60036         update_fail_htlcs_arg_constr.datalen = (*env)->GetArrayLength(env, update_fail_htlcs_arg);
60037         if (update_fail_htlcs_arg_constr.datalen > 0)
60038                 update_fail_htlcs_arg_constr.data = MALLOC(update_fail_htlcs_arg_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
60039         else
60040                 update_fail_htlcs_arg_constr.data = NULL;
60041         int64_t* update_fail_htlcs_arg_vals = (*env)->GetLongArrayElements (env, update_fail_htlcs_arg, NULL);
60042         for (size_t q = 0; q < update_fail_htlcs_arg_constr.datalen; q++) {
60043                 int64_t update_fail_htlcs_arg_conv_16 = update_fail_htlcs_arg_vals[q];
60044                 LDKUpdateFailHTLC update_fail_htlcs_arg_conv_16_conv;
60045                 update_fail_htlcs_arg_conv_16_conv.inner = untag_ptr(update_fail_htlcs_arg_conv_16);
60046                 update_fail_htlcs_arg_conv_16_conv.is_owned = ptr_is_owned(update_fail_htlcs_arg_conv_16);
60047                 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fail_htlcs_arg_conv_16_conv);
60048                 update_fail_htlcs_arg_conv_16_conv = UpdateFailHTLC_clone(&update_fail_htlcs_arg_conv_16_conv);
60049                 update_fail_htlcs_arg_constr.data[q] = update_fail_htlcs_arg_conv_16_conv;
60050         }
60051         (*env)->ReleaseLongArrayElements(env, update_fail_htlcs_arg, update_fail_htlcs_arg_vals, 0);
60052         LDKCVec_UpdateFailMalformedHTLCZ update_fail_malformed_htlcs_arg_constr;
60053         update_fail_malformed_htlcs_arg_constr.datalen = (*env)->GetArrayLength(env, update_fail_malformed_htlcs_arg);
60054         if (update_fail_malformed_htlcs_arg_constr.datalen > 0)
60055                 update_fail_malformed_htlcs_arg_constr.data = MALLOC(update_fail_malformed_htlcs_arg_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
60056         else
60057                 update_fail_malformed_htlcs_arg_constr.data = NULL;
60058         int64_t* update_fail_malformed_htlcs_arg_vals = (*env)->GetLongArrayElements (env, update_fail_malformed_htlcs_arg, NULL);
60059         for (size_t z = 0; z < update_fail_malformed_htlcs_arg_constr.datalen; z++) {
60060                 int64_t update_fail_malformed_htlcs_arg_conv_25 = update_fail_malformed_htlcs_arg_vals[z];
60061                 LDKUpdateFailMalformedHTLC update_fail_malformed_htlcs_arg_conv_25_conv;
60062                 update_fail_malformed_htlcs_arg_conv_25_conv.inner = untag_ptr(update_fail_malformed_htlcs_arg_conv_25);
60063                 update_fail_malformed_htlcs_arg_conv_25_conv.is_owned = ptr_is_owned(update_fail_malformed_htlcs_arg_conv_25);
60064                 CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fail_malformed_htlcs_arg_conv_25_conv);
60065                 update_fail_malformed_htlcs_arg_conv_25_conv = UpdateFailMalformedHTLC_clone(&update_fail_malformed_htlcs_arg_conv_25_conv);
60066                 update_fail_malformed_htlcs_arg_constr.data[z] = update_fail_malformed_htlcs_arg_conv_25_conv;
60067         }
60068         (*env)->ReleaseLongArrayElements(env, update_fail_malformed_htlcs_arg, update_fail_malformed_htlcs_arg_vals, 0);
60069         LDKUpdateFee update_fee_arg_conv;
60070         update_fee_arg_conv.inner = untag_ptr(update_fee_arg);
60071         update_fee_arg_conv.is_owned = ptr_is_owned(update_fee_arg);
60072         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_fee_arg_conv);
60073         update_fee_arg_conv = UpdateFee_clone(&update_fee_arg_conv);
60074         LDKCommitmentSigned commitment_signed_arg_conv;
60075         commitment_signed_arg_conv.inner = untag_ptr(commitment_signed_arg);
60076         commitment_signed_arg_conv.is_owned = ptr_is_owned(commitment_signed_arg);
60077         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_signed_arg_conv);
60078         commitment_signed_arg_conv = CommitmentSigned_clone(&commitment_signed_arg_conv);
60079         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);
60080         int64_t ret_ref = 0;
60081         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60082         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60083         return ret_ref;
60084 }
60085
60086 static inline uint64_t CommitmentUpdate_clone_ptr(LDKCommitmentUpdate *NONNULL_PTR arg) {
60087         LDKCommitmentUpdate ret_var = CommitmentUpdate_clone(arg);
60088         int64_t ret_ref = 0;
60089         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60090         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60091         return ret_ref;
60092 }
60093 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
60094         LDKCommitmentUpdate arg_conv;
60095         arg_conv.inner = untag_ptr(arg);
60096         arg_conv.is_owned = ptr_is_owned(arg);
60097         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
60098         arg_conv.is_owned = false;
60099         int64_t ret_conv = CommitmentUpdate_clone_ptr(&arg_conv);
60100         return ret_conv;
60101 }
60102
60103 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
60104         LDKCommitmentUpdate orig_conv;
60105         orig_conv.inner = untag_ptr(orig);
60106         orig_conv.is_owned = ptr_is_owned(orig);
60107         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
60108         orig_conv.is_owned = false;
60109         LDKCommitmentUpdate ret_var = CommitmentUpdate_clone(&orig_conv);
60110         int64_t ret_ref = 0;
60111         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60112         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60113         return ret_ref;
60114 }
60115
60116 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1hash(JNIEnv *env, jclass clz, int64_t o) {
60117         LDKCommitmentUpdate o_conv;
60118         o_conv.inner = untag_ptr(o);
60119         o_conv.is_owned = ptr_is_owned(o);
60120         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
60121         o_conv.is_owned = false;
60122         int64_t ret_conv = CommitmentUpdate_hash(&o_conv);
60123         return ret_conv;
60124 }
60125
60126 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
60127         LDKCommitmentUpdate a_conv;
60128         a_conv.inner = untag_ptr(a);
60129         a_conv.is_owned = ptr_is_owned(a);
60130         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
60131         a_conv.is_owned = false;
60132         LDKCommitmentUpdate b_conv;
60133         b_conv.inner = untag_ptr(b);
60134         b_conv.is_owned = ptr_is_owned(b);
60135         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
60136         b_conv.is_owned = false;
60137         jboolean ret_conv = CommitmentUpdate_eq(&a_conv, &b_conv);
60138         return ret_conv;
60139 }
60140
60141 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
60142         if (!ptr_is_owned(this_ptr)) return;
60143         void* this_ptr_ptr = untag_ptr(this_ptr);
60144         CHECK_ACCESS(this_ptr_ptr);
60145         LDKChannelMessageHandler this_ptr_conv = *(LDKChannelMessageHandler*)(this_ptr_ptr);
60146         FREE(untag_ptr(this_ptr));
60147         ChannelMessageHandler_free(this_ptr_conv);
60148 }
60149
60150 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
60151         if (!ptr_is_owned(this_ptr)) return;
60152         void* this_ptr_ptr = untag_ptr(this_ptr);
60153         CHECK_ACCESS(this_ptr_ptr);
60154         LDKRoutingMessageHandler this_ptr_conv = *(LDKRoutingMessageHandler*)(this_ptr_ptr);
60155         FREE(untag_ptr(this_ptr));
60156         RoutingMessageHandler_free(this_ptr_conv);
60157 }
60158
60159 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OnionMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
60160         if (!ptr_is_owned(this_ptr)) return;
60161         void* this_ptr_ptr = untag_ptr(this_ptr);
60162         CHECK_ACCESS(this_ptr_ptr);
60163         LDKOnionMessageHandler this_ptr_conv = *(LDKOnionMessageHandler*)(this_ptr_ptr);
60164         FREE(untag_ptr(this_ptr));
60165         OnionMessageHandler_free(this_ptr_conv);
60166 }
60167
60168 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FinalOnionHopData_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
60169         LDKFinalOnionHopData this_obj_conv;
60170         this_obj_conv.inner = untag_ptr(this_obj);
60171         this_obj_conv.is_owned = ptr_is_owned(this_obj);
60172         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
60173         FinalOnionHopData_free(this_obj_conv);
60174 }
60175
60176 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FinalOnionHopData_1get_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_ptr) {
60177         LDKFinalOnionHopData this_ptr_conv;
60178         this_ptr_conv.inner = untag_ptr(this_ptr);
60179         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60180         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60181         this_ptr_conv.is_owned = false;
60182         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
60183         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *FinalOnionHopData_get_payment_secret(&this_ptr_conv));
60184         return ret_arr;
60185 }
60186
60187 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FinalOnionHopData_1set_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
60188         LDKFinalOnionHopData this_ptr_conv;
60189         this_ptr_conv.inner = untag_ptr(this_ptr);
60190         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60191         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60192         this_ptr_conv.is_owned = false;
60193         LDKThirtyTwoBytes val_ref;
60194         CHECK((*env)->GetArrayLength(env, val) == 32);
60195         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
60196         FinalOnionHopData_set_payment_secret(&this_ptr_conv, val_ref);
60197 }
60198
60199 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FinalOnionHopData_1get_1total_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
60200         LDKFinalOnionHopData this_ptr_conv;
60201         this_ptr_conv.inner = untag_ptr(this_ptr);
60202         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60203         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60204         this_ptr_conv.is_owned = false;
60205         int64_t ret_conv = FinalOnionHopData_get_total_msat(&this_ptr_conv);
60206         return ret_conv;
60207 }
60208
60209 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FinalOnionHopData_1set_1total_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
60210         LDKFinalOnionHopData this_ptr_conv;
60211         this_ptr_conv.inner = untag_ptr(this_ptr);
60212         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60213         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60214         this_ptr_conv.is_owned = false;
60215         FinalOnionHopData_set_total_msat(&this_ptr_conv, val);
60216 }
60217
60218 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) {
60219         LDKThirtyTwoBytes payment_secret_arg_ref;
60220         CHECK((*env)->GetArrayLength(env, payment_secret_arg) == 32);
60221         (*env)->GetByteArrayRegion(env, payment_secret_arg, 0, 32, payment_secret_arg_ref.data);
60222         LDKFinalOnionHopData ret_var = FinalOnionHopData_new(payment_secret_arg_ref, total_msat_arg);
60223         int64_t ret_ref = 0;
60224         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60225         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60226         return ret_ref;
60227 }
60228
60229 static inline uint64_t FinalOnionHopData_clone_ptr(LDKFinalOnionHopData *NONNULL_PTR arg) {
60230         LDKFinalOnionHopData ret_var = FinalOnionHopData_clone(arg);
60231         int64_t ret_ref = 0;
60232         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60233         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60234         return ret_ref;
60235 }
60236 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FinalOnionHopData_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
60237         LDKFinalOnionHopData arg_conv;
60238         arg_conv.inner = untag_ptr(arg);
60239         arg_conv.is_owned = ptr_is_owned(arg);
60240         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
60241         arg_conv.is_owned = false;
60242         int64_t ret_conv = FinalOnionHopData_clone_ptr(&arg_conv);
60243         return ret_conv;
60244 }
60245
60246 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FinalOnionHopData_1clone(JNIEnv *env, jclass clz, int64_t orig) {
60247         LDKFinalOnionHopData orig_conv;
60248         orig_conv.inner = untag_ptr(orig);
60249         orig_conv.is_owned = ptr_is_owned(orig);
60250         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
60251         orig_conv.is_owned = false;
60252         LDKFinalOnionHopData ret_var = FinalOnionHopData_clone(&orig_conv);
60253         int64_t ret_ref = 0;
60254         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60255         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60256         return ret_ref;
60257 }
60258
60259 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OnionPacket_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
60260         LDKOnionPacket this_obj_conv;
60261         this_obj_conv.inner = untag_ptr(this_obj);
60262         this_obj_conv.is_owned = ptr_is_owned(this_obj);
60263         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
60264         OnionPacket_free(this_obj_conv);
60265 }
60266
60267 JNIEXPORT int8_t JNICALL Java_org_ldk_impl_bindings_OnionPacket_1get_1version(JNIEnv *env, jclass clz, int64_t this_ptr) {
60268         LDKOnionPacket this_ptr_conv;
60269         this_ptr_conv.inner = untag_ptr(this_ptr);
60270         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60271         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60272         this_ptr_conv.is_owned = false;
60273         int8_t ret_conv = OnionPacket_get_version(&this_ptr_conv);
60274         return ret_conv;
60275 }
60276
60277 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OnionPacket_1set_1version(JNIEnv *env, jclass clz, int64_t this_ptr, int8_t val) {
60278         LDKOnionPacket this_ptr_conv;
60279         this_ptr_conv.inner = untag_ptr(this_ptr);
60280         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60281         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60282         this_ptr_conv.is_owned = false;
60283         OnionPacket_set_version(&this_ptr_conv, val);
60284 }
60285
60286 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OnionPacket_1get_1public_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
60287         LDKOnionPacket this_ptr_conv;
60288         this_ptr_conv.inner = untag_ptr(this_ptr);
60289         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60290         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60291         this_ptr_conv.is_owned = false;
60292         LDKCResult_PublicKeySecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeySecp256k1ErrorZ), "LDKCResult_PublicKeySecp256k1ErrorZ");
60293         *ret_conv = OnionPacket_get_public_key(&this_ptr_conv);
60294         return tag_ptr(ret_conv, true);
60295 }
60296
60297 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OnionPacket_1set_1public_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
60298         LDKOnionPacket this_ptr_conv;
60299         this_ptr_conv.inner = untag_ptr(this_ptr);
60300         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60301         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60302         this_ptr_conv.is_owned = false;
60303         void* val_ptr = untag_ptr(val);
60304         CHECK_ACCESS(val_ptr);
60305         LDKCResult_PublicKeySecp256k1ErrorZ val_conv = *(LDKCResult_PublicKeySecp256k1ErrorZ*)(val_ptr);
60306         val_conv = CResult_PublicKeySecp256k1ErrorZ_clone((LDKCResult_PublicKeySecp256k1ErrorZ*)untag_ptr(val));
60307         OnionPacket_set_public_key(&this_ptr_conv, val_conv);
60308 }
60309
60310 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OnionPacket_1get_1hmac(JNIEnv *env, jclass clz, int64_t this_ptr) {
60311         LDKOnionPacket this_ptr_conv;
60312         this_ptr_conv.inner = untag_ptr(this_ptr);
60313         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60314         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60315         this_ptr_conv.is_owned = false;
60316         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
60317         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *OnionPacket_get_hmac(&this_ptr_conv));
60318         return ret_arr;
60319 }
60320
60321 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OnionPacket_1set_1hmac(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
60322         LDKOnionPacket this_ptr_conv;
60323         this_ptr_conv.inner = untag_ptr(this_ptr);
60324         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60325         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60326         this_ptr_conv.is_owned = false;
60327         LDKThirtyTwoBytes val_ref;
60328         CHECK((*env)->GetArrayLength(env, val) == 32);
60329         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
60330         OnionPacket_set_hmac(&this_ptr_conv, val_ref);
60331 }
60332
60333 static inline uint64_t OnionPacket_clone_ptr(LDKOnionPacket *NONNULL_PTR arg) {
60334         LDKOnionPacket ret_var = OnionPacket_clone(arg);
60335         int64_t ret_ref = 0;
60336         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60337         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60338         return ret_ref;
60339 }
60340 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OnionPacket_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
60341         LDKOnionPacket arg_conv;
60342         arg_conv.inner = untag_ptr(arg);
60343         arg_conv.is_owned = ptr_is_owned(arg);
60344         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
60345         arg_conv.is_owned = false;
60346         int64_t ret_conv = OnionPacket_clone_ptr(&arg_conv);
60347         return ret_conv;
60348 }
60349
60350 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OnionPacket_1clone(JNIEnv *env, jclass clz, int64_t orig) {
60351         LDKOnionPacket orig_conv;
60352         orig_conv.inner = untag_ptr(orig);
60353         orig_conv.is_owned = ptr_is_owned(orig);
60354         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
60355         orig_conv.is_owned = false;
60356         LDKOnionPacket ret_var = OnionPacket_clone(&orig_conv);
60357         int64_t ret_ref = 0;
60358         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60359         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60360         return ret_ref;
60361 }
60362
60363 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OnionPacket_1hash(JNIEnv *env, jclass clz, int64_t o) {
60364         LDKOnionPacket o_conv;
60365         o_conv.inner = untag_ptr(o);
60366         o_conv.is_owned = ptr_is_owned(o);
60367         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
60368         o_conv.is_owned = false;
60369         int64_t ret_conv = OnionPacket_hash(&o_conv);
60370         return ret_conv;
60371 }
60372
60373 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_OnionPacket_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
60374         LDKOnionPacket a_conv;
60375         a_conv.inner = untag_ptr(a);
60376         a_conv.is_owned = ptr_is_owned(a);
60377         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
60378         a_conv.is_owned = false;
60379         LDKOnionPacket b_conv;
60380         b_conv.inner = untag_ptr(b);
60381         b_conv.is_owned = ptr_is_owned(b);
60382         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
60383         b_conv.is_owned = false;
60384         jboolean ret_conv = OnionPacket_eq(&a_conv, &b_conv);
60385         return ret_conv;
60386 }
60387
60388 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TrampolineOnionPacket_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
60389         LDKTrampolineOnionPacket this_obj_conv;
60390         this_obj_conv.inner = untag_ptr(this_obj);
60391         this_obj_conv.is_owned = ptr_is_owned(this_obj);
60392         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
60393         TrampolineOnionPacket_free(this_obj_conv);
60394 }
60395
60396 JNIEXPORT int8_t JNICALL Java_org_ldk_impl_bindings_TrampolineOnionPacket_1get_1version(JNIEnv *env, jclass clz, int64_t this_ptr) {
60397         LDKTrampolineOnionPacket this_ptr_conv;
60398         this_ptr_conv.inner = untag_ptr(this_ptr);
60399         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60400         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60401         this_ptr_conv.is_owned = false;
60402         int8_t ret_conv = TrampolineOnionPacket_get_version(&this_ptr_conv);
60403         return ret_conv;
60404 }
60405
60406 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TrampolineOnionPacket_1set_1version(JNIEnv *env, jclass clz, int64_t this_ptr, int8_t val) {
60407         LDKTrampolineOnionPacket this_ptr_conv;
60408         this_ptr_conv.inner = untag_ptr(this_ptr);
60409         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60410         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60411         this_ptr_conv.is_owned = false;
60412         TrampolineOnionPacket_set_version(&this_ptr_conv, val);
60413 }
60414
60415 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TrampolineOnionPacket_1get_1public_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
60416         LDKTrampolineOnionPacket this_ptr_conv;
60417         this_ptr_conv.inner = untag_ptr(this_ptr);
60418         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60419         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60420         this_ptr_conv.is_owned = false;
60421         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
60422         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, TrampolineOnionPacket_get_public_key(&this_ptr_conv).compressed_form);
60423         return ret_arr;
60424 }
60425
60426 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TrampolineOnionPacket_1set_1public_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
60427         LDKTrampolineOnionPacket this_ptr_conv;
60428         this_ptr_conv.inner = untag_ptr(this_ptr);
60429         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60430         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60431         this_ptr_conv.is_owned = false;
60432         LDKPublicKey val_ref;
60433         CHECK((*env)->GetArrayLength(env, val) == 33);
60434         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
60435         TrampolineOnionPacket_set_public_key(&this_ptr_conv, val_ref);
60436 }
60437
60438 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TrampolineOnionPacket_1get_1hop_1data(JNIEnv *env, jclass clz, int64_t this_ptr) {
60439         LDKTrampolineOnionPacket this_ptr_conv;
60440         this_ptr_conv.inner = untag_ptr(this_ptr);
60441         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60442         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60443         this_ptr_conv.is_owned = false;
60444         LDKCVec_u8Z ret_var = TrampolineOnionPacket_get_hop_data(&this_ptr_conv);
60445         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
60446         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
60447         CVec_u8Z_free(ret_var);
60448         return ret_arr;
60449 }
60450
60451 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TrampolineOnionPacket_1set_1hop_1data(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
60452         LDKTrampolineOnionPacket this_ptr_conv;
60453         this_ptr_conv.inner = untag_ptr(this_ptr);
60454         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60455         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60456         this_ptr_conv.is_owned = false;
60457         LDKCVec_u8Z val_ref;
60458         val_ref.datalen = (*env)->GetArrayLength(env, val);
60459         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
60460         (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
60461         TrampolineOnionPacket_set_hop_data(&this_ptr_conv, val_ref);
60462 }
60463
60464 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TrampolineOnionPacket_1get_1hmac(JNIEnv *env, jclass clz, int64_t this_ptr) {
60465         LDKTrampolineOnionPacket this_ptr_conv;
60466         this_ptr_conv.inner = untag_ptr(this_ptr);
60467         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60468         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60469         this_ptr_conv.is_owned = false;
60470         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
60471         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *TrampolineOnionPacket_get_hmac(&this_ptr_conv));
60472         return ret_arr;
60473 }
60474
60475 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TrampolineOnionPacket_1set_1hmac(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
60476         LDKTrampolineOnionPacket this_ptr_conv;
60477         this_ptr_conv.inner = untag_ptr(this_ptr);
60478         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
60479         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
60480         this_ptr_conv.is_owned = false;
60481         LDKThirtyTwoBytes val_ref;
60482         CHECK((*env)->GetArrayLength(env, val) == 32);
60483         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
60484         TrampolineOnionPacket_set_hmac(&this_ptr_conv, val_ref);
60485 }
60486
60487 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TrampolineOnionPacket_1new(JNIEnv *env, jclass clz, int8_t version_arg, int8_tArray public_key_arg, int8_tArray hop_data_arg, int8_tArray hmac_arg) {
60488         LDKPublicKey public_key_arg_ref;
60489         CHECK((*env)->GetArrayLength(env, public_key_arg) == 33);
60490         (*env)->GetByteArrayRegion(env, public_key_arg, 0, 33, public_key_arg_ref.compressed_form);
60491         LDKCVec_u8Z hop_data_arg_ref;
60492         hop_data_arg_ref.datalen = (*env)->GetArrayLength(env, hop_data_arg);
60493         hop_data_arg_ref.data = MALLOC(hop_data_arg_ref.datalen, "LDKCVec_u8Z Bytes");
60494         (*env)->GetByteArrayRegion(env, hop_data_arg, 0, hop_data_arg_ref.datalen, hop_data_arg_ref.data);
60495         LDKThirtyTwoBytes hmac_arg_ref;
60496         CHECK((*env)->GetArrayLength(env, hmac_arg) == 32);
60497         (*env)->GetByteArrayRegion(env, hmac_arg, 0, 32, hmac_arg_ref.data);
60498         LDKTrampolineOnionPacket ret_var = TrampolineOnionPacket_new(version_arg, public_key_arg_ref, hop_data_arg_ref, hmac_arg_ref);
60499         int64_t ret_ref = 0;
60500         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60501         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60502         return ret_ref;
60503 }
60504
60505 static inline uint64_t TrampolineOnionPacket_clone_ptr(LDKTrampolineOnionPacket *NONNULL_PTR arg) {
60506         LDKTrampolineOnionPacket ret_var = TrampolineOnionPacket_clone(arg);
60507         int64_t ret_ref = 0;
60508         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60509         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60510         return ret_ref;
60511 }
60512 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TrampolineOnionPacket_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
60513         LDKTrampolineOnionPacket arg_conv;
60514         arg_conv.inner = untag_ptr(arg);
60515         arg_conv.is_owned = ptr_is_owned(arg);
60516         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
60517         arg_conv.is_owned = false;
60518         int64_t ret_conv = TrampolineOnionPacket_clone_ptr(&arg_conv);
60519         return ret_conv;
60520 }
60521
60522 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TrampolineOnionPacket_1clone(JNIEnv *env, jclass clz, int64_t orig) {
60523         LDKTrampolineOnionPacket orig_conv;
60524         orig_conv.inner = untag_ptr(orig);
60525         orig_conv.is_owned = ptr_is_owned(orig);
60526         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
60527         orig_conv.is_owned = false;
60528         LDKTrampolineOnionPacket ret_var = TrampolineOnionPacket_clone(&orig_conv);
60529         int64_t ret_ref = 0;
60530         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
60531         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
60532         return ret_ref;
60533 }
60534
60535 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TrampolineOnionPacket_1hash(JNIEnv *env, jclass clz, int64_t o) {
60536         LDKTrampolineOnionPacket o_conv;
60537         o_conv.inner = untag_ptr(o);
60538         o_conv.is_owned = ptr_is_owned(o);
60539         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
60540         o_conv.is_owned = false;
60541         int64_t ret_conv = TrampolineOnionPacket_hash(&o_conv);
60542         return ret_conv;
60543 }
60544
60545 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_TrampolineOnionPacket_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
60546         LDKTrampolineOnionPacket a_conv;
60547         a_conv.inner = untag_ptr(a);
60548         a_conv.is_owned = ptr_is_owned(a);
60549         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
60550         a_conv.is_owned = false;
60551         LDKTrampolineOnionPacket b_conv;
60552         b_conv.inner = untag_ptr(b);
60553         b_conv.is_owned = ptr_is_owned(b);
60554         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
60555         b_conv.is_owned = false;
60556         jboolean ret_conv = TrampolineOnionPacket_eq(&a_conv, &b_conv);
60557         return ret_conv;
60558 }
60559
60560 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TrampolineOnionPacket_1write(JNIEnv *env, jclass clz, int64_t obj) {
60561         LDKTrampolineOnionPacket obj_conv;
60562         obj_conv.inner = untag_ptr(obj);
60563         obj_conv.is_owned = ptr_is_owned(obj);
60564         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
60565         obj_conv.is_owned = false;
60566         LDKCVec_u8Z ret_var = TrampolineOnionPacket_write(&obj_conv);
60567         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
60568         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
60569         CVec_u8Z_free(ret_var);
60570         return ret_arr;
60571 }
60572
60573 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1write(JNIEnv *env, jclass clz, int64_t obj) {
60574         LDKAcceptChannel obj_conv;
60575         obj_conv.inner = untag_ptr(obj);
60576         obj_conv.is_owned = ptr_is_owned(obj);
60577         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
60578         obj_conv.is_owned = false;
60579         LDKCVec_u8Z ret_var = AcceptChannel_write(&obj_conv);
60580         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
60581         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
60582         CVec_u8Z_free(ret_var);
60583         return ret_arr;
60584 }
60585
60586 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
60587         LDKu8slice ser_ref;
60588         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
60589         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
60590         LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
60591         *ret_conv = AcceptChannel_read(ser_ref);
60592         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
60593         return tag_ptr(ret_conv, true);
60594 }
60595
60596 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1write(JNIEnv *env, jclass clz, int64_t obj) {
60597         LDKAcceptChannelV2 obj_conv;
60598         obj_conv.inner = untag_ptr(obj);
60599         obj_conv.is_owned = ptr_is_owned(obj);
60600         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
60601         obj_conv.is_owned = false;
60602         LDKCVec_u8Z ret_var = AcceptChannelV2_write(&obj_conv);
60603         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
60604         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
60605         CVec_u8Z_free(ret_var);
60606         return ret_arr;
60607 }
60608
60609 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannelV2_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
60610         LDKu8slice ser_ref;
60611         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
60612         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
60613         LDKCResult_AcceptChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelV2DecodeErrorZ), "LDKCResult_AcceptChannelV2DecodeErrorZ");
60614         *ret_conv = AcceptChannelV2_read(ser_ref);
60615         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
60616         return tag_ptr(ret_conv, true);
60617 }
60618
60619 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Stfu_1write(JNIEnv *env, jclass clz, int64_t obj) {
60620         LDKStfu obj_conv;
60621         obj_conv.inner = untag_ptr(obj);
60622         obj_conv.is_owned = ptr_is_owned(obj);
60623         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
60624         obj_conv.is_owned = false;
60625         LDKCVec_u8Z ret_var = Stfu_write(&obj_conv);
60626         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
60627         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
60628         CVec_u8Z_free(ret_var);
60629         return ret_arr;
60630 }
60631
60632 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Stfu_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
60633         LDKu8slice ser_ref;
60634         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
60635         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
60636         LDKCResult_StfuDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StfuDecodeErrorZ), "LDKCResult_StfuDecodeErrorZ");
60637         *ret_conv = Stfu_read(ser_ref);
60638         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
60639         return tag_ptr(ret_conv, true);
60640 }
60641
60642 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Splice_1write(JNIEnv *env, jclass clz, int64_t obj) {
60643         LDKSplice obj_conv;
60644         obj_conv.inner = untag_ptr(obj);
60645         obj_conv.is_owned = ptr_is_owned(obj);
60646         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
60647         obj_conv.is_owned = false;
60648         LDKCVec_u8Z ret_var = Splice_write(&obj_conv);
60649         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
60650         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
60651         CVec_u8Z_free(ret_var);
60652         return ret_arr;
60653 }
60654
60655 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Splice_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
60656         LDKu8slice ser_ref;
60657         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
60658         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
60659         LDKCResult_SpliceDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpliceDecodeErrorZ), "LDKCResult_SpliceDecodeErrorZ");
60660         *ret_conv = Splice_read(ser_ref);
60661         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
60662         return tag_ptr(ret_conv, true);
60663 }
60664
60665 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_SpliceAck_1write(JNIEnv *env, jclass clz, int64_t obj) {
60666         LDKSpliceAck obj_conv;
60667         obj_conv.inner = untag_ptr(obj);
60668         obj_conv.is_owned = ptr_is_owned(obj);
60669         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
60670         obj_conv.is_owned = false;
60671         LDKCVec_u8Z ret_var = SpliceAck_write(&obj_conv);
60672         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
60673         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
60674         CVec_u8Z_free(ret_var);
60675         return ret_arr;
60676 }
60677
60678 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpliceAck_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
60679         LDKu8slice ser_ref;
60680         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
60681         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
60682         LDKCResult_SpliceAckDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpliceAckDecodeErrorZ), "LDKCResult_SpliceAckDecodeErrorZ");
60683         *ret_conv = SpliceAck_read(ser_ref);
60684         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
60685         return tag_ptr(ret_conv, true);
60686 }
60687
60688 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_SpliceLocked_1write(JNIEnv *env, jclass clz, int64_t obj) {
60689         LDKSpliceLocked obj_conv;
60690         obj_conv.inner = untag_ptr(obj);
60691         obj_conv.is_owned = ptr_is_owned(obj);
60692         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
60693         obj_conv.is_owned = false;
60694         LDKCVec_u8Z ret_var = SpliceLocked_write(&obj_conv);
60695         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
60696         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
60697         CVec_u8Z_free(ret_var);
60698         return ret_arr;
60699 }
60700
60701 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpliceLocked_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
60702         LDKu8slice ser_ref;
60703         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
60704         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
60705         LDKCResult_SpliceLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpliceLockedDecodeErrorZ), "LDKCResult_SpliceLockedDecodeErrorZ");
60706         *ret_conv = SpliceLocked_read(ser_ref);
60707         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
60708         return tag_ptr(ret_conv, true);
60709 }
60710
60711 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxAddInput_1write(JNIEnv *env, jclass clz, int64_t obj) {
60712         LDKTxAddInput obj_conv;
60713         obj_conv.inner = untag_ptr(obj);
60714         obj_conv.is_owned = ptr_is_owned(obj);
60715         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
60716         obj_conv.is_owned = false;
60717         LDKCVec_u8Z ret_var = TxAddInput_write(&obj_conv);
60718         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
60719         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
60720         CVec_u8Z_free(ret_var);
60721         return ret_arr;
60722 }
60723
60724 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxAddInput_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
60725         LDKu8slice ser_ref;
60726         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
60727         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
60728         LDKCResult_TxAddInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddInputDecodeErrorZ), "LDKCResult_TxAddInputDecodeErrorZ");
60729         *ret_conv = TxAddInput_read(ser_ref);
60730         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
60731         return tag_ptr(ret_conv, true);
60732 }
60733
60734 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxAddOutput_1write(JNIEnv *env, jclass clz, int64_t obj) {
60735         LDKTxAddOutput obj_conv;
60736         obj_conv.inner = untag_ptr(obj);
60737         obj_conv.is_owned = ptr_is_owned(obj);
60738         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
60739         obj_conv.is_owned = false;
60740         LDKCVec_u8Z ret_var = TxAddOutput_write(&obj_conv);
60741         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
60742         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
60743         CVec_u8Z_free(ret_var);
60744         return ret_arr;
60745 }
60746
60747 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxAddOutput_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
60748         LDKu8slice ser_ref;
60749         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
60750         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
60751         LDKCResult_TxAddOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAddOutputDecodeErrorZ), "LDKCResult_TxAddOutputDecodeErrorZ");
60752         *ret_conv = TxAddOutput_read(ser_ref);
60753         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
60754         return tag_ptr(ret_conv, true);
60755 }
60756
60757 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxRemoveInput_1write(JNIEnv *env, jclass clz, int64_t obj) {
60758         LDKTxRemoveInput obj_conv;
60759         obj_conv.inner = untag_ptr(obj);
60760         obj_conv.is_owned = ptr_is_owned(obj);
60761         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
60762         obj_conv.is_owned = false;
60763         LDKCVec_u8Z ret_var = TxRemoveInput_write(&obj_conv);
60764         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
60765         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
60766         CVec_u8Z_free(ret_var);
60767         return ret_arr;
60768 }
60769
60770 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxRemoveInput_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
60771         LDKu8slice ser_ref;
60772         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
60773         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
60774         LDKCResult_TxRemoveInputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveInputDecodeErrorZ), "LDKCResult_TxRemoveInputDecodeErrorZ");
60775         *ret_conv = TxRemoveInput_read(ser_ref);
60776         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
60777         return tag_ptr(ret_conv, true);
60778 }
60779
60780 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxRemoveOutput_1write(JNIEnv *env, jclass clz, int64_t obj) {
60781         LDKTxRemoveOutput obj_conv;
60782         obj_conv.inner = untag_ptr(obj);
60783         obj_conv.is_owned = ptr_is_owned(obj);
60784         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
60785         obj_conv.is_owned = false;
60786         LDKCVec_u8Z ret_var = TxRemoveOutput_write(&obj_conv);
60787         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
60788         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
60789         CVec_u8Z_free(ret_var);
60790         return ret_arr;
60791 }
60792
60793 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxRemoveOutput_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
60794         LDKu8slice ser_ref;
60795         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
60796         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
60797         LDKCResult_TxRemoveOutputDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxRemoveOutputDecodeErrorZ), "LDKCResult_TxRemoveOutputDecodeErrorZ");
60798         *ret_conv = TxRemoveOutput_read(ser_ref);
60799         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
60800         return tag_ptr(ret_conv, true);
60801 }
60802
60803 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxComplete_1write(JNIEnv *env, jclass clz, int64_t obj) {
60804         LDKTxComplete obj_conv;
60805         obj_conv.inner = untag_ptr(obj);
60806         obj_conv.is_owned = ptr_is_owned(obj);
60807         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
60808         obj_conv.is_owned = false;
60809         LDKCVec_u8Z ret_var = TxComplete_write(&obj_conv);
60810         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
60811         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
60812         CVec_u8Z_free(ret_var);
60813         return ret_arr;
60814 }
60815
60816 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxComplete_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
60817         LDKu8slice ser_ref;
60818         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
60819         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
60820         LDKCResult_TxCompleteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCompleteDecodeErrorZ), "LDKCResult_TxCompleteDecodeErrorZ");
60821         *ret_conv = TxComplete_read(ser_ref);
60822         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
60823         return tag_ptr(ret_conv, true);
60824 }
60825
60826 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxSignatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
60827         LDKTxSignatures obj_conv;
60828         obj_conv.inner = untag_ptr(obj);
60829         obj_conv.is_owned = ptr_is_owned(obj);
60830         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
60831         obj_conv.is_owned = false;
60832         LDKCVec_u8Z ret_var = TxSignatures_write(&obj_conv);
60833         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
60834         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
60835         CVec_u8Z_free(ret_var);
60836         return ret_arr;
60837 }
60838
60839 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxSignatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
60840         LDKu8slice ser_ref;
60841         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
60842         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
60843         LDKCResult_TxSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxSignaturesDecodeErrorZ), "LDKCResult_TxSignaturesDecodeErrorZ");
60844         *ret_conv = TxSignatures_read(ser_ref);
60845         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
60846         return tag_ptr(ret_conv, true);
60847 }
60848
60849 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxInitRbf_1write(JNIEnv *env, jclass clz, int64_t obj) {
60850         LDKTxInitRbf obj_conv;
60851         obj_conv.inner = untag_ptr(obj);
60852         obj_conv.is_owned = ptr_is_owned(obj);
60853         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
60854         obj_conv.is_owned = false;
60855         LDKCVec_u8Z ret_var = TxInitRbf_write(&obj_conv);
60856         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
60857         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
60858         CVec_u8Z_free(ret_var);
60859         return ret_arr;
60860 }
60861
60862 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxInitRbf_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
60863         LDKu8slice ser_ref;
60864         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
60865         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
60866         LDKCResult_TxInitRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxInitRbfDecodeErrorZ), "LDKCResult_TxInitRbfDecodeErrorZ");
60867         *ret_conv = TxInitRbf_read(ser_ref);
60868         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
60869         return tag_ptr(ret_conv, true);
60870 }
60871
60872 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxAckRbf_1write(JNIEnv *env, jclass clz, int64_t obj) {
60873         LDKTxAckRbf obj_conv;
60874         obj_conv.inner = untag_ptr(obj);
60875         obj_conv.is_owned = ptr_is_owned(obj);
60876         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
60877         obj_conv.is_owned = false;
60878         LDKCVec_u8Z ret_var = TxAckRbf_write(&obj_conv);
60879         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
60880         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
60881         CVec_u8Z_free(ret_var);
60882         return ret_arr;
60883 }
60884
60885 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxAckRbf_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
60886         LDKu8slice ser_ref;
60887         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
60888         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
60889         LDKCResult_TxAckRbfDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAckRbfDecodeErrorZ), "LDKCResult_TxAckRbfDecodeErrorZ");
60890         *ret_conv = TxAckRbf_read(ser_ref);
60891         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
60892         return tag_ptr(ret_conv, true);
60893 }
60894
60895 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxAbort_1write(JNIEnv *env, jclass clz, int64_t obj) {
60896         LDKTxAbort obj_conv;
60897         obj_conv.inner = untag_ptr(obj);
60898         obj_conv.is_owned = ptr_is_owned(obj);
60899         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
60900         obj_conv.is_owned = false;
60901         LDKCVec_u8Z ret_var = TxAbort_write(&obj_conv);
60902         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
60903         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
60904         CVec_u8Z_free(ret_var);
60905         return ret_arr;
60906 }
60907
60908 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxAbort_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
60909         LDKu8slice ser_ref;
60910         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
60911         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
60912         LDKCResult_TxAbortDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxAbortDecodeErrorZ), "LDKCResult_TxAbortDecodeErrorZ");
60913         *ret_conv = TxAbort_read(ser_ref);
60914         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
60915         return tag_ptr(ret_conv, true);
60916 }
60917
60918 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
60919         LDKAnnouncementSignatures obj_conv;
60920         obj_conv.inner = untag_ptr(obj);
60921         obj_conv.is_owned = ptr_is_owned(obj);
60922         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
60923         obj_conv.is_owned = false;
60924         LDKCVec_u8Z ret_var = AnnouncementSignatures_write(&obj_conv);
60925         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
60926         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
60927         CVec_u8Z_free(ret_var);
60928         return ret_arr;
60929 }
60930
60931 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
60932         LDKu8slice ser_ref;
60933         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
60934         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
60935         LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
60936         *ret_conv = AnnouncementSignatures_read(ser_ref);
60937         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
60938         return tag_ptr(ret_conv, true);
60939 }
60940
60941 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1write(JNIEnv *env, jclass clz, int64_t obj) {
60942         LDKChannelReestablish obj_conv;
60943         obj_conv.inner = untag_ptr(obj);
60944         obj_conv.is_owned = ptr_is_owned(obj);
60945         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
60946         obj_conv.is_owned = false;
60947         LDKCVec_u8Z ret_var = ChannelReestablish_write(&obj_conv);
60948         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
60949         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
60950         CVec_u8Z_free(ret_var);
60951         return ret_arr;
60952 }
60953
60954 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
60955         LDKu8slice ser_ref;
60956         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
60957         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
60958         LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
60959         *ret_conv = ChannelReestablish_read(ser_ref);
60960         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
60961         return tag_ptr(ret_conv, true);
60962 }
60963
60964 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1write(JNIEnv *env, jclass clz, int64_t obj) {
60965         LDKClosingSigned obj_conv;
60966         obj_conv.inner = untag_ptr(obj);
60967         obj_conv.is_owned = ptr_is_owned(obj);
60968         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
60969         obj_conv.is_owned = false;
60970         LDKCVec_u8Z ret_var = ClosingSigned_write(&obj_conv);
60971         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
60972         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
60973         CVec_u8Z_free(ret_var);
60974         return ret_arr;
60975 }
60976
60977 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
60978         LDKu8slice ser_ref;
60979         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
60980         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
60981         LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
60982         *ret_conv = ClosingSigned_read(ser_ref);
60983         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
60984         return tag_ptr(ret_conv, true);
60985 }
60986
60987 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1write(JNIEnv *env, jclass clz, int64_t obj) {
60988         LDKClosingSignedFeeRange obj_conv;
60989         obj_conv.inner = untag_ptr(obj);
60990         obj_conv.is_owned = ptr_is_owned(obj);
60991         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
60992         obj_conv.is_owned = false;
60993         LDKCVec_u8Z ret_var = ClosingSignedFeeRange_write(&obj_conv);
60994         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
60995         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
60996         CVec_u8Z_free(ret_var);
60997         return ret_arr;
60998 }
60999
61000 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
61001         LDKu8slice ser_ref;
61002         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
61003         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
61004         LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
61005         *ret_conv = ClosingSignedFeeRange_read(ser_ref);
61006         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
61007         return tag_ptr(ret_conv, true);
61008 }
61009
61010 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1write(JNIEnv *env, jclass clz, int64_t obj) {
61011         LDKCommitmentSigned obj_conv;
61012         obj_conv.inner = untag_ptr(obj);
61013         obj_conv.is_owned = ptr_is_owned(obj);
61014         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
61015         obj_conv.is_owned = false;
61016         LDKCVec_u8Z ret_var = CommitmentSigned_write(&obj_conv);
61017         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
61018         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
61019         CVec_u8Z_free(ret_var);
61020         return ret_arr;
61021 }
61022
61023 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
61024         LDKu8slice ser_ref;
61025         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
61026         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
61027         LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
61028         *ret_conv = CommitmentSigned_read(ser_ref);
61029         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
61030         return tag_ptr(ret_conv, true);
61031 }
61032
61033 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1write(JNIEnv *env, jclass clz, int64_t obj) {
61034         LDKFundingCreated obj_conv;
61035         obj_conv.inner = untag_ptr(obj);
61036         obj_conv.is_owned = ptr_is_owned(obj);
61037         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
61038         obj_conv.is_owned = false;
61039         LDKCVec_u8Z ret_var = FundingCreated_write(&obj_conv);
61040         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
61041         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
61042         CVec_u8Z_free(ret_var);
61043         return ret_arr;
61044 }
61045
61046 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingCreated_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
61047         LDKu8slice ser_ref;
61048         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
61049         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
61050         LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
61051         *ret_conv = FundingCreated_read(ser_ref);
61052         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
61053         return tag_ptr(ret_conv, true);
61054 }
61055
61056 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingSigned_1write(JNIEnv *env, jclass clz, int64_t obj) {
61057         LDKFundingSigned obj_conv;
61058         obj_conv.inner = untag_ptr(obj);
61059         obj_conv.is_owned = ptr_is_owned(obj);
61060         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
61061         obj_conv.is_owned = false;
61062         LDKCVec_u8Z ret_var = FundingSigned_write(&obj_conv);
61063         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
61064         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
61065         CVec_u8Z_free(ret_var);
61066         return ret_arr;
61067 }
61068
61069 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingSigned_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
61070         LDKu8slice ser_ref;
61071         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
61072         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
61073         LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
61074         *ret_conv = FundingSigned_read(ser_ref);
61075         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
61076         return tag_ptr(ret_conv, true);
61077 }
61078
61079 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelReady_1write(JNIEnv *env, jclass clz, int64_t obj) {
61080         LDKChannelReady obj_conv;
61081         obj_conv.inner = untag_ptr(obj);
61082         obj_conv.is_owned = ptr_is_owned(obj);
61083         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
61084         obj_conv.is_owned = false;
61085         LDKCVec_u8Z ret_var = ChannelReady_write(&obj_conv);
61086         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
61087         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
61088         CVec_u8Z_free(ret_var);
61089         return ret_arr;
61090 }
61091
61092 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReady_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
61093         LDKu8slice ser_ref;
61094         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
61095         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
61096         LDKCResult_ChannelReadyDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReadyDecodeErrorZ), "LDKCResult_ChannelReadyDecodeErrorZ");
61097         *ret_conv = ChannelReady_read(ser_ref);
61098         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
61099         return tag_ptr(ret_conv, true);
61100 }
61101
61102 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Init_1write(JNIEnv *env, jclass clz, int64_t obj) {
61103         LDKInit obj_conv;
61104         obj_conv.inner = untag_ptr(obj);
61105         obj_conv.is_owned = ptr_is_owned(obj);
61106         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
61107         obj_conv.is_owned = false;
61108         LDKCVec_u8Z ret_var = Init_write(&obj_conv);
61109         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
61110         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
61111         CVec_u8Z_free(ret_var);
61112         return ret_arr;
61113 }
61114
61115 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Init_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
61116         LDKu8slice ser_ref;
61117         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
61118         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
61119         LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
61120         *ret_conv = Init_read(ser_ref);
61121         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
61122         return tag_ptr(ret_conv, true);
61123 }
61124
61125 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1write(JNIEnv *env, jclass clz, int64_t obj) {
61126         LDKOpenChannel obj_conv;
61127         obj_conv.inner = untag_ptr(obj);
61128         obj_conv.is_owned = ptr_is_owned(obj);
61129         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
61130         obj_conv.is_owned = false;
61131         LDKCVec_u8Z ret_var = OpenChannel_write(&obj_conv);
61132         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
61133         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
61134         CVec_u8Z_free(ret_var);
61135         return ret_arr;
61136 }
61137
61138 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
61139         LDKu8slice ser_ref;
61140         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
61141         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
61142         LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
61143         *ret_conv = OpenChannel_read(ser_ref);
61144         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
61145         return tag_ptr(ret_conv, true);
61146 }
61147
61148 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1write(JNIEnv *env, jclass clz, int64_t obj) {
61149         LDKOpenChannelV2 obj_conv;
61150         obj_conv.inner = untag_ptr(obj);
61151         obj_conv.is_owned = ptr_is_owned(obj);
61152         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
61153         obj_conv.is_owned = false;
61154         LDKCVec_u8Z ret_var = OpenChannelV2_write(&obj_conv);
61155         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
61156         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
61157         CVec_u8Z_free(ret_var);
61158         return ret_arr;
61159 }
61160
61161 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannelV2_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
61162         LDKu8slice ser_ref;
61163         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
61164         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
61165         LDKCResult_OpenChannelV2DecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelV2DecodeErrorZ), "LDKCResult_OpenChannelV2DecodeErrorZ");
61166         *ret_conv = OpenChannelV2_read(ser_ref);
61167         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
61168         return tag_ptr(ret_conv, true);
61169 }
61170
61171 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1write(JNIEnv *env, jclass clz, int64_t obj) {
61172         LDKRevokeAndACK obj_conv;
61173         obj_conv.inner = untag_ptr(obj);
61174         obj_conv.is_owned = ptr_is_owned(obj);
61175         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
61176         obj_conv.is_owned = false;
61177         LDKCVec_u8Z ret_var = RevokeAndACK_write(&obj_conv);
61178         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
61179         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
61180         CVec_u8Z_free(ret_var);
61181         return ret_arr;
61182 }
61183
61184 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
61185         LDKu8slice ser_ref;
61186         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
61187         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
61188         LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
61189         *ret_conv = RevokeAndACK_read(ser_ref);
61190         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
61191         return tag_ptr(ret_conv, true);
61192 }
61193
61194 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Shutdown_1write(JNIEnv *env, jclass clz, int64_t obj) {
61195         LDKShutdown obj_conv;
61196         obj_conv.inner = untag_ptr(obj);
61197         obj_conv.is_owned = ptr_is_owned(obj);
61198         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
61199         obj_conv.is_owned = false;
61200         LDKCVec_u8Z ret_var = Shutdown_write(&obj_conv);
61201         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
61202         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
61203         CVec_u8Z_free(ret_var);
61204         return ret_arr;
61205 }
61206
61207 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Shutdown_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
61208         LDKu8slice ser_ref;
61209         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
61210         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
61211         LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
61212         *ret_conv = Shutdown_read(ser_ref);
61213         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
61214         return tag_ptr(ret_conv, true);
61215 }
61216
61217 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1write(JNIEnv *env, jclass clz, int64_t obj) {
61218         LDKUpdateFailHTLC obj_conv;
61219         obj_conv.inner = untag_ptr(obj);
61220         obj_conv.is_owned = ptr_is_owned(obj);
61221         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
61222         obj_conv.is_owned = false;
61223         LDKCVec_u8Z ret_var = UpdateFailHTLC_write(&obj_conv);
61224         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
61225         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
61226         CVec_u8Z_free(ret_var);
61227         return ret_arr;
61228 }
61229
61230 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
61231         LDKu8slice ser_ref;
61232         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
61233         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
61234         LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
61235         *ret_conv = UpdateFailHTLC_read(ser_ref);
61236         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
61237         return tag_ptr(ret_conv, true);
61238 }
61239
61240 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1write(JNIEnv *env, jclass clz, int64_t obj) {
61241         LDKUpdateFailMalformedHTLC obj_conv;
61242         obj_conv.inner = untag_ptr(obj);
61243         obj_conv.is_owned = ptr_is_owned(obj);
61244         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
61245         obj_conv.is_owned = false;
61246         LDKCVec_u8Z ret_var = UpdateFailMalformedHTLC_write(&obj_conv);
61247         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
61248         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
61249         CVec_u8Z_free(ret_var);
61250         return ret_arr;
61251 }
61252
61253 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
61254         LDKu8slice ser_ref;
61255         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
61256         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
61257         LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
61258         *ret_conv = UpdateFailMalformedHTLC_read(ser_ref);
61259         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
61260         return tag_ptr(ret_conv, true);
61261 }
61262
61263 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFee_1write(JNIEnv *env, jclass clz, int64_t obj) {
61264         LDKUpdateFee obj_conv;
61265         obj_conv.inner = untag_ptr(obj);
61266         obj_conv.is_owned = ptr_is_owned(obj);
61267         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
61268         obj_conv.is_owned = false;
61269         LDKCVec_u8Z ret_var = UpdateFee_write(&obj_conv);
61270         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
61271         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
61272         CVec_u8Z_free(ret_var);
61273         return ret_arr;
61274 }
61275
61276 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFee_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
61277         LDKu8slice ser_ref;
61278         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
61279         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
61280         LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
61281         *ret_conv = UpdateFee_read(ser_ref);
61282         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
61283         return tag_ptr(ret_conv, true);
61284 }
61285
61286 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1write(JNIEnv *env, jclass clz, int64_t obj) {
61287         LDKUpdateFulfillHTLC obj_conv;
61288         obj_conv.inner = untag_ptr(obj);
61289         obj_conv.is_owned = ptr_is_owned(obj);
61290         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
61291         obj_conv.is_owned = false;
61292         LDKCVec_u8Z ret_var = UpdateFulfillHTLC_write(&obj_conv);
61293         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
61294         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
61295         CVec_u8Z_free(ret_var);
61296         return ret_arr;
61297 }
61298
61299 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
61300         LDKu8slice ser_ref;
61301         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
61302         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
61303         LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
61304         *ret_conv = UpdateFulfillHTLC_read(ser_ref);
61305         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
61306         return tag_ptr(ret_conv, true);
61307 }
61308
61309 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OnionPacket_1write(JNIEnv *env, jclass clz, int64_t obj) {
61310         LDKOnionPacket obj_conv;
61311         obj_conv.inner = untag_ptr(obj);
61312         obj_conv.is_owned = ptr_is_owned(obj);
61313         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
61314         obj_conv.is_owned = false;
61315         LDKCVec_u8Z ret_var = OnionPacket_write(&obj_conv);
61316         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
61317         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
61318         CVec_u8Z_free(ret_var);
61319         return ret_arr;
61320 }
61321
61322 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OnionPacket_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
61323         LDKu8slice ser_ref;
61324         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
61325         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
61326         LDKCResult_OnionPacketDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionPacketDecodeErrorZ), "LDKCResult_OnionPacketDecodeErrorZ");
61327         *ret_conv = OnionPacket_read(ser_ref);
61328         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
61329         return tag_ptr(ret_conv, true);
61330 }
61331
61332 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1write(JNIEnv *env, jclass clz, int64_t obj) {
61333         LDKUpdateAddHTLC obj_conv;
61334         obj_conv.inner = untag_ptr(obj);
61335         obj_conv.is_owned = ptr_is_owned(obj);
61336         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
61337         obj_conv.is_owned = false;
61338         LDKCVec_u8Z ret_var = UpdateAddHTLC_write(&obj_conv);
61339         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
61340         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
61341         CVec_u8Z_free(ret_var);
61342         return ret_arr;
61343 }
61344
61345 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
61346         LDKu8slice ser_ref;
61347         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
61348         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
61349         LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
61350         *ret_conv = UpdateAddHTLC_read(ser_ref);
61351         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
61352         return tag_ptr(ret_conv, true);
61353 }
61354
61355 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OnionMessage_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
61356         LDKu8slice ser_ref;
61357         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
61358         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
61359         LDKCResult_OnionMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OnionMessageDecodeErrorZ), "LDKCResult_OnionMessageDecodeErrorZ");
61360         *ret_conv = OnionMessage_read(ser_ref);
61361         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
61362         return tag_ptr(ret_conv, true);
61363 }
61364
61365 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OnionMessage_1write(JNIEnv *env, jclass clz, int64_t obj) {
61366         LDKOnionMessage obj_conv;
61367         obj_conv.inner = untag_ptr(obj);
61368         obj_conv.is_owned = ptr_is_owned(obj);
61369         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
61370         obj_conv.is_owned = false;
61371         LDKCVec_u8Z ret_var = OnionMessage_write(&obj_conv);
61372         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
61373         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
61374         CVec_u8Z_free(ret_var);
61375         return ret_arr;
61376 }
61377
61378 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FinalOnionHopData_1write(JNIEnv *env, jclass clz, int64_t obj) {
61379         LDKFinalOnionHopData obj_conv;
61380         obj_conv.inner = untag_ptr(obj);
61381         obj_conv.is_owned = ptr_is_owned(obj);
61382         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
61383         obj_conv.is_owned = false;
61384         LDKCVec_u8Z ret_var = FinalOnionHopData_write(&obj_conv);
61385         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
61386         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
61387         CVec_u8Z_free(ret_var);
61388         return ret_arr;
61389 }
61390
61391 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FinalOnionHopData_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
61392         LDKu8slice ser_ref;
61393         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
61394         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
61395         LDKCResult_FinalOnionHopDataDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FinalOnionHopDataDecodeErrorZ), "LDKCResult_FinalOnionHopDataDecodeErrorZ");
61396         *ret_conv = FinalOnionHopData_read(ser_ref);
61397         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
61398         return tag_ptr(ret_conv, true);
61399 }
61400
61401 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Ping_1write(JNIEnv *env, jclass clz, int64_t obj) {
61402         LDKPing obj_conv;
61403         obj_conv.inner = untag_ptr(obj);
61404         obj_conv.is_owned = ptr_is_owned(obj);
61405         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
61406         obj_conv.is_owned = false;
61407         LDKCVec_u8Z ret_var = Ping_write(&obj_conv);
61408         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
61409         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
61410         CVec_u8Z_free(ret_var);
61411         return ret_arr;
61412 }
61413
61414 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Ping_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
61415         LDKu8slice ser_ref;
61416         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
61417         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
61418         LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
61419         *ret_conv = Ping_read(ser_ref);
61420         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
61421         return tag_ptr(ret_conv, true);
61422 }
61423
61424 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Pong_1write(JNIEnv *env, jclass clz, int64_t obj) {
61425         LDKPong obj_conv;
61426         obj_conv.inner = untag_ptr(obj);
61427         obj_conv.is_owned = ptr_is_owned(obj);
61428         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
61429         obj_conv.is_owned = false;
61430         LDKCVec_u8Z ret_var = Pong_write(&obj_conv);
61431         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
61432         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
61433         CVec_u8Z_free(ret_var);
61434         return ret_arr;
61435 }
61436
61437 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Pong_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
61438         LDKu8slice ser_ref;
61439         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
61440         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
61441         LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
61442         *ret_conv = Pong_read(ser_ref);
61443         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
61444         return tag_ptr(ret_conv, true);
61445 }
61446
61447 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1write(JNIEnv *env, jclass clz, int64_t obj) {
61448         LDKUnsignedChannelAnnouncement obj_conv;
61449         obj_conv.inner = untag_ptr(obj);
61450         obj_conv.is_owned = ptr_is_owned(obj);
61451         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
61452         obj_conv.is_owned = false;
61453         LDKCVec_u8Z ret_var = UnsignedChannelAnnouncement_write(&obj_conv);
61454         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
61455         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
61456         CVec_u8Z_free(ret_var);
61457         return ret_arr;
61458 }
61459
61460 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
61461         LDKu8slice ser_ref;
61462         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
61463         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
61464         LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
61465         *ret_conv = UnsignedChannelAnnouncement_read(ser_ref);
61466         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
61467         return tag_ptr(ret_conv, true);
61468 }
61469
61470 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1write(JNIEnv *env, jclass clz, int64_t obj) {
61471         LDKChannelAnnouncement obj_conv;
61472         obj_conv.inner = untag_ptr(obj);
61473         obj_conv.is_owned = ptr_is_owned(obj);
61474         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
61475         obj_conv.is_owned = false;
61476         LDKCVec_u8Z ret_var = ChannelAnnouncement_write(&obj_conv);
61477         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
61478         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
61479         CVec_u8Z_free(ret_var);
61480         return ret_arr;
61481 }
61482
61483 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
61484         LDKu8slice ser_ref;
61485         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
61486         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
61487         LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
61488         *ret_conv = ChannelAnnouncement_read(ser_ref);
61489         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
61490         return tag_ptr(ret_conv, true);
61491 }
61492
61493 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1write(JNIEnv *env, jclass clz, int64_t obj) {
61494         LDKUnsignedChannelUpdate obj_conv;
61495         obj_conv.inner = untag_ptr(obj);
61496         obj_conv.is_owned = ptr_is_owned(obj);
61497         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
61498         obj_conv.is_owned = false;
61499         LDKCVec_u8Z ret_var = UnsignedChannelUpdate_write(&obj_conv);
61500         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
61501         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
61502         CVec_u8Z_free(ret_var);
61503         return ret_arr;
61504 }
61505
61506 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
61507         LDKu8slice ser_ref;
61508         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
61509         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
61510         LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
61511         *ret_conv = UnsignedChannelUpdate_read(ser_ref);
61512         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
61513         return tag_ptr(ret_conv, true);
61514 }
61515
61516 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1write(JNIEnv *env, jclass clz, int64_t obj) {
61517         LDKChannelUpdate obj_conv;
61518         obj_conv.inner = untag_ptr(obj);
61519         obj_conv.is_owned = ptr_is_owned(obj);
61520         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
61521         obj_conv.is_owned = false;
61522         LDKCVec_u8Z ret_var = ChannelUpdate_write(&obj_conv);
61523         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
61524         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
61525         CVec_u8Z_free(ret_var);
61526         return ret_arr;
61527 }
61528
61529 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
61530         LDKu8slice ser_ref;
61531         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
61532         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
61533         LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
61534         *ret_conv = ChannelUpdate_read(ser_ref);
61535         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
61536         return tag_ptr(ret_conv, true);
61537 }
61538
61539 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1write(JNIEnv *env, jclass clz, int64_t obj) {
61540         LDKErrorMessage obj_conv;
61541         obj_conv.inner = untag_ptr(obj);
61542         obj_conv.is_owned = ptr_is_owned(obj);
61543         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
61544         obj_conv.is_owned = false;
61545         LDKCVec_u8Z ret_var = ErrorMessage_write(&obj_conv);
61546         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
61547         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
61548         CVec_u8Z_free(ret_var);
61549         return ret_arr;
61550 }
61551
61552 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
61553         LDKu8slice ser_ref;
61554         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
61555         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
61556         LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
61557         *ret_conv = ErrorMessage_read(ser_ref);
61558         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
61559         return tag_ptr(ret_conv, true);
61560 }
61561
61562 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_WarningMessage_1write(JNIEnv *env, jclass clz, int64_t obj) {
61563         LDKWarningMessage obj_conv;
61564         obj_conv.inner = untag_ptr(obj);
61565         obj_conv.is_owned = ptr_is_owned(obj);
61566         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
61567         obj_conv.is_owned = false;
61568         LDKCVec_u8Z ret_var = WarningMessage_write(&obj_conv);
61569         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
61570         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
61571         CVec_u8Z_free(ret_var);
61572         return ret_arr;
61573 }
61574
61575 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WarningMessage_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
61576         LDKu8slice ser_ref;
61577         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
61578         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
61579         LDKCResult_WarningMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WarningMessageDecodeErrorZ), "LDKCResult_WarningMessageDecodeErrorZ");
61580         *ret_conv = WarningMessage_read(ser_ref);
61581         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
61582         return tag_ptr(ret_conv, true);
61583 }
61584
61585 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1write(JNIEnv *env, jclass clz, int64_t obj) {
61586         LDKUnsignedNodeAnnouncement obj_conv;
61587         obj_conv.inner = untag_ptr(obj);
61588         obj_conv.is_owned = ptr_is_owned(obj);
61589         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
61590         obj_conv.is_owned = false;
61591         LDKCVec_u8Z ret_var = UnsignedNodeAnnouncement_write(&obj_conv);
61592         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
61593         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
61594         CVec_u8Z_free(ret_var);
61595         return ret_arr;
61596 }
61597
61598 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
61599         LDKu8slice ser_ref;
61600         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
61601         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
61602         LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
61603         *ret_conv = UnsignedNodeAnnouncement_read(ser_ref);
61604         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
61605         return tag_ptr(ret_conv, true);
61606 }
61607
61608 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1write(JNIEnv *env, jclass clz, int64_t obj) {
61609         LDKNodeAnnouncement obj_conv;
61610         obj_conv.inner = untag_ptr(obj);
61611         obj_conv.is_owned = ptr_is_owned(obj);
61612         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
61613         obj_conv.is_owned = false;
61614         LDKCVec_u8Z ret_var = NodeAnnouncement_write(&obj_conv);
61615         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
61616         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
61617         CVec_u8Z_free(ret_var);
61618         return ret_arr;
61619 }
61620
61621 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
61622         LDKu8slice ser_ref;
61623         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
61624         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
61625         LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
61626         *ret_conv = NodeAnnouncement_read(ser_ref);
61627         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
61628         return tag_ptr(ret_conv, true);
61629 }
61630
61631 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
61632         LDKu8slice ser_ref;
61633         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
61634         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
61635         LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
61636         *ret_conv = QueryShortChannelIds_read(ser_ref);
61637         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
61638         return tag_ptr(ret_conv, true);
61639 }
61640
61641 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1write(JNIEnv *env, jclass clz, int64_t obj) {
61642         LDKQueryShortChannelIds obj_conv;
61643         obj_conv.inner = untag_ptr(obj);
61644         obj_conv.is_owned = ptr_is_owned(obj);
61645         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
61646         obj_conv.is_owned = false;
61647         LDKCVec_u8Z ret_var = QueryShortChannelIds_write(&obj_conv);
61648         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
61649         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
61650         CVec_u8Z_free(ret_var);
61651         return ret_arr;
61652 }
61653
61654 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1write(JNIEnv *env, jclass clz, int64_t obj) {
61655         LDKReplyShortChannelIdsEnd obj_conv;
61656         obj_conv.inner = untag_ptr(obj);
61657         obj_conv.is_owned = ptr_is_owned(obj);
61658         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
61659         obj_conv.is_owned = false;
61660         LDKCVec_u8Z ret_var = ReplyShortChannelIdsEnd_write(&obj_conv);
61661         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
61662         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
61663         CVec_u8Z_free(ret_var);
61664         return ret_arr;
61665 }
61666
61667 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
61668         LDKu8slice ser_ref;
61669         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
61670         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
61671         LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
61672         *ret_conv = ReplyShortChannelIdsEnd_read(ser_ref);
61673         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
61674         return tag_ptr(ret_conv, true);
61675 }
61676
61677 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1end_1blocknum(JNIEnv *env, jclass clz, int64_t this_arg) {
61678         LDKQueryChannelRange this_arg_conv;
61679         this_arg_conv.inner = untag_ptr(this_arg);
61680         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61681         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61682         this_arg_conv.is_owned = false;
61683         int32_t ret_conv = QueryChannelRange_end_blocknum(&this_arg_conv);
61684         return ret_conv;
61685 }
61686
61687 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1write(JNIEnv *env, jclass clz, int64_t obj) {
61688         LDKQueryChannelRange obj_conv;
61689         obj_conv.inner = untag_ptr(obj);
61690         obj_conv.is_owned = ptr_is_owned(obj);
61691         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
61692         obj_conv.is_owned = false;
61693         LDKCVec_u8Z ret_var = QueryChannelRange_write(&obj_conv);
61694         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
61695         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
61696         CVec_u8Z_free(ret_var);
61697         return ret_arr;
61698 }
61699
61700 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
61701         LDKu8slice ser_ref;
61702         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
61703         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
61704         LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
61705         *ret_conv = QueryChannelRange_read(ser_ref);
61706         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
61707         return tag_ptr(ret_conv, true);
61708 }
61709
61710 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
61711         LDKu8slice ser_ref;
61712         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
61713         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
61714         LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
61715         *ret_conv = ReplyChannelRange_read(ser_ref);
61716         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
61717         return tag_ptr(ret_conv, true);
61718 }
61719
61720 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1write(JNIEnv *env, jclass clz, int64_t obj) {
61721         LDKReplyChannelRange obj_conv;
61722         obj_conv.inner = untag_ptr(obj);
61723         obj_conv.is_owned = ptr_is_owned(obj);
61724         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
61725         obj_conv.is_owned = false;
61726         LDKCVec_u8Z ret_var = ReplyChannelRange_write(&obj_conv);
61727         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
61728         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
61729         CVec_u8Z_free(ret_var);
61730         return ret_arr;
61731 }
61732
61733 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1write(JNIEnv *env, jclass clz, int64_t obj) {
61734         LDKGossipTimestampFilter obj_conv;
61735         obj_conv.inner = untag_ptr(obj);
61736         obj_conv.is_owned = ptr_is_owned(obj);
61737         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
61738         obj_conv.is_owned = false;
61739         LDKCVec_u8Z ret_var = GossipTimestampFilter_write(&obj_conv);
61740         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
61741         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
61742         CVec_u8Z_free(ret_var);
61743         return ret_arr;
61744 }
61745
61746 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
61747         LDKu8slice ser_ref;
61748         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
61749         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
61750         LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
61751         *ret_conv = GossipTimestampFilter_read(ser_ref);
61752         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
61753         return tag_ptr(ret_conv, true);
61754 }
61755
61756 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CustomMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
61757         if (!ptr_is_owned(this_ptr)) return;
61758         void* this_ptr_ptr = untag_ptr(this_ptr);
61759         CHECK_ACCESS(this_ptr_ptr);
61760         LDKCustomMessageHandler this_ptr_conv = *(LDKCustomMessageHandler*)(this_ptr_ptr);
61761         FREE(untag_ptr(this_ptr));
61762         CustomMessageHandler_free(this_ptr_conv);
61763 }
61764
61765 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
61766         LDKIgnoringMessageHandler this_obj_conv;
61767         this_obj_conv.inner = untag_ptr(this_obj);
61768         this_obj_conv.is_owned = ptr_is_owned(this_obj);
61769         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
61770         IgnoringMessageHandler_free(this_obj_conv);
61771 }
61772
61773 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1new(JNIEnv *env, jclass clz) {
61774         LDKIgnoringMessageHandler ret_var = IgnoringMessageHandler_new();
61775         int64_t ret_ref = 0;
61776         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61777         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61778         return ret_ref;
61779 }
61780
61781 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1as_1EventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
61782         LDKIgnoringMessageHandler this_arg_conv;
61783         this_arg_conv.inner = untag_ptr(this_arg);
61784         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61785         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61786         this_arg_conv.is_owned = false;
61787         LDKEventsProvider* ret_ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
61788         *ret_ret = IgnoringMessageHandler_as_EventsProvider(&this_arg_conv);
61789         return tag_ptr(ret_ret, true);
61790 }
61791
61792 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1as_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
61793         LDKIgnoringMessageHandler this_arg_conv;
61794         this_arg_conv.inner = untag_ptr(this_arg);
61795         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61796         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61797         this_arg_conv.is_owned = false;
61798         LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
61799         *ret_ret = IgnoringMessageHandler_as_MessageSendEventsProvider(&this_arg_conv);
61800         return tag_ptr(ret_ret, true);
61801 }
61802
61803 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1as_1RoutingMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
61804         LDKIgnoringMessageHandler this_arg_conv;
61805         this_arg_conv.inner = untag_ptr(this_arg);
61806         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61807         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61808         this_arg_conv.is_owned = false;
61809         LDKRoutingMessageHandler* ret_ret = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
61810         *ret_ret = IgnoringMessageHandler_as_RoutingMessageHandler(&this_arg_conv);
61811         return tag_ptr(ret_ret, true);
61812 }
61813
61814 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1as_1OnionMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
61815         LDKIgnoringMessageHandler this_arg_conv;
61816         this_arg_conv.inner = untag_ptr(this_arg);
61817         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61818         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61819         this_arg_conv.is_owned = false;
61820         LDKOnionMessageHandler* ret_ret = MALLOC(sizeof(LDKOnionMessageHandler), "LDKOnionMessageHandler");
61821         *ret_ret = IgnoringMessageHandler_as_OnionMessageHandler(&this_arg_conv);
61822         return tag_ptr(ret_ret, true);
61823 }
61824
61825 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1as_1OffersMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
61826         LDKIgnoringMessageHandler this_arg_conv;
61827         this_arg_conv.inner = untag_ptr(this_arg);
61828         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61829         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61830         this_arg_conv.is_owned = false;
61831         LDKOffersMessageHandler* ret_ret = MALLOC(sizeof(LDKOffersMessageHandler), "LDKOffersMessageHandler");
61832         *ret_ret = IgnoringMessageHandler_as_OffersMessageHandler(&this_arg_conv);
61833         return tag_ptr(ret_ret, true);
61834 }
61835
61836 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1as_1CustomOnionMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
61837         LDKIgnoringMessageHandler this_arg_conv;
61838         this_arg_conv.inner = untag_ptr(this_arg);
61839         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61840         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61841         this_arg_conv.is_owned = false;
61842         LDKCustomOnionMessageHandler* ret_ret = MALLOC(sizeof(LDKCustomOnionMessageHandler), "LDKCustomOnionMessageHandler");
61843         *ret_ret = IgnoringMessageHandler_as_CustomOnionMessageHandler(&this_arg_conv);
61844         return tag_ptr(ret_ret, true);
61845 }
61846
61847 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1as_1CustomMessageReader(JNIEnv *env, jclass clz, int64_t this_arg) {
61848         LDKIgnoringMessageHandler this_arg_conv;
61849         this_arg_conv.inner = untag_ptr(this_arg);
61850         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61851         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61852         this_arg_conv.is_owned = false;
61853         LDKCustomMessageReader* ret_ret = MALLOC(sizeof(LDKCustomMessageReader), "LDKCustomMessageReader");
61854         *ret_ret = IgnoringMessageHandler_as_CustomMessageReader(&this_arg_conv);
61855         return tag_ptr(ret_ret, true);
61856 }
61857
61858 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1as_1CustomMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
61859         LDKIgnoringMessageHandler this_arg_conv;
61860         this_arg_conv.inner = untag_ptr(this_arg);
61861         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61862         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61863         this_arg_conv.is_owned = false;
61864         LDKCustomMessageHandler* ret_ret = MALLOC(sizeof(LDKCustomMessageHandler), "LDKCustomMessageHandler");
61865         *ret_ret = IgnoringMessageHandler_as_CustomMessageHandler(&this_arg_conv);
61866         return tag_ptr(ret_ret, true);
61867 }
61868
61869 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErroringMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
61870         LDKErroringMessageHandler this_obj_conv;
61871         this_obj_conv.inner = untag_ptr(this_obj);
61872         this_obj_conv.is_owned = ptr_is_owned(this_obj);
61873         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
61874         ErroringMessageHandler_free(this_obj_conv);
61875 }
61876
61877 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErroringMessageHandler_1new(JNIEnv *env, jclass clz) {
61878         LDKErroringMessageHandler ret_var = ErroringMessageHandler_new();
61879         int64_t ret_ref = 0;
61880         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
61881         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
61882         return ret_ref;
61883 }
61884
61885 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErroringMessageHandler_1as_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
61886         LDKErroringMessageHandler this_arg_conv;
61887         this_arg_conv.inner = untag_ptr(this_arg);
61888         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61889         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61890         this_arg_conv.is_owned = false;
61891         LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
61892         *ret_ret = ErroringMessageHandler_as_MessageSendEventsProvider(&this_arg_conv);
61893         return tag_ptr(ret_ret, true);
61894 }
61895
61896 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErroringMessageHandler_1as_1ChannelMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
61897         LDKErroringMessageHandler this_arg_conv;
61898         this_arg_conv.inner = untag_ptr(this_arg);
61899         this_arg_conv.is_owned = ptr_is_owned(this_arg);
61900         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
61901         this_arg_conv.is_owned = false;
61902         LDKChannelMessageHandler* ret_ret = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
61903         *ret_ret = ErroringMessageHandler_as_ChannelMessageHandler(&this_arg_conv);
61904         return tag_ptr(ret_ret, true);
61905 }
61906
61907 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
61908         LDKMessageHandler this_obj_conv;
61909         this_obj_conv.inner = untag_ptr(this_obj);
61910         this_obj_conv.is_owned = ptr_is_owned(this_obj);
61911         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
61912         MessageHandler_free(this_obj_conv);
61913 }
61914
61915 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageHandler_1get_1chan_1handler(JNIEnv *env, jclass clz, int64_t this_ptr) {
61916         LDKMessageHandler this_ptr_conv;
61917         this_ptr_conv.inner = untag_ptr(this_ptr);
61918         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61919         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61920         this_ptr_conv.is_owned = false;
61921         // WARNING: This object doesn't live past this scope, needs clone!
61922         int64_t ret_ret = tag_ptr(MessageHandler_get_chan_handler(&this_ptr_conv), false);
61923         return ret_ret;
61924 }
61925
61926 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1set_1chan_1handler(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
61927         LDKMessageHandler this_ptr_conv;
61928         this_ptr_conv.inner = untag_ptr(this_ptr);
61929         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61930         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61931         this_ptr_conv.is_owned = false;
61932         void* val_ptr = untag_ptr(val);
61933         CHECK_ACCESS(val_ptr);
61934         LDKChannelMessageHandler val_conv = *(LDKChannelMessageHandler*)(val_ptr);
61935         if (val_conv.free == LDKChannelMessageHandler_JCalls_free) {
61936                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
61937                 LDKChannelMessageHandler_JCalls_cloned(&val_conv);
61938         }
61939         MessageHandler_set_chan_handler(&this_ptr_conv, val_conv);
61940 }
61941
61942 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageHandler_1get_1route_1handler(JNIEnv *env, jclass clz, int64_t this_ptr) {
61943         LDKMessageHandler this_ptr_conv;
61944         this_ptr_conv.inner = untag_ptr(this_ptr);
61945         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61946         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61947         this_ptr_conv.is_owned = false;
61948         // WARNING: This object doesn't live past this scope, needs clone!
61949         int64_t ret_ret = tag_ptr(MessageHandler_get_route_handler(&this_ptr_conv), false);
61950         return ret_ret;
61951 }
61952
61953 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1set_1route_1handler(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
61954         LDKMessageHandler this_ptr_conv;
61955         this_ptr_conv.inner = untag_ptr(this_ptr);
61956         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61957         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61958         this_ptr_conv.is_owned = false;
61959         void* val_ptr = untag_ptr(val);
61960         CHECK_ACCESS(val_ptr);
61961         LDKRoutingMessageHandler val_conv = *(LDKRoutingMessageHandler*)(val_ptr);
61962         if (val_conv.free == LDKRoutingMessageHandler_JCalls_free) {
61963                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
61964                 LDKRoutingMessageHandler_JCalls_cloned(&val_conv);
61965         }
61966         MessageHandler_set_route_handler(&this_ptr_conv, val_conv);
61967 }
61968
61969 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageHandler_1get_1onion_1message_1handler(JNIEnv *env, jclass clz, int64_t this_ptr) {
61970         LDKMessageHandler this_ptr_conv;
61971         this_ptr_conv.inner = untag_ptr(this_ptr);
61972         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61973         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61974         this_ptr_conv.is_owned = false;
61975         // WARNING: This object doesn't live past this scope, needs clone!
61976         int64_t ret_ret = tag_ptr(MessageHandler_get_onion_message_handler(&this_ptr_conv), false);
61977         return ret_ret;
61978 }
61979
61980 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1set_1onion_1message_1handler(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
61981         LDKMessageHandler this_ptr_conv;
61982         this_ptr_conv.inner = untag_ptr(this_ptr);
61983         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
61984         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
61985         this_ptr_conv.is_owned = false;
61986         void* val_ptr = untag_ptr(val);
61987         CHECK_ACCESS(val_ptr);
61988         LDKOnionMessageHandler val_conv = *(LDKOnionMessageHandler*)(val_ptr);
61989         if (val_conv.free == LDKOnionMessageHandler_JCalls_free) {
61990                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
61991                 LDKOnionMessageHandler_JCalls_cloned(&val_conv);
61992         }
61993         MessageHandler_set_onion_message_handler(&this_ptr_conv, val_conv);
61994 }
61995
61996 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageHandler_1get_1custom_1message_1handler(JNIEnv *env, jclass clz, int64_t this_ptr) {
61997         LDKMessageHandler this_ptr_conv;
61998         this_ptr_conv.inner = untag_ptr(this_ptr);
61999         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62000         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62001         this_ptr_conv.is_owned = false;
62002         // WARNING: This object doesn't live past this scope, needs clone!
62003         int64_t ret_ret = tag_ptr(MessageHandler_get_custom_message_handler(&this_ptr_conv), false);
62004         return ret_ret;
62005 }
62006
62007 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1set_1custom_1message_1handler(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
62008         LDKMessageHandler this_ptr_conv;
62009         this_ptr_conv.inner = untag_ptr(this_ptr);
62010         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62011         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62012         this_ptr_conv.is_owned = false;
62013         void* val_ptr = untag_ptr(val);
62014         CHECK_ACCESS(val_ptr);
62015         LDKCustomMessageHandler val_conv = *(LDKCustomMessageHandler*)(val_ptr);
62016         if (val_conv.free == LDKCustomMessageHandler_JCalls_free) {
62017                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
62018                 LDKCustomMessageHandler_JCalls_cloned(&val_conv);
62019         }
62020         MessageHandler_set_custom_message_handler(&this_ptr_conv, val_conv);
62021 }
62022
62023 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) {
62024         void* chan_handler_arg_ptr = untag_ptr(chan_handler_arg);
62025         CHECK_ACCESS(chan_handler_arg_ptr);
62026         LDKChannelMessageHandler chan_handler_arg_conv = *(LDKChannelMessageHandler*)(chan_handler_arg_ptr);
62027         if (chan_handler_arg_conv.free == LDKChannelMessageHandler_JCalls_free) {
62028                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
62029                 LDKChannelMessageHandler_JCalls_cloned(&chan_handler_arg_conv);
62030         }
62031         void* route_handler_arg_ptr = untag_ptr(route_handler_arg);
62032         CHECK_ACCESS(route_handler_arg_ptr);
62033         LDKRoutingMessageHandler route_handler_arg_conv = *(LDKRoutingMessageHandler*)(route_handler_arg_ptr);
62034         if (route_handler_arg_conv.free == LDKRoutingMessageHandler_JCalls_free) {
62035                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
62036                 LDKRoutingMessageHandler_JCalls_cloned(&route_handler_arg_conv);
62037         }
62038         void* onion_message_handler_arg_ptr = untag_ptr(onion_message_handler_arg);
62039         CHECK_ACCESS(onion_message_handler_arg_ptr);
62040         LDKOnionMessageHandler onion_message_handler_arg_conv = *(LDKOnionMessageHandler*)(onion_message_handler_arg_ptr);
62041         if (onion_message_handler_arg_conv.free == LDKOnionMessageHandler_JCalls_free) {
62042                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
62043                 LDKOnionMessageHandler_JCalls_cloned(&onion_message_handler_arg_conv);
62044         }
62045         void* custom_message_handler_arg_ptr = untag_ptr(custom_message_handler_arg);
62046         CHECK_ACCESS(custom_message_handler_arg_ptr);
62047         LDKCustomMessageHandler custom_message_handler_arg_conv = *(LDKCustomMessageHandler*)(custom_message_handler_arg_ptr);
62048         if (custom_message_handler_arg_conv.free == LDKCustomMessageHandler_JCalls_free) {
62049                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
62050                 LDKCustomMessageHandler_JCalls_cloned(&custom_message_handler_arg_conv);
62051         }
62052         LDKMessageHandler ret_var = MessageHandler_new(chan_handler_arg_conv, route_handler_arg_conv, onion_message_handler_arg_conv, custom_message_handler_arg_conv);
62053         int64_t ret_ref = 0;
62054         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62055         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62056         return ret_ref;
62057 }
62058
62059 static inline uint64_t SocketDescriptor_clone_ptr(LDKSocketDescriptor *NONNULL_PTR arg) {
62060         LDKSocketDescriptor* ret_ret = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
62061         *ret_ret = SocketDescriptor_clone(arg);
62062         return tag_ptr(ret_ret, true);
62063 }
62064 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
62065         void* arg_ptr = untag_ptr(arg);
62066         if (ptr_is_owned(arg)) { CHECK_ACCESS(arg_ptr); }
62067         LDKSocketDescriptor* arg_conv = (LDKSocketDescriptor*)arg_ptr;
62068         int64_t ret_conv = SocketDescriptor_clone_ptr(arg_conv);
62069         return ret_conv;
62070 }
62071
62072 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
62073         void* orig_ptr = untag_ptr(orig);
62074         if (ptr_is_owned(orig)) { CHECK_ACCESS(orig_ptr); }
62075         LDKSocketDescriptor* orig_conv = (LDKSocketDescriptor*)orig_ptr;
62076         LDKSocketDescriptor* ret_ret = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
62077         *ret_ret = SocketDescriptor_clone(orig_conv);
62078         return tag_ptr(ret_ret, true);
62079 }
62080
62081 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
62082         if (!ptr_is_owned(this_ptr)) return;
62083         void* this_ptr_ptr = untag_ptr(this_ptr);
62084         CHECK_ACCESS(this_ptr_ptr);
62085         LDKSocketDescriptor this_ptr_conv = *(LDKSocketDescriptor*)(this_ptr_ptr);
62086         FREE(untag_ptr(this_ptr));
62087         SocketDescriptor_free(this_ptr_conv);
62088 }
62089
62090 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerDetails_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
62091         LDKPeerDetails this_obj_conv;
62092         this_obj_conv.inner = untag_ptr(this_obj);
62093         this_obj_conv.is_owned = ptr_is_owned(this_obj);
62094         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
62095         PeerDetails_free(this_obj_conv);
62096 }
62097
62098 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_PeerDetails_1get_1counterparty_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
62099         LDKPeerDetails this_ptr_conv;
62100         this_ptr_conv.inner = untag_ptr(this_ptr);
62101         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62102         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62103         this_ptr_conv.is_owned = false;
62104         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
62105         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, PeerDetails_get_counterparty_node_id(&this_ptr_conv).compressed_form);
62106         return ret_arr;
62107 }
62108
62109 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerDetails_1set_1counterparty_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
62110         LDKPeerDetails this_ptr_conv;
62111         this_ptr_conv.inner = untag_ptr(this_ptr);
62112         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62113         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62114         this_ptr_conv.is_owned = false;
62115         LDKPublicKey val_ref;
62116         CHECK((*env)->GetArrayLength(env, val) == 33);
62117         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
62118         PeerDetails_set_counterparty_node_id(&this_ptr_conv, val_ref);
62119 }
62120
62121 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeerDetails_1get_1socket_1address(JNIEnv *env, jclass clz, int64_t this_ptr) {
62122         LDKPeerDetails this_ptr_conv;
62123         this_ptr_conv.inner = untag_ptr(this_ptr);
62124         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62125         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62126         this_ptr_conv.is_owned = false;
62127         LDKCOption_SocketAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_SocketAddressZ), "LDKCOption_SocketAddressZ");
62128         *ret_copy = PeerDetails_get_socket_address(&this_ptr_conv);
62129         int64_t ret_ref = tag_ptr(ret_copy, true);
62130         return ret_ref;
62131 }
62132
62133 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerDetails_1set_1socket_1address(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
62134         LDKPeerDetails this_ptr_conv;
62135         this_ptr_conv.inner = untag_ptr(this_ptr);
62136         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62137         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62138         this_ptr_conv.is_owned = false;
62139         void* val_ptr = untag_ptr(val);
62140         CHECK_ACCESS(val_ptr);
62141         LDKCOption_SocketAddressZ val_conv = *(LDKCOption_SocketAddressZ*)(val_ptr);
62142         val_conv = COption_SocketAddressZ_clone((LDKCOption_SocketAddressZ*)untag_ptr(val));
62143         PeerDetails_set_socket_address(&this_ptr_conv, val_conv);
62144 }
62145
62146 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeerDetails_1get_1init_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
62147         LDKPeerDetails this_ptr_conv;
62148         this_ptr_conv.inner = untag_ptr(this_ptr);
62149         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62150         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62151         this_ptr_conv.is_owned = false;
62152         LDKInitFeatures ret_var = PeerDetails_get_init_features(&this_ptr_conv);
62153         int64_t ret_ref = 0;
62154         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62155         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62156         return ret_ref;
62157 }
62158
62159 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerDetails_1set_1init_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
62160         LDKPeerDetails this_ptr_conv;
62161         this_ptr_conv.inner = untag_ptr(this_ptr);
62162         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62163         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62164         this_ptr_conv.is_owned = false;
62165         LDKInitFeatures val_conv;
62166         val_conv.inner = untag_ptr(val);
62167         val_conv.is_owned = ptr_is_owned(val);
62168         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
62169         val_conv = InitFeatures_clone(&val_conv);
62170         PeerDetails_set_init_features(&this_ptr_conv, val_conv);
62171 }
62172
62173 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PeerDetails_1get_1is_1inbound_1connection(JNIEnv *env, jclass clz, int64_t this_ptr) {
62174         LDKPeerDetails this_ptr_conv;
62175         this_ptr_conv.inner = untag_ptr(this_ptr);
62176         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62177         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62178         this_ptr_conv.is_owned = false;
62179         jboolean ret_conv = PeerDetails_get_is_inbound_connection(&this_ptr_conv);
62180         return ret_conv;
62181 }
62182
62183 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerDetails_1set_1is_1inbound_1connection(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
62184         LDKPeerDetails this_ptr_conv;
62185         this_ptr_conv.inner = untag_ptr(this_ptr);
62186         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62187         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62188         this_ptr_conv.is_owned = false;
62189         PeerDetails_set_is_inbound_connection(&this_ptr_conv, val);
62190 }
62191
62192 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeerDetails_1new(JNIEnv *env, jclass clz, int8_tArray counterparty_node_id_arg, int64_t socket_address_arg, int64_t init_features_arg, jboolean is_inbound_connection_arg) {
62193         LDKPublicKey counterparty_node_id_arg_ref;
62194         CHECK((*env)->GetArrayLength(env, counterparty_node_id_arg) == 33);
62195         (*env)->GetByteArrayRegion(env, counterparty_node_id_arg, 0, 33, counterparty_node_id_arg_ref.compressed_form);
62196         void* socket_address_arg_ptr = untag_ptr(socket_address_arg);
62197         CHECK_ACCESS(socket_address_arg_ptr);
62198         LDKCOption_SocketAddressZ socket_address_arg_conv = *(LDKCOption_SocketAddressZ*)(socket_address_arg_ptr);
62199         LDKInitFeatures init_features_arg_conv;
62200         init_features_arg_conv.inner = untag_ptr(init_features_arg);
62201         init_features_arg_conv.is_owned = ptr_is_owned(init_features_arg);
62202         CHECK_INNER_FIELD_ACCESS_OR_NULL(init_features_arg_conv);
62203         init_features_arg_conv = InitFeatures_clone(&init_features_arg_conv);
62204         LDKPeerDetails ret_var = PeerDetails_new(counterparty_node_id_arg_ref, socket_address_arg_conv, init_features_arg_conv, is_inbound_connection_arg);
62205         int64_t ret_ref = 0;
62206         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62207         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62208         return ret_ref;
62209 }
62210
62211 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
62212         LDKPeerHandleError this_obj_conv;
62213         this_obj_conv.inner = untag_ptr(this_obj);
62214         this_obj_conv.is_owned = ptr_is_owned(this_obj);
62215         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
62216         PeerHandleError_free(this_obj_conv);
62217 }
62218
62219 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1new(JNIEnv *env, jclass clz) {
62220         LDKPeerHandleError ret_var = PeerHandleError_new();
62221         int64_t ret_ref = 0;
62222         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62223         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62224         return ret_ref;
62225 }
62226
62227 static inline uint64_t PeerHandleError_clone_ptr(LDKPeerHandleError *NONNULL_PTR arg) {
62228         LDKPeerHandleError ret_var = PeerHandleError_clone(arg);
62229         int64_t ret_ref = 0;
62230         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62231         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62232         return ret_ref;
62233 }
62234 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
62235         LDKPeerHandleError arg_conv;
62236         arg_conv.inner = untag_ptr(arg);
62237         arg_conv.is_owned = ptr_is_owned(arg);
62238         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
62239         arg_conv.is_owned = false;
62240         int64_t ret_conv = PeerHandleError_clone_ptr(&arg_conv);
62241         return ret_conv;
62242 }
62243
62244 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
62245         LDKPeerHandleError orig_conv;
62246         orig_conv.inner = untag_ptr(orig);
62247         orig_conv.is_owned = ptr_is_owned(orig);
62248         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
62249         orig_conv.is_owned = false;
62250         LDKPeerHandleError ret_var = PeerHandleError_clone(&orig_conv);
62251         int64_t ret_ref = 0;
62252         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62253         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62254         return ret_ref;
62255 }
62256
62257 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
62258         LDKPeerManager this_obj_conv;
62259         this_obj_conv.inner = untag_ptr(this_obj);
62260         this_obj_conv.is_owned = ptr_is_owned(this_obj);
62261         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
62262         PeerManager_free(this_obj_conv);
62263 }
62264
62265 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) {
62266         LDKMessageHandler message_handler_conv;
62267         message_handler_conv.inner = untag_ptr(message_handler);
62268         message_handler_conv.is_owned = ptr_is_owned(message_handler);
62269         CHECK_INNER_FIELD_ACCESS_OR_NULL(message_handler_conv);
62270         // WARNING: we need a move here but no clone is available for LDKMessageHandler
62271         
62272         uint8_t ephemeral_random_data_arr[32];
62273         CHECK((*env)->GetArrayLength(env, ephemeral_random_data) == 32);
62274         (*env)->GetByteArrayRegion(env, ephemeral_random_data, 0, 32, ephemeral_random_data_arr);
62275         uint8_t (*ephemeral_random_data_ref)[32] = &ephemeral_random_data_arr;
62276         void* logger_ptr = untag_ptr(logger);
62277         CHECK_ACCESS(logger_ptr);
62278         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
62279         if (logger_conv.free == LDKLogger_JCalls_free) {
62280                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
62281                 LDKLogger_JCalls_cloned(&logger_conv);
62282         }
62283         void* node_signer_ptr = untag_ptr(node_signer);
62284         CHECK_ACCESS(node_signer_ptr);
62285         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
62286         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
62287                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
62288                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
62289         }
62290         LDKPeerManager ret_var = PeerManager_new(message_handler_conv, current_time, ephemeral_random_data_ref, logger_conv, node_signer_conv);
62291         int64_t ret_ref = 0;
62292         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62293         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62294         return ret_ref;
62295 }
62296
62297 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_PeerManager_1list_1peers(JNIEnv *env, jclass clz, int64_t this_arg) {
62298         LDKPeerManager this_arg_conv;
62299         this_arg_conv.inner = untag_ptr(this_arg);
62300         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62301         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62302         this_arg_conv.is_owned = false;
62303         LDKCVec_PeerDetailsZ ret_var = PeerManager_list_peers(&this_arg_conv);
62304         int64_tArray ret_arr = NULL;
62305         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
62306         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
62307         for (size_t n = 0; n < ret_var.datalen; n++) {
62308                 LDKPeerDetails ret_conv_13_var = ret_var.data[n];
62309                 int64_t ret_conv_13_ref = 0;
62310                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_13_var);
62311                 ret_conv_13_ref = tag_ptr(ret_conv_13_var.inner, ret_conv_13_var.is_owned);
62312                 ret_arr_ptr[n] = ret_conv_13_ref;
62313         }
62314         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
62315         FREE(ret_var.data);
62316         return ret_arr;
62317 }
62318
62319 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeerManager_1peer_1by_1node_1id(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id) {
62320         LDKPeerManager this_arg_conv;
62321         this_arg_conv.inner = untag_ptr(this_arg);
62322         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62323         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62324         this_arg_conv.is_owned = false;
62325         LDKPublicKey their_node_id_ref;
62326         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
62327         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
62328         LDKPeerDetails ret_var = PeerManager_peer_by_node_id(&this_arg_conv, their_node_id_ref);
62329         int64_t ret_ref = 0;
62330         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62331         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62332         return ret_ref;
62333 }
62334
62335 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) {
62336         LDKPeerManager this_arg_conv;
62337         this_arg_conv.inner = untag_ptr(this_arg);
62338         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62339         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62340         this_arg_conv.is_owned = false;
62341         LDKPublicKey their_node_id_ref;
62342         CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
62343         (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
62344         void* descriptor_ptr = untag_ptr(descriptor);
62345         CHECK_ACCESS(descriptor_ptr);
62346         LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)(descriptor_ptr);
62347         if (descriptor_conv.free == LDKSocketDescriptor_JCalls_free) {
62348                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
62349                 LDKSocketDescriptor_JCalls_cloned(&descriptor_conv);
62350         }
62351         void* remote_network_address_ptr = untag_ptr(remote_network_address);
62352         CHECK_ACCESS(remote_network_address_ptr);
62353         LDKCOption_SocketAddressZ remote_network_address_conv = *(LDKCOption_SocketAddressZ*)(remote_network_address_ptr);
62354         LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
62355         *ret_conv = PeerManager_new_outbound_connection(&this_arg_conv, their_node_id_ref, descriptor_conv, remote_network_address_conv);
62356         return tag_ptr(ret_conv, true);
62357 }
62358
62359 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) {
62360         LDKPeerManager this_arg_conv;
62361         this_arg_conv.inner = untag_ptr(this_arg);
62362         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62363         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62364         this_arg_conv.is_owned = false;
62365         void* descriptor_ptr = untag_ptr(descriptor);
62366         CHECK_ACCESS(descriptor_ptr);
62367         LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)(descriptor_ptr);
62368         if (descriptor_conv.free == LDKSocketDescriptor_JCalls_free) {
62369                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
62370                 LDKSocketDescriptor_JCalls_cloned(&descriptor_conv);
62371         }
62372         void* remote_network_address_ptr = untag_ptr(remote_network_address);
62373         CHECK_ACCESS(remote_network_address_ptr);
62374         LDKCOption_SocketAddressZ remote_network_address_conv = *(LDKCOption_SocketAddressZ*)(remote_network_address_ptr);
62375         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
62376         *ret_conv = PeerManager_new_inbound_connection(&this_arg_conv, descriptor_conv, remote_network_address_conv);
62377         return tag_ptr(ret_conv, true);
62378 }
62379
62380 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) {
62381         LDKPeerManager 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         void* descriptor_ptr = untag_ptr(descriptor);
62387         if (ptr_is_owned(descriptor)) { CHECK_ACCESS(descriptor_ptr); }
62388         LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)descriptor_ptr;
62389         LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
62390         *ret_conv = PeerManager_write_buffer_space_avail(&this_arg_conv, descriptor_conv);
62391         return tag_ptr(ret_conv, true);
62392 }
62393
62394 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) {
62395         LDKPeerManager this_arg_conv;
62396         this_arg_conv.inner = untag_ptr(this_arg);
62397         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62398         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62399         this_arg_conv.is_owned = false;
62400         void* peer_descriptor_ptr = untag_ptr(peer_descriptor);
62401         if (ptr_is_owned(peer_descriptor)) { CHECK_ACCESS(peer_descriptor_ptr); }
62402         LDKSocketDescriptor* peer_descriptor_conv = (LDKSocketDescriptor*)peer_descriptor_ptr;
62403         LDKu8slice data_ref;
62404         data_ref.datalen = (*env)->GetArrayLength(env, data);
62405         data_ref.data = (*env)->GetByteArrayElements (env, data, NULL);
62406         LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
62407         *ret_conv = PeerManager_read_event(&this_arg_conv, peer_descriptor_conv, data_ref);
62408         (*env)->ReleaseByteArrayElements(env, data, (int8_t*)data_ref.data, 0);
62409         return tag_ptr(ret_conv, true);
62410 }
62411
62412 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1process_1events(JNIEnv *env, jclass clz, int64_t this_arg) {
62413         LDKPeerManager this_arg_conv;
62414         this_arg_conv.inner = untag_ptr(this_arg);
62415         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62416         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62417         this_arg_conv.is_owned = false;
62418         PeerManager_process_events(&this_arg_conv);
62419 }
62420
62421 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1socket_1disconnected(JNIEnv *env, jclass clz, int64_t this_arg, int64_t descriptor) {
62422         LDKPeerManager this_arg_conv;
62423         this_arg_conv.inner = untag_ptr(this_arg);
62424         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62425         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62426         this_arg_conv.is_owned = false;
62427         void* descriptor_ptr = untag_ptr(descriptor);
62428         if (ptr_is_owned(descriptor)) { CHECK_ACCESS(descriptor_ptr); }
62429         LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)descriptor_ptr;
62430         PeerManager_socket_disconnected(&this_arg_conv, descriptor_conv);
62431 }
62432
62433 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) {
62434         LDKPeerManager this_arg_conv;
62435         this_arg_conv.inner = untag_ptr(this_arg);
62436         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62437         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62438         this_arg_conv.is_owned = false;
62439         LDKPublicKey node_id_ref;
62440         CHECK((*env)->GetArrayLength(env, node_id) == 33);
62441         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
62442         PeerManager_disconnect_by_node_id(&this_arg_conv, node_id_ref);
62443 }
62444
62445 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1disconnect_1all_1peers(JNIEnv *env, jclass clz, int64_t this_arg) {
62446         LDKPeerManager this_arg_conv;
62447         this_arg_conv.inner = untag_ptr(this_arg);
62448         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62449         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62450         this_arg_conv.is_owned = false;
62451         PeerManager_disconnect_all_peers(&this_arg_conv);
62452 }
62453
62454 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1timer_1tick_1occurred(JNIEnv *env, jclass clz, int64_t this_arg) {
62455         LDKPeerManager this_arg_conv;
62456         this_arg_conv.inner = untag_ptr(this_arg);
62457         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62458         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62459         this_arg_conv.is_owned = false;
62460         PeerManager_timer_tick_occurred(&this_arg_conv);
62461 }
62462
62463 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) {
62464         LDKPeerManager this_arg_conv;
62465         this_arg_conv.inner = untag_ptr(this_arg);
62466         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62467         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62468         this_arg_conv.is_owned = false;
62469         LDKThreeBytes rgb_ref;
62470         CHECK((*env)->GetArrayLength(env, rgb) == 3);
62471         (*env)->GetByteArrayRegion(env, rgb, 0, 3, rgb_ref.data);
62472         LDKThirtyTwoBytes alias_ref;
62473         CHECK((*env)->GetArrayLength(env, alias) == 32);
62474         (*env)->GetByteArrayRegion(env, alias, 0, 32, alias_ref.data);
62475         LDKCVec_SocketAddressZ addresses_constr;
62476         addresses_constr.datalen = (*env)->GetArrayLength(env, addresses);
62477         if (addresses_constr.datalen > 0)
62478                 addresses_constr.data = MALLOC(addresses_constr.datalen * sizeof(LDKSocketAddress), "LDKCVec_SocketAddressZ Elements");
62479         else
62480                 addresses_constr.data = NULL;
62481         int64_t* addresses_vals = (*env)->GetLongArrayElements (env, addresses, NULL);
62482         for (size_t p = 0; p < addresses_constr.datalen; p++) {
62483                 int64_t addresses_conv_15 = addresses_vals[p];
62484                 void* addresses_conv_15_ptr = untag_ptr(addresses_conv_15);
62485                 CHECK_ACCESS(addresses_conv_15_ptr);
62486                 LDKSocketAddress addresses_conv_15_conv = *(LDKSocketAddress*)(addresses_conv_15_ptr);
62487                 addresses_constr.data[p] = addresses_conv_15_conv;
62488         }
62489         (*env)->ReleaseLongArrayElements(env, addresses, addresses_vals, 0);
62490         PeerManager_broadcast_node_announcement(&this_arg_conv, rgb_ref, alias_ref, addresses_constr);
62491 }
62492
62493 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_htlc_1success_1tx_1weight(JNIEnv *env, jclass clz, int64_t channel_type_features) {
62494         LDKChannelTypeFeatures channel_type_features_conv;
62495         channel_type_features_conv.inner = untag_ptr(channel_type_features);
62496         channel_type_features_conv.is_owned = ptr_is_owned(channel_type_features);
62497         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_features_conv);
62498         channel_type_features_conv.is_owned = false;
62499         int64_t ret_conv = htlc_success_tx_weight(&channel_type_features_conv);
62500         return ret_conv;
62501 }
62502
62503 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_htlc_1timeout_1tx_1weight(JNIEnv *env, jclass clz, int64_t channel_type_features) {
62504         LDKChannelTypeFeatures channel_type_features_conv;
62505         channel_type_features_conv.inner = untag_ptr(channel_type_features);
62506         channel_type_features_conv.is_owned = ptr_is_owned(channel_type_features);
62507         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_features_conv);
62508         channel_type_features_conv.is_owned = false;
62509         int64_t ret_conv = htlc_timeout_tx_weight(&channel_type_features_conv);
62510         return ret_conv;
62511 }
62512
62513 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_HTLCClaim_1clone(JNIEnv *env, jclass clz, int64_t orig) {
62514         LDKHTLCClaim* orig_conv = (LDKHTLCClaim*)untag_ptr(orig);
62515         jclass ret_conv = LDKHTLCClaim_to_java(env, HTLCClaim_clone(orig_conv));
62516         return ret_conv;
62517 }
62518
62519 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_HTLCClaim_1offered_1timeout(JNIEnv *env, jclass clz) {
62520         jclass ret_conv = LDKHTLCClaim_to_java(env, HTLCClaim_offered_timeout());
62521         return ret_conv;
62522 }
62523
62524 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_HTLCClaim_1offered_1preimage(JNIEnv *env, jclass clz) {
62525         jclass ret_conv = LDKHTLCClaim_to_java(env, HTLCClaim_offered_preimage());
62526         return ret_conv;
62527 }
62528
62529 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_HTLCClaim_1accepted_1timeout(JNIEnv *env, jclass clz) {
62530         jclass ret_conv = LDKHTLCClaim_to_java(env, HTLCClaim_accepted_timeout());
62531         return ret_conv;
62532 }
62533
62534 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_HTLCClaim_1accepted_1preimage(JNIEnv *env, jclass clz) {
62535         jclass ret_conv = LDKHTLCClaim_to_java(env, HTLCClaim_accepted_preimage());
62536         return ret_conv;
62537 }
62538
62539 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_HTLCClaim_1revocation(JNIEnv *env, jclass clz) {
62540         jclass ret_conv = LDKHTLCClaim_to_java(env, HTLCClaim_revocation());
62541         return ret_conv;
62542 }
62543
62544 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_HTLCClaim_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
62545         LDKHTLCClaim* a_conv = (LDKHTLCClaim*)untag_ptr(a);
62546         LDKHTLCClaim* b_conv = (LDKHTLCClaim*)untag_ptr(b);
62547         jboolean ret_conv = HTLCClaim_eq(a_conv, b_conv);
62548         return ret_conv;
62549 }
62550
62551 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCClaim_1from_1witness(JNIEnv *env, jclass clz, int8_tArray witness) {
62552         LDKWitness witness_ref;
62553         witness_ref.datalen = (*env)->GetArrayLength(env, witness);
62554         witness_ref.data = MALLOC(witness_ref.datalen, "LDKWitness Bytes");
62555         (*env)->GetByteArrayRegion(env, witness, 0, witness_ref.datalen, witness_ref.data);
62556         witness_ref.data_is_owned = true;
62557         LDKCOption_HTLCClaimZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCClaimZ), "LDKCOption_HTLCClaimZ");
62558         *ret_copy = HTLCClaim_from_witness(witness_ref);
62559         int64_t ret_ref = tag_ptr(ret_copy, true);
62560         return ret_ref;
62561 }
62562
62563 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_build_1commitment_1secret(JNIEnv *env, jclass clz, int8_tArray commitment_seed, int64_t idx) {
62564         uint8_t commitment_seed_arr[32];
62565         CHECK((*env)->GetArrayLength(env, commitment_seed) == 32);
62566         (*env)->GetByteArrayRegion(env, commitment_seed, 0, 32, commitment_seed_arr);
62567         uint8_t (*commitment_seed_ref)[32] = &commitment_seed_arr;
62568         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
62569         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, build_commitment_secret(commitment_seed_ref, idx).data);
62570         return ret_arr;
62571 }
62572
62573 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) {
62574         LDKCVec_u8Z to_holder_script_ref;
62575         to_holder_script_ref.datalen = (*env)->GetArrayLength(env, to_holder_script);
62576         to_holder_script_ref.data = MALLOC(to_holder_script_ref.datalen, "LDKCVec_u8Z Bytes");
62577         (*env)->GetByteArrayRegion(env, to_holder_script, 0, to_holder_script_ref.datalen, to_holder_script_ref.data);
62578         LDKCVec_u8Z to_counterparty_script_ref;
62579         to_counterparty_script_ref.datalen = (*env)->GetArrayLength(env, to_counterparty_script);
62580         to_counterparty_script_ref.data = MALLOC(to_counterparty_script_ref.datalen, "LDKCVec_u8Z Bytes");
62581         (*env)->GetByteArrayRegion(env, to_counterparty_script, 0, to_counterparty_script_ref.datalen, to_counterparty_script_ref.data);
62582         LDKOutPoint funding_outpoint_conv;
62583         funding_outpoint_conv.inner = untag_ptr(funding_outpoint);
62584         funding_outpoint_conv.is_owned = ptr_is_owned(funding_outpoint);
62585         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_conv);
62586         funding_outpoint_conv = OutPoint_clone(&funding_outpoint_conv);
62587         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);
62588         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
62589         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
62590         Transaction_free(ret_var);
62591         return ret_arr;
62592 }
62593
62594 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyCommitmentSecrets_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
62595         LDKCounterpartyCommitmentSecrets this_obj_conv;
62596         this_obj_conv.inner = untag_ptr(this_obj);
62597         this_obj_conv.is_owned = ptr_is_owned(this_obj);
62598         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
62599         CounterpartyCommitmentSecrets_free(this_obj_conv);
62600 }
62601
62602 static inline uint64_t CounterpartyCommitmentSecrets_clone_ptr(LDKCounterpartyCommitmentSecrets *NONNULL_PTR arg) {
62603         LDKCounterpartyCommitmentSecrets ret_var = CounterpartyCommitmentSecrets_clone(arg);
62604         int64_t ret_ref = 0;
62605         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62606         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62607         return ret_ref;
62608 }
62609 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyCommitmentSecrets_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
62610         LDKCounterpartyCommitmentSecrets arg_conv;
62611         arg_conv.inner = untag_ptr(arg);
62612         arg_conv.is_owned = ptr_is_owned(arg);
62613         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
62614         arg_conv.is_owned = false;
62615         int64_t ret_conv = CounterpartyCommitmentSecrets_clone_ptr(&arg_conv);
62616         return ret_conv;
62617 }
62618
62619 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyCommitmentSecrets_1clone(JNIEnv *env, jclass clz, int64_t orig) {
62620         LDKCounterpartyCommitmentSecrets orig_conv;
62621         orig_conv.inner = untag_ptr(orig);
62622         orig_conv.is_owned = ptr_is_owned(orig);
62623         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
62624         orig_conv.is_owned = false;
62625         LDKCounterpartyCommitmentSecrets ret_var = CounterpartyCommitmentSecrets_clone(&orig_conv);
62626         int64_t ret_ref = 0;
62627         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62628         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62629         return ret_ref;
62630 }
62631
62632 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyCommitmentSecrets_1new(JNIEnv *env, jclass clz) {
62633         LDKCounterpartyCommitmentSecrets ret_var = CounterpartyCommitmentSecrets_new();
62634         int64_t ret_ref = 0;
62635         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62636         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62637         return ret_ref;
62638 }
62639
62640 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyCommitmentSecrets_1get_1min_1seen_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
62641         LDKCounterpartyCommitmentSecrets this_arg_conv;
62642         this_arg_conv.inner = untag_ptr(this_arg);
62643         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62644         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62645         this_arg_conv.is_owned = false;
62646         int64_t ret_conv = CounterpartyCommitmentSecrets_get_min_seen_secret(&this_arg_conv);
62647         return ret_conv;
62648 }
62649
62650 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) {
62651         LDKCounterpartyCommitmentSecrets this_arg_conv;
62652         this_arg_conv.inner = untag_ptr(this_arg);
62653         this_arg_conv.is_owned = ptr_is_owned(this_arg);
62654         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
62655         this_arg_conv.is_owned = false;
62656         LDKThirtyTwoBytes secret_ref;
62657         CHECK((*env)->GetArrayLength(env, secret) == 32);
62658         (*env)->GetByteArrayRegion(env, secret, 0, 32, secret_ref.data);
62659         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
62660         *ret_conv = CounterpartyCommitmentSecrets_provide_secret(&this_arg_conv, idx, secret_ref);
62661         return tag_ptr(ret_conv, true);
62662 }
62663
62664 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CounterpartyCommitmentSecrets_1get_1secret(JNIEnv *env, jclass clz, int64_t this_arg, int64_t idx) {
62665         LDKCounterpartyCommitmentSecrets 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         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
62671         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, CounterpartyCommitmentSecrets_get_secret(&this_arg_conv, idx).data);
62672         return ret_arr;
62673 }
62674
62675 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CounterpartyCommitmentSecrets_1write(JNIEnv *env, jclass clz, int64_t obj) {
62676         LDKCounterpartyCommitmentSecrets obj_conv;
62677         obj_conv.inner = untag_ptr(obj);
62678         obj_conv.is_owned = ptr_is_owned(obj);
62679         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
62680         obj_conv.is_owned = false;
62681         LDKCVec_u8Z ret_var = CounterpartyCommitmentSecrets_write(&obj_conv);
62682         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
62683         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
62684         CVec_u8Z_free(ret_var);
62685         return ret_arr;
62686 }
62687
62688 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyCommitmentSecrets_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
62689         LDKu8slice ser_ref;
62690         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
62691         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
62692         LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ), "LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ");
62693         *ret_conv = CounterpartyCommitmentSecrets_read(ser_ref);
62694         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
62695         return tag_ptr(ret_conv, true);
62696 }
62697
62698 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) {
62699         LDKPublicKey per_commitment_point_ref;
62700         CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
62701         (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
62702         uint8_t base_secret_arr[32];
62703         CHECK((*env)->GetArrayLength(env, base_secret) == 32);
62704         (*env)->GetByteArrayRegion(env, base_secret, 0, 32, base_secret_arr);
62705         uint8_t (*base_secret_ref)[32] = &base_secret_arr;
62706         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
62707         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, derive_private_key(per_commitment_point_ref, base_secret_ref).bytes);
62708         return ret_arr;
62709 }
62710
62711 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) {
62712         uint8_t per_commitment_secret_arr[32];
62713         CHECK((*env)->GetArrayLength(env, per_commitment_secret) == 32);
62714         (*env)->GetByteArrayRegion(env, per_commitment_secret, 0, 32, per_commitment_secret_arr);
62715         uint8_t (*per_commitment_secret_ref)[32] = &per_commitment_secret_arr;
62716         uint8_t countersignatory_revocation_base_secret_arr[32];
62717         CHECK((*env)->GetArrayLength(env, countersignatory_revocation_base_secret) == 32);
62718         (*env)->GetByteArrayRegion(env, countersignatory_revocation_base_secret, 0, 32, countersignatory_revocation_base_secret_arr);
62719         uint8_t (*countersignatory_revocation_base_secret_ref)[32] = &countersignatory_revocation_base_secret_arr;
62720         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
62721         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, derive_private_revocation_key(per_commitment_secret_ref, countersignatory_revocation_base_secret_ref).bytes);
62722         return ret_arr;
62723 }
62724
62725 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
62726         LDKTxCreationKeys this_obj_conv;
62727         this_obj_conv.inner = untag_ptr(this_obj);
62728         this_obj_conv.is_owned = ptr_is_owned(this_obj);
62729         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
62730         TxCreationKeys_free(this_obj_conv);
62731 }
62732
62733 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
62734         LDKTxCreationKeys this_ptr_conv;
62735         this_ptr_conv.inner = untag_ptr(this_ptr);
62736         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62737         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62738         this_ptr_conv.is_owned = false;
62739         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
62740         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, TxCreationKeys_get_per_commitment_point(&this_ptr_conv).compressed_form);
62741         return ret_arr;
62742 }
62743
62744 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
62745         LDKTxCreationKeys this_ptr_conv;
62746         this_ptr_conv.inner = untag_ptr(this_ptr);
62747         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62748         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62749         this_ptr_conv.is_owned = false;
62750         LDKPublicKey val_ref;
62751         CHECK((*env)->GetArrayLength(env, val) == 33);
62752         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
62753         TxCreationKeys_set_per_commitment_point(&this_ptr_conv, val_ref);
62754 }
62755
62756 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1revocation_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
62757         LDKTxCreationKeys this_ptr_conv;
62758         this_ptr_conv.inner = untag_ptr(this_ptr);
62759         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62760         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62761         this_ptr_conv.is_owned = false;
62762         LDKRevocationKey ret_var = TxCreationKeys_get_revocation_key(&this_ptr_conv);
62763         int64_t ret_ref = 0;
62764         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62765         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62766         return ret_ref;
62767 }
62768
62769 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1revocation_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
62770         LDKTxCreationKeys this_ptr_conv;
62771         this_ptr_conv.inner = untag_ptr(this_ptr);
62772         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62773         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62774         this_ptr_conv.is_owned = false;
62775         LDKRevocationKey val_conv;
62776         val_conv.inner = untag_ptr(val);
62777         val_conv.is_owned = ptr_is_owned(val);
62778         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
62779         val_conv = RevocationKey_clone(&val_conv);
62780         TxCreationKeys_set_revocation_key(&this_ptr_conv, val_conv);
62781 }
62782
62783 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1broadcaster_1htlc_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
62784         LDKTxCreationKeys this_ptr_conv;
62785         this_ptr_conv.inner = untag_ptr(this_ptr);
62786         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62787         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62788         this_ptr_conv.is_owned = false;
62789         LDKHtlcKey ret_var = TxCreationKeys_get_broadcaster_htlc_key(&this_ptr_conv);
62790         int64_t ret_ref = 0;
62791         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62792         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62793         return ret_ref;
62794 }
62795
62796 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1broadcaster_1htlc_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
62797         LDKTxCreationKeys this_ptr_conv;
62798         this_ptr_conv.inner = untag_ptr(this_ptr);
62799         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62800         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62801         this_ptr_conv.is_owned = false;
62802         LDKHtlcKey val_conv;
62803         val_conv.inner = untag_ptr(val);
62804         val_conv.is_owned = ptr_is_owned(val);
62805         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
62806         val_conv = HtlcKey_clone(&val_conv);
62807         TxCreationKeys_set_broadcaster_htlc_key(&this_ptr_conv, val_conv);
62808 }
62809
62810 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1countersignatory_1htlc_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
62811         LDKTxCreationKeys this_ptr_conv;
62812         this_ptr_conv.inner = untag_ptr(this_ptr);
62813         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62814         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62815         this_ptr_conv.is_owned = false;
62816         LDKHtlcKey ret_var = TxCreationKeys_get_countersignatory_htlc_key(&this_ptr_conv);
62817         int64_t ret_ref = 0;
62818         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62819         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62820         return ret_ref;
62821 }
62822
62823 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1countersignatory_1htlc_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
62824         LDKTxCreationKeys this_ptr_conv;
62825         this_ptr_conv.inner = untag_ptr(this_ptr);
62826         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62827         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62828         this_ptr_conv.is_owned = false;
62829         LDKHtlcKey val_conv;
62830         val_conv.inner = untag_ptr(val);
62831         val_conv.is_owned = ptr_is_owned(val);
62832         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
62833         val_conv = HtlcKey_clone(&val_conv);
62834         TxCreationKeys_set_countersignatory_htlc_key(&this_ptr_conv, val_conv);
62835 }
62836
62837 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1broadcaster_1delayed_1payment_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
62838         LDKTxCreationKeys this_ptr_conv;
62839         this_ptr_conv.inner = untag_ptr(this_ptr);
62840         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62841         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62842         this_ptr_conv.is_owned = false;
62843         LDKDelayedPaymentKey ret_var = TxCreationKeys_get_broadcaster_delayed_payment_key(&this_ptr_conv);
62844         int64_t ret_ref = 0;
62845         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62846         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62847         return ret_ref;
62848 }
62849
62850 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) {
62851         LDKTxCreationKeys this_ptr_conv;
62852         this_ptr_conv.inner = untag_ptr(this_ptr);
62853         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62854         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62855         this_ptr_conv.is_owned = false;
62856         LDKDelayedPaymentKey val_conv;
62857         val_conv.inner = untag_ptr(val);
62858         val_conv.is_owned = ptr_is_owned(val);
62859         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
62860         val_conv = DelayedPaymentKey_clone(&val_conv);
62861         TxCreationKeys_set_broadcaster_delayed_payment_key(&this_ptr_conv, val_conv);
62862 }
62863
62864 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) {
62865         LDKPublicKey per_commitment_point_arg_ref;
62866         CHECK((*env)->GetArrayLength(env, per_commitment_point_arg) == 33);
62867         (*env)->GetByteArrayRegion(env, per_commitment_point_arg, 0, 33, per_commitment_point_arg_ref.compressed_form);
62868         LDKRevocationKey revocation_key_arg_conv;
62869         revocation_key_arg_conv.inner = untag_ptr(revocation_key_arg);
62870         revocation_key_arg_conv.is_owned = ptr_is_owned(revocation_key_arg);
62871         CHECK_INNER_FIELD_ACCESS_OR_NULL(revocation_key_arg_conv);
62872         revocation_key_arg_conv = RevocationKey_clone(&revocation_key_arg_conv);
62873         LDKHtlcKey broadcaster_htlc_key_arg_conv;
62874         broadcaster_htlc_key_arg_conv.inner = untag_ptr(broadcaster_htlc_key_arg);
62875         broadcaster_htlc_key_arg_conv.is_owned = ptr_is_owned(broadcaster_htlc_key_arg);
62876         CHECK_INNER_FIELD_ACCESS_OR_NULL(broadcaster_htlc_key_arg_conv);
62877         broadcaster_htlc_key_arg_conv = HtlcKey_clone(&broadcaster_htlc_key_arg_conv);
62878         LDKHtlcKey countersignatory_htlc_key_arg_conv;
62879         countersignatory_htlc_key_arg_conv.inner = untag_ptr(countersignatory_htlc_key_arg);
62880         countersignatory_htlc_key_arg_conv.is_owned = ptr_is_owned(countersignatory_htlc_key_arg);
62881         CHECK_INNER_FIELD_ACCESS_OR_NULL(countersignatory_htlc_key_arg_conv);
62882         countersignatory_htlc_key_arg_conv = HtlcKey_clone(&countersignatory_htlc_key_arg_conv);
62883         LDKDelayedPaymentKey broadcaster_delayed_payment_key_arg_conv;
62884         broadcaster_delayed_payment_key_arg_conv.inner = untag_ptr(broadcaster_delayed_payment_key_arg);
62885         broadcaster_delayed_payment_key_arg_conv.is_owned = ptr_is_owned(broadcaster_delayed_payment_key_arg);
62886         CHECK_INNER_FIELD_ACCESS_OR_NULL(broadcaster_delayed_payment_key_arg_conv);
62887         broadcaster_delayed_payment_key_arg_conv = DelayedPaymentKey_clone(&broadcaster_delayed_payment_key_arg_conv);
62888         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);
62889         int64_t ret_ref = 0;
62890         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62891         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62892         return ret_ref;
62893 }
62894
62895 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
62896         LDKTxCreationKeys a_conv;
62897         a_conv.inner = untag_ptr(a);
62898         a_conv.is_owned = ptr_is_owned(a);
62899         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
62900         a_conv.is_owned = false;
62901         LDKTxCreationKeys b_conv;
62902         b_conv.inner = untag_ptr(b);
62903         b_conv.is_owned = ptr_is_owned(b);
62904         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
62905         b_conv.is_owned = false;
62906         jboolean ret_conv = TxCreationKeys_eq(&a_conv, &b_conv);
62907         return ret_conv;
62908 }
62909
62910 static inline uint64_t TxCreationKeys_clone_ptr(LDKTxCreationKeys *NONNULL_PTR arg) {
62911         LDKTxCreationKeys ret_var = TxCreationKeys_clone(arg);
62912         int64_t ret_ref = 0;
62913         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62914         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62915         return ret_ref;
62916 }
62917 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
62918         LDKTxCreationKeys arg_conv;
62919         arg_conv.inner = untag_ptr(arg);
62920         arg_conv.is_owned = ptr_is_owned(arg);
62921         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
62922         arg_conv.is_owned = false;
62923         int64_t ret_conv = TxCreationKeys_clone_ptr(&arg_conv);
62924         return ret_conv;
62925 }
62926
62927 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1clone(JNIEnv *env, jclass clz, int64_t orig) {
62928         LDKTxCreationKeys orig_conv;
62929         orig_conv.inner = untag_ptr(orig);
62930         orig_conv.is_owned = ptr_is_owned(orig);
62931         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
62932         orig_conv.is_owned = false;
62933         LDKTxCreationKeys ret_var = TxCreationKeys_clone(&orig_conv);
62934         int64_t ret_ref = 0;
62935         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
62936         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
62937         return ret_ref;
62938 }
62939
62940 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1write(JNIEnv *env, jclass clz, int64_t obj) {
62941         LDKTxCreationKeys obj_conv;
62942         obj_conv.inner = untag_ptr(obj);
62943         obj_conv.is_owned = ptr_is_owned(obj);
62944         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
62945         obj_conv.is_owned = false;
62946         LDKCVec_u8Z ret_var = TxCreationKeys_write(&obj_conv);
62947         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
62948         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
62949         CVec_u8Z_free(ret_var);
62950         return ret_arr;
62951 }
62952
62953 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
62954         LDKu8slice ser_ref;
62955         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
62956         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
62957         LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
62958         *ret_conv = TxCreationKeys_read(ser_ref);
62959         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
62960         return tag_ptr(ret_conv, true);
62961 }
62962
62963 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
62964         LDKChannelPublicKeys this_obj_conv;
62965         this_obj_conv.inner = untag_ptr(this_obj);
62966         this_obj_conv.is_owned = ptr_is_owned(this_obj);
62967         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
62968         ChannelPublicKeys_free(this_obj_conv);
62969 }
62970
62971 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
62972         LDKChannelPublicKeys this_ptr_conv;
62973         this_ptr_conv.inner = untag_ptr(this_ptr);
62974         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62975         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62976         this_ptr_conv.is_owned = false;
62977         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
62978         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelPublicKeys_get_funding_pubkey(&this_ptr_conv).compressed_form);
62979         return ret_arr;
62980 }
62981
62982 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
62983         LDKChannelPublicKeys this_ptr_conv;
62984         this_ptr_conv.inner = untag_ptr(this_ptr);
62985         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62986         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62987         this_ptr_conv.is_owned = false;
62988         LDKPublicKey val_ref;
62989         CHECK((*env)->GetArrayLength(env, val) == 33);
62990         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
62991         ChannelPublicKeys_set_funding_pubkey(&this_ptr_conv, val_ref);
62992 }
62993
62994 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
62995         LDKChannelPublicKeys this_ptr_conv;
62996         this_ptr_conv.inner = untag_ptr(this_ptr);
62997         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
62998         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
62999         this_ptr_conv.is_owned = false;
63000         LDKRevocationBasepoint ret_var = ChannelPublicKeys_get_revocation_basepoint(&this_ptr_conv);
63001         int64_t ret_ref = 0;
63002         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63003         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63004         return ret_ref;
63005 }
63006
63007 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
63008         LDKChannelPublicKeys this_ptr_conv;
63009         this_ptr_conv.inner = untag_ptr(this_ptr);
63010         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63011         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63012         this_ptr_conv.is_owned = false;
63013         LDKRevocationBasepoint val_conv;
63014         val_conv.inner = untag_ptr(val);
63015         val_conv.is_owned = ptr_is_owned(val);
63016         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
63017         val_conv = RevocationBasepoint_clone(&val_conv);
63018         ChannelPublicKeys_set_revocation_basepoint(&this_ptr_conv, val_conv);
63019 }
63020
63021 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
63022         LDKChannelPublicKeys this_ptr_conv;
63023         this_ptr_conv.inner = untag_ptr(this_ptr);
63024         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63025         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63026         this_ptr_conv.is_owned = false;
63027         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
63028         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelPublicKeys_get_payment_point(&this_ptr_conv).compressed_form);
63029         return ret_arr;
63030 }
63031
63032 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
63033         LDKChannelPublicKeys this_ptr_conv;
63034         this_ptr_conv.inner = untag_ptr(this_ptr);
63035         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63036         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63037         this_ptr_conv.is_owned = false;
63038         LDKPublicKey val_ref;
63039         CHECK((*env)->GetArrayLength(env, val) == 33);
63040         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
63041         ChannelPublicKeys_set_payment_point(&this_ptr_conv, val_ref);
63042 }
63043
63044 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
63045         LDKChannelPublicKeys this_ptr_conv;
63046         this_ptr_conv.inner = untag_ptr(this_ptr);
63047         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63048         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63049         this_ptr_conv.is_owned = false;
63050         LDKDelayedPaymentBasepoint ret_var = ChannelPublicKeys_get_delayed_payment_basepoint(&this_ptr_conv);
63051         int64_t ret_ref = 0;
63052         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63053         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63054         return ret_ref;
63055 }
63056
63057 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
63058         LDKChannelPublicKeys this_ptr_conv;
63059         this_ptr_conv.inner = untag_ptr(this_ptr);
63060         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63061         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63062         this_ptr_conv.is_owned = false;
63063         LDKDelayedPaymentBasepoint val_conv;
63064         val_conv.inner = untag_ptr(val);
63065         val_conv.is_owned = ptr_is_owned(val);
63066         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
63067         val_conv = DelayedPaymentBasepoint_clone(&val_conv);
63068         ChannelPublicKeys_set_delayed_payment_basepoint(&this_ptr_conv, val_conv);
63069 }
63070
63071 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
63072         LDKChannelPublicKeys this_ptr_conv;
63073         this_ptr_conv.inner = untag_ptr(this_ptr);
63074         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63075         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63076         this_ptr_conv.is_owned = false;
63077         LDKHtlcBasepoint ret_var = ChannelPublicKeys_get_htlc_basepoint(&this_ptr_conv);
63078         int64_t ret_ref = 0;
63079         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63080         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63081         return ret_ref;
63082 }
63083
63084 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
63085         LDKChannelPublicKeys this_ptr_conv;
63086         this_ptr_conv.inner = untag_ptr(this_ptr);
63087         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63088         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63089         this_ptr_conv.is_owned = false;
63090         LDKHtlcBasepoint val_conv;
63091         val_conv.inner = untag_ptr(val);
63092         val_conv.is_owned = ptr_is_owned(val);
63093         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
63094         val_conv = HtlcBasepoint_clone(&val_conv);
63095         ChannelPublicKeys_set_htlc_basepoint(&this_ptr_conv, val_conv);
63096 }
63097
63098 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) {
63099         LDKPublicKey funding_pubkey_arg_ref;
63100         CHECK((*env)->GetArrayLength(env, funding_pubkey_arg) == 33);
63101         (*env)->GetByteArrayRegion(env, funding_pubkey_arg, 0, 33, funding_pubkey_arg_ref.compressed_form);
63102         LDKRevocationBasepoint revocation_basepoint_arg_conv;
63103         revocation_basepoint_arg_conv.inner = untag_ptr(revocation_basepoint_arg);
63104         revocation_basepoint_arg_conv.is_owned = ptr_is_owned(revocation_basepoint_arg);
63105         CHECK_INNER_FIELD_ACCESS_OR_NULL(revocation_basepoint_arg_conv);
63106         revocation_basepoint_arg_conv = RevocationBasepoint_clone(&revocation_basepoint_arg_conv);
63107         LDKPublicKey payment_point_arg_ref;
63108         CHECK((*env)->GetArrayLength(env, payment_point_arg) == 33);
63109         (*env)->GetByteArrayRegion(env, payment_point_arg, 0, 33, payment_point_arg_ref.compressed_form);
63110         LDKDelayedPaymentBasepoint delayed_payment_basepoint_arg_conv;
63111         delayed_payment_basepoint_arg_conv.inner = untag_ptr(delayed_payment_basepoint_arg);
63112         delayed_payment_basepoint_arg_conv.is_owned = ptr_is_owned(delayed_payment_basepoint_arg);
63113         CHECK_INNER_FIELD_ACCESS_OR_NULL(delayed_payment_basepoint_arg_conv);
63114         delayed_payment_basepoint_arg_conv = DelayedPaymentBasepoint_clone(&delayed_payment_basepoint_arg_conv);
63115         LDKHtlcBasepoint htlc_basepoint_arg_conv;
63116         htlc_basepoint_arg_conv.inner = untag_ptr(htlc_basepoint_arg);
63117         htlc_basepoint_arg_conv.is_owned = ptr_is_owned(htlc_basepoint_arg);
63118         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_basepoint_arg_conv);
63119         htlc_basepoint_arg_conv = HtlcBasepoint_clone(&htlc_basepoint_arg_conv);
63120         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);
63121         int64_t ret_ref = 0;
63122         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63123         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63124         return ret_ref;
63125 }
63126
63127 static inline uint64_t ChannelPublicKeys_clone_ptr(LDKChannelPublicKeys *NONNULL_PTR arg) {
63128         LDKChannelPublicKeys ret_var = ChannelPublicKeys_clone(arg);
63129         int64_t ret_ref = 0;
63130         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63131         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63132         return ret_ref;
63133 }
63134 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
63135         LDKChannelPublicKeys arg_conv;
63136         arg_conv.inner = untag_ptr(arg);
63137         arg_conv.is_owned = ptr_is_owned(arg);
63138         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
63139         arg_conv.is_owned = false;
63140         int64_t ret_conv = ChannelPublicKeys_clone_ptr(&arg_conv);
63141         return ret_conv;
63142 }
63143
63144 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1clone(JNIEnv *env, jclass clz, int64_t orig) {
63145         LDKChannelPublicKeys orig_conv;
63146         orig_conv.inner = untag_ptr(orig);
63147         orig_conv.is_owned = ptr_is_owned(orig);
63148         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
63149         orig_conv.is_owned = false;
63150         LDKChannelPublicKeys ret_var = ChannelPublicKeys_clone(&orig_conv);
63151         int64_t ret_ref = 0;
63152         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63153         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63154         return ret_ref;
63155 }
63156
63157 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1hash(JNIEnv *env, jclass clz, int64_t o) {
63158         LDKChannelPublicKeys o_conv;
63159         o_conv.inner = untag_ptr(o);
63160         o_conv.is_owned = ptr_is_owned(o);
63161         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
63162         o_conv.is_owned = false;
63163         int64_t ret_conv = ChannelPublicKeys_hash(&o_conv);
63164         return ret_conv;
63165 }
63166
63167 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
63168         LDKChannelPublicKeys a_conv;
63169         a_conv.inner = untag_ptr(a);
63170         a_conv.is_owned = ptr_is_owned(a);
63171         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
63172         a_conv.is_owned = false;
63173         LDKChannelPublicKeys b_conv;
63174         b_conv.inner = untag_ptr(b);
63175         b_conv.is_owned = ptr_is_owned(b);
63176         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
63177         b_conv.is_owned = false;
63178         jboolean ret_conv = ChannelPublicKeys_eq(&a_conv, &b_conv);
63179         return ret_conv;
63180 }
63181
63182 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1write(JNIEnv *env, jclass clz, int64_t obj) {
63183         LDKChannelPublicKeys obj_conv;
63184         obj_conv.inner = untag_ptr(obj);
63185         obj_conv.is_owned = ptr_is_owned(obj);
63186         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
63187         obj_conv.is_owned = false;
63188         LDKCVec_u8Z ret_var = ChannelPublicKeys_write(&obj_conv);
63189         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
63190         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
63191         CVec_u8Z_free(ret_var);
63192         return ret_arr;
63193 }
63194
63195 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
63196         LDKu8slice ser_ref;
63197         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
63198         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
63199         LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
63200         *ret_conv = ChannelPublicKeys_read(ser_ref);
63201         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
63202         return tag_ptr(ret_conv, true);
63203 }
63204
63205 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) {
63206         LDKPublicKey per_commitment_point_ref;
63207         CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
63208         (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
63209         LDKDelayedPaymentBasepoint broadcaster_delayed_payment_base_conv;
63210         broadcaster_delayed_payment_base_conv.inner = untag_ptr(broadcaster_delayed_payment_base);
63211         broadcaster_delayed_payment_base_conv.is_owned = ptr_is_owned(broadcaster_delayed_payment_base);
63212         CHECK_INNER_FIELD_ACCESS_OR_NULL(broadcaster_delayed_payment_base_conv);
63213         broadcaster_delayed_payment_base_conv.is_owned = false;
63214         LDKHtlcBasepoint broadcaster_htlc_base_conv;
63215         broadcaster_htlc_base_conv.inner = untag_ptr(broadcaster_htlc_base);
63216         broadcaster_htlc_base_conv.is_owned = ptr_is_owned(broadcaster_htlc_base);
63217         CHECK_INNER_FIELD_ACCESS_OR_NULL(broadcaster_htlc_base_conv);
63218         broadcaster_htlc_base_conv.is_owned = false;
63219         LDKRevocationBasepoint countersignatory_revocation_base_conv;
63220         countersignatory_revocation_base_conv.inner = untag_ptr(countersignatory_revocation_base);
63221         countersignatory_revocation_base_conv.is_owned = ptr_is_owned(countersignatory_revocation_base);
63222         CHECK_INNER_FIELD_ACCESS_OR_NULL(countersignatory_revocation_base_conv);
63223         countersignatory_revocation_base_conv.is_owned = false;
63224         LDKHtlcBasepoint countersignatory_htlc_base_conv;
63225         countersignatory_htlc_base_conv.inner = untag_ptr(countersignatory_htlc_base);
63226         countersignatory_htlc_base_conv.is_owned = ptr_is_owned(countersignatory_htlc_base);
63227         CHECK_INNER_FIELD_ACCESS_OR_NULL(countersignatory_htlc_base_conv);
63228         countersignatory_htlc_base_conv.is_owned = false;
63229         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);
63230         int64_t ret_ref = 0;
63231         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63232         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63233         return ret_ref;
63234 }
63235
63236 JNIEXPORT 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) {
63237         LDKPublicKey per_commitment_point_ref;
63238         CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
63239         (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
63240         LDKChannelPublicKeys broadcaster_keys_conv;
63241         broadcaster_keys_conv.inner = untag_ptr(broadcaster_keys);
63242         broadcaster_keys_conv.is_owned = ptr_is_owned(broadcaster_keys);
63243         CHECK_INNER_FIELD_ACCESS_OR_NULL(broadcaster_keys_conv);
63244         broadcaster_keys_conv.is_owned = false;
63245         LDKChannelPublicKeys countersignatory_keys_conv;
63246         countersignatory_keys_conv.inner = untag_ptr(countersignatory_keys);
63247         countersignatory_keys_conv.is_owned = ptr_is_owned(countersignatory_keys);
63248         CHECK_INNER_FIELD_ACCESS_OR_NULL(countersignatory_keys_conv);
63249         countersignatory_keys_conv.is_owned = false;
63250         LDKTxCreationKeys ret_var = TxCreationKeys_from_channel_static_keys(per_commitment_point_ref, &broadcaster_keys_conv, &countersignatory_keys_conv);
63251         int64_t ret_ref = 0;
63252         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63253         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63254         return ret_ref;
63255 }
63256
63257 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) {
63258         LDKRevocationKey revocation_key_conv;
63259         revocation_key_conv.inner = untag_ptr(revocation_key);
63260         revocation_key_conv.is_owned = ptr_is_owned(revocation_key);
63261         CHECK_INNER_FIELD_ACCESS_OR_NULL(revocation_key_conv);
63262         revocation_key_conv.is_owned = false;
63263         LDKDelayedPaymentKey broadcaster_delayed_payment_key_conv;
63264         broadcaster_delayed_payment_key_conv.inner = untag_ptr(broadcaster_delayed_payment_key);
63265         broadcaster_delayed_payment_key_conv.is_owned = ptr_is_owned(broadcaster_delayed_payment_key);
63266         CHECK_INNER_FIELD_ACCESS_OR_NULL(broadcaster_delayed_payment_key_conv);
63267         broadcaster_delayed_payment_key_conv.is_owned = false;
63268         LDKCVec_u8Z ret_var = get_revokeable_redeemscript(&revocation_key_conv, contest_delay, &broadcaster_delayed_payment_key_conv);
63269         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
63270         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
63271         CVec_u8Z_free(ret_var);
63272         return ret_arr;
63273 }
63274
63275 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) {
63276         LDKChannelTypeFeatures channel_type_features_conv;
63277         channel_type_features_conv.inner = untag_ptr(channel_type_features);
63278         channel_type_features_conv.is_owned = ptr_is_owned(channel_type_features);
63279         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_features_conv);
63280         channel_type_features_conv.is_owned = false;
63281         LDKPublicKey payment_key_ref;
63282         CHECK((*env)->GetArrayLength(env, payment_key) == 33);
63283         (*env)->GetByteArrayRegion(env, payment_key, 0, 33, payment_key_ref.compressed_form);
63284         LDKCVec_u8Z ret_var = get_counterparty_payment_script(&channel_type_features_conv, payment_key_ref);
63285         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
63286         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
63287         CVec_u8Z_free(ret_var);
63288         return ret_arr;
63289 }
63290
63291 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
63292         LDKHTLCOutputInCommitment this_obj_conv;
63293         this_obj_conv.inner = untag_ptr(this_obj);
63294         this_obj_conv.is_owned = ptr_is_owned(this_obj);
63295         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
63296         HTLCOutputInCommitment_free(this_obj_conv);
63297 }
63298
63299 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1offered(JNIEnv *env, jclass clz, int64_t this_ptr) {
63300         LDKHTLCOutputInCommitment this_ptr_conv;
63301         this_ptr_conv.inner = untag_ptr(this_ptr);
63302         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63303         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63304         this_ptr_conv.is_owned = false;
63305         jboolean ret_conv = HTLCOutputInCommitment_get_offered(&this_ptr_conv);
63306         return ret_conv;
63307 }
63308
63309 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1offered(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
63310         LDKHTLCOutputInCommitment this_ptr_conv;
63311         this_ptr_conv.inner = untag_ptr(this_ptr);
63312         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63313         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63314         this_ptr_conv.is_owned = false;
63315         HTLCOutputInCommitment_set_offered(&this_ptr_conv, val);
63316 }
63317
63318 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1amount_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
63319         LDKHTLCOutputInCommitment this_ptr_conv;
63320         this_ptr_conv.inner = untag_ptr(this_ptr);
63321         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63322         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63323         this_ptr_conv.is_owned = false;
63324         int64_t ret_conv = HTLCOutputInCommitment_get_amount_msat(&this_ptr_conv);
63325         return ret_conv;
63326 }
63327
63328 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1amount_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
63329         LDKHTLCOutputInCommitment this_ptr_conv;
63330         this_ptr_conv.inner = untag_ptr(this_ptr);
63331         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63332         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63333         this_ptr_conv.is_owned = false;
63334         HTLCOutputInCommitment_set_amount_msat(&this_ptr_conv, val);
63335 }
63336
63337 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_ptr) {
63338         LDKHTLCOutputInCommitment this_ptr_conv;
63339         this_ptr_conv.inner = untag_ptr(this_ptr);
63340         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63341         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63342         this_ptr_conv.is_owned = false;
63343         int32_t ret_conv = HTLCOutputInCommitment_get_cltv_expiry(&this_ptr_conv);
63344         return ret_conv;
63345 }
63346
63347 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
63348         LDKHTLCOutputInCommitment this_ptr_conv;
63349         this_ptr_conv.inner = untag_ptr(this_ptr);
63350         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63351         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63352         this_ptr_conv.is_owned = false;
63353         HTLCOutputInCommitment_set_cltv_expiry(&this_ptr_conv, val);
63354 }
63355
63356 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
63357         LDKHTLCOutputInCommitment this_ptr_conv;
63358         this_ptr_conv.inner = untag_ptr(this_ptr);
63359         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63360         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63361         this_ptr_conv.is_owned = false;
63362         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
63363         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *HTLCOutputInCommitment_get_payment_hash(&this_ptr_conv));
63364         return ret_arr;
63365 }
63366
63367 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
63368         LDKHTLCOutputInCommitment this_ptr_conv;
63369         this_ptr_conv.inner = untag_ptr(this_ptr);
63370         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63371         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63372         this_ptr_conv.is_owned = false;
63373         LDKThirtyTwoBytes val_ref;
63374         CHECK((*env)->GetArrayLength(env, val) == 32);
63375         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
63376         HTLCOutputInCommitment_set_payment_hash(&this_ptr_conv, val_ref);
63377 }
63378
63379 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1transaction_1output_1index(JNIEnv *env, jclass clz, int64_t this_ptr) {
63380         LDKHTLCOutputInCommitment this_ptr_conv;
63381         this_ptr_conv.inner = untag_ptr(this_ptr);
63382         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63383         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63384         this_ptr_conv.is_owned = false;
63385         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
63386         *ret_copy = HTLCOutputInCommitment_get_transaction_output_index(&this_ptr_conv);
63387         int64_t ret_ref = tag_ptr(ret_copy, true);
63388         return ret_ref;
63389 }
63390
63391 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1transaction_1output_1index(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
63392         LDKHTLCOutputInCommitment this_ptr_conv;
63393         this_ptr_conv.inner = untag_ptr(this_ptr);
63394         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63395         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63396         this_ptr_conv.is_owned = false;
63397         void* val_ptr = untag_ptr(val);
63398         CHECK_ACCESS(val_ptr);
63399         LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr);
63400         val_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(val));
63401         HTLCOutputInCommitment_set_transaction_output_index(&this_ptr_conv, val_conv);
63402 }
63403
63404 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) {
63405         LDKThirtyTwoBytes payment_hash_arg_ref;
63406         CHECK((*env)->GetArrayLength(env, payment_hash_arg) == 32);
63407         (*env)->GetByteArrayRegion(env, payment_hash_arg, 0, 32, payment_hash_arg_ref.data);
63408         void* transaction_output_index_arg_ptr = untag_ptr(transaction_output_index_arg);
63409         CHECK_ACCESS(transaction_output_index_arg_ptr);
63410         LDKCOption_u32Z transaction_output_index_arg_conv = *(LDKCOption_u32Z*)(transaction_output_index_arg_ptr);
63411         transaction_output_index_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(transaction_output_index_arg));
63412         LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_new(offered_arg, amount_msat_arg, cltv_expiry_arg, payment_hash_arg_ref, transaction_output_index_arg_conv);
63413         int64_t ret_ref = 0;
63414         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63415         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63416         return ret_ref;
63417 }
63418
63419 static inline uint64_t HTLCOutputInCommitment_clone_ptr(LDKHTLCOutputInCommitment *NONNULL_PTR arg) {
63420         LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_clone(arg);
63421         int64_t ret_ref = 0;
63422         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63423         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63424         return ret_ref;
63425 }
63426 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
63427         LDKHTLCOutputInCommitment arg_conv;
63428         arg_conv.inner = untag_ptr(arg);
63429         arg_conv.is_owned = ptr_is_owned(arg);
63430         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
63431         arg_conv.is_owned = false;
63432         int64_t ret_conv = HTLCOutputInCommitment_clone_ptr(&arg_conv);
63433         return ret_conv;
63434 }
63435
63436 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1clone(JNIEnv *env, jclass clz, int64_t orig) {
63437         LDKHTLCOutputInCommitment orig_conv;
63438         orig_conv.inner = untag_ptr(orig);
63439         orig_conv.is_owned = ptr_is_owned(orig);
63440         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
63441         orig_conv.is_owned = false;
63442         LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_clone(&orig_conv);
63443         int64_t ret_ref = 0;
63444         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63445         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63446         return ret_ref;
63447 }
63448
63449 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
63450         LDKHTLCOutputInCommitment a_conv;
63451         a_conv.inner = untag_ptr(a);
63452         a_conv.is_owned = ptr_is_owned(a);
63453         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
63454         a_conv.is_owned = false;
63455         LDKHTLCOutputInCommitment b_conv;
63456         b_conv.inner = untag_ptr(b);
63457         b_conv.is_owned = ptr_is_owned(b);
63458         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
63459         b_conv.is_owned = false;
63460         jboolean ret_conv = HTLCOutputInCommitment_eq(&a_conv, &b_conv);
63461         return ret_conv;
63462 }
63463
63464 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1write(JNIEnv *env, jclass clz, int64_t obj) {
63465         LDKHTLCOutputInCommitment obj_conv;
63466         obj_conv.inner = untag_ptr(obj);
63467         obj_conv.is_owned = ptr_is_owned(obj);
63468         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
63469         obj_conv.is_owned = false;
63470         LDKCVec_u8Z ret_var = HTLCOutputInCommitment_write(&obj_conv);
63471         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
63472         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
63473         CVec_u8Z_free(ret_var);
63474         return ret_arr;
63475 }
63476
63477 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
63478         LDKu8slice ser_ref;
63479         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
63480         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
63481         LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
63482         *ret_conv = HTLCOutputInCommitment_read(ser_ref);
63483         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
63484         return tag_ptr(ret_conv, true);
63485 }
63486
63487 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) {
63488         LDKHTLCOutputInCommitment htlc_conv;
63489         htlc_conv.inner = untag_ptr(htlc);
63490         htlc_conv.is_owned = ptr_is_owned(htlc);
63491         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
63492         htlc_conv.is_owned = false;
63493         LDKChannelTypeFeatures channel_type_features_conv;
63494         channel_type_features_conv.inner = untag_ptr(channel_type_features);
63495         channel_type_features_conv.is_owned = ptr_is_owned(channel_type_features);
63496         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_features_conv);
63497         channel_type_features_conv.is_owned = false;
63498         LDKTxCreationKeys keys_conv;
63499         keys_conv.inner = untag_ptr(keys);
63500         keys_conv.is_owned = ptr_is_owned(keys);
63501         CHECK_INNER_FIELD_ACCESS_OR_NULL(keys_conv);
63502         keys_conv.is_owned = false;
63503         LDKCVec_u8Z ret_var = get_htlc_redeemscript(&htlc_conv, &channel_type_features_conv, &keys_conv);
63504         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
63505         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
63506         CVec_u8Z_free(ret_var);
63507         return ret_arr;
63508 }
63509
63510 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_make_1funding_1redeemscript(JNIEnv *env, jclass clz, int8_tArray broadcaster, int8_tArray countersignatory) {
63511         LDKPublicKey broadcaster_ref;
63512         CHECK((*env)->GetArrayLength(env, broadcaster) == 33);
63513         (*env)->GetByteArrayRegion(env, broadcaster, 0, 33, broadcaster_ref.compressed_form);
63514         LDKPublicKey countersignatory_ref;
63515         CHECK((*env)->GetArrayLength(env, countersignatory) == 33);
63516         (*env)->GetByteArrayRegion(env, countersignatory, 0, 33, countersignatory_ref.compressed_form);
63517         LDKCVec_u8Z ret_var = make_funding_redeemscript(broadcaster_ref, countersignatory_ref);
63518         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
63519         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
63520         CVec_u8Z_free(ret_var);
63521         return ret_arr;
63522 }
63523
63524 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) {
63525         uint8_t commitment_txid_arr[32];
63526         CHECK((*env)->GetArrayLength(env, commitment_txid) == 32);
63527         (*env)->GetByteArrayRegion(env, commitment_txid, 0, 32, commitment_txid_arr);
63528         uint8_t (*commitment_txid_ref)[32] = &commitment_txid_arr;
63529         LDKHTLCOutputInCommitment htlc_conv;
63530         htlc_conv.inner = untag_ptr(htlc);
63531         htlc_conv.is_owned = ptr_is_owned(htlc);
63532         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_conv);
63533         htlc_conv.is_owned = false;
63534         LDKChannelTypeFeatures channel_type_features_conv;
63535         channel_type_features_conv.inner = untag_ptr(channel_type_features);
63536         channel_type_features_conv.is_owned = ptr_is_owned(channel_type_features);
63537         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_features_conv);
63538         channel_type_features_conv.is_owned = false;
63539         LDKDelayedPaymentKey broadcaster_delayed_payment_key_conv;
63540         broadcaster_delayed_payment_key_conv.inner = untag_ptr(broadcaster_delayed_payment_key);
63541         broadcaster_delayed_payment_key_conv.is_owned = ptr_is_owned(broadcaster_delayed_payment_key);
63542         CHECK_INNER_FIELD_ACCESS_OR_NULL(broadcaster_delayed_payment_key_conv);
63543         broadcaster_delayed_payment_key_conv.is_owned = false;
63544         LDKRevocationKey revocation_key_conv;
63545         revocation_key_conv.inner = untag_ptr(revocation_key);
63546         revocation_key_conv.is_owned = ptr_is_owned(revocation_key);
63547         CHECK_INNER_FIELD_ACCESS_OR_NULL(revocation_key_conv);
63548         revocation_key_conv.is_owned = false;
63549         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);
63550         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
63551         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
63552         Transaction_free(ret_var);
63553         return ret_arr;
63554 }
63555
63556 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) {
63557         LDKECDSASignature local_sig_ref;
63558         CHECK((*env)->GetArrayLength(env, local_sig) == 64);
63559         (*env)->GetByteArrayRegion(env, local_sig, 0, 64, local_sig_ref.compact_form);
63560         LDKECDSASignature remote_sig_ref;
63561         CHECK((*env)->GetArrayLength(env, remote_sig) == 64);
63562         (*env)->GetByteArrayRegion(env, remote_sig, 0, 64, remote_sig_ref.compact_form);
63563         void* preimage_ptr = untag_ptr(preimage);
63564         CHECK_ACCESS(preimage_ptr);
63565         LDKCOption_ThirtyTwoBytesZ preimage_conv = *(LDKCOption_ThirtyTwoBytesZ*)(preimage_ptr);
63566         preimage_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(preimage));
63567         LDKu8slice redeem_script_ref;
63568         redeem_script_ref.datalen = (*env)->GetArrayLength(env, redeem_script);
63569         redeem_script_ref.data = (*env)->GetByteArrayElements (env, redeem_script, NULL);
63570         LDKChannelTypeFeatures channel_type_features_conv;
63571         channel_type_features_conv.inner = untag_ptr(channel_type_features);
63572         channel_type_features_conv.is_owned = ptr_is_owned(channel_type_features);
63573         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_features_conv);
63574         channel_type_features_conv.is_owned = false;
63575         LDKWitness ret_var = build_htlc_input_witness(local_sig_ref, remote_sig_ref, preimage_conv, redeem_script_ref, &channel_type_features_conv);
63576         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
63577         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
63578         Witness_free(ret_var);
63579         (*env)->ReleaseByteArrayElements(env, redeem_script, (int8_t*)redeem_script_ref.data, 0);
63580         return ret_arr;
63581 }
63582
63583 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_get_1to_1countersignatory_1with_1anchors_1redeemscript(JNIEnv *env, jclass clz, int8_tArray payment_point) {
63584         LDKPublicKey payment_point_ref;
63585         CHECK((*env)->GetArrayLength(env, payment_point) == 33);
63586         (*env)->GetByteArrayRegion(env, payment_point, 0, 33, payment_point_ref.compressed_form);
63587         LDKCVec_u8Z ret_var = get_to_countersignatory_with_anchors_redeemscript(payment_point_ref);
63588         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
63589         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
63590         CVec_u8Z_free(ret_var);
63591         return ret_arr;
63592 }
63593
63594 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_get_1anchor_1redeemscript(JNIEnv *env, jclass clz, int8_tArray funding_pubkey) {
63595         LDKPublicKey funding_pubkey_ref;
63596         CHECK((*env)->GetArrayLength(env, funding_pubkey) == 33);
63597         (*env)->GetByteArrayRegion(env, funding_pubkey, 0, 33, funding_pubkey_ref.compressed_form);
63598         LDKCVec_u8Z ret_var = get_anchor_redeemscript(funding_pubkey_ref);
63599         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
63600         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
63601         CVec_u8Z_free(ret_var);
63602         return ret_arr;
63603 }
63604
63605 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) {
63606         LDKPublicKey funding_key_ref;
63607         CHECK((*env)->GetArrayLength(env, funding_key) == 33);
63608         (*env)->GetByteArrayRegion(env, funding_key, 0, 33, funding_key_ref.compressed_form);
63609         LDKECDSASignature funding_sig_ref;
63610         CHECK((*env)->GetArrayLength(env, funding_sig) == 64);
63611         (*env)->GetByteArrayRegion(env, funding_sig, 0, 64, funding_sig_ref.compact_form);
63612         LDKWitness ret_var = build_anchor_input_witness(funding_key_ref, funding_sig_ref);
63613         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
63614         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
63615         Witness_free(ret_var);
63616         return ret_arr;
63617 }
63618
63619 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
63620         LDKChannelTransactionParameters this_obj_conv;
63621         this_obj_conv.inner = untag_ptr(this_obj);
63622         this_obj_conv.is_owned = ptr_is_owned(this_obj);
63623         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
63624         ChannelTransactionParameters_free(this_obj_conv);
63625 }
63626
63627 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1holder_1pubkeys(JNIEnv *env, jclass clz, int64_t this_ptr) {
63628         LDKChannelTransactionParameters this_ptr_conv;
63629         this_ptr_conv.inner = untag_ptr(this_ptr);
63630         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63631         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63632         this_ptr_conv.is_owned = false;
63633         LDKChannelPublicKeys ret_var = ChannelTransactionParameters_get_holder_pubkeys(&this_ptr_conv);
63634         int64_t ret_ref = 0;
63635         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63636         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63637         return ret_ref;
63638 }
63639
63640 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1set_1holder_1pubkeys(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
63641         LDKChannelTransactionParameters this_ptr_conv;
63642         this_ptr_conv.inner = untag_ptr(this_ptr);
63643         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63644         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63645         this_ptr_conv.is_owned = false;
63646         LDKChannelPublicKeys val_conv;
63647         val_conv.inner = untag_ptr(val);
63648         val_conv.is_owned = ptr_is_owned(val);
63649         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
63650         val_conv = ChannelPublicKeys_clone(&val_conv);
63651         ChannelTransactionParameters_set_holder_pubkeys(&this_ptr_conv, val_conv);
63652 }
63653
63654 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1holder_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
63655         LDKChannelTransactionParameters this_ptr_conv;
63656         this_ptr_conv.inner = untag_ptr(this_ptr);
63657         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63658         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63659         this_ptr_conv.is_owned = false;
63660         int16_t ret_conv = ChannelTransactionParameters_get_holder_selected_contest_delay(&this_ptr_conv);
63661         return ret_conv;
63662 }
63663
63664 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) {
63665         LDKChannelTransactionParameters this_ptr_conv;
63666         this_ptr_conv.inner = untag_ptr(this_ptr);
63667         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63668         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63669         this_ptr_conv.is_owned = false;
63670         ChannelTransactionParameters_set_holder_selected_contest_delay(&this_ptr_conv, val);
63671 }
63672
63673 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1is_1outbound_1from_1holder(JNIEnv *env, jclass clz, int64_t this_ptr) {
63674         LDKChannelTransactionParameters this_ptr_conv;
63675         this_ptr_conv.inner = untag_ptr(this_ptr);
63676         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63677         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63678         this_ptr_conv.is_owned = false;
63679         jboolean ret_conv = ChannelTransactionParameters_get_is_outbound_from_holder(&this_ptr_conv);
63680         return ret_conv;
63681 }
63682
63683 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1set_1is_1outbound_1from_1holder(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
63684         LDKChannelTransactionParameters this_ptr_conv;
63685         this_ptr_conv.inner = untag_ptr(this_ptr);
63686         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63687         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63688         this_ptr_conv.is_owned = false;
63689         ChannelTransactionParameters_set_is_outbound_from_holder(&this_ptr_conv, val);
63690 }
63691
63692 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1counterparty_1parameters(JNIEnv *env, jclass clz, int64_t this_ptr) {
63693         LDKChannelTransactionParameters this_ptr_conv;
63694         this_ptr_conv.inner = untag_ptr(this_ptr);
63695         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63696         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63697         this_ptr_conv.is_owned = false;
63698         LDKCounterpartyChannelTransactionParameters ret_var = ChannelTransactionParameters_get_counterparty_parameters(&this_ptr_conv);
63699         int64_t ret_ref = 0;
63700         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63701         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63702         return ret_ref;
63703 }
63704
63705 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1set_1counterparty_1parameters(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
63706         LDKChannelTransactionParameters this_ptr_conv;
63707         this_ptr_conv.inner = untag_ptr(this_ptr);
63708         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63709         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63710         this_ptr_conv.is_owned = false;
63711         LDKCounterpartyChannelTransactionParameters val_conv;
63712         val_conv.inner = untag_ptr(val);
63713         val_conv.is_owned = ptr_is_owned(val);
63714         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
63715         val_conv = CounterpartyChannelTransactionParameters_clone(&val_conv);
63716         ChannelTransactionParameters_set_counterparty_parameters(&this_ptr_conv, val_conv);
63717 }
63718
63719 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1funding_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
63720         LDKChannelTransactionParameters this_ptr_conv;
63721         this_ptr_conv.inner = untag_ptr(this_ptr);
63722         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63723         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63724         this_ptr_conv.is_owned = false;
63725         LDKOutPoint ret_var = ChannelTransactionParameters_get_funding_outpoint(&this_ptr_conv);
63726         int64_t ret_ref = 0;
63727         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63728         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63729         return ret_ref;
63730 }
63731
63732 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1set_1funding_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
63733         LDKChannelTransactionParameters this_ptr_conv;
63734         this_ptr_conv.inner = untag_ptr(this_ptr);
63735         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63736         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63737         this_ptr_conv.is_owned = false;
63738         LDKOutPoint val_conv;
63739         val_conv.inner = untag_ptr(val);
63740         val_conv.is_owned = ptr_is_owned(val);
63741         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
63742         val_conv = OutPoint_clone(&val_conv);
63743         ChannelTransactionParameters_set_funding_outpoint(&this_ptr_conv, val_conv);
63744 }
63745
63746 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1channel_1type_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
63747         LDKChannelTransactionParameters this_ptr_conv;
63748         this_ptr_conv.inner = untag_ptr(this_ptr);
63749         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63750         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63751         this_ptr_conv.is_owned = false;
63752         LDKChannelTypeFeatures ret_var = ChannelTransactionParameters_get_channel_type_features(&this_ptr_conv);
63753         int64_t ret_ref = 0;
63754         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63755         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63756         return ret_ref;
63757 }
63758
63759 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1set_1channel_1type_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
63760         LDKChannelTransactionParameters this_ptr_conv;
63761         this_ptr_conv.inner = untag_ptr(this_ptr);
63762         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63763         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63764         this_ptr_conv.is_owned = false;
63765         LDKChannelTypeFeatures val_conv;
63766         val_conv.inner = untag_ptr(val);
63767         val_conv.is_owned = ptr_is_owned(val);
63768         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
63769         val_conv = ChannelTypeFeatures_clone(&val_conv);
63770         ChannelTransactionParameters_set_channel_type_features(&this_ptr_conv, val_conv);
63771 }
63772
63773 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) {
63774         LDKChannelPublicKeys holder_pubkeys_arg_conv;
63775         holder_pubkeys_arg_conv.inner = untag_ptr(holder_pubkeys_arg);
63776         holder_pubkeys_arg_conv.is_owned = ptr_is_owned(holder_pubkeys_arg);
63777         CHECK_INNER_FIELD_ACCESS_OR_NULL(holder_pubkeys_arg_conv);
63778         holder_pubkeys_arg_conv = ChannelPublicKeys_clone(&holder_pubkeys_arg_conv);
63779         LDKCounterpartyChannelTransactionParameters counterparty_parameters_arg_conv;
63780         counterparty_parameters_arg_conv.inner = untag_ptr(counterparty_parameters_arg);
63781         counterparty_parameters_arg_conv.is_owned = ptr_is_owned(counterparty_parameters_arg);
63782         CHECK_INNER_FIELD_ACCESS_OR_NULL(counterparty_parameters_arg_conv);
63783         counterparty_parameters_arg_conv = CounterpartyChannelTransactionParameters_clone(&counterparty_parameters_arg_conv);
63784         LDKOutPoint funding_outpoint_arg_conv;
63785         funding_outpoint_arg_conv.inner = untag_ptr(funding_outpoint_arg);
63786         funding_outpoint_arg_conv.is_owned = ptr_is_owned(funding_outpoint_arg);
63787         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_arg_conv);
63788         funding_outpoint_arg_conv = OutPoint_clone(&funding_outpoint_arg_conv);
63789         LDKChannelTypeFeatures channel_type_features_arg_conv;
63790         channel_type_features_arg_conv.inner = untag_ptr(channel_type_features_arg);
63791         channel_type_features_arg_conv.is_owned = ptr_is_owned(channel_type_features_arg);
63792         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_features_arg_conv);
63793         channel_type_features_arg_conv = ChannelTypeFeatures_clone(&channel_type_features_arg_conv);
63794         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);
63795         int64_t ret_ref = 0;
63796         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63797         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63798         return ret_ref;
63799 }
63800
63801 static inline uint64_t ChannelTransactionParameters_clone_ptr(LDKChannelTransactionParameters *NONNULL_PTR arg) {
63802         LDKChannelTransactionParameters ret_var = ChannelTransactionParameters_clone(arg);
63803         int64_t ret_ref = 0;
63804         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63805         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63806         return ret_ref;
63807 }
63808 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
63809         LDKChannelTransactionParameters arg_conv;
63810         arg_conv.inner = untag_ptr(arg);
63811         arg_conv.is_owned = ptr_is_owned(arg);
63812         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
63813         arg_conv.is_owned = false;
63814         int64_t ret_conv = ChannelTransactionParameters_clone_ptr(&arg_conv);
63815         return ret_conv;
63816 }
63817
63818 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1clone(JNIEnv *env, jclass clz, int64_t orig) {
63819         LDKChannelTransactionParameters orig_conv;
63820         orig_conv.inner = untag_ptr(orig);
63821         orig_conv.is_owned = ptr_is_owned(orig);
63822         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
63823         orig_conv.is_owned = false;
63824         LDKChannelTransactionParameters ret_var = ChannelTransactionParameters_clone(&orig_conv);
63825         int64_t ret_ref = 0;
63826         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63827         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63828         return ret_ref;
63829 }
63830
63831 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1hash(JNIEnv *env, jclass clz, int64_t o) {
63832         LDKChannelTransactionParameters o_conv;
63833         o_conv.inner = untag_ptr(o);
63834         o_conv.is_owned = ptr_is_owned(o);
63835         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
63836         o_conv.is_owned = false;
63837         int64_t ret_conv = ChannelTransactionParameters_hash(&o_conv);
63838         return ret_conv;
63839 }
63840
63841 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
63842         LDKChannelTransactionParameters a_conv;
63843         a_conv.inner = untag_ptr(a);
63844         a_conv.is_owned = ptr_is_owned(a);
63845         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
63846         a_conv.is_owned = false;
63847         LDKChannelTransactionParameters b_conv;
63848         b_conv.inner = untag_ptr(b);
63849         b_conv.is_owned = ptr_is_owned(b);
63850         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
63851         b_conv.is_owned = false;
63852         jboolean ret_conv = ChannelTransactionParameters_eq(&a_conv, &b_conv);
63853         return ret_conv;
63854 }
63855
63856 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
63857         LDKCounterpartyChannelTransactionParameters this_obj_conv;
63858         this_obj_conv.inner = untag_ptr(this_obj);
63859         this_obj_conv.is_owned = ptr_is_owned(this_obj);
63860         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
63861         CounterpartyChannelTransactionParameters_free(this_obj_conv);
63862 }
63863
63864 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1get_1pubkeys(JNIEnv *env, jclass clz, int64_t this_ptr) {
63865         LDKCounterpartyChannelTransactionParameters this_ptr_conv;
63866         this_ptr_conv.inner = untag_ptr(this_ptr);
63867         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63868         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63869         this_ptr_conv.is_owned = false;
63870         LDKChannelPublicKeys ret_var = CounterpartyChannelTransactionParameters_get_pubkeys(&this_ptr_conv);
63871         int64_t ret_ref = 0;
63872         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63873         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63874         return ret_ref;
63875 }
63876
63877 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1set_1pubkeys(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
63878         LDKCounterpartyChannelTransactionParameters this_ptr_conv;
63879         this_ptr_conv.inner = untag_ptr(this_ptr);
63880         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63881         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63882         this_ptr_conv.is_owned = false;
63883         LDKChannelPublicKeys val_conv;
63884         val_conv.inner = untag_ptr(val);
63885         val_conv.is_owned = ptr_is_owned(val);
63886         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
63887         val_conv = ChannelPublicKeys_clone(&val_conv);
63888         CounterpartyChannelTransactionParameters_set_pubkeys(&this_ptr_conv, val_conv);
63889 }
63890
63891 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1get_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
63892         LDKCounterpartyChannelTransactionParameters this_ptr_conv;
63893         this_ptr_conv.inner = untag_ptr(this_ptr);
63894         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63895         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63896         this_ptr_conv.is_owned = false;
63897         int16_t ret_conv = CounterpartyChannelTransactionParameters_get_selected_contest_delay(&this_ptr_conv);
63898         return ret_conv;
63899 }
63900
63901 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1set_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
63902         LDKCounterpartyChannelTransactionParameters this_ptr_conv;
63903         this_ptr_conv.inner = untag_ptr(this_ptr);
63904         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
63905         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
63906         this_ptr_conv.is_owned = false;
63907         CounterpartyChannelTransactionParameters_set_selected_contest_delay(&this_ptr_conv, val);
63908 }
63909
63910 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) {
63911         LDKChannelPublicKeys pubkeys_arg_conv;
63912         pubkeys_arg_conv.inner = untag_ptr(pubkeys_arg);
63913         pubkeys_arg_conv.is_owned = ptr_is_owned(pubkeys_arg);
63914         CHECK_INNER_FIELD_ACCESS_OR_NULL(pubkeys_arg_conv);
63915         pubkeys_arg_conv = ChannelPublicKeys_clone(&pubkeys_arg_conv);
63916         LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_new(pubkeys_arg_conv, selected_contest_delay_arg);
63917         int64_t ret_ref = 0;
63918         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63919         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63920         return ret_ref;
63921 }
63922
63923 static inline uint64_t CounterpartyChannelTransactionParameters_clone_ptr(LDKCounterpartyChannelTransactionParameters *NONNULL_PTR arg) {
63924         LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_clone(arg);
63925         int64_t ret_ref = 0;
63926         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63927         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63928         return ret_ref;
63929 }
63930 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
63931         LDKCounterpartyChannelTransactionParameters arg_conv;
63932         arg_conv.inner = untag_ptr(arg);
63933         arg_conv.is_owned = ptr_is_owned(arg);
63934         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
63935         arg_conv.is_owned = false;
63936         int64_t ret_conv = CounterpartyChannelTransactionParameters_clone_ptr(&arg_conv);
63937         return ret_conv;
63938 }
63939
63940 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1clone(JNIEnv *env, jclass clz, int64_t orig) {
63941         LDKCounterpartyChannelTransactionParameters orig_conv;
63942         orig_conv.inner = untag_ptr(orig);
63943         orig_conv.is_owned = ptr_is_owned(orig);
63944         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
63945         orig_conv.is_owned = false;
63946         LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_clone(&orig_conv);
63947         int64_t ret_ref = 0;
63948         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63949         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63950         return ret_ref;
63951 }
63952
63953 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1hash(JNIEnv *env, jclass clz, int64_t o) {
63954         LDKCounterpartyChannelTransactionParameters o_conv;
63955         o_conv.inner = untag_ptr(o);
63956         o_conv.is_owned = ptr_is_owned(o);
63957         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
63958         o_conv.is_owned = false;
63959         int64_t ret_conv = CounterpartyChannelTransactionParameters_hash(&o_conv);
63960         return ret_conv;
63961 }
63962
63963 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
63964         LDKCounterpartyChannelTransactionParameters a_conv;
63965         a_conv.inner = untag_ptr(a);
63966         a_conv.is_owned = ptr_is_owned(a);
63967         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
63968         a_conv.is_owned = false;
63969         LDKCounterpartyChannelTransactionParameters b_conv;
63970         b_conv.inner = untag_ptr(b);
63971         b_conv.is_owned = ptr_is_owned(b);
63972         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
63973         b_conv.is_owned = false;
63974         jboolean ret_conv = CounterpartyChannelTransactionParameters_eq(&a_conv, &b_conv);
63975         return ret_conv;
63976 }
63977
63978 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1is_1populated(JNIEnv *env, jclass clz, int64_t this_arg) {
63979         LDKChannelTransactionParameters this_arg_conv;
63980         this_arg_conv.inner = untag_ptr(this_arg);
63981         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63982         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63983         this_arg_conv.is_owned = false;
63984         jboolean ret_conv = ChannelTransactionParameters_is_populated(&this_arg_conv);
63985         return ret_conv;
63986 }
63987
63988 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1as_1holder_1broadcastable(JNIEnv *env, jclass clz, int64_t this_arg) {
63989         LDKChannelTransactionParameters this_arg_conv;
63990         this_arg_conv.inner = untag_ptr(this_arg);
63991         this_arg_conv.is_owned = ptr_is_owned(this_arg);
63992         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
63993         this_arg_conv.is_owned = false;
63994         LDKDirectedChannelTransactionParameters ret_var = ChannelTransactionParameters_as_holder_broadcastable(&this_arg_conv);
63995         int64_t ret_ref = 0;
63996         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
63997         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
63998         return ret_ref;
63999 }
64000
64001 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1as_1counterparty_1broadcastable(JNIEnv *env, jclass clz, int64_t this_arg) {
64002         LDKChannelTransactionParameters this_arg_conv;
64003         this_arg_conv.inner = untag_ptr(this_arg);
64004         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64005         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64006         this_arg_conv.is_owned = false;
64007         LDKDirectedChannelTransactionParameters ret_var = ChannelTransactionParameters_as_counterparty_broadcastable(&this_arg_conv);
64008         int64_t ret_ref = 0;
64009         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64010         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64011         return ret_ref;
64012 }
64013
64014 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1write(JNIEnv *env, jclass clz, int64_t obj) {
64015         LDKCounterpartyChannelTransactionParameters obj_conv;
64016         obj_conv.inner = untag_ptr(obj);
64017         obj_conv.is_owned = ptr_is_owned(obj);
64018         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
64019         obj_conv.is_owned = false;
64020         LDKCVec_u8Z ret_var = CounterpartyChannelTransactionParameters_write(&obj_conv);
64021         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
64022         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
64023         CVec_u8Z_free(ret_var);
64024         return ret_arr;
64025 }
64026
64027 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
64028         LDKu8slice ser_ref;
64029         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
64030         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
64031         LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
64032         *ret_conv = CounterpartyChannelTransactionParameters_read(ser_ref);
64033         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
64034         return tag_ptr(ret_conv, true);
64035 }
64036
64037 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1write(JNIEnv *env, jclass clz, int64_t obj) {
64038         LDKChannelTransactionParameters obj_conv;
64039         obj_conv.inner = untag_ptr(obj);
64040         obj_conv.is_owned = ptr_is_owned(obj);
64041         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
64042         obj_conv.is_owned = false;
64043         LDKCVec_u8Z ret_var = ChannelTransactionParameters_write(&obj_conv);
64044         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
64045         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
64046         CVec_u8Z_free(ret_var);
64047         return ret_arr;
64048 }
64049
64050 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
64051         LDKu8slice ser_ref;
64052         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
64053         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
64054         LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
64055         *ret_conv = ChannelTransactionParameters_read(ser_ref);
64056         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
64057         return tag_ptr(ret_conv, true);
64058 }
64059
64060 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
64061         LDKDirectedChannelTransactionParameters this_obj_conv;
64062         this_obj_conv.inner = untag_ptr(this_obj);
64063         this_obj_conv.is_owned = ptr_is_owned(this_obj);
64064         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
64065         DirectedChannelTransactionParameters_free(this_obj_conv);
64066 }
64067
64068 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1broadcaster_1pubkeys(JNIEnv *env, jclass clz, int64_t this_arg) {
64069         LDKDirectedChannelTransactionParameters this_arg_conv;
64070         this_arg_conv.inner = untag_ptr(this_arg);
64071         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64072         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64073         this_arg_conv.is_owned = false;
64074         LDKChannelPublicKeys ret_var = DirectedChannelTransactionParameters_broadcaster_pubkeys(&this_arg_conv);
64075         int64_t ret_ref = 0;
64076         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64077         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64078         return ret_ref;
64079 }
64080
64081 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1countersignatory_1pubkeys(JNIEnv *env, jclass clz, int64_t this_arg) {
64082         LDKDirectedChannelTransactionParameters this_arg_conv;
64083         this_arg_conv.inner = untag_ptr(this_arg);
64084         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64085         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64086         this_arg_conv.is_owned = false;
64087         LDKChannelPublicKeys ret_var = DirectedChannelTransactionParameters_countersignatory_pubkeys(&this_arg_conv);
64088         int64_t ret_ref = 0;
64089         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64090         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64091         return ret_ref;
64092 }
64093
64094 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_arg) {
64095         LDKDirectedChannelTransactionParameters this_arg_conv;
64096         this_arg_conv.inner = untag_ptr(this_arg);
64097         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64098         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64099         this_arg_conv.is_owned = false;
64100         int16_t ret_conv = DirectedChannelTransactionParameters_contest_delay(&this_arg_conv);
64101         return ret_conv;
64102 }
64103
64104 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1is_1outbound(JNIEnv *env, jclass clz, int64_t this_arg) {
64105         LDKDirectedChannelTransactionParameters this_arg_conv;
64106         this_arg_conv.inner = untag_ptr(this_arg);
64107         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64108         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64109         this_arg_conv.is_owned = false;
64110         jboolean ret_conv = DirectedChannelTransactionParameters_is_outbound(&this_arg_conv);
64111         return ret_conv;
64112 }
64113
64114 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1funding_1outpoint(JNIEnv *env, jclass clz, int64_t this_arg) {
64115         LDKDirectedChannelTransactionParameters this_arg_conv;
64116         this_arg_conv.inner = untag_ptr(this_arg);
64117         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64118         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64119         this_arg_conv.is_owned = false;
64120         LDKOutPoint ret_var = DirectedChannelTransactionParameters_funding_outpoint(&this_arg_conv);
64121         int64_t ret_ref = 0;
64122         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64123         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64124         return ret_ref;
64125 }
64126
64127 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1channel_1type_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
64128         LDKDirectedChannelTransactionParameters this_arg_conv;
64129         this_arg_conv.inner = untag_ptr(this_arg);
64130         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64131         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64132         this_arg_conv.is_owned = false;
64133         LDKChannelTypeFeatures ret_var = DirectedChannelTransactionParameters_channel_type_features(&this_arg_conv);
64134         int64_t ret_ref = 0;
64135         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64136         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64137         return ret_ref;
64138 }
64139
64140 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
64141         LDKHolderCommitmentTransaction this_obj_conv;
64142         this_obj_conv.inner = untag_ptr(this_obj);
64143         this_obj_conv.is_owned = ptr_is_owned(this_obj);
64144         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
64145         HolderCommitmentTransaction_free(this_obj_conv);
64146 }
64147
64148 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1get_1counterparty_1sig(JNIEnv *env, jclass clz, int64_t this_ptr) {
64149         LDKHolderCommitmentTransaction this_ptr_conv;
64150         this_ptr_conv.inner = untag_ptr(this_ptr);
64151         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64152         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64153         this_ptr_conv.is_owned = false;
64154         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
64155         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, HolderCommitmentTransaction_get_counterparty_sig(&this_ptr_conv).compact_form);
64156         return ret_arr;
64157 }
64158
64159 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1set_1counterparty_1sig(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
64160         LDKHolderCommitmentTransaction this_ptr_conv;
64161         this_ptr_conv.inner = untag_ptr(this_ptr);
64162         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64163         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64164         this_ptr_conv.is_owned = false;
64165         LDKECDSASignature val_ref;
64166         CHECK((*env)->GetArrayLength(env, val) == 64);
64167         (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
64168         HolderCommitmentTransaction_set_counterparty_sig(&this_ptr_conv, val_ref);
64169 }
64170
64171 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1get_1counterparty_1htlc_1sigs(JNIEnv *env, jclass clz, int64_t this_ptr) {
64172         LDKHolderCommitmentTransaction this_ptr_conv;
64173         this_ptr_conv.inner = untag_ptr(this_ptr);
64174         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64175         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64176         this_ptr_conv.is_owned = false;
64177         LDKCVec_ECDSASignatureZ ret_var = HolderCommitmentTransaction_get_counterparty_htlc_sigs(&this_ptr_conv);
64178         jobjectArray ret_arr = NULL;
64179         ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
64180         ;
64181         for (size_t i = 0; i < ret_var.datalen; i++) {
64182                 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, 64);
64183                 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, 64, ret_var.data[i].compact_form);
64184                 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
64185         }
64186         
64187         FREE(ret_var.data);
64188         return ret_arr;
64189 }
64190
64191 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1set_1counterparty_1htlc_1sigs(JNIEnv *env, jclass clz, int64_t this_ptr, jobjectArray val) {
64192         LDKHolderCommitmentTransaction this_ptr_conv;
64193         this_ptr_conv.inner = untag_ptr(this_ptr);
64194         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64195         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64196         this_ptr_conv.is_owned = false;
64197         LDKCVec_ECDSASignatureZ val_constr;
64198         val_constr.datalen = (*env)->GetArrayLength(env, val);
64199         if (val_constr.datalen > 0)
64200                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKECDSASignature), "LDKCVec_ECDSASignatureZ Elements");
64201         else
64202                 val_constr.data = NULL;
64203         for (size_t i = 0; i < val_constr.datalen; i++) {
64204                 int8_tArray val_conv_8 = (*env)->GetObjectArrayElement(env, val, i);
64205                 LDKECDSASignature val_conv_8_ref;
64206                 CHECK((*env)->GetArrayLength(env, val_conv_8) == 64);
64207                 (*env)->GetByteArrayRegion(env, val_conv_8, 0, 64, val_conv_8_ref.compact_form);
64208                 val_constr.data[i] = val_conv_8_ref;
64209         }
64210         HolderCommitmentTransaction_set_counterparty_htlc_sigs(&this_ptr_conv, val_constr);
64211 }
64212
64213 static inline uint64_t HolderCommitmentTransaction_clone_ptr(LDKHolderCommitmentTransaction *NONNULL_PTR arg) {
64214         LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_clone(arg);
64215         int64_t ret_ref = 0;
64216         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64217         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64218         return ret_ref;
64219 }
64220 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
64221         LDKHolderCommitmentTransaction arg_conv;
64222         arg_conv.inner = untag_ptr(arg);
64223         arg_conv.is_owned = ptr_is_owned(arg);
64224         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
64225         arg_conv.is_owned = false;
64226         int64_t ret_conv = HolderCommitmentTransaction_clone_ptr(&arg_conv);
64227         return ret_conv;
64228 }
64229
64230 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1clone(JNIEnv *env, jclass clz, int64_t orig) {
64231         LDKHolderCommitmentTransaction orig_conv;
64232         orig_conv.inner = untag_ptr(orig);
64233         orig_conv.is_owned = ptr_is_owned(orig);
64234         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
64235         orig_conv.is_owned = false;
64236         LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_clone(&orig_conv);
64237         int64_t ret_ref = 0;
64238         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64239         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64240         return ret_ref;
64241 }
64242
64243 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1write(JNIEnv *env, jclass clz, int64_t obj) {
64244         LDKHolderCommitmentTransaction obj_conv;
64245         obj_conv.inner = untag_ptr(obj);
64246         obj_conv.is_owned = ptr_is_owned(obj);
64247         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
64248         obj_conv.is_owned = false;
64249         LDKCVec_u8Z ret_var = HolderCommitmentTransaction_write(&obj_conv);
64250         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
64251         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
64252         CVec_u8Z_free(ret_var);
64253         return ret_arr;
64254 }
64255
64256 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
64257         LDKu8slice ser_ref;
64258         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
64259         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
64260         LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
64261         *ret_conv = HolderCommitmentTransaction_read(ser_ref);
64262         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
64263         return tag_ptr(ret_conv, true);
64264 }
64265
64266 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) {
64267         LDKCommitmentTransaction commitment_tx_conv;
64268         commitment_tx_conv.inner = untag_ptr(commitment_tx);
64269         commitment_tx_conv.is_owned = ptr_is_owned(commitment_tx);
64270         CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_conv);
64271         commitment_tx_conv = CommitmentTransaction_clone(&commitment_tx_conv);
64272         LDKECDSASignature counterparty_sig_ref;
64273         CHECK((*env)->GetArrayLength(env, counterparty_sig) == 64);
64274         (*env)->GetByteArrayRegion(env, counterparty_sig, 0, 64, counterparty_sig_ref.compact_form);
64275         LDKCVec_ECDSASignatureZ counterparty_htlc_sigs_constr;
64276         counterparty_htlc_sigs_constr.datalen = (*env)->GetArrayLength(env, counterparty_htlc_sigs);
64277         if (counterparty_htlc_sigs_constr.datalen > 0)
64278                 counterparty_htlc_sigs_constr.data = MALLOC(counterparty_htlc_sigs_constr.datalen * sizeof(LDKECDSASignature), "LDKCVec_ECDSASignatureZ Elements");
64279         else
64280                 counterparty_htlc_sigs_constr.data = NULL;
64281         for (size_t i = 0; i < counterparty_htlc_sigs_constr.datalen; i++) {
64282                 int8_tArray counterparty_htlc_sigs_conv_8 = (*env)->GetObjectArrayElement(env, counterparty_htlc_sigs, i);
64283                 LDKECDSASignature counterparty_htlc_sigs_conv_8_ref;
64284                 CHECK((*env)->GetArrayLength(env, counterparty_htlc_sigs_conv_8) == 64);
64285                 (*env)->GetByteArrayRegion(env, counterparty_htlc_sigs_conv_8, 0, 64, counterparty_htlc_sigs_conv_8_ref.compact_form);
64286                 counterparty_htlc_sigs_constr.data[i] = counterparty_htlc_sigs_conv_8_ref;
64287         }
64288         LDKPublicKey holder_funding_key_ref;
64289         CHECK((*env)->GetArrayLength(env, holder_funding_key) == 33);
64290         (*env)->GetByteArrayRegion(env, holder_funding_key, 0, 33, holder_funding_key_ref.compressed_form);
64291         LDKPublicKey counterparty_funding_key_ref;
64292         CHECK((*env)->GetArrayLength(env, counterparty_funding_key) == 33);
64293         (*env)->GetByteArrayRegion(env, counterparty_funding_key, 0, 33, counterparty_funding_key_ref.compressed_form);
64294         LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_new(commitment_tx_conv, counterparty_sig_ref, counterparty_htlc_sigs_constr, holder_funding_key_ref, counterparty_funding_key_ref);
64295         int64_t ret_ref = 0;
64296         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64297         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64298         return ret_ref;
64299 }
64300
64301 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
64302         LDKBuiltCommitmentTransaction this_obj_conv;
64303         this_obj_conv.inner = untag_ptr(this_obj);
64304         this_obj_conv.is_owned = ptr_is_owned(this_obj);
64305         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
64306         BuiltCommitmentTransaction_free(this_obj_conv);
64307 }
64308
64309 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1get_1transaction(JNIEnv *env, jclass clz, int64_t this_ptr) {
64310         LDKBuiltCommitmentTransaction this_ptr_conv;
64311         this_ptr_conv.inner = untag_ptr(this_ptr);
64312         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64313         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64314         this_ptr_conv.is_owned = false;
64315         LDKTransaction ret_var = BuiltCommitmentTransaction_get_transaction(&this_ptr_conv);
64316         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
64317         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
64318         Transaction_free(ret_var);
64319         return ret_arr;
64320 }
64321
64322 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1set_1transaction(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
64323         LDKBuiltCommitmentTransaction this_ptr_conv;
64324         this_ptr_conv.inner = untag_ptr(this_ptr);
64325         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64326         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64327         this_ptr_conv.is_owned = false;
64328         LDKTransaction val_ref;
64329         val_ref.datalen = (*env)->GetArrayLength(env, val);
64330         val_ref.data = MALLOC(val_ref.datalen, "LDKTransaction Bytes");
64331         (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
64332         val_ref.data_is_owned = true;
64333         BuiltCommitmentTransaction_set_transaction(&this_ptr_conv, val_ref);
64334 }
64335
64336 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1get_1txid(JNIEnv *env, jclass clz, int64_t this_ptr) {
64337         LDKBuiltCommitmentTransaction this_ptr_conv;
64338         this_ptr_conv.inner = untag_ptr(this_ptr);
64339         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64340         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64341         this_ptr_conv.is_owned = false;
64342         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
64343         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *BuiltCommitmentTransaction_get_txid(&this_ptr_conv));
64344         return ret_arr;
64345 }
64346
64347 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1set_1txid(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
64348         LDKBuiltCommitmentTransaction this_ptr_conv;
64349         this_ptr_conv.inner = untag_ptr(this_ptr);
64350         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
64351         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
64352         this_ptr_conv.is_owned = false;
64353         LDKThirtyTwoBytes val_ref;
64354         CHECK((*env)->GetArrayLength(env, val) == 32);
64355         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
64356         BuiltCommitmentTransaction_set_txid(&this_ptr_conv, val_ref);
64357 }
64358
64359 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1new(JNIEnv *env, jclass clz, int8_tArray transaction_arg, int8_tArray txid_arg) {
64360         LDKTransaction transaction_arg_ref;
64361         transaction_arg_ref.datalen = (*env)->GetArrayLength(env, transaction_arg);
64362         transaction_arg_ref.data = MALLOC(transaction_arg_ref.datalen, "LDKTransaction Bytes");
64363         (*env)->GetByteArrayRegion(env, transaction_arg, 0, transaction_arg_ref.datalen, transaction_arg_ref.data);
64364         transaction_arg_ref.data_is_owned = true;
64365         LDKThirtyTwoBytes txid_arg_ref;
64366         CHECK((*env)->GetArrayLength(env, txid_arg) == 32);
64367         (*env)->GetByteArrayRegion(env, txid_arg, 0, 32, txid_arg_ref.data);
64368         LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_new(transaction_arg_ref, txid_arg_ref);
64369         int64_t ret_ref = 0;
64370         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64371         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64372         return ret_ref;
64373 }
64374
64375 static inline uint64_t BuiltCommitmentTransaction_clone_ptr(LDKBuiltCommitmentTransaction *NONNULL_PTR arg) {
64376         LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_clone(arg);
64377         int64_t ret_ref = 0;
64378         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64379         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64380         return ret_ref;
64381 }
64382 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
64383         LDKBuiltCommitmentTransaction arg_conv;
64384         arg_conv.inner = untag_ptr(arg);
64385         arg_conv.is_owned = ptr_is_owned(arg);
64386         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
64387         arg_conv.is_owned = false;
64388         int64_t ret_conv = BuiltCommitmentTransaction_clone_ptr(&arg_conv);
64389         return ret_conv;
64390 }
64391
64392 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1clone(JNIEnv *env, jclass clz, int64_t orig) {
64393         LDKBuiltCommitmentTransaction orig_conv;
64394         orig_conv.inner = untag_ptr(orig);
64395         orig_conv.is_owned = ptr_is_owned(orig);
64396         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
64397         orig_conv.is_owned = false;
64398         LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_clone(&orig_conv);
64399         int64_t ret_ref = 0;
64400         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64401         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64402         return ret_ref;
64403 }
64404
64405 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1write(JNIEnv *env, jclass clz, int64_t obj) {
64406         LDKBuiltCommitmentTransaction obj_conv;
64407         obj_conv.inner = untag_ptr(obj);
64408         obj_conv.is_owned = ptr_is_owned(obj);
64409         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
64410         obj_conv.is_owned = false;
64411         LDKCVec_u8Z ret_var = BuiltCommitmentTransaction_write(&obj_conv);
64412         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
64413         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
64414         CVec_u8Z_free(ret_var);
64415         return ret_arr;
64416 }
64417
64418 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
64419         LDKu8slice ser_ref;
64420         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
64421         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
64422         LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
64423         *ret_conv = BuiltCommitmentTransaction_read(ser_ref);
64424         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
64425         return tag_ptr(ret_conv, true);
64426 }
64427
64428 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) {
64429         LDKBuiltCommitmentTransaction this_arg_conv;
64430         this_arg_conv.inner = untag_ptr(this_arg);
64431         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64432         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64433         this_arg_conv.is_owned = false;
64434         LDKu8slice funding_redeemscript_ref;
64435         funding_redeemscript_ref.datalen = (*env)->GetArrayLength(env, funding_redeemscript);
64436         funding_redeemscript_ref.data = (*env)->GetByteArrayElements (env, funding_redeemscript, NULL);
64437         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
64438         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, BuiltCommitmentTransaction_get_sighash_all(&this_arg_conv, funding_redeemscript_ref, channel_value_satoshis).data);
64439         (*env)->ReleaseByteArrayElements(env, funding_redeemscript, (int8_t*)funding_redeemscript_ref.data, 0);
64440         return ret_arr;
64441 }
64442
64443 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) {
64444         LDKBuiltCommitmentTransaction this_arg_conv;
64445         this_arg_conv.inner = untag_ptr(this_arg);
64446         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64447         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64448         this_arg_conv.is_owned = false;
64449         uint8_t funding_key_arr[32];
64450         CHECK((*env)->GetArrayLength(env, funding_key) == 32);
64451         (*env)->GetByteArrayRegion(env, funding_key, 0, 32, funding_key_arr);
64452         uint8_t (*funding_key_ref)[32] = &funding_key_arr;
64453         LDKu8slice funding_redeemscript_ref;
64454         funding_redeemscript_ref.datalen = (*env)->GetArrayLength(env, funding_redeemscript);
64455         funding_redeemscript_ref.data = (*env)->GetByteArrayElements (env, funding_redeemscript, NULL);
64456         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
64457         (*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);
64458         (*env)->ReleaseByteArrayElements(env, funding_redeemscript, (int8_t*)funding_redeemscript_ref.data, 0);
64459         return ret_arr;
64460 }
64461
64462 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) {
64463         LDKBuiltCommitmentTransaction this_arg_conv;
64464         this_arg_conv.inner = untag_ptr(this_arg);
64465         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64466         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64467         this_arg_conv.is_owned = false;
64468         uint8_t funding_key_arr[32];
64469         CHECK((*env)->GetArrayLength(env, funding_key) == 32);
64470         (*env)->GetByteArrayRegion(env, funding_key, 0, 32, funding_key_arr);
64471         uint8_t (*funding_key_ref)[32] = &funding_key_arr;
64472         LDKu8slice funding_redeemscript_ref;
64473         funding_redeemscript_ref.datalen = (*env)->GetArrayLength(env, funding_redeemscript);
64474         funding_redeemscript_ref.data = (*env)->GetByteArrayElements (env, funding_redeemscript, NULL);
64475         void* entropy_source_ptr = untag_ptr(entropy_source);
64476         if (ptr_is_owned(entropy_source)) { CHECK_ACCESS(entropy_source_ptr); }
64477         LDKEntropySource* entropy_source_conv = (LDKEntropySource*)entropy_source_ptr;
64478         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
64479         (*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);
64480         (*env)->ReleaseByteArrayElements(env, funding_redeemscript, (int8_t*)funding_redeemscript_ref.data, 0);
64481         return ret_arr;
64482 }
64483
64484 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
64485         LDKClosingTransaction this_obj_conv;
64486         this_obj_conv.inner = untag_ptr(this_obj);
64487         this_obj_conv.is_owned = ptr_is_owned(this_obj);
64488         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
64489         ClosingTransaction_free(this_obj_conv);
64490 }
64491
64492 static inline uint64_t ClosingTransaction_clone_ptr(LDKClosingTransaction *NONNULL_PTR arg) {
64493         LDKClosingTransaction ret_var = ClosingTransaction_clone(arg);
64494         int64_t ret_ref = 0;
64495         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64496         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64497         return ret_ref;
64498 }
64499 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
64500         LDKClosingTransaction arg_conv;
64501         arg_conv.inner = untag_ptr(arg);
64502         arg_conv.is_owned = ptr_is_owned(arg);
64503         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
64504         arg_conv.is_owned = false;
64505         int64_t ret_conv = ClosingTransaction_clone_ptr(&arg_conv);
64506         return ret_conv;
64507 }
64508
64509 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1clone(JNIEnv *env, jclass clz, int64_t orig) {
64510         LDKClosingTransaction orig_conv;
64511         orig_conv.inner = untag_ptr(orig);
64512         orig_conv.is_owned = ptr_is_owned(orig);
64513         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
64514         orig_conv.is_owned = false;
64515         LDKClosingTransaction ret_var = ClosingTransaction_clone(&orig_conv);
64516         int64_t ret_ref = 0;
64517         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64518         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64519         return ret_ref;
64520 }
64521
64522 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1hash(JNIEnv *env, jclass clz, int64_t o) {
64523         LDKClosingTransaction o_conv;
64524         o_conv.inner = untag_ptr(o);
64525         o_conv.is_owned = ptr_is_owned(o);
64526         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
64527         o_conv.is_owned = false;
64528         int64_t ret_conv = ClosingTransaction_hash(&o_conv);
64529         return ret_conv;
64530 }
64531
64532 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
64533         LDKClosingTransaction a_conv;
64534         a_conv.inner = untag_ptr(a);
64535         a_conv.is_owned = ptr_is_owned(a);
64536         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
64537         a_conv.is_owned = false;
64538         LDKClosingTransaction b_conv;
64539         b_conv.inner = untag_ptr(b);
64540         b_conv.is_owned = ptr_is_owned(b);
64541         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
64542         b_conv.is_owned = false;
64543         jboolean ret_conv = ClosingTransaction_eq(&a_conv, &b_conv);
64544         return ret_conv;
64545 }
64546
64547 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) {
64548         LDKCVec_u8Z to_holder_script_ref;
64549         to_holder_script_ref.datalen = (*env)->GetArrayLength(env, to_holder_script);
64550         to_holder_script_ref.data = MALLOC(to_holder_script_ref.datalen, "LDKCVec_u8Z Bytes");
64551         (*env)->GetByteArrayRegion(env, to_holder_script, 0, to_holder_script_ref.datalen, to_holder_script_ref.data);
64552         LDKCVec_u8Z to_counterparty_script_ref;
64553         to_counterparty_script_ref.datalen = (*env)->GetArrayLength(env, to_counterparty_script);
64554         to_counterparty_script_ref.data = MALLOC(to_counterparty_script_ref.datalen, "LDKCVec_u8Z Bytes");
64555         (*env)->GetByteArrayRegion(env, to_counterparty_script, 0, to_counterparty_script_ref.datalen, to_counterparty_script_ref.data);
64556         LDKOutPoint funding_outpoint_conv;
64557         funding_outpoint_conv.inner = untag_ptr(funding_outpoint);
64558         funding_outpoint_conv.is_owned = ptr_is_owned(funding_outpoint);
64559         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_conv);
64560         funding_outpoint_conv = OutPoint_clone(&funding_outpoint_conv);
64561         LDKClosingTransaction ret_var = ClosingTransaction_new(to_holder_value_sat, to_counterparty_value_sat, to_holder_script_ref, to_counterparty_script_ref, funding_outpoint_conv);
64562         int64_t ret_ref = 0;
64563         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64564         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64565         return ret_ref;
64566 }
64567
64568 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1trust(JNIEnv *env, jclass clz, int64_t this_arg) {
64569         LDKClosingTransaction this_arg_conv;
64570         this_arg_conv.inner = untag_ptr(this_arg);
64571         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64572         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64573         this_arg_conv.is_owned = false;
64574         LDKTrustedClosingTransaction ret_var = ClosingTransaction_trust(&this_arg_conv);
64575         int64_t ret_ref = 0;
64576         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64577         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64578         return ret_ref;
64579 }
64580
64581 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1verify(JNIEnv *env, jclass clz, int64_t this_arg, int64_t funding_outpoint) {
64582         LDKClosingTransaction this_arg_conv;
64583         this_arg_conv.inner = untag_ptr(this_arg);
64584         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64585         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64586         this_arg_conv.is_owned = false;
64587         LDKOutPoint funding_outpoint_conv;
64588         funding_outpoint_conv.inner = untag_ptr(funding_outpoint);
64589         funding_outpoint_conv.is_owned = ptr_is_owned(funding_outpoint);
64590         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_conv);
64591         funding_outpoint_conv = OutPoint_clone(&funding_outpoint_conv);
64592         LDKCResult_TrustedClosingTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedClosingTransactionNoneZ), "LDKCResult_TrustedClosingTransactionNoneZ");
64593         *ret_conv = ClosingTransaction_verify(&this_arg_conv, funding_outpoint_conv);
64594         return tag_ptr(ret_conv, true);
64595 }
64596
64597 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1to_1holder_1value_1sat(JNIEnv *env, jclass clz, int64_t this_arg) {
64598         LDKClosingTransaction this_arg_conv;
64599         this_arg_conv.inner = untag_ptr(this_arg);
64600         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64601         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64602         this_arg_conv.is_owned = false;
64603         int64_t ret_conv = ClosingTransaction_to_holder_value_sat(&this_arg_conv);
64604         return ret_conv;
64605 }
64606
64607 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1to_1counterparty_1value_1sat(JNIEnv *env, jclass clz, int64_t this_arg) {
64608         LDKClosingTransaction this_arg_conv;
64609         this_arg_conv.inner = untag_ptr(this_arg);
64610         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64611         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64612         this_arg_conv.is_owned = false;
64613         int64_t ret_conv = ClosingTransaction_to_counterparty_value_sat(&this_arg_conv);
64614         return ret_conv;
64615 }
64616
64617 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1to_1holder_1script(JNIEnv *env, jclass clz, int64_t this_arg) {
64618         LDKClosingTransaction this_arg_conv;
64619         this_arg_conv.inner = untag_ptr(this_arg);
64620         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64621         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64622         this_arg_conv.is_owned = false;
64623         LDKu8slice ret_var = ClosingTransaction_to_holder_script(&this_arg_conv);
64624         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
64625         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
64626         return ret_arr;
64627 }
64628
64629 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1to_1counterparty_1script(JNIEnv *env, jclass clz, int64_t this_arg) {
64630         LDKClosingTransaction this_arg_conv;
64631         this_arg_conv.inner = untag_ptr(this_arg);
64632         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64633         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64634         this_arg_conv.is_owned = false;
64635         LDKu8slice ret_var = ClosingTransaction_to_counterparty_script(&this_arg_conv);
64636         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
64637         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
64638         return ret_arr;
64639 }
64640
64641 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TrustedClosingTransaction_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
64642         LDKTrustedClosingTransaction this_obj_conv;
64643         this_obj_conv.inner = untag_ptr(this_obj);
64644         this_obj_conv.is_owned = ptr_is_owned(this_obj);
64645         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
64646         TrustedClosingTransaction_free(this_obj_conv);
64647 }
64648
64649 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TrustedClosingTransaction_1built_1transaction(JNIEnv *env, jclass clz, int64_t this_arg) {
64650         LDKTrustedClosingTransaction this_arg_conv;
64651         this_arg_conv.inner = untag_ptr(this_arg);
64652         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64653         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64654         this_arg_conv.is_owned = false;
64655         LDKTransaction ret_var = TrustedClosingTransaction_built_transaction(&this_arg_conv);
64656         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
64657         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
64658         Transaction_free(ret_var);
64659         return ret_arr;
64660 }
64661
64662 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) {
64663         LDKTrustedClosingTransaction this_arg_conv;
64664         this_arg_conv.inner = untag_ptr(this_arg);
64665         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64666         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64667         this_arg_conv.is_owned = false;
64668         LDKu8slice funding_redeemscript_ref;
64669         funding_redeemscript_ref.datalen = (*env)->GetArrayLength(env, funding_redeemscript);
64670         funding_redeemscript_ref.data = (*env)->GetByteArrayElements (env, funding_redeemscript, NULL);
64671         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
64672         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, TrustedClosingTransaction_get_sighash_all(&this_arg_conv, funding_redeemscript_ref, channel_value_satoshis).data);
64673         (*env)->ReleaseByteArrayElements(env, funding_redeemscript, (int8_t*)funding_redeemscript_ref.data, 0);
64674         return ret_arr;
64675 }
64676
64677 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) {
64678         LDKTrustedClosingTransaction this_arg_conv;
64679         this_arg_conv.inner = untag_ptr(this_arg);
64680         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64681         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64682         this_arg_conv.is_owned = false;
64683         uint8_t funding_key_arr[32];
64684         CHECK((*env)->GetArrayLength(env, funding_key) == 32);
64685         (*env)->GetByteArrayRegion(env, funding_key, 0, 32, funding_key_arr);
64686         uint8_t (*funding_key_ref)[32] = &funding_key_arr;
64687         LDKu8slice funding_redeemscript_ref;
64688         funding_redeemscript_ref.datalen = (*env)->GetArrayLength(env, funding_redeemscript);
64689         funding_redeemscript_ref.data = (*env)->GetByteArrayElements (env, funding_redeemscript, NULL);
64690         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
64691         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, TrustedClosingTransaction_sign(&this_arg_conv, funding_key_ref, funding_redeemscript_ref, channel_value_satoshis).compact_form);
64692         (*env)->ReleaseByteArrayElements(env, funding_redeemscript, (int8_t*)funding_redeemscript_ref.data, 0);
64693         return ret_arr;
64694 }
64695
64696 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
64697         LDKCommitmentTransaction this_obj_conv;
64698         this_obj_conv.inner = untag_ptr(this_obj);
64699         this_obj_conv.is_owned = ptr_is_owned(this_obj);
64700         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
64701         CommitmentTransaction_free(this_obj_conv);
64702 }
64703
64704 static inline uint64_t CommitmentTransaction_clone_ptr(LDKCommitmentTransaction *NONNULL_PTR arg) {
64705         LDKCommitmentTransaction ret_var = CommitmentTransaction_clone(arg);
64706         int64_t ret_ref = 0;
64707         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64708         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64709         return ret_ref;
64710 }
64711 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
64712         LDKCommitmentTransaction arg_conv;
64713         arg_conv.inner = untag_ptr(arg);
64714         arg_conv.is_owned = ptr_is_owned(arg);
64715         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
64716         arg_conv.is_owned = false;
64717         int64_t ret_conv = CommitmentTransaction_clone_ptr(&arg_conv);
64718         return ret_conv;
64719 }
64720
64721 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1clone(JNIEnv *env, jclass clz, int64_t orig) {
64722         LDKCommitmentTransaction orig_conv;
64723         orig_conv.inner = untag_ptr(orig);
64724         orig_conv.is_owned = ptr_is_owned(orig);
64725         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
64726         orig_conv.is_owned = false;
64727         LDKCommitmentTransaction ret_var = CommitmentTransaction_clone(&orig_conv);
64728         int64_t ret_ref = 0;
64729         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64730         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64731         return ret_ref;
64732 }
64733
64734 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1write(JNIEnv *env, jclass clz, int64_t obj) {
64735         LDKCommitmentTransaction obj_conv;
64736         obj_conv.inner = untag_ptr(obj);
64737         obj_conv.is_owned = ptr_is_owned(obj);
64738         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
64739         obj_conv.is_owned = false;
64740         LDKCVec_u8Z ret_var = CommitmentTransaction_write(&obj_conv);
64741         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
64742         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
64743         CVec_u8Z_free(ret_var);
64744         return ret_arr;
64745 }
64746
64747 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
64748         LDKu8slice ser_ref;
64749         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
64750         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
64751         LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
64752         *ret_conv = CommitmentTransaction_read(ser_ref);
64753         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
64754         return tag_ptr(ret_conv, true);
64755 }
64756
64757 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1commitment_1number(JNIEnv *env, jclass clz, int64_t this_arg) {
64758         LDKCommitmentTransaction this_arg_conv;
64759         this_arg_conv.inner = untag_ptr(this_arg);
64760         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64761         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64762         this_arg_conv.is_owned = false;
64763         int64_t ret_conv = CommitmentTransaction_commitment_number(&this_arg_conv);
64764         return ret_conv;
64765 }
64766
64767 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_arg) {
64768         LDKCommitmentTransaction this_arg_conv;
64769         this_arg_conv.inner = untag_ptr(this_arg);
64770         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64771         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64772         this_arg_conv.is_owned = false;
64773         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
64774         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, CommitmentTransaction_per_commitment_point(&this_arg_conv).compressed_form);
64775         return ret_arr;
64776 }
64777
64778 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1to_1broadcaster_1value_1sat(JNIEnv *env, jclass clz, int64_t this_arg) {
64779         LDKCommitmentTransaction this_arg_conv;
64780         this_arg_conv.inner = untag_ptr(this_arg);
64781         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64782         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64783         this_arg_conv.is_owned = false;
64784         int64_t ret_conv = CommitmentTransaction_to_broadcaster_value_sat(&this_arg_conv);
64785         return ret_conv;
64786 }
64787
64788 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1to_1countersignatory_1value_1sat(JNIEnv *env, jclass clz, int64_t this_arg) {
64789         LDKCommitmentTransaction this_arg_conv;
64790         this_arg_conv.inner = untag_ptr(this_arg);
64791         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64792         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64793         this_arg_conv.is_owned = false;
64794         int64_t ret_conv = CommitmentTransaction_to_countersignatory_value_sat(&this_arg_conv);
64795         return ret_conv;
64796 }
64797
64798 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_arg) {
64799         LDKCommitmentTransaction this_arg_conv;
64800         this_arg_conv.inner = untag_ptr(this_arg);
64801         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64802         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64803         this_arg_conv.is_owned = false;
64804         int32_t ret_conv = CommitmentTransaction_feerate_per_kw(&this_arg_conv);
64805         return ret_conv;
64806 }
64807
64808 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1trust(JNIEnv *env, jclass clz, int64_t this_arg) {
64809         LDKCommitmentTransaction this_arg_conv;
64810         this_arg_conv.inner = untag_ptr(this_arg);
64811         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64812         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64813         this_arg_conv.is_owned = false;
64814         LDKTrustedCommitmentTransaction ret_var = CommitmentTransaction_trust(&this_arg_conv);
64815         int64_t ret_ref = 0;
64816         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64817         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64818         return ret_ref;
64819 }
64820
64821 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) {
64822         LDKCommitmentTransaction this_arg_conv;
64823         this_arg_conv.inner = untag_ptr(this_arg);
64824         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64825         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64826         this_arg_conv.is_owned = false;
64827         LDKDirectedChannelTransactionParameters channel_parameters_conv;
64828         channel_parameters_conv.inner = untag_ptr(channel_parameters);
64829         channel_parameters_conv.is_owned = ptr_is_owned(channel_parameters);
64830         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_conv);
64831         channel_parameters_conv.is_owned = false;
64832         LDKChannelPublicKeys broadcaster_keys_conv;
64833         broadcaster_keys_conv.inner = untag_ptr(broadcaster_keys);
64834         broadcaster_keys_conv.is_owned = ptr_is_owned(broadcaster_keys);
64835         CHECK_INNER_FIELD_ACCESS_OR_NULL(broadcaster_keys_conv);
64836         broadcaster_keys_conv.is_owned = false;
64837         LDKChannelPublicKeys countersignatory_keys_conv;
64838         countersignatory_keys_conv.inner = untag_ptr(countersignatory_keys);
64839         countersignatory_keys_conv.is_owned = ptr_is_owned(countersignatory_keys);
64840         CHECK_INNER_FIELD_ACCESS_OR_NULL(countersignatory_keys_conv);
64841         countersignatory_keys_conv.is_owned = false;
64842         LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
64843         *ret_conv = CommitmentTransaction_verify(&this_arg_conv, &channel_parameters_conv, &broadcaster_keys_conv, &countersignatory_keys_conv);
64844         return tag_ptr(ret_conv, true);
64845 }
64846
64847 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
64848         LDKTrustedCommitmentTransaction this_obj_conv;
64849         this_obj_conv.inner = untag_ptr(this_obj);
64850         this_obj_conv.is_owned = ptr_is_owned(this_obj);
64851         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
64852         TrustedCommitmentTransaction_free(this_obj_conv);
64853 }
64854
64855 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1txid(JNIEnv *env, jclass clz, int64_t this_arg) {
64856         LDKTrustedCommitmentTransaction this_arg_conv;
64857         this_arg_conv.inner = untag_ptr(this_arg);
64858         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64859         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64860         this_arg_conv.is_owned = false;
64861         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
64862         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, TrustedCommitmentTransaction_txid(&this_arg_conv).data);
64863         return ret_arr;
64864 }
64865
64866 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1built_1transaction(JNIEnv *env, jclass clz, int64_t this_arg) {
64867         LDKTrustedCommitmentTransaction this_arg_conv;
64868         this_arg_conv.inner = untag_ptr(this_arg);
64869         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64870         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64871         this_arg_conv.is_owned = false;
64872         LDKBuiltCommitmentTransaction ret_var = TrustedCommitmentTransaction_built_transaction(&this_arg_conv);
64873         int64_t ret_ref = 0;
64874         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64875         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64876         return ret_ref;
64877 }
64878
64879 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1keys(JNIEnv *env, jclass clz, int64_t this_arg) {
64880         LDKTrustedCommitmentTransaction this_arg_conv;
64881         this_arg_conv.inner = untag_ptr(this_arg);
64882         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64883         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64884         this_arg_conv.is_owned = false;
64885         LDKTxCreationKeys ret_var = TrustedCommitmentTransaction_keys(&this_arg_conv);
64886         int64_t ret_ref = 0;
64887         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64888         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64889         return ret_ref;
64890 }
64891
64892 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1channel_1type_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
64893         LDKTrustedCommitmentTransaction this_arg_conv;
64894         this_arg_conv.inner = untag_ptr(this_arg);
64895         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64896         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64897         this_arg_conv.is_owned = false;
64898         LDKChannelTypeFeatures ret_var = TrustedCommitmentTransaction_channel_type_features(&this_arg_conv);
64899         int64_t ret_ref = 0;
64900         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
64901         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
64902         return ret_ref;
64903 }
64904
64905 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) {
64906         LDKTrustedCommitmentTransaction this_arg_conv;
64907         this_arg_conv.inner = untag_ptr(this_arg);
64908         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64909         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64910         this_arg_conv.is_owned = false;
64911         uint8_t htlc_base_key_arr[32];
64912         CHECK((*env)->GetArrayLength(env, htlc_base_key) == 32);
64913         (*env)->GetByteArrayRegion(env, htlc_base_key, 0, 32, htlc_base_key_arr);
64914         uint8_t (*htlc_base_key_ref)[32] = &htlc_base_key_arr;
64915         LDKDirectedChannelTransactionParameters channel_parameters_conv;
64916         channel_parameters_conv.inner = untag_ptr(channel_parameters);
64917         channel_parameters_conv.is_owned = ptr_is_owned(channel_parameters);
64918         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_conv);
64919         channel_parameters_conv.is_owned = false;
64920         void* entropy_source_ptr = untag_ptr(entropy_source);
64921         if (ptr_is_owned(entropy_source)) { CHECK_ACCESS(entropy_source_ptr); }
64922         LDKEntropySource* entropy_source_conv = (LDKEntropySource*)entropy_source_ptr;
64923         LDKCResult_CVec_ECDSASignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_ECDSASignatureZNoneZ), "LDKCResult_CVec_ECDSASignatureZNoneZ");
64924         *ret_conv = TrustedCommitmentTransaction_get_htlc_sigs(&this_arg_conv, htlc_base_key_ref, &channel_parameters_conv, entropy_source_conv);
64925         return tag_ptr(ret_conv, true);
64926 }
64927
64928 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1revokeable_1output_1index(JNIEnv *env, jclass clz, int64_t this_arg) {
64929         LDKTrustedCommitmentTransaction this_arg_conv;
64930         this_arg_conv.inner = untag_ptr(this_arg);
64931         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64932         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64933         this_arg_conv.is_owned = false;
64934         LDKCOption_usizeZ *ret_copy = MALLOC(sizeof(LDKCOption_usizeZ), "LDKCOption_usizeZ");
64935         *ret_copy = TrustedCommitmentTransaction_revokeable_output_index(&this_arg_conv);
64936         int64_t ret_ref = tag_ptr(ret_copy, true);
64937         return ret_ref;
64938 }
64939
64940 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) {
64941         LDKTrustedCommitmentTransaction this_arg_conv;
64942         this_arg_conv.inner = untag_ptr(this_arg);
64943         this_arg_conv.is_owned = ptr_is_owned(this_arg);
64944         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
64945         this_arg_conv.is_owned = false;
64946         LDKCVec_u8Z destination_script_ref;
64947         destination_script_ref.datalen = (*env)->GetArrayLength(env, destination_script);
64948         destination_script_ref.data = MALLOC(destination_script_ref.datalen, "LDKCVec_u8Z Bytes");
64949         (*env)->GetByteArrayRegion(env, destination_script, 0, destination_script_ref.datalen, destination_script_ref.data);
64950         LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
64951         *ret_conv = TrustedCommitmentTransaction_build_to_local_justice_tx(&this_arg_conv, feerate_per_kw, destination_script_ref);
64952         return tag_ptr(ret_conv, true);
64953 }
64954
64955 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) {
64956         LDKPublicKey broadcaster_payment_basepoint_ref;
64957         CHECK((*env)->GetArrayLength(env, broadcaster_payment_basepoint) == 33);
64958         (*env)->GetByteArrayRegion(env, broadcaster_payment_basepoint, 0, 33, broadcaster_payment_basepoint_ref.compressed_form);
64959         LDKPublicKey countersignatory_payment_basepoint_ref;
64960         CHECK((*env)->GetArrayLength(env, countersignatory_payment_basepoint) == 33);
64961         (*env)->GetByteArrayRegion(env, countersignatory_payment_basepoint, 0, 33, countersignatory_payment_basepoint_ref.compressed_form);
64962         int64_t ret_conv = get_commitment_transaction_number_obscure_factor(broadcaster_payment_basepoint_ref, countersignatory_payment_basepoint_ref, outbound_from_broadcaster);
64963         return ret_conv;
64964 }
64965
64966 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
64967         LDKInitFeatures a_conv;
64968         a_conv.inner = untag_ptr(a);
64969         a_conv.is_owned = ptr_is_owned(a);
64970         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
64971         a_conv.is_owned = false;
64972         LDKInitFeatures b_conv;
64973         b_conv.inner = untag_ptr(b);
64974         b_conv.is_owned = ptr_is_owned(b);
64975         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
64976         b_conv.is_owned = false;
64977         jboolean ret_conv = InitFeatures_eq(&a_conv, &b_conv);
64978         return ret_conv;
64979 }
64980
64981 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
64982         LDKNodeFeatures a_conv;
64983         a_conv.inner = untag_ptr(a);
64984         a_conv.is_owned = ptr_is_owned(a);
64985         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
64986         a_conv.is_owned = false;
64987         LDKNodeFeatures b_conv;
64988         b_conv.inner = untag_ptr(b);
64989         b_conv.is_owned = ptr_is_owned(b);
64990         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
64991         b_conv.is_owned = false;
64992         jboolean ret_conv = NodeFeatures_eq(&a_conv, &b_conv);
64993         return ret_conv;
64994 }
64995
64996 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
64997         LDKChannelFeatures a_conv;
64998         a_conv.inner = untag_ptr(a);
64999         a_conv.is_owned = ptr_is_owned(a);
65000         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
65001         a_conv.is_owned = false;
65002         LDKChannelFeatures b_conv;
65003         b_conv.inner = untag_ptr(b);
65004         b_conv.is_owned = ptr_is_owned(b);
65005         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
65006         b_conv.is_owned = false;
65007         jboolean ret_conv = ChannelFeatures_eq(&a_conv, &b_conv);
65008         return ret_conv;
65009 }
65010
65011 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
65012         LDKBolt11InvoiceFeatures a_conv;
65013         a_conv.inner = untag_ptr(a);
65014         a_conv.is_owned = ptr_is_owned(a);
65015         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
65016         a_conv.is_owned = false;
65017         LDKBolt11InvoiceFeatures b_conv;
65018         b_conv.inner = untag_ptr(b);
65019         b_conv.is_owned = ptr_is_owned(b);
65020         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
65021         b_conv.is_owned = false;
65022         jboolean ret_conv = Bolt11InvoiceFeatures_eq(&a_conv, &b_conv);
65023         return ret_conv;
65024 }
65025
65026 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_OfferFeatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
65027         LDKOfferFeatures a_conv;
65028         a_conv.inner = untag_ptr(a);
65029         a_conv.is_owned = ptr_is_owned(a);
65030         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
65031         a_conv.is_owned = false;
65032         LDKOfferFeatures b_conv;
65033         b_conv.inner = untag_ptr(b);
65034         b_conv.is_owned = ptr_is_owned(b);
65035         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
65036         b_conv.is_owned = false;
65037         jboolean ret_conv = OfferFeatures_eq(&a_conv, &b_conv);
65038         return ret_conv;
65039 }
65040
65041 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InvoiceRequestFeatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
65042         LDKInvoiceRequestFeatures a_conv;
65043         a_conv.inner = untag_ptr(a);
65044         a_conv.is_owned = ptr_is_owned(a);
65045         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
65046         a_conv.is_owned = false;
65047         LDKInvoiceRequestFeatures b_conv;
65048         b_conv.inner = untag_ptr(b);
65049         b_conv.is_owned = ptr_is_owned(b);
65050         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
65051         b_conv.is_owned = false;
65052         jboolean ret_conv = InvoiceRequestFeatures_eq(&a_conv, &b_conv);
65053         return ret_conv;
65054 }
65055
65056 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt12InvoiceFeatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
65057         LDKBolt12InvoiceFeatures a_conv;
65058         a_conv.inner = untag_ptr(a);
65059         a_conv.is_owned = ptr_is_owned(a);
65060         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
65061         a_conv.is_owned = false;
65062         LDKBolt12InvoiceFeatures b_conv;
65063         b_conv.inner = untag_ptr(b);
65064         b_conv.is_owned = ptr_is_owned(b);
65065         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
65066         b_conv.is_owned = false;
65067         jboolean ret_conv = Bolt12InvoiceFeatures_eq(&a_conv, &b_conv);
65068         return ret_conv;
65069 }
65070
65071 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_BlindedHopFeatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
65072         LDKBlindedHopFeatures a_conv;
65073         a_conv.inner = untag_ptr(a);
65074         a_conv.is_owned = ptr_is_owned(a);
65075         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
65076         a_conv.is_owned = false;
65077         LDKBlindedHopFeatures b_conv;
65078         b_conv.inner = untag_ptr(b);
65079         b_conv.is_owned = ptr_is_owned(b);
65080         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
65081         b_conv.is_owned = false;
65082         jboolean ret_conv = BlindedHopFeatures_eq(&a_conv, &b_conv);
65083         return ret_conv;
65084 }
65085
65086 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
65087         LDKChannelTypeFeatures a_conv;
65088         a_conv.inner = untag_ptr(a);
65089         a_conv.is_owned = ptr_is_owned(a);
65090         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
65091         a_conv.is_owned = false;
65092         LDKChannelTypeFeatures b_conv;
65093         b_conv.inner = untag_ptr(b);
65094         b_conv.is_owned = ptr_is_owned(b);
65095         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
65096         b_conv.is_owned = false;
65097         jboolean ret_conv = ChannelTypeFeatures_eq(&a_conv, &b_conv);
65098         return ret_conv;
65099 }
65100
65101 static inline uint64_t InitFeatures_clone_ptr(LDKInitFeatures *NONNULL_PTR arg) {
65102         LDKInitFeatures ret_var = InitFeatures_clone(arg);
65103         int64_t ret_ref = 0;
65104         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65105         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65106         return ret_ref;
65107 }
65108 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InitFeatures_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
65109         LDKInitFeatures arg_conv;
65110         arg_conv.inner = untag_ptr(arg);
65111         arg_conv.is_owned = ptr_is_owned(arg);
65112         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
65113         arg_conv.is_owned = false;
65114         int64_t ret_conv = InitFeatures_clone_ptr(&arg_conv);
65115         return ret_conv;
65116 }
65117
65118 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InitFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
65119         LDKInitFeatures orig_conv;
65120         orig_conv.inner = untag_ptr(orig);
65121         orig_conv.is_owned = ptr_is_owned(orig);
65122         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
65123         orig_conv.is_owned = false;
65124         LDKInitFeatures ret_var = InitFeatures_clone(&orig_conv);
65125         int64_t ret_ref = 0;
65126         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65127         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65128         return ret_ref;
65129 }
65130
65131 static inline uint64_t NodeFeatures_clone_ptr(LDKNodeFeatures *NONNULL_PTR arg) {
65132         LDKNodeFeatures ret_var = NodeFeatures_clone(arg);
65133         int64_t ret_ref = 0;
65134         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65135         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65136         return ret_ref;
65137 }
65138 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
65139         LDKNodeFeatures arg_conv;
65140         arg_conv.inner = untag_ptr(arg);
65141         arg_conv.is_owned = ptr_is_owned(arg);
65142         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
65143         arg_conv.is_owned = false;
65144         int64_t ret_conv = NodeFeatures_clone_ptr(&arg_conv);
65145         return ret_conv;
65146 }
65147
65148 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
65149         LDKNodeFeatures orig_conv;
65150         orig_conv.inner = untag_ptr(orig);
65151         orig_conv.is_owned = ptr_is_owned(orig);
65152         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
65153         orig_conv.is_owned = false;
65154         LDKNodeFeatures ret_var = NodeFeatures_clone(&orig_conv);
65155         int64_t ret_ref = 0;
65156         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65157         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65158         return ret_ref;
65159 }
65160
65161 static inline uint64_t ChannelFeatures_clone_ptr(LDKChannelFeatures *NONNULL_PTR arg) {
65162         LDKChannelFeatures ret_var = ChannelFeatures_clone(arg);
65163         int64_t ret_ref = 0;
65164         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65165         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65166         return ret_ref;
65167 }
65168 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
65169         LDKChannelFeatures arg_conv;
65170         arg_conv.inner = untag_ptr(arg);
65171         arg_conv.is_owned = ptr_is_owned(arg);
65172         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
65173         arg_conv.is_owned = false;
65174         int64_t ret_conv = ChannelFeatures_clone_ptr(&arg_conv);
65175         return ret_conv;
65176 }
65177
65178 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
65179         LDKChannelFeatures orig_conv;
65180         orig_conv.inner = untag_ptr(orig);
65181         orig_conv.is_owned = ptr_is_owned(orig);
65182         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
65183         orig_conv.is_owned = false;
65184         LDKChannelFeatures ret_var = ChannelFeatures_clone(&orig_conv);
65185         int64_t ret_ref = 0;
65186         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65187         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65188         return ret_ref;
65189 }
65190
65191 static inline uint64_t Bolt11InvoiceFeatures_clone_ptr(LDKBolt11InvoiceFeatures *NONNULL_PTR arg) {
65192         LDKBolt11InvoiceFeatures ret_var = Bolt11InvoiceFeatures_clone(arg);
65193         int64_t ret_ref = 0;
65194         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65195         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65196         return ret_ref;
65197 }
65198 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
65199         LDKBolt11InvoiceFeatures arg_conv;
65200         arg_conv.inner = untag_ptr(arg);
65201         arg_conv.is_owned = ptr_is_owned(arg);
65202         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
65203         arg_conv.is_owned = false;
65204         int64_t ret_conv = Bolt11InvoiceFeatures_clone_ptr(&arg_conv);
65205         return ret_conv;
65206 }
65207
65208 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
65209         LDKBolt11InvoiceFeatures orig_conv;
65210         orig_conv.inner = untag_ptr(orig);
65211         orig_conv.is_owned = ptr_is_owned(orig);
65212         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
65213         orig_conv.is_owned = false;
65214         LDKBolt11InvoiceFeatures ret_var = Bolt11InvoiceFeatures_clone(&orig_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 static inline uint64_t OfferFeatures_clone_ptr(LDKOfferFeatures *NONNULL_PTR arg) {
65222         LDKOfferFeatures ret_var = OfferFeatures_clone(arg);
65223         int64_t ret_ref = 0;
65224         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65225         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65226         return ret_ref;
65227 }
65228 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OfferFeatures_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
65229         LDKOfferFeatures arg_conv;
65230         arg_conv.inner = untag_ptr(arg);
65231         arg_conv.is_owned = ptr_is_owned(arg);
65232         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
65233         arg_conv.is_owned = false;
65234         int64_t ret_conv = OfferFeatures_clone_ptr(&arg_conv);
65235         return ret_conv;
65236 }
65237
65238 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OfferFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
65239         LDKOfferFeatures orig_conv;
65240         orig_conv.inner = untag_ptr(orig);
65241         orig_conv.is_owned = ptr_is_owned(orig);
65242         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
65243         orig_conv.is_owned = false;
65244         LDKOfferFeatures ret_var = OfferFeatures_clone(&orig_conv);
65245         int64_t ret_ref = 0;
65246         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65247         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65248         return ret_ref;
65249 }
65250
65251 static inline uint64_t InvoiceRequestFeatures_clone_ptr(LDKInvoiceRequestFeatures *NONNULL_PTR arg) {
65252         LDKInvoiceRequestFeatures ret_var = InvoiceRequestFeatures_clone(arg);
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 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceRequestFeatures_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
65259         LDKInvoiceRequestFeatures arg_conv;
65260         arg_conv.inner = untag_ptr(arg);
65261         arg_conv.is_owned = ptr_is_owned(arg);
65262         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
65263         arg_conv.is_owned = false;
65264         int64_t ret_conv = InvoiceRequestFeatures_clone_ptr(&arg_conv);
65265         return ret_conv;
65266 }
65267
65268 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceRequestFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
65269         LDKInvoiceRequestFeatures orig_conv;
65270         orig_conv.inner = untag_ptr(orig);
65271         orig_conv.is_owned = ptr_is_owned(orig);
65272         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
65273         orig_conv.is_owned = false;
65274         LDKInvoiceRequestFeatures ret_var = InvoiceRequestFeatures_clone(&orig_conv);
65275         int64_t ret_ref = 0;
65276         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65277         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65278         return ret_ref;
65279 }
65280
65281 static inline uint64_t Bolt12InvoiceFeatures_clone_ptr(LDKBolt12InvoiceFeatures *NONNULL_PTR arg) {
65282         LDKBolt12InvoiceFeatures ret_var = Bolt12InvoiceFeatures_clone(arg);
65283         int64_t ret_ref = 0;
65284         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65285         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65286         return ret_ref;
65287 }
65288 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12InvoiceFeatures_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
65289         LDKBolt12InvoiceFeatures arg_conv;
65290         arg_conv.inner = untag_ptr(arg);
65291         arg_conv.is_owned = ptr_is_owned(arg);
65292         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
65293         arg_conv.is_owned = false;
65294         int64_t ret_conv = Bolt12InvoiceFeatures_clone_ptr(&arg_conv);
65295         return ret_conv;
65296 }
65297
65298 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12InvoiceFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
65299         LDKBolt12InvoiceFeatures orig_conv;
65300         orig_conv.inner = untag_ptr(orig);
65301         orig_conv.is_owned = ptr_is_owned(orig);
65302         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
65303         orig_conv.is_owned = false;
65304         LDKBolt12InvoiceFeatures ret_var = Bolt12InvoiceFeatures_clone(&orig_conv);
65305         int64_t ret_ref = 0;
65306         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65307         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65308         return ret_ref;
65309 }
65310
65311 static inline uint64_t BlindedHopFeatures_clone_ptr(LDKBlindedHopFeatures *NONNULL_PTR arg) {
65312         LDKBlindedHopFeatures ret_var = BlindedHopFeatures_clone(arg);
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 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedHopFeatures_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
65319         LDKBlindedHopFeatures arg_conv;
65320         arg_conv.inner = untag_ptr(arg);
65321         arg_conv.is_owned = ptr_is_owned(arg);
65322         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
65323         arg_conv.is_owned = false;
65324         int64_t ret_conv = BlindedHopFeatures_clone_ptr(&arg_conv);
65325         return ret_conv;
65326 }
65327
65328 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedHopFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
65329         LDKBlindedHopFeatures orig_conv;
65330         orig_conv.inner = untag_ptr(orig);
65331         orig_conv.is_owned = ptr_is_owned(orig);
65332         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
65333         orig_conv.is_owned = false;
65334         LDKBlindedHopFeatures ret_var = BlindedHopFeatures_clone(&orig_conv);
65335         int64_t ret_ref = 0;
65336         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65337         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65338         return ret_ref;
65339 }
65340
65341 static inline uint64_t ChannelTypeFeatures_clone_ptr(LDKChannelTypeFeatures *NONNULL_PTR arg) {
65342         LDKChannelTypeFeatures ret_var = ChannelTypeFeatures_clone(arg);
65343         int64_t ret_ref = 0;
65344         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65345         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65346         return ret_ref;
65347 }
65348 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
65349         LDKChannelTypeFeatures arg_conv;
65350         arg_conv.inner = untag_ptr(arg);
65351         arg_conv.is_owned = ptr_is_owned(arg);
65352         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
65353         arg_conv.is_owned = false;
65354         int64_t ret_conv = ChannelTypeFeatures_clone_ptr(&arg_conv);
65355         return ret_conv;
65356 }
65357
65358 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
65359         LDKChannelTypeFeatures orig_conv;
65360         orig_conv.inner = untag_ptr(orig);
65361         orig_conv.is_owned = ptr_is_owned(orig);
65362         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
65363         orig_conv.is_owned = false;
65364         LDKChannelTypeFeatures ret_var = ChannelTypeFeatures_clone(&orig_conv);
65365         int64_t ret_ref = 0;
65366         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65367         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65368         return ret_ref;
65369 }
65370
65371 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InitFeatures_1hash(JNIEnv *env, jclass clz, int64_t o) {
65372         LDKInitFeatures o_conv;
65373         o_conv.inner = untag_ptr(o);
65374         o_conv.is_owned = ptr_is_owned(o);
65375         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
65376         o_conv.is_owned = false;
65377         int64_t ret_conv = InitFeatures_hash(&o_conv);
65378         return ret_conv;
65379 }
65380
65381 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1hash(JNIEnv *env, jclass clz, int64_t o) {
65382         LDKNodeFeatures o_conv;
65383         o_conv.inner = untag_ptr(o);
65384         o_conv.is_owned = ptr_is_owned(o);
65385         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
65386         o_conv.is_owned = false;
65387         int64_t ret_conv = NodeFeatures_hash(&o_conv);
65388         return ret_conv;
65389 }
65390
65391 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1hash(JNIEnv *env, jclass clz, int64_t o) {
65392         LDKChannelFeatures o_conv;
65393         o_conv.inner = untag_ptr(o);
65394         o_conv.is_owned = ptr_is_owned(o);
65395         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
65396         o_conv.is_owned = false;
65397         int64_t ret_conv = ChannelFeatures_hash(&o_conv);
65398         return ret_conv;
65399 }
65400
65401 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1hash(JNIEnv *env, jclass clz, int64_t o) {
65402         LDKBolt11InvoiceFeatures o_conv;
65403         o_conv.inner = untag_ptr(o);
65404         o_conv.is_owned = ptr_is_owned(o);
65405         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
65406         o_conv.is_owned = false;
65407         int64_t ret_conv = Bolt11InvoiceFeatures_hash(&o_conv);
65408         return ret_conv;
65409 }
65410
65411 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OfferFeatures_1hash(JNIEnv *env, jclass clz, int64_t o) {
65412         LDKOfferFeatures o_conv;
65413         o_conv.inner = untag_ptr(o);
65414         o_conv.is_owned = ptr_is_owned(o);
65415         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
65416         o_conv.is_owned = false;
65417         int64_t ret_conv = OfferFeatures_hash(&o_conv);
65418         return ret_conv;
65419 }
65420
65421 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceRequestFeatures_1hash(JNIEnv *env, jclass clz, int64_t o) {
65422         LDKInvoiceRequestFeatures o_conv;
65423         o_conv.inner = untag_ptr(o);
65424         o_conv.is_owned = ptr_is_owned(o);
65425         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
65426         o_conv.is_owned = false;
65427         int64_t ret_conv = InvoiceRequestFeatures_hash(&o_conv);
65428         return ret_conv;
65429 }
65430
65431 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12InvoiceFeatures_1hash(JNIEnv *env, jclass clz, int64_t o) {
65432         LDKBolt12InvoiceFeatures o_conv;
65433         o_conv.inner = untag_ptr(o);
65434         o_conv.is_owned = ptr_is_owned(o);
65435         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
65436         o_conv.is_owned = false;
65437         int64_t ret_conv = Bolt12InvoiceFeatures_hash(&o_conv);
65438         return ret_conv;
65439 }
65440
65441 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedHopFeatures_1hash(JNIEnv *env, jclass clz, int64_t o) {
65442         LDKBlindedHopFeatures o_conv;
65443         o_conv.inner = untag_ptr(o);
65444         o_conv.is_owned = ptr_is_owned(o);
65445         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
65446         o_conv.is_owned = false;
65447         int64_t ret_conv = BlindedHopFeatures_hash(&o_conv);
65448         return ret_conv;
65449 }
65450
65451 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1hash(JNIEnv *env, jclass clz, int64_t o) {
65452         LDKChannelTypeFeatures o_conv;
65453         o_conv.inner = untag_ptr(o);
65454         o_conv.is_owned = ptr_is_owned(o);
65455         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
65456         o_conv.is_owned = false;
65457         int64_t ret_conv = ChannelTypeFeatures_hash(&o_conv);
65458         return ret_conv;
65459 }
65460
65461 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
65462         LDKInitFeatures this_obj_conv;
65463         this_obj_conv.inner = untag_ptr(this_obj);
65464         this_obj_conv.is_owned = ptr_is_owned(this_obj);
65465         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
65466         InitFeatures_free(this_obj_conv);
65467 }
65468
65469 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
65470         LDKNodeFeatures this_obj_conv;
65471         this_obj_conv.inner = untag_ptr(this_obj);
65472         this_obj_conv.is_owned = ptr_is_owned(this_obj);
65473         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
65474         NodeFeatures_free(this_obj_conv);
65475 }
65476
65477 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
65478         LDKChannelFeatures this_obj_conv;
65479         this_obj_conv.inner = untag_ptr(this_obj);
65480         this_obj_conv.is_owned = ptr_is_owned(this_obj);
65481         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
65482         ChannelFeatures_free(this_obj_conv);
65483 }
65484
65485 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
65486         LDKBolt11InvoiceFeatures this_obj_conv;
65487         this_obj_conv.inner = untag_ptr(this_obj);
65488         this_obj_conv.is_owned = ptr_is_owned(this_obj);
65489         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
65490         Bolt11InvoiceFeatures_free(this_obj_conv);
65491 }
65492
65493 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OfferFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
65494         LDKOfferFeatures this_obj_conv;
65495         this_obj_conv.inner = untag_ptr(this_obj);
65496         this_obj_conv.is_owned = ptr_is_owned(this_obj);
65497         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
65498         OfferFeatures_free(this_obj_conv);
65499 }
65500
65501 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoiceRequestFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
65502         LDKInvoiceRequestFeatures this_obj_conv;
65503         this_obj_conv.inner = untag_ptr(this_obj);
65504         this_obj_conv.is_owned = ptr_is_owned(this_obj);
65505         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
65506         InvoiceRequestFeatures_free(this_obj_conv);
65507 }
65508
65509 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Bolt12InvoiceFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
65510         LDKBolt12InvoiceFeatures this_obj_conv;
65511         this_obj_conv.inner = untag_ptr(this_obj);
65512         this_obj_conv.is_owned = ptr_is_owned(this_obj);
65513         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
65514         Bolt12InvoiceFeatures_free(this_obj_conv);
65515 }
65516
65517 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BlindedHopFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
65518         LDKBlindedHopFeatures this_obj_conv;
65519         this_obj_conv.inner = untag_ptr(this_obj);
65520         this_obj_conv.is_owned = ptr_is_owned(this_obj);
65521         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
65522         BlindedHopFeatures_free(this_obj_conv);
65523 }
65524
65525 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
65526         LDKChannelTypeFeatures this_obj_conv;
65527         this_obj_conv.inner = untag_ptr(this_obj);
65528         this_obj_conv.is_owned = ptr_is_owned(this_obj);
65529         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
65530         ChannelTypeFeatures_free(this_obj_conv);
65531 }
65532
65533 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InitFeatures_1empty(JNIEnv *env, jclass clz) {
65534         LDKInitFeatures ret_var = InitFeatures_empty();
65535         int64_t ret_ref = 0;
65536         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65537         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65538         return ret_ref;
65539 }
65540
65541 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1unknown_1bits_1from(JNIEnv *env, jclass clz, int64_t this_arg, int64_t other) {
65542         LDKInitFeatures this_arg_conv;
65543         this_arg_conv.inner = untag_ptr(this_arg);
65544         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65545         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65546         this_arg_conv.is_owned = false;
65547         LDKInitFeatures other_conv;
65548         other_conv.inner = untag_ptr(other);
65549         other_conv.is_owned = ptr_is_owned(other);
65550         CHECK_INNER_FIELD_ACCESS_OR_NULL(other_conv);
65551         other_conv.is_owned = false;
65552         jboolean ret_conv = InitFeatures_requires_unknown_bits_from(&this_arg_conv, &other_conv);
65553         return ret_conv;
65554 }
65555
65556 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1unknown_1bits(JNIEnv *env, jclass clz, int64_t this_arg) {
65557         LDKInitFeatures this_arg_conv;
65558         this_arg_conv.inner = untag_ptr(this_arg);
65559         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65560         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65561         this_arg_conv.is_owned = false;
65562         jboolean ret_conv = InitFeatures_requires_unknown_bits(&this_arg_conv);
65563         return ret_conv;
65564 }
65565
65566 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) {
65567         LDKInitFeatures this_arg_conv;
65568         this_arg_conv.inner = untag_ptr(this_arg);
65569         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65570         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65571         this_arg_conv.is_owned = false;
65572         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
65573         *ret_conv = InitFeatures_set_required_feature_bit(&this_arg_conv, bit);
65574         return tag_ptr(ret_conv, true);
65575 }
65576
65577 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) {
65578         LDKInitFeatures this_arg_conv;
65579         this_arg_conv.inner = untag_ptr(this_arg);
65580         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65581         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65582         this_arg_conv.is_owned = false;
65583         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
65584         *ret_conv = InitFeatures_set_optional_feature_bit(&this_arg_conv, bit);
65585         return tag_ptr(ret_conv, true);
65586 }
65587
65588 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) {
65589         LDKInitFeatures this_arg_conv;
65590         this_arg_conv.inner = untag_ptr(this_arg);
65591         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65592         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65593         this_arg_conv.is_owned = false;
65594         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
65595         *ret_conv = InitFeatures_set_required_custom_bit(&this_arg_conv, bit);
65596         return tag_ptr(ret_conv, true);
65597 }
65598
65599 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) {
65600         LDKInitFeatures this_arg_conv;
65601         this_arg_conv.inner = untag_ptr(this_arg);
65602         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65603         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65604         this_arg_conv.is_owned = false;
65605         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
65606         *ret_conv = InitFeatures_set_optional_custom_bit(&this_arg_conv, bit);
65607         return tag_ptr(ret_conv, true);
65608 }
65609
65610 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1empty(JNIEnv *env, jclass clz) {
65611         LDKNodeFeatures ret_var = NodeFeatures_empty();
65612         int64_t ret_ref = 0;
65613         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65614         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65615         return ret_ref;
65616 }
65617
65618 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1unknown_1bits_1from(JNIEnv *env, jclass clz, int64_t this_arg, int64_t other) {
65619         LDKNodeFeatures this_arg_conv;
65620         this_arg_conv.inner = untag_ptr(this_arg);
65621         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65622         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65623         this_arg_conv.is_owned = false;
65624         LDKNodeFeatures other_conv;
65625         other_conv.inner = untag_ptr(other);
65626         other_conv.is_owned = ptr_is_owned(other);
65627         CHECK_INNER_FIELD_ACCESS_OR_NULL(other_conv);
65628         other_conv.is_owned = false;
65629         jboolean ret_conv = NodeFeatures_requires_unknown_bits_from(&this_arg_conv, &other_conv);
65630         return ret_conv;
65631 }
65632
65633 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1unknown_1bits(JNIEnv *env, jclass clz, int64_t this_arg) {
65634         LDKNodeFeatures this_arg_conv;
65635         this_arg_conv.inner = untag_ptr(this_arg);
65636         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65637         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65638         this_arg_conv.is_owned = false;
65639         jboolean ret_conv = NodeFeatures_requires_unknown_bits(&this_arg_conv);
65640         return ret_conv;
65641 }
65642
65643 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) {
65644         LDKNodeFeatures this_arg_conv;
65645         this_arg_conv.inner = untag_ptr(this_arg);
65646         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65647         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65648         this_arg_conv.is_owned = false;
65649         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
65650         *ret_conv = NodeFeatures_set_required_feature_bit(&this_arg_conv, bit);
65651         return tag_ptr(ret_conv, true);
65652 }
65653
65654 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) {
65655         LDKNodeFeatures this_arg_conv;
65656         this_arg_conv.inner = untag_ptr(this_arg);
65657         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65658         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65659         this_arg_conv.is_owned = false;
65660         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
65661         *ret_conv = NodeFeatures_set_optional_feature_bit(&this_arg_conv, bit);
65662         return tag_ptr(ret_conv, true);
65663 }
65664
65665 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) {
65666         LDKNodeFeatures this_arg_conv;
65667         this_arg_conv.inner = untag_ptr(this_arg);
65668         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65669         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65670         this_arg_conv.is_owned = false;
65671         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
65672         *ret_conv = NodeFeatures_set_required_custom_bit(&this_arg_conv, bit);
65673         return tag_ptr(ret_conv, true);
65674 }
65675
65676 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) {
65677         LDKNodeFeatures this_arg_conv;
65678         this_arg_conv.inner = untag_ptr(this_arg);
65679         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65680         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65681         this_arg_conv.is_owned = false;
65682         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
65683         *ret_conv = NodeFeatures_set_optional_custom_bit(&this_arg_conv, bit);
65684         return tag_ptr(ret_conv, true);
65685 }
65686
65687 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1empty(JNIEnv *env, jclass clz) {
65688         LDKChannelFeatures ret_var = ChannelFeatures_empty();
65689         int64_t ret_ref = 0;
65690         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65691         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65692         return ret_ref;
65693 }
65694
65695 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1requires_1unknown_1bits_1from(JNIEnv *env, jclass clz, int64_t this_arg, int64_t other) {
65696         LDKChannelFeatures this_arg_conv;
65697         this_arg_conv.inner = untag_ptr(this_arg);
65698         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65699         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65700         this_arg_conv.is_owned = false;
65701         LDKChannelFeatures other_conv;
65702         other_conv.inner = untag_ptr(other);
65703         other_conv.is_owned = ptr_is_owned(other);
65704         CHECK_INNER_FIELD_ACCESS_OR_NULL(other_conv);
65705         other_conv.is_owned = false;
65706         jboolean ret_conv = ChannelFeatures_requires_unknown_bits_from(&this_arg_conv, &other_conv);
65707         return ret_conv;
65708 }
65709
65710 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1requires_1unknown_1bits(JNIEnv *env, jclass clz, int64_t this_arg) {
65711         LDKChannelFeatures this_arg_conv;
65712         this_arg_conv.inner = untag_ptr(this_arg);
65713         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65714         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65715         this_arg_conv.is_owned = false;
65716         jboolean ret_conv = ChannelFeatures_requires_unknown_bits(&this_arg_conv);
65717         return ret_conv;
65718 }
65719
65720 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) {
65721         LDKChannelFeatures this_arg_conv;
65722         this_arg_conv.inner = untag_ptr(this_arg);
65723         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65724         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65725         this_arg_conv.is_owned = false;
65726         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
65727         *ret_conv = ChannelFeatures_set_required_feature_bit(&this_arg_conv, bit);
65728         return tag_ptr(ret_conv, true);
65729 }
65730
65731 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) {
65732         LDKChannelFeatures this_arg_conv;
65733         this_arg_conv.inner = untag_ptr(this_arg);
65734         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65735         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65736         this_arg_conv.is_owned = false;
65737         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
65738         *ret_conv = ChannelFeatures_set_optional_feature_bit(&this_arg_conv, bit);
65739         return tag_ptr(ret_conv, true);
65740 }
65741
65742 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) {
65743         LDKChannelFeatures this_arg_conv;
65744         this_arg_conv.inner = untag_ptr(this_arg);
65745         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65746         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65747         this_arg_conv.is_owned = false;
65748         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
65749         *ret_conv = ChannelFeatures_set_required_custom_bit(&this_arg_conv, bit);
65750         return tag_ptr(ret_conv, true);
65751 }
65752
65753 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) {
65754         LDKChannelFeatures this_arg_conv;
65755         this_arg_conv.inner = untag_ptr(this_arg);
65756         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65757         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65758         this_arg_conv.is_owned = false;
65759         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
65760         *ret_conv = ChannelFeatures_set_optional_custom_bit(&this_arg_conv, bit);
65761         return tag_ptr(ret_conv, true);
65762 }
65763
65764 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1empty(JNIEnv *env, jclass clz) {
65765         LDKBolt11InvoiceFeatures ret_var = Bolt11InvoiceFeatures_empty();
65766         int64_t ret_ref = 0;
65767         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65768         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65769         return ret_ref;
65770 }
65771
65772 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1requires_1unknown_1bits_1from(JNIEnv *env, jclass clz, int64_t this_arg, int64_t other) {
65773         LDKBolt11InvoiceFeatures this_arg_conv;
65774         this_arg_conv.inner = untag_ptr(this_arg);
65775         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65776         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65777         this_arg_conv.is_owned = false;
65778         LDKBolt11InvoiceFeatures other_conv;
65779         other_conv.inner = untag_ptr(other);
65780         other_conv.is_owned = ptr_is_owned(other);
65781         CHECK_INNER_FIELD_ACCESS_OR_NULL(other_conv);
65782         other_conv.is_owned = false;
65783         jboolean ret_conv = Bolt11InvoiceFeatures_requires_unknown_bits_from(&this_arg_conv, &other_conv);
65784         return ret_conv;
65785 }
65786
65787 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1requires_1unknown_1bits(JNIEnv *env, jclass clz, int64_t this_arg) {
65788         LDKBolt11InvoiceFeatures this_arg_conv;
65789         this_arg_conv.inner = untag_ptr(this_arg);
65790         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65791         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65792         this_arg_conv.is_owned = false;
65793         jboolean ret_conv = Bolt11InvoiceFeatures_requires_unknown_bits(&this_arg_conv);
65794         return ret_conv;
65795 }
65796
65797 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) {
65798         LDKBolt11InvoiceFeatures this_arg_conv;
65799         this_arg_conv.inner = untag_ptr(this_arg);
65800         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65801         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65802         this_arg_conv.is_owned = false;
65803         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
65804         *ret_conv = Bolt11InvoiceFeatures_set_required_feature_bit(&this_arg_conv, bit);
65805         return tag_ptr(ret_conv, true);
65806 }
65807
65808 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) {
65809         LDKBolt11InvoiceFeatures this_arg_conv;
65810         this_arg_conv.inner = untag_ptr(this_arg);
65811         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65812         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65813         this_arg_conv.is_owned = false;
65814         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
65815         *ret_conv = Bolt11InvoiceFeatures_set_optional_feature_bit(&this_arg_conv, bit);
65816         return tag_ptr(ret_conv, true);
65817 }
65818
65819 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) {
65820         LDKBolt11InvoiceFeatures this_arg_conv;
65821         this_arg_conv.inner = untag_ptr(this_arg);
65822         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65823         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65824         this_arg_conv.is_owned = false;
65825         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
65826         *ret_conv = Bolt11InvoiceFeatures_set_required_custom_bit(&this_arg_conv, bit);
65827         return tag_ptr(ret_conv, true);
65828 }
65829
65830 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) {
65831         LDKBolt11InvoiceFeatures this_arg_conv;
65832         this_arg_conv.inner = untag_ptr(this_arg);
65833         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65834         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65835         this_arg_conv.is_owned = false;
65836         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
65837         *ret_conv = Bolt11InvoiceFeatures_set_optional_custom_bit(&this_arg_conv, bit);
65838         return tag_ptr(ret_conv, true);
65839 }
65840
65841 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OfferFeatures_1empty(JNIEnv *env, jclass clz) {
65842         LDKOfferFeatures ret_var = OfferFeatures_empty();
65843         int64_t ret_ref = 0;
65844         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65845         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65846         return ret_ref;
65847 }
65848
65849 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_OfferFeatures_1requires_1unknown_1bits_1from(JNIEnv *env, jclass clz, int64_t this_arg, int64_t other) {
65850         LDKOfferFeatures this_arg_conv;
65851         this_arg_conv.inner = untag_ptr(this_arg);
65852         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65853         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65854         this_arg_conv.is_owned = false;
65855         LDKOfferFeatures other_conv;
65856         other_conv.inner = untag_ptr(other);
65857         other_conv.is_owned = ptr_is_owned(other);
65858         CHECK_INNER_FIELD_ACCESS_OR_NULL(other_conv);
65859         other_conv.is_owned = false;
65860         jboolean ret_conv = OfferFeatures_requires_unknown_bits_from(&this_arg_conv, &other_conv);
65861         return ret_conv;
65862 }
65863
65864 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_OfferFeatures_1requires_1unknown_1bits(JNIEnv *env, jclass clz, int64_t this_arg) {
65865         LDKOfferFeatures this_arg_conv;
65866         this_arg_conv.inner = untag_ptr(this_arg);
65867         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65868         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65869         this_arg_conv.is_owned = false;
65870         jboolean ret_conv = OfferFeatures_requires_unknown_bits(&this_arg_conv);
65871         return ret_conv;
65872 }
65873
65874 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) {
65875         LDKOfferFeatures this_arg_conv;
65876         this_arg_conv.inner = untag_ptr(this_arg);
65877         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65878         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65879         this_arg_conv.is_owned = false;
65880         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
65881         *ret_conv = OfferFeatures_set_required_feature_bit(&this_arg_conv, bit);
65882         return tag_ptr(ret_conv, true);
65883 }
65884
65885 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) {
65886         LDKOfferFeatures this_arg_conv;
65887         this_arg_conv.inner = untag_ptr(this_arg);
65888         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65889         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65890         this_arg_conv.is_owned = false;
65891         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
65892         *ret_conv = OfferFeatures_set_optional_feature_bit(&this_arg_conv, bit);
65893         return tag_ptr(ret_conv, true);
65894 }
65895
65896 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) {
65897         LDKOfferFeatures this_arg_conv;
65898         this_arg_conv.inner = untag_ptr(this_arg);
65899         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65900         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65901         this_arg_conv.is_owned = false;
65902         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
65903         *ret_conv = OfferFeatures_set_required_custom_bit(&this_arg_conv, bit);
65904         return tag_ptr(ret_conv, true);
65905 }
65906
65907 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) {
65908         LDKOfferFeatures this_arg_conv;
65909         this_arg_conv.inner = untag_ptr(this_arg);
65910         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65911         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65912         this_arg_conv.is_owned = false;
65913         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
65914         *ret_conv = OfferFeatures_set_optional_custom_bit(&this_arg_conv, bit);
65915         return tag_ptr(ret_conv, true);
65916 }
65917
65918 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceRequestFeatures_1empty(JNIEnv *env, jclass clz) {
65919         LDKInvoiceRequestFeatures ret_var = InvoiceRequestFeatures_empty();
65920         int64_t ret_ref = 0;
65921         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65922         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
65923         return ret_ref;
65924 }
65925
65926 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InvoiceRequestFeatures_1requires_1unknown_1bits_1from(JNIEnv *env, jclass clz, int64_t this_arg, int64_t other) {
65927         LDKInvoiceRequestFeatures this_arg_conv;
65928         this_arg_conv.inner = untag_ptr(this_arg);
65929         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65930         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65931         this_arg_conv.is_owned = false;
65932         LDKInvoiceRequestFeatures other_conv;
65933         other_conv.inner = untag_ptr(other);
65934         other_conv.is_owned = ptr_is_owned(other);
65935         CHECK_INNER_FIELD_ACCESS_OR_NULL(other_conv);
65936         other_conv.is_owned = false;
65937         jboolean ret_conv = InvoiceRequestFeatures_requires_unknown_bits_from(&this_arg_conv, &other_conv);
65938         return ret_conv;
65939 }
65940
65941 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InvoiceRequestFeatures_1requires_1unknown_1bits(JNIEnv *env, jclass clz, int64_t this_arg) {
65942         LDKInvoiceRequestFeatures this_arg_conv;
65943         this_arg_conv.inner = untag_ptr(this_arg);
65944         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65945         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65946         this_arg_conv.is_owned = false;
65947         jboolean ret_conv = InvoiceRequestFeatures_requires_unknown_bits(&this_arg_conv);
65948         return ret_conv;
65949 }
65950
65951 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) {
65952         LDKInvoiceRequestFeatures this_arg_conv;
65953         this_arg_conv.inner = untag_ptr(this_arg);
65954         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65955         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65956         this_arg_conv.is_owned = false;
65957         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
65958         *ret_conv = InvoiceRequestFeatures_set_required_feature_bit(&this_arg_conv, bit);
65959         return tag_ptr(ret_conv, true);
65960 }
65961
65962 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) {
65963         LDKInvoiceRequestFeatures this_arg_conv;
65964         this_arg_conv.inner = untag_ptr(this_arg);
65965         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65966         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65967         this_arg_conv.is_owned = false;
65968         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
65969         *ret_conv = InvoiceRequestFeatures_set_optional_feature_bit(&this_arg_conv, bit);
65970         return tag_ptr(ret_conv, true);
65971 }
65972
65973 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) {
65974         LDKInvoiceRequestFeatures this_arg_conv;
65975         this_arg_conv.inner = untag_ptr(this_arg);
65976         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65977         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65978         this_arg_conv.is_owned = false;
65979         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
65980         *ret_conv = InvoiceRequestFeatures_set_required_custom_bit(&this_arg_conv, bit);
65981         return tag_ptr(ret_conv, true);
65982 }
65983
65984 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) {
65985         LDKInvoiceRequestFeatures this_arg_conv;
65986         this_arg_conv.inner = untag_ptr(this_arg);
65987         this_arg_conv.is_owned = ptr_is_owned(this_arg);
65988         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
65989         this_arg_conv.is_owned = false;
65990         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
65991         *ret_conv = InvoiceRequestFeatures_set_optional_custom_bit(&this_arg_conv, bit);
65992         return tag_ptr(ret_conv, true);
65993 }
65994
65995 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12InvoiceFeatures_1empty(JNIEnv *env, jclass clz) {
65996         LDKBolt12InvoiceFeatures ret_var = Bolt12InvoiceFeatures_empty();
65997         int64_t ret_ref = 0;
65998         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
65999         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66000         return ret_ref;
66001 }
66002
66003 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt12InvoiceFeatures_1requires_1unknown_1bits_1from(JNIEnv *env, jclass clz, int64_t this_arg, int64_t other) {
66004         LDKBolt12InvoiceFeatures this_arg_conv;
66005         this_arg_conv.inner = untag_ptr(this_arg);
66006         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66007         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66008         this_arg_conv.is_owned = false;
66009         LDKBolt12InvoiceFeatures other_conv;
66010         other_conv.inner = untag_ptr(other);
66011         other_conv.is_owned = ptr_is_owned(other);
66012         CHECK_INNER_FIELD_ACCESS_OR_NULL(other_conv);
66013         other_conv.is_owned = false;
66014         jboolean ret_conv = Bolt12InvoiceFeatures_requires_unknown_bits_from(&this_arg_conv, &other_conv);
66015         return ret_conv;
66016 }
66017
66018 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt12InvoiceFeatures_1requires_1unknown_1bits(JNIEnv *env, jclass clz, int64_t this_arg) {
66019         LDKBolt12InvoiceFeatures this_arg_conv;
66020         this_arg_conv.inner = untag_ptr(this_arg);
66021         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66022         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66023         this_arg_conv.is_owned = false;
66024         jboolean ret_conv = Bolt12InvoiceFeatures_requires_unknown_bits(&this_arg_conv);
66025         return ret_conv;
66026 }
66027
66028 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) {
66029         LDKBolt12InvoiceFeatures this_arg_conv;
66030         this_arg_conv.inner = untag_ptr(this_arg);
66031         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66032         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66033         this_arg_conv.is_owned = false;
66034         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
66035         *ret_conv = Bolt12InvoiceFeatures_set_required_feature_bit(&this_arg_conv, bit);
66036         return tag_ptr(ret_conv, true);
66037 }
66038
66039 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) {
66040         LDKBolt12InvoiceFeatures this_arg_conv;
66041         this_arg_conv.inner = untag_ptr(this_arg);
66042         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66043         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66044         this_arg_conv.is_owned = false;
66045         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
66046         *ret_conv = Bolt12InvoiceFeatures_set_optional_feature_bit(&this_arg_conv, bit);
66047         return tag_ptr(ret_conv, true);
66048 }
66049
66050 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) {
66051         LDKBolt12InvoiceFeatures this_arg_conv;
66052         this_arg_conv.inner = untag_ptr(this_arg);
66053         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66054         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66055         this_arg_conv.is_owned = false;
66056         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
66057         *ret_conv = Bolt12InvoiceFeatures_set_required_custom_bit(&this_arg_conv, bit);
66058         return tag_ptr(ret_conv, true);
66059 }
66060
66061 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) {
66062         LDKBolt12InvoiceFeatures this_arg_conv;
66063         this_arg_conv.inner = untag_ptr(this_arg);
66064         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66065         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66066         this_arg_conv.is_owned = false;
66067         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
66068         *ret_conv = Bolt12InvoiceFeatures_set_optional_custom_bit(&this_arg_conv, bit);
66069         return tag_ptr(ret_conv, true);
66070 }
66071
66072 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedHopFeatures_1empty(JNIEnv *env, jclass clz) {
66073         LDKBlindedHopFeatures ret_var = BlindedHopFeatures_empty();
66074         int64_t ret_ref = 0;
66075         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66076         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66077         return ret_ref;
66078 }
66079
66080 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_BlindedHopFeatures_1requires_1unknown_1bits_1from(JNIEnv *env, jclass clz, int64_t this_arg, int64_t other) {
66081         LDKBlindedHopFeatures this_arg_conv;
66082         this_arg_conv.inner = untag_ptr(this_arg);
66083         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66084         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66085         this_arg_conv.is_owned = false;
66086         LDKBlindedHopFeatures other_conv;
66087         other_conv.inner = untag_ptr(other);
66088         other_conv.is_owned = ptr_is_owned(other);
66089         CHECK_INNER_FIELD_ACCESS_OR_NULL(other_conv);
66090         other_conv.is_owned = false;
66091         jboolean ret_conv = BlindedHopFeatures_requires_unknown_bits_from(&this_arg_conv, &other_conv);
66092         return ret_conv;
66093 }
66094
66095 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_BlindedHopFeatures_1requires_1unknown_1bits(JNIEnv *env, jclass clz, int64_t this_arg) {
66096         LDKBlindedHopFeatures this_arg_conv;
66097         this_arg_conv.inner = untag_ptr(this_arg);
66098         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66099         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66100         this_arg_conv.is_owned = false;
66101         jboolean ret_conv = BlindedHopFeatures_requires_unknown_bits(&this_arg_conv);
66102         return ret_conv;
66103 }
66104
66105 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) {
66106         LDKBlindedHopFeatures 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         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
66112         *ret_conv = BlindedHopFeatures_set_required_feature_bit(&this_arg_conv, bit);
66113         return tag_ptr(ret_conv, true);
66114 }
66115
66116 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) {
66117         LDKBlindedHopFeatures this_arg_conv;
66118         this_arg_conv.inner = untag_ptr(this_arg);
66119         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66120         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66121         this_arg_conv.is_owned = false;
66122         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
66123         *ret_conv = BlindedHopFeatures_set_optional_feature_bit(&this_arg_conv, bit);
66124         return tag_ptr(ret_conv, true);
66125 }
66126
66127 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) {
66128         LDKBlindedHopFeatures this_arg_conv;
66129         this_arg_conv.inner = untag_ptr(this_arg);
66130         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66131         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66132         this_arg_conv.is_owned = false;
66133         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
66134         *ret_conv = BlindedHopFeatures_set_required_custom_bit(&this_arg_conv, bit);
66135         return tag_ptr(ret_conv, true);
66136 }
66137
66138 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) {
66139         LDKBlindedHopFeatures this_arg_conv;
66140         this_arg_conv.inner = untag_ptr(this_arg);
66141         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66142         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66143         this_arg_conv.is_owned = false;
66144         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
66145         *ret_conv = BlindedHopFeatures_set_optional_custom_bit(&this_arg_conv, bit);
66146         return tag_ptr(ret_conv, true);
66147 }
66148
66149 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1empty(JNIEnv *env, jclass clz) {
66150         LDKChannelTypeFeatures ret_var = ChannelTypeFeatures_empty();
66151         int64_t ret_ref = 0;
66152         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
66153         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
66154         return ret_ref;
66155 }
66156
66157 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1requires_1unknown_1bits_1from(JNIEnv *env, jclass clz, int64_t this_arg, int64_t other) {
66158         LDKChannelTypeFeatures this_arg_conv;
66159         this_arg_conv.inner = untag_ptr(this_arg);
66160         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66161         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66162         this_arg_conv.is_owned = false;
66163         LDKChannelTypeFeatures other_conv;
66164         other_conv.inner = untag_ptr(other);
66165         other_conv.is_owned = ptr_is_owned(other);
66166         CHECK_INNER_FIELD_ACCESS_OR_NULL(other_conv);
66167         other_conv.is_owned = false;
66168         jboolean ret_conv = ChannelTypeFeatures_requires_unknown_bits_from(&this_arg_conv, &other_conv);
66169         return ret_conv;
66170 }
66171
66172 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1requires_1unknown_1bits(JNIEnv *env, jclass clz, int64_t this_arg) {
66173         LDKChannelTypeFeatures this_arg_conv;
66174         this_arg_conv.inner = untag_ptr(this_arg);
66175         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66176         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66177         this_arg_conv.is_owned = false;
66178         jboolean ret_conv = ChannelTypeFeatures_requires_unknown_bits(&this_arg_conv);
66179         return ret_conv;
66180 }
66181
66182 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) {
66183         LDKChannelTypeFeatures this_arg_conv;
66184         this_arg_conv.inner = untag_ptr(this_arg);
66185         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66186         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66187         this_arg_conv.is_owned = false;
66188         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
66189         *ret_conv = ChannelTypeFeatures_set_required_feature_bit(&this_arg_conv, bit);
66190         return tag_ptr(ret_conv, true);
66191 }
66192
66193 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) {
66194         LDKChannelTypeFeatures this_arg_conv;
66195         this_arg_conv.inner = untag_ptr(this_arg);
66196         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66197         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66198         this_arg_conv.is_owned = false;
66199         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
66200         *ret_conv = ChannelTypeFeatures_set_optional_feature_bit(&this_arg_conv, bit);
66201         return tag_ptr(ret_conv, true);
66202 }
66203
66204 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) {
66205         LDKChannelTypeFeatures 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         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
66211         *ret_conv = ChannelTypeFeatures_set_required_custom_bit(&this_arg_conv, bit);
66212         return tag_ptr(ret_conv, true);
66213 }
66214
66215 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) {
66216         LDKChannelTypeFeatures 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         LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
66222         *ret_conv = ChannelTypeFeatures_set_optional_custom_bit(&this_arg_conv, bit);
66223         return tag_ptr(ret_conv, true);
66224 }
66225
66226 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InitFeatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
66227         LDKInitFeatures obj_conv;
66228         obj_conv.inner = untag_ptr(obj);
66229         obj_conv.is_owned = ptr_is_owned(obj);
66230         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
66231         obj_conv.is_owned = false;
66232         LDKCVec_u8Z ret_var = InitFeatures_write(&obj_conv);
66233         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
66234         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
66235         CVec_u8Z_free(ret_var);
66236         return ret_arr;
66237 }
66238
66239 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InitFeatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
66240         LDKu8slice ser_ref;
66241         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
66242         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
66243         LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
66244         *ret_conv = InitFeatures_read(ser_ref);
66245         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
66246         return tag_ptr(ret_conv, true);
66247 }
66248
66249 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
66250         LDKChannelFeatures obj_conv;
66251         obj_conv.inner = untag_ptr(obj);
66252         obj_conv.is_owned = ptr_is_owned(obj);
66253         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
66254         obj_conv.is_owned = false;
66255         LDKCVec_u8Z ret_var = ChannelFeatures_write(&obj_conv);
66256         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
66257         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
66258         CVec_u8Z_free(ret_var);
66259         return ret_arr;
66260 }
66261
66262 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
66263         LDKu8slice ser_ref;
66264         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
66265         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
66266         LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
66267         *ret_conv = ChannelFeatures_read(ser_ref);
66268         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
66269         return tag_ptr(ret_conv, true);
66270 }
66271
66272 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
66273         LDKNodeFeatures obj_conv;
66274         obj_conv.inner = untag_ptr(obj);
66275         obj_conv.is_owned = ptr_is_owned(obj);
66276         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
66277         obj_conv.is_owned = false;
66278         LDKCVec_u8Z ret_var = NodeFeatures_write(&obj_conv);
66279         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
66280         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
66281         CVec_u8Z_free(ret_var);
66282         return ret_arr;
66283 }
66284
66285 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
66286         LDKu8slice ser_ref;
66287         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
66288         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
66289         LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
66290         *ret_conv = NodeFeatures_read(ser_ref);
66291         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
66292         return tag_ptr(ret_conv, true);
66293 }
66294
66295 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
66296         LDKBolt11InvoiceFeatures obj_conv;
66297         obj_conv.inner = untag_ptr(obj);
66298         obj_conv.is_owned = ptr_is_owned(obj);
66299         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
66300         obj_conv.is_owned = false;
66301         LDKCVec_u8Z ret_var = Bolt11InvoiceFeatures_write(&obj_conv);
66302         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
66303         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
66304         CVec_u8Z_free(ret_var);
66305         return ret_arr;
66306 }
66307
66308 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
66309         LDKu8slice ser_ref;
66310         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
66311         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
66312         LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ");
66313         *ret_conv = Bolt11InvoiceFeatures_read(ser_ref);
66314         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
66315         return tag_ptr(ret_conv, true);
66316 }
66317
66318 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Bolt12InvoiceFeatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
66319         LDKBolt12InvoiceFeatures obj_conv;
66320         obj_conv.inner = untag_ptr(obj);
66321         obj_conv.is_owned = ptr_is_owned(obj);
66322         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
66323         obj_conv.is_owned = false;
66324         LDKCVec_u8Z ret_var = Bolt12InvoiceFeatures_write(&obj_conv);
66325         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
66326         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
66327         CVec_u8Z_free(ret_var);
66328         return ret_arr;
66329 }
66330
66331 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12InvoiceFeatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
66332         LDKu8slice ser_ref;
66333         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
66334         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
66335         LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ), "LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ");
66336         *ret_conv = Bolt12InvoiceFeatures_read(ser_ref);
66337         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
66338         return tag_ptr(ret_conv, true);
66339 }
66340
66341 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BlindedHopFeatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
66342         LDKBlindedHopFeatures obj_conv;
66343         obj_conv.inner = untag_ptr(obj);
66344         obj_conv.is_owned = ptr_is_owned(obj);
66345         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
66346         obj_conv.is_owned = false;
66347         LDKCVec_u8Z ret_var = BlindedHopFeatures_write(&obj_conv);
66348         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
66349         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
66350         CVec_u8Z_free(ret_var);
66351         return ret_arr;
66352 }
66353
66354 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedHopFeatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
66355         LDKu8slice ser_ref;
66356         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
66357         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
66358         LDKCResult_BlindedHopFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopFeaturesDecodeErrorZ), "LDKCResult_BlindedHopFeaturesDecodeErrorZ");
66359         *ret_conv = BlindedHopFeatures_read(ser_ref);
66360         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
66361         return tag_ptr(ret_conv, true);
66362 }
66363
66364 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
66365         LDKChannelTypeFeatures obj_conv;
66366         obj_conv.inner = untag_ptr(obj);
66367         obj_conv.is_owned = ptr_is_owned(obj);
66368         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
66369         obj_conv.is_owned = false;
66370         LDKCVec_u8Z ret_var = ChannelTypeFeatures_write(&obj_conv);
66371         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
66372         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
66373         CVec_u8Z_free(ret_var);
66374         return ret_arr;
66375 }
66376
66377 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
66378         LDKu8slice ser_ref;
66379         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
66380         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
66381         LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ");
66382         *ret_conv = ChannelTypeFeatures_read(ser_ref);
66383         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
66384         return tag_ptr(ret_conv, true);
66385 }
66386
66387 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1data_1loss_1protect_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
66388         LDKInitFeatures this_arg_conv;
66389         this_arg_conv.inner = untag_ptr(this_arg);
66390         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66391         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66392         this_arg_conv.is_owned = false;
66393         InitFeatures_set_data_loss_protect_optional(&this_arg_conv);
66394 }
66395
66396 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1data_1loss_1protect_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
66397         LDKInitFeatures this_arg_conv;
66398         this_arg_conv.inner = untag_ptr(this_arg);
66399         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66400         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66401         this_arg_conv.is_owned = false;
66402         InitFeatures_set_data_loss_protect_required(&this_arg_conv);
66403 }
66404
66405 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1data_1loss_1protect(JNIEnv *env, jclass clz, int64_t this_arg) {
66406         LDKInitFeatures this_arg_conv;
66407         this_arg_conv.inner = untag_ptr(this_arg);
66408         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66409         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66410         this_arg_conv.is_owned = false;
66411         jboolean ret_conv = InitFeatures_supports_data_loss_protect(&this_arg_conv);
66412         return ret_conv;
66413 }
66414
66415 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1data_1loss_1protect_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
66416         LDKNodeFeatures this_arg_conv;
66417         this_arg_conv.inner = untag_ptr(this_arg);
66418         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66419         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66420         this_arg_conv.is_owned = false;
66421         NodeFeatures_set_data_loss_protect_optional(&this_arg_conv);
66422 }
66423
66424 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1data_1loss_1protect_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
66425         LDKNodeFeatures this_arg_conv;
66426         this_arg_conv.inner = untag_ptr(this_arg);
66427         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66428         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66429         this_arg_conv.is_owned = false;
66430         NodeFeatures_set_data_loss_protect_required(&this_arg_conv);
66431 }
66432
66433 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1data_1loss_1protect(JNIEnv *env, jclass clz, int64_t this_arg) {
66434         LDKNodeFeatures this_arg_conv;
66435         this_arg_conv.inner = untag_ptr(this_arg);
66436         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66437         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66438         this_arg_conv.is_owned = false;
66439         jboolean ret_conv = NodeFeatures_supports_data_loss_protect(&this_arg_conv);
66440         return ret_conv;
66441 }
66442
66443 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1data_1loss_1protect(JNIEnv *env, jclass clz, int64_t this_arg) {
66444         LDKInitFeatures this_arg_conv;
66445         this_arg_conv.inner = untag_ptr(this_arg);
66446         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66447         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66448         this_arg_conv.is_owned = false;
66449         jboolean ret_conv = InitFeatures_requires_data_loss_protect(&this_arg_conv);
66450         return ret_conv;
66451 }
66452
66453 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1data_1loss_1protect(JNIEnv *env, jclass clz, int64_t this_arg) {
66454         LDKNodeFeatures 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         jboolean ret_conv = NodeFeatures_requires_data_loss_protect(&this_arg_conv);
66460         return ret_conv;
66461 }
66462
66463 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1initial_1routing_1sync_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
66464         LDKInitFeatures this_arg_conv;
66465         this_arg_conv.inner = untag_ptr(this_arg);
66466         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66467         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66468         this_arg_conv.is_owned = false;
66469         InitFeatures_set_initial_routing_sync_optional(&this_arg_conv);
66470 }
66471
66472 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1initial_1routing_1sync_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
66473         LDKInitFeatures this_arg_conv;
66474         this_arg_conv.inner = untag_ptr(this_arg);
66475         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66476         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66477         this_arg_conv.is_owned = false;
66478         InitFeatures_set_initial_routing_sync_required(&this_arg_conv);
66479 }
66480
66481 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1initial_1routing_1sync(JNIEnv *env, jclass clz, int64_t this_arg) {
66482         LDKInitFeatures this_arg_conv;
66483         this_arg_conv.inner = untag_ptr(this_arg);
66484         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66485         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66486         this_arg_conv.is_owned = false;
66487         jboolean ret_conv = InitFeatures_initial_routing_sync(&this_arg_conv);
66488         return ret_conv;
66489 }
66490
66491 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1upfront_1shutdown_1script_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
66492         LDKInitFeatures this_arg_conv;
66493         this_arg_conv.inner = untag_ptr(this_arg);
66494         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66495         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66496         this_arg_conv.is_owned = false;
66497         InitFeatures_set_upfront_shutdown_script_optional(&this_arg_conv);
66498 }
66499
66500 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1upfront_1shutdown_1script_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
66501         LDKInitFeatures this_arg_conv;
66502         this_arg_conv.inner = untag_ptr(this_arg);
66503         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66504         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66505         this_arg_conv.is_owned = false;
66506         InitFeatures_set_upfront_shutdown_script_required(&this_arg_conv);
66507 }
66508
66509 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1upfront_1shutdown_1script(JNIEnv *env, jclass clz, int64_t this_arg) {
66510         LDKInitFeatures this_arg_conv;
66511         this_arg_conv.inner = untag_ptr(this_arg);
66512         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66513         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66514         this_arg_conv.is_owned = false;
66515         jboolean ret_conv = InitFeatures_supports_upfront_shutdown_script(&this_arg_conv);
66516         return ret_conv;
66517 }
66518
66519 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1upfront_1shutdown_1script_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
66520         LDKNodeFeatures this_arg_conv;
66521         this_arg_conv.inner = untag_ptr(this_arg);
66522         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66523         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66524         this_arg_conv.is_owned = false;
66525         NodeFeatures_set_upfront_shutdown_script_optional(&this_arg_conv);
66526 }
66527
66528 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1upfront_1shutdown_1script_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
66529         LDKNodeFeatures this_arg_conv;
66530         this_arg_conv.inner = untag_ptr(this_arg);
66531         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66532         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66533         this_arg_conv.is_owned = false;
66534         NodeFeatures_set_upfront_shutdown_script_required(&this_arg_conv);
66535 }
66536
66537 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1upfront_1shutdown_1script(JNIEnv *env, jclass clz, int64_t this_arg) {
66538         LDKNodeFeatures this_arg_conv;
66539         this_arg_conv.inner = untag_ptr(this_arg);
66540         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66541         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66542         this_arg_conv.is_owned = false;
66543         jboolean ret_conv = NodeFeatures_supports_upfront_shutdown_script(&this_arg_conv);
66544         return ret_conv;
66545 }
66546
66547 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1upfront_1shutdown_1script(JNIEnv *env, jclass clz, int64_t this_arg) {
66548         LDKInitFeatures this_arg_conv;
66549         this_arg_conv.inner = untag_ptr(this_arg);
66550         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66551         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66552         this_arg_conv.is_owned = false;
66553         jboolean ret_conv = InitFeatures_requires_upfront_shutdown_script(&this_arg_conv);
66554         return ret_conv;
66555 }
66556
66557 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1upfront_1shutdown_1script(JNIEnv *env, jclass clz, int64_t this_arg) {
66558         LDKNodeFeatures this_arg_conv;
66559         this_arg_conv.inner = untag_ptr(this_arg);
66560         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66561         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66562         this_arg_conv.is_owned = false;
66563         jboolean ret_conv = NodeFeatures_requires_upfront_shutdown_script(&this_arg_conv);
66564         return ret_conv;
66565 }
66566
66567 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1gossip_1queries_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
66568         LDKInitFeatures this_arg_conv;
66569         this_arg_conv.inner = untag_ptr(this_arg);
66570         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66571         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66572         this_arg_conv.is_owned = false;
66573         InitFeatures_set_gossip_queries_optional(&this_arg_conv);
66574 }
66575
66576 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1gossip_1queries_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
66577         LDKInitFeatures this_arg_conv;
66578         this_arg_conv.inner = untag_ptr(this_arg);
66579         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66580         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66581         this_arg_conv.is_owned = false;
66582         InitFeatures_set_gossip_queries_required(&this_arg_conv);
66583 }
66584
66585 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1gossip_1queries(JNIEnv *env, jclass clz, int64_t this_arg) {
66586         LDKInitFeatures this_arg_conv;
66587         this_arg_conv.inner = untag_ptr(this_arg);
66588         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66589         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66590         this_arg_conv.is_owned = false;
66591         jboolean ret_conv = InitFeatures_supports_gossip_queries(&this_arg_conv);
66592         return ret_conv;
66593 }
66594
66595 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1gossip_1queries_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
66596         LDKNodeFeatures this_arg_conv;
66597         this_arg_conv.inner = untag_ptr(this_arg);
66598         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66599         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66600         this_arg_conv.is_owned = false;
66601         NodeFeatures_set_gossip_queries_optional(&this_arg_conv);
66602 }
66603
66604 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1gossip_1queries_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
66605         LDKNodeFeatures this_arg_conv;
66606         this_arg_conv.inner = untag_ptr(this_arg);
66607         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66608         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66609         this_arg_conv.is_owned = false;
66610         NodeFeatures_set_gossip_queries_required(&this_arg_conv);
66611 }
66612
66613 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1gossip_1queries(JNIEnv *env, jclass clz, int64_t this_arg) {
66614         LDKNodeFeatures this_arg_conv;
66615         this_arg_conv.inner = untag_ptr(this_arg);
66616         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66617         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66618         this_arg_conv.is_owned = false;
66619         jboolean ret_conv = NodeFeatures_supports_gossip_queries(&this_arg_conv);
66620         return ret_conv;
66621 }
66622
66623 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1gossip_1queries(JNIEnv *env, jclass clz, int64_t this_arg) {
66624         LDKInitFeatures 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         jboolean ret_conv = InitFeatures_requires_gossip_queries(&this_arg_conv);
66630         return ret_conv;
66631 }
66632
66633 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1gossip_1queries(JNIEnv *env, jclass clz, int64_t this_arg) {
66634         LDKNodeFeatures this_arg_conv;
66635         this_arg_conv.inner = untag_ptr(this_arg);
66636         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66637         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66638         this_arg_conv.is_owned = false;
66639         jboolean ret_conv = NodeFeatures_requires_gossip_queries(&this_arg_conv);
66640         return ret_conv;
66641 }
66642
66643 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1variable_1length_1onion_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
66644         LDKInitFeatures this_arg_conv;
66645         this_arg_conv.inner = untag_ptr(this_arg);
66646         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66647         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66648         this_arg_conv.is_owned = false;
66649         InitFeatures_set_variable_length_onion_optional(&this_arg_conv);
66650 }
66651
66652 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1variable_1length_1onion_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
66653         LDKInitFeatures this_arg_conv;
66654         this_arg_conv.inner = untag_ptr(this_arg);
66655         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66656         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66657         this_arg_conv.is_owned = false;
66658         InitFeatures_set_variable_length_onion_required(&this_arg_conv);
66659 }
66660
66661 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1variable_1length_1onion(JNIEnv *env, jclass clz, int64_t this_arg) {
66662         LDKInitFeatures this_arg_conv;
66663         this_arg_conv.inner = untag_ptr(this_arg);
66664         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66665         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66666         this_arg_conv.is_owned = false;
66667         jboolean ret_conv = InitFeatures_supports_variable_length_onion(&this_arg_conv);
66668         return ret_conv;
66669 }
66670
66671 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1variable_1length_1onion_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
66672         LDKNodeFeatures this_arg_conv;
66673         this_arg_conv.inner = untag_ptr(this_arg);
66674         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66675         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66676         this_arg_conv.is_owned = false;
66677         NodeFeatures_set_variable_length_onion_optional(&this_arg_conv);
66678 }
66679
66680 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1variable_1length_1onion_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
66681         LDKNodeFeatures this_arg_conv;
66682         this_arg_conv.inner = untag_ptr(this_arg);
66683         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66684         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66685         this_arg_conv.is_owned = false;
66686         NodeFeatures_set_variable_length_onion_required(&this_arg_conv);
66687 }
66688
66689 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1variable_1length_1onion(JNIEnv *env, jclass clz, int64_t this_arg) {
66690         LDKNodeFeatures this_arg_conv;
66691         this_arg_conv.inner = untag_ptr(this_arg);
66692         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66693         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66694         this_arg_conv.is_owned = false;
66695         jboolean ret_conv = NodeFeatures_supports_variable_length_onion(&this_arg_conv);
66696         return ret_conv;
66697 }
66698
66699 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1set_1variable_1length_1onion_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
66700         LDKBolt11InvoiceFeatures this_arg_conv;
66701         this_arg_conv.inner = untag_ptr(this_arg);
66702         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66703         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66704         this_arg_conv.is_owned = false;
66705         Bolt11InvoiceFeatures_set_variable_length_onion_optional(&this_arg_conv);
66706 }
66707
66708 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1set_1variable_1length_1onion_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
66709         LDKBolt11InvoiceFeatures this_arg_conv;
66710         this_arg_conv.inner = untag_ptr(this_arg);
66711         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66712         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66713         this_arg_conv.is_owned = false;
66714         Bolt11InvoiceFeatures_set_variable_length_onion_required(&this_arg_conv);
66715 }
66716
66717 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1supports_1variable_1length_1onion(JNIEnv *env, jclass clz, int64_t this_arg) {
66718         LDKBolt11InvoiceFeatures 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         jboolean ret_conv = Bolt11InvoiceFeatures_supports_variable_length_onion(&this_arg_conv);
66724         return ret_conv;
66725 }
66726
66727 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1variable_1length_1onion(JNIEnv *env, jclass clz, int64_t this_arg) {
66728         LDKInitFeatures this_arg_conv;
66729         this_arg_conv.inner = untag_ptr(this_arg);
66730         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66731         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66732         this_arg_conv.is_owned = false;
66733         jboolean ret_conv = InitFeatures_requires_variable_length_onion(&this_arg_conv);
66734         return ret_conv;
66735 }
66736
66737 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1variable_1length_1onion(JNIEnv *env, jclass clz, int64_t this_arg) {
66738         LDKNodeFeatures this_arg_conv;
66739         this_arg_conv.inner = untag_ptr(this_arg);
66740         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66741         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66742         this_arg_conv.is_owned = false;
66743         jboolean ret_conv = NodeFeatures_requires_variable_length_onion(&this_arg_conv);
66744         return ret_conv;
66745 }
66746
66747 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1requires_1variable_1length_1onion(JNIEnv *env, jclass clz, int64_t this_arg) {
66748         LDKBolt11InvoiceFeatures this_arg_conv;
66749         this_arg_conv.inner = untag_ptr(this_arg);
66750         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66751         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66752         this_arg_conv.is_owned = false;
66753         jboolean ret_conv = Bolt11InvoiceFeatures_requires_variable_length_onion(&this_arg_conv);
66754         return ret_conv;
66755 }
66756
66757 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1static_1remote_1key_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
66758         LDKInitFeatures this_arg_conv;
66759         this_arg_conv.inner = untag_ptr(this_arg);
66760         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66761         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66762         this_arg_conv.is_owned = false;
66763         InitFeatures_set_static_remote_key_optional(&this_arg_conv);
66764 }
66765
66766 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1static_1remote_1key_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
66767         LDKInitFeatures this_arg_conv;
66768         this_arg_conv.inner = untag_ptr(this_arg);
66769         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66770         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66771         this_arg_conv.is_owned = false;
66772         InitFeatures_set_static_remote_key_required(&this_arg_conv);
66773 }
66774
66775 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1static_1remote_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
66776         LDKInitFeatures this_arg_conv;
66777         this_arg_conv.inner = untag_ptr(this_arg);
66778         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66779         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66780         this_arg_conv.is_owned = false;
66781         jboolean ret_conv = InitFeatures_supports_static_remote_key(&this_arg_conv);
66782         return ret_conv;
66783 }
66784
66785 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1static_1remote_1key_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
66786         LDKNodeFeatures this_arg_conv;
66787         this_arg_conv.inner = untag_ptr(this_arg);
66788         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66789         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66790         this_arg_conv.is_owned = false;
66791         NodeFeatures_set_static_remote_key_optional(&this_arg_conv);
66792 }
66793
66794 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1static_1remote_1key_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
66795         LDKNodeFeatures this_arg_conv;
66796         this_arg_conv.inner = untag_ptr(this_arg);
66797         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66798         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66799         this_arg_conv.is_owned = false;
66800         NodeFeatures_set_static_remote_key_required(&this_arg_conv);
66801 }
66802
66803 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1static_1remote_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
66804         LDKNodeFeatures this_arg_conv;
66805         this_arg_conv.inner = untag_ptr(this_arg);
66806         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66807         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66808         this_arg_conv.is_owned = false;
66809         jboolean ret_conv = NodeFeatures_supports_static_remote_key(&this_arg_conv);
66810         return ret_conv;
66811 }
66812
66813 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1set_1static_1remote_1key_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
66814         LDKChannelTypeFeatures this_arg_conv;
66815         this_arg_conv.inner = untag_ptr(this_arg);
66816         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66817         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66818         this_arg_conv.is_owned = false;
66819         ChannelTypeFeatures_set_static_remote_key_optional(&this_arg_conv);
66820 }
66821
66822 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1set_1static_1remote_1key_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
66823         LDKChannelTypeFeatures this_arg_conv;
66824         this_arg_conv.inner = untag_ptr(this_arg);
66825         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66826         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66827         this_arg_conv.is_owned = false;
66828         ChannelTypeFeatures_set_static_remote_key_required(&this_arg_conv);
66829 }
66830
66831 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1supports_1static_1remote_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
66832         LDKChannelTypeFeatures this_arg_conv;
66833         this_arg_conv.inner = untag_ptr(this_arg);
66834         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66835         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66836         this_arg_conv.is_owned = false;
66837         jboolean ret_conv = ChannelTypeFeatures_supports_static_remote_key(&this_arg_conv);
66838         return ret_conv;
66839 }
66840
66841 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1static_1remote_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
66842         LDKInitFeatures this_arg_conv;
66843         this_arg_conv.inner = untag_ptr(this_arg);
66844         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66845         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66846         this_arg_conv.is_owned = false;
66847         jboolean ret_conv = InitFeatures_requires_static_remote_key(&this_arg_conv);
66848         return ret_conv;
66849 }
66850
66851 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1static_1remote_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
66852         LDKNodeFeatures this_arg_conv;
66853         this_arg_conv.inner = untag_ptr(this_arg);
66854         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66855         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66856         this_arg_conv.is_owned = false;
66857         jboolean ret_conv = NodeFeatures_requires_static_remote_key(&this_arg_conv);
66858         return ret_conv;
66859 }
66860
66861 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1requires_1static_1remote_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
66862         LDKChannelTypeFeatures this_arg_conv;
66863         this_arg_conv.inner = untag_ptr(this_arg);
66864         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66865         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66866         this_arg_conv.is_owned = false;
66867         jboolean ret_conv = ChannelTypeFeatures_requires_static_remote_key(&this_arg_conv);
66868         return ret_conv;
66869 }
66870
66871 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1payment_1secret_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
66872         LDKInitFeatures this_arg_conv;
66873         this_arg_conv.inner = untag_ptr(this_arg);
66874         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66875         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66876         this_arg_conv.is_owned = false;
66877         InitFeatures_set_payment_secret_optional(&this_arg_conv);
66878 }
66879
66880 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1payment_1secret_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
66881         LDKInitFeatures this_arg_conv;
66882         this_arg_conv.inner = untag_ptr(this_arg);
66883         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66884         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66885         this_arg_conv.is_owned = false;
66886         InitFeatures_set_payment_secret_required(&this_arg_conv);
66887 }
66888
66889 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
66890         LDKInitFeatures this_arg_conv;
66891         this_arg_conv.inner = untag_ptr(this_arg);
66892         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66893         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66894         this_arg_conv.is_owned = false;
66895         jboolean ret_conv = InitFeatures_supports_payment_secret(&this_arg_conv);
66896         return ret_conv;
66897 }
66898
66899 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1payment_1secret_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
66900         LDKNodeFeatures this_arg_conv;
66901         this_arg_conv.inner = untag_ptr(this_arg);
66902         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66903         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66904         this_arg_conv.is_owned = false;
66905         NodeFeatures_set_payment_secret_optional(&this_arg_conv);
66906 }
66907
66908 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1payment_1secret_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
66909         LDKNodeFeatures this_arg_conv;
66910         this_arg_conv.inner = untag_ptr(this_arg);
66911         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66912         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66913         this_arg_conv.is_owned = false;
66914         NodeFeatures_set_payment_secret_required(&this_arg_conv);
66915 }
66916
66917 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
66918         LDKNodeFeatures this_arg_conv;
66919         this_arg_conv.inner = untag_ptr(this_arg);
66920         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66921         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66922         this_arg_conv.is_owned = false;
66923         jboolean ret_conv = NodeFeatures_supports_payment_secret(&this_arg_conv);
66924         return ret_conv;
66925 }
66926
66927 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1set_1payment_1secret_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
66928         LDKBolt11InvoiceFeatures this_arg_conv;
66929         this_arg_conv.inner = untag_ptr(this_arg);
66930         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66931         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66932         this_arg_conv.is_owned = false;
66933         Bolt11InvoiceFeatures_set_payment_secret_optional(&this_arg_conv);
66934 }
66935
66936 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1set_1payment_1secret_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
66937         LDKBolt11InvoiceFeatures this_arg_conv;
66938         this_arg_conv.inner = untag_ptr(this_arg);
66939         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66940         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66941         this_arg_conv.is_owned = false;
66942         Bolt11InvoiceFeatures_set_payment_secret_required(&this_arg_conv);
66943 }
66944
66945 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1supports_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
66946         LDKBolt11InvoiceFeatures this_arg_conv;
66947         this_arg_conv.inner = untag_ptr(this_arg);
66948         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66949         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66950         this_arg_conv.is_owned = false;
66951         jboolean ret_conv = Bolt11InvoiceFeatures_supports_payment_secret(&this_arg_conv);
66952         return ret_conv;
66953 }
66954
66955 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
66956         LDKInitFeatures this_arg_conv;
66957         this_arg_conv.inner = untag_ptr(this_arg);
66958         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66959         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66960         this_arg_conv.is_owned = false;
66961         jboolean ret_conv = InitFeatures_requires_payment_secret(&this_arg_conv);
66962         return ret_conv;
66963 }
66964
66965 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
66966         LDKNodeFeatures this_arg_conv;
66967         this_arg_conv.inner = untag_ptr(this_arg);
66968         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66969         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66970         this_arg_conv.is_owned = false;
66971         jboolean ret_conv = NodeFeatures_requires_payment_secret(&this_arg_conv);
66972         return ret_conv;
66973 }
66974
66975 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1requires_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
66976         LDKBolt11InvoiceFeatures this_arg_conv;
66977         this_arg_conv.inner = untag_ptr(this_arg);
66978         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66979         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66980         this_arg_conv.is_owned = false;
66981         jboolean ret_conv = Bolt11InvoiceFeatures_requires_payment_secret(&this_arg_conv);
66982         return ret_conv;
66983 }
66984
66985 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1basic_1mpp_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
66986         LDKInitFeatures this_arg_conv;
66987         this_arg_conv.inner = untag_ptr(this_arg);
66988         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66989         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66990         this_arg_conv.is_owned = false;
66991         InitFeatures_set_basic_mpp_optional(&this_arg_conv);
66992 }
66993
66994 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1basic_1mpp_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
66995         LDKInitFeatures this_arg_conv;
66996         this_arg_conv.inner = untag_ptr(this_arg);
66997         this_arg_conv.is_owned = ptr_is_owned(this_arg);
66998         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
66999         this_arg_conv.is_owned = false;
67000         InitFeatures_set_basic_mpp_required(&this_arg_conv);
67001 }
67002
67003 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1basic_1mpp(JNIEnv *env, jclass clz, int64_t this_arg) {
67004         LDKInitFeatures this_arg_conv;
67005         this_arg_conv.inner = untag_ptr(this_arg);
67006         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67007         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67008         this_arg_conv.is_owned = false;
67009         jboolean ret_conv = InitFeatures_supports_basic_mpp(&this_arg_conv);
67010         return ret_conv;
67011 }
67012
67013 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1basic_1mpp_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
67014         LDKNodeFeatures this_arg_conv;
67015         this_arg_conv.inner = untag_ptr(this_arg);
67016         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67017         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67018         this_arg_conv.is_owned = false;
67019         NodeFeatures_set_basic_mpp_optional(&this_arg_conv);
67020 }
67021
67022 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1basic_1mpp_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
67023         LDKNodeFeatures this_arg_conv;
67024         this_arg_conv.inner = untag_ptr(this_arg);
67025         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67026         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67027         this_arg_conv.is_owned = false;
67028         NodeFeatures_set_basic_mpp_required(&this_arg_conv);
67029 }
67030
67031 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1basic_1mpp(JNIEnv *env, jclass clz, int64_t this_arg) {
67032         LDKNodeFeatures this_arg_conv;
67033         this_arg_conv.inner = untag_ptr(this_arg);
67034         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67035         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67036         this_arg_conv.is_owned = false;
67037         jboolean ret_conv = NodeFeatures_supports_basic_mpp(&this_arg_conv);
67038         return ret_conv;
67039 }
67040
67041 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1set_1basic_1mpp_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
67042         LDKBolt11InvoiceFeatures this_arg_conv;
67043         this_arg_conv.inner = untag_ptr(this_arg);
67044         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67045         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67046         this_arg_conv.is_owned = false;
67047         Bolt11InvoiceFeatures_set_basic_mpp_optional(&this_arg_conv);
67048 }
67049
67050 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1set_1basic_1mpp_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
67051         LDKBolt11InvoiceFeatures this_arg_conv;
67052         this_arg_conv.inner = untag_ptr(this_arg);
67053         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67054         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67055         this_arg_conv.is_owned = false;
67056         Bolt11InvoiceFeatures_set_basic_mpp_required(&this_arg_conv);
67057 }
67058
67059 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1supports_1basic_1mpp(JNIEnv *env, jclass clz, int64_t this_arg) {
67060         LDKBolt11InvoiceFeatures this_arg_conv;
67061         this_arg_conv.inner = untag_ptr(this_arg);
67062         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67063         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67064         this_arg_conv.is_owned = false;
67065         jboolean ret_conv = Bolt11InvoiceFeatures_supports_basic_mpp(&this_arg_conv);
67066         return ret_conv;
67067 }
67068
67069 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Bolt12InvoiceFeatures_1set_1basic_1mpp_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
67070         LDKBolt12InvoiceFeatures this_arg_conv;
67071         this_arg_conv.inner = untag_ptr(this_arg);
67072         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67073         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67074         this_arg_conv.is_owned = false;
67075         Bolt12InvoiceFeatures_set_basic_mpp_optional(&this_arg_conv);
67076 }
67077
67078 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Bolt12InvoiceFeatures_1set_1basic_1mpp_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
67079         LDKBolt12InvoiceFeatures this_arg_conv;
67080         this_arg_conv.inner = untag_ptr(this_arg);
67081         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67082         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67083         this_arg_conv.is_owned = false;
67084         Bolt12InvoiceFeatures_set_basic_mpp_required(&this_arg_conv);
67085 }
67086
67087 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt12InvoiceFeatures_1supports_1basic_1mpp(JNIEnv *env, jclass clz, int64_t this_arg) {
67088         LDKBolt12InvoiceFeatures this_arg_conv;
67089         this_arg_conv.inner = untag_ptr(this_arg);
67090         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67091         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67092         this_arg_conv.is_owned = false;
67093         jboolean ret_conv = Bolt12InvoiceFeatures_supports_basic_mpp(&this_arg_conv);
67094         return ret_conv;
67095 }
67096
67097 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1basic_1mpp(JNIEnv *env, jclass clz, int64_t this_arg) {
67098         LDKInitFeatures this_arg_conv;
67099         this_arg_conv.inner = untag_ptr(this_arg);
67100         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67101         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67102         this_arg_conv.is_owned = false;
67103         jboolean ret_conv = InitFeatures_requires_basic_mpp(&this_arg_conv);
67104         return ret_conv;
67105 }
67106
67107 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1basic_1mpp(JNIEnv *env, jclass clz, int64_t this_arg) {
67108         LDKNodeFeatures this_arg_conv;
67109         this_arg_conv.inner = untag_ptr(this_arg);
67110         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67111         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67112         this_arg_conv.is_owned = false;
67113         jboolean ret_conv = NodeFeatures_requires_basic_mpp(&this_arg_conv);
67114         return ret_conv;
67115 }
67116
67117 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1requires_1basic_1mpp(JNIEnv *env, jclass clz, int64_t this_arg) {
67118         LDKBolt11InvoiceFeatures this_arg_conv;
67119         this_arg_conv.inner = untag_ptr(this_arg);
67120         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67121         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67122         this_arg_conv.is_owned = false;
67123         jboolean ret_conv = Bolt11InvoiceFeatures_requires_basic_mpp(&this_arg_conv);
67124         return ret_conv;
67125 }
67126
67127 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt12InvoiceFeatures_1requires_1basic_1mpp(JNIEnv *env, jclass clz, int64_t this_arg) {
67128         LDKBolt12InvoiceFeatures this_arg_conv;
67129         this_arg_conv.inner = untag_ptr(this_arg);
67130         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67131         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67132         this_arg_conv.is_owned = false;
67133         jboolean ret_conv = Bolt12InvoiceFeatures_requires_basic_mpp(&this_arg_conv);
67134         return ret_conv;
67135 }
67136
67137 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1wumbo_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
67138         LDKInitFeatures this_arg_conv;
67139         this_arg_conv.inner = untag_ptr(this_arg);
67140         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67141         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67142         this_arg_conv.is_owned = false;
67143         InitFeatures_set_wumbo_optional(&this_arg_conv);
67144 }
67145
67146 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1wumbo_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
67147         LDKInitFeatures this_arg_conv;
67148         this_arg_conv.inner = untag_ptr(this_arg);
67149         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67150         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67151         this_arg_conv.is_owned = false;
67152         InitFeatures_set_wumbo_required(&this_arg_conv);
67153 }
67154
67155 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1wumbo(JNIEnv *env, jclass clz, int64_t this_arg) {
67156         LDKInitFeatures this_arg_conv;
67157         this_arg_conv.inner = untag_ptr(this_arg);
67158         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67159         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67160         this_arg_conv.is_owned = false;
67161         jboolean ret_conv = InitFeatures_supports_wumbo(&this_arg_conv);
67162         return ret_conv;
67163 }
67164
67165 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1wumbo_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
67166         LDKNodeFeatures this_arg_conv;
67167         this_arg_conv.inner = untag_ptr(this_arg);
67168         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67169         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67170         this_arg_conv.is_owned = false;
67171         NodeFeatures_set_wumbo_optional(&this_arg_conv);
67172 }
67173
67174 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1wumbo_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
67175         LDKNodeFeatures this_arg_conv;
67176         this_arg_conv.inner = untag_ptr(this_arg);
67177         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67178         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67179         this_arg_conv.is_owned = false;
67180         NodeFeatures_set_wumbo_required(&this_arg_conv);
67181 }
67182
67183 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1wumbo(JNIEnv *env, jclass clz, int64_t this_arg) {
67184         LDKNodeFeatures this_arg_conv;
67185         this_arg_conv.inner = untag_ptr(this_arg);
67186         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67187         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67188         this_arg_conv.is_owned = false;
67189         jboolean ret_conv = NodeFeatures_supports_wumbo(&this_arg_conv);
67190         return ret_conv;
67191 }
67192
67193 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1wumbo(JNIEnv *env, jclass clz, int64_t this_arg) {
67194         LDKInitFeatures this_arg_conv;
67195         this_arg_conv.inner = untag_ptr(this_arg);
67196         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67197         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67198         this_arg_conv.is_owned = false;
67199         jboolean ret_conv = InitFeatures_requires_wumbo(&this_arg_conv);
67200         return ret_conv;
67201 }
67202
67203 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1wumbo(JNIEnv *env, jclass clz, int64_t this_arg) {
67204         LDKNodeFeatures this_arg_conv;
67205         this_arg_conv.inner = untag_ptr(this_arg);
67206         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67207         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67208         this_arg_conv.is_owned = false;
67209         jboolean ret_conv = NodeFeatures_requires_wumbo(&this_arg_conv);
67210         return ret_conv;
67211 }
67212
67213 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1anchors_1nonzero_1fee_1htlc_1tx_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
67214         LDKInitFeatures this_arg_conv;
67215         this_arg_conv.inner = untag_ptr(this_arg);
67216         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67217         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67218         this_arg_conv.is_owned = false;
67219         InitFeatures_set_anchors_nonzero_fee_htlc_tx_optional(&this_arg_conv);
67220 }
67221
67222 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1anchors_1nonzero_1fee_1htlc_1tx_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
67223         LDKInitFeatures this_arg_conv;
67224         this_arg_conv.inner = untag_ptr(this_arg);
67225         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67226         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67227         this_arg_conv.is_owned = false;
67228         InitFeatures_set_anchors_nonzero_fee_htlc_tx_required(&this_arg_conv);
67229 }
67230
67231 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1anchors_1nonzero_1fee_1htlc_1tx(JNIEnv *env, jclass clz, int64_t this_arg) {
67232         LDKInitFeatures 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         jboolean ret_conv = InitFeatures_supports_anchors_nonzero_fee_htlc_tx(&this_arg_conv);
67238         return ret_conv;
67239 }
67240
67241 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1anchors_1nonzero_1fee_1htlc_1tx_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
67242         LDKNodeFeatures this_arg_conv;
67243         this_arg_conv.inner = untag_ptr(this_arg);
67244         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67245         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67246         this_arg_conv.is_owned = false;
67247         NodeFeatures_set_anchors_nonzero_fee_htlc_tx_optional(&this_arg_conv);
67248 }
67249
67250 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1anchors_1nonzero_1fee_1htlc_1tx_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
67251         LDKNodeFeatures this_arg_conv;
67252         this_arg_conv.inner = untag_ptr(this_arg);
67253         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67254         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67255         this_arg_conv.is_owned = false;
67256         NodeFeatures_set_anchors_nonzero_fee_htlc_tx_required(&this_arg_conv);
67257 }
67258
67259 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1anchors_1nonzero_1fee_1htlc_1tx(JNIEnv *env, jclass clz, int64_t this_arg) {
67260         LDKNodeFeatures this_arg_conv;
67261         this_arg_conv.inner = untag_ptr(this_arg);
67262         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67263         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67264         this_arg_conv.is_owned = false;
67265         jboolean ret_conv = NodeFeatures_supports_anchors_nonzero_fee_htlc_tx(&this_arg_conv);
67266         return ret_conv;
67267 }
67268
67269 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1set_1anchors_1nonzero_1fee_1htlc_1tx_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
67270         LDKChannelTypeFeatures this_arg_conv;
67271         this_arg_conv.inner = untag_ptr(this_arg);
67272         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67273         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67274         this_arg_conv.is_owned = false;
67275         ChannelTypeFeatures_set_anchors_nonzero_fee_htlc_tx_optional(&this_arg_conv);
67276 }
67277
67278 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1set_1anchors_1nonzero_1fee_1htlc_1tx_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
67279         LDKChannelTypeFeatures this_arg_conv;
67280         this_arg_conv.inner = untag_ptr(this_arg);
67281         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67282         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67283         this_arg_conv.is_owned = false;
67284         ChannelTypeFeatures_set_anchors_nonzero_fee_htlc_tx_required(&this_arg_conv);
67285 }
67286
67287 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1supports_1anchors_1nonzero_1fee_1htlc_1tx(JNIEnv *env, jclass clz, int64_t this_arg) {
67288         LDKChannelTypeFeatures this_arg_conv;
67289         this_arg_conv.inner = untag_ptr(this_arg);
67290         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67291         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67292         this_arg_conv.is_owned = false;
67293         jboolean ret_conv = ChannelTypeFeatures_supports_anchors_nonzero_fee_htlc_tx(&this_arg_conv);
67294         return ret_conv;
67295 }
67296
67297 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1anchors_1nonzero_1fee_1htlc_1tx(JNIEnv *env, jclass clz, int64_t this_arg) {
67298         LDKInitFeatures this_arg_conv;
67299         this_arg_conv.inner = untag_ptr(this_arg);
67300         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67301         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67302         this_arg_conv.is_owned = false;
67303         jboolean ret_conv = InitFeatures_requires_anchors_nonzero_fee_htlc_tx(&this_arg_conv);
67304         return ret_conv;
67305 }
67306
67307 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1anchors_1nonzero_1fee_1htlc_1tx(JNIEnv *env, jclass clz, int64_t this_arg) {
67308         LDKNodeFeatures this_arg_conv;
67309         this_arg_conv.inner = untag_ptr(this_arg);
67310         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67311         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67312         this_arg_conv.is_owned = false;
67313         jboolean ret_conv = NodeFeatures_requires_anchors_nonzero_fee_htlc_tx(&this_arg_conv);
67314         return ret_conv;
67315 }
67316
67317 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1requires_1anchors_1nonzero_1fee_1htlc_1tx(JNIEnv *env, jclass clz, int64_t this_arg) {
67318         LDKChannelTypeFeatures this_arg_conv;
67319         this_arg_conv.inner = untag_ptr(this_arg);
67320         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67321         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67322         this_arg_conv.is_owned = false;
67323         jboolean ret_conv = ChannelTypeFeatures_requires_anchors_nonzero_fee_htlc_tx(&this_arg_conv);
67324         return ret_conv;
67325 }
67326
67327 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1anchors_1zero_1fee_1htlc_1tx_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
67328         LDKInitFeatures this_arg_conv;
67329         this_arg_conv.inner = untag_ptr(this_arg);
67330         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67331         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67332         this_arg_conv.is_owned = false;
67333         InitFeatures_set_anchors_zero_fee_htlc_tx_optional(&this_arg_conv);
67334 }
67335
67336 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1anchors_1zero_1fee_1htlc_1tx_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
67337         LDKInitFeatures this_arg_conv;
67338         this_arg_conv.inner = untag_ptr(this_arg);
67339         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67340         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67341         this_arg_conv.is_owned = false;
67342         InitFeatures_set_anchors_zero_fee_htlc_tx_required(&this_arg_conv);
67343 }
67344
67345 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1anchors_1zero_1fee_1htlc_1tx(JNIEnv *env, jclass clz, int64_t this_arg) {
67346         LDKInitFeatures this_arg_conv;
67347         this_arg_conv.inner = untag_ptr(this_arg);
67348         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67349         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67350         this_arg_conv.is_owned = false;
67351         jboolean ret_conv = InitFeatures_supports_anchors_zero_fee_htlc_tx(&this_arg_conv);
67352         return ret_conv;
67353 }
67354
67355 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1anchors_1zero_1fee_1htlc_1tx_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
67356         LDKNodeFeatures this_arg_conv;
67357         this_arg_conv.inner = untag_ptr(this_arg);
67358         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67359         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67360         this_arg_conv.is_owned = false;
67361         NodeFeatures_set_anchors_zero_fee_htlc_tx_optional(&this_arg_conv);
67362 }
67363
67364 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1anchors_1zero_1fee_1htlc_1tx_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
67365         LDKNodeFeatures this_arg_conv;
67366         this_arg_conv.inner = untag_ptr(this_arg);
67367         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67368         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67369         this_arg_conv.is_owned = false;
67370         NodeFeatures_set_anchors_zero_fee_htlc_tx_required(&this_arg_conv);
67371 }
67372
67373 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1anchors_1zero_1fee_1htlc_1tx(JNIEnv *env, jclass clz, int64_t this_arg) {
67374         LDKNodeFeatures this_arg_conv;
67375         this_arg_conv.inner = untag_ptr(this_arg);
67376         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67377         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67378         this_arg_conv.is_owned = false;
67379         jboolean ret_conv = NodeFeatures_supports_anchors_zero_fee_htlc_tx(&this_arg_conv);
67380         return ret_conv;
67381 }
67382
67383 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1set_1anchors_1zero_1fee_1htlc_1tx_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
67384         LDKChannelTypeFeatures this_arg_conv;
67385         this_arg_conv.inner = untag_ptr(this_arg);
67386         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67387         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67388         this_arg_conv.is_owned = false;
67389         ChannelTypeFeatures_set_anchors_zero_fee_htlc_tx_optional(&this_arg_conv);
67390 }
67391
67392 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1set_1anchors_1zero_1fee_1htlc_1tx_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
67393         LDKChannelTypeFeatures this_arg_conv;
67394         this_arg_conv.inner = untag_ptr(this_arg);
67395         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67396         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67397         this_arg_conv.is_owned = false;
67398         ChannelTypeFeatures_set_anchors_zero_fee_htlc_tx_required(&this_arg_conv);
67399 }
67400
67401 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1supports_1anchors_1zero_1fee_1htlc_1tx(JNIEnv *env, jclass clz, int64_t this_arg) {
67402         LDKChannelTypeFeatures this_arg_conv;
67403         this_arg_conv.inner = untag_ptr(this_arg);
67404         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67405         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67406         this_arg_conv.is_owned = false;
67407         jboolean ret_conv = ChannelTypeFeatures_supports_anchors_zero_fee_htlc_tx(&this_arg_conv);
67408         return ret_conv;
67409 }
67410
67411 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1anchors_1zero_1fee_1htlc_1tx(JNIEnv *env, jclass clz, int64_t this_arg) {
67412         LDKInitFeatures this_arg_conv;
67413         this_arg_conv.inner = untag_ptr(this_arg);
67414         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67415         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67416         this_arg_conv.is_owned = false;
67417         jboolean ret_conv = InitFeatures_requires_anchors_zero_fee_htlc_tx(&this_arg_conv);
67418         return ret_conv;
67419 }
67420
67421 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1anchors_1zero_1fee_1htlc_1tx(JNIEnv *env, jclass clz, int64_t this_arg) {
67422         LDKNodeFeatures this_arg_conv;
67423         this_arg_conv.inner = untag_ptr(this_arg);
67424         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67425         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67426         this_arg_conv.is_owned = false;
67427         jboolean ret_conv = NodeFeatures_requires_anchors_zero_fee_htlc_tx(&this_arg_conv);
67428         return ret_conv;
67429 }
67430
67431 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1requires_1anchors_1zero_1fee_1htlc_1tx(JNIEnv *env, jclass clz, int64_t this_arg) {
67432         LDKChannelTypeFeatures this_arg_conv;
67433         this_arg_conv.inner = untag_ptr(this_arg);
67434         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67435         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67436         this_arg_conv.is_owned = false;
67437         jboolean ret_conv = ChannelTypeFeatures_requires_anchors_zero_fee_htlc_tx(&this_arg_conv);
67438         return ret_conv;
67439 }
67440
67441 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1route_1blinding_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
67442         LDKInitFeatures this_arg_conv;
67443         this_arg_conv.inner = untag_ptr(this_arg);
67444         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67445         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67446         this_arg_conv.is_owned = false;
67447         InitFeatures_set_route_blinding_optional(&this_arg_conv);
67448 }
67449
67450 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1route_1blinding_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
67451         LDKInitFeatures this_arg_conv;
67452         this_arg_conv.inner = untag_ptr(this_arg);
67453         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67454         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67455         this_arg_conv.is_owned = false;
67456         InitFeatures_set_route_blinding_required(&this_arg_conv);
67457 }
67458
67459 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1route_1blinding(JNIEnv *env, jclass clz, int64_t this_arg) {
67460         LDKInitFeatures this_arg_conv;
67461         this_arg_conv.inner = untag_ptr(this_arg);
67462         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67463         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67464         this_arg_conv.is_owned = false;
67465         jboolean ret_conv = InitFeatures_supports_route_blinding(&this_arg_conv);
67466         return ret_conv;
67467 }
67468
67469 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1route_1blinding_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
67470         LDKNodeFeatures this_arg_conv;
67471         this_arg_conv.inner = untag_ptr(this_arg);
67472         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67473         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67474         this_arg_conv.is_owned = false;
67475         NodeFeatures_set_route_blinding_optional(&this_arg_conv);
67476 }
67477
67478 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1route_1blinding_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
67479         LDKNodeFeatures this_arg_conv;
67480         this_arg_conv.inner = untag_ptr(this_arg);
67481         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67482         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67483         this_arg_conv.is_owned = false;
67484         NodeFeatures_set_route_blinding_required(&this_arg_conv);
67485 }
67486
67487 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1route_1blinding(JNIEnv *env, jclass clz, int64_t this_arg) {
67488         LDKNodeFeatures this_arg_conv;
67489         this_arg_conv.inner = untag_ptr(this_arg);
67490         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67491         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67492         this_arg_conv.is_owned = false;
67493         jboolean ret_conv = NodeFeatures_supports_route_blinding(&this_arg_conv);
67494         return ret_conv;
67495 }
67496
67497 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1route_1blinding(JNIEnv *env, jclass clz, int64_t this_arg) {
67498         LDKInitFeatures this_arg_conv;
67499         this_arg_conv.inner = untag_ptr(this_arg);
67500         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67501         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67502         this_arg_conv.is_owned = false;
67503         jboolean ret_conv = InitFeatures_requires_route_blinding(&this_arg_conv);
67504         return ret_conv;
67505 }
67506
67507 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1route_1blinding(JNIEnv *env, jclass clz, int64_t this_arg) {
67508         LDKNodeFeatures this_arg_conv;
67509         this_arg_conv.inner = untag_ptr(this_arg);
67510         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67511         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67512         this_arg_conv.is_owned = false;
67513         jboolean ret_conv = NodeFeatures_requires_route_blinding(&this_arg_conv);
67514         return ret_conv;
67515 }
67516
67517 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1shutdown_1any_1segwit_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
67518         LDKInitFeatures this_arg_conv;
67519         this_arg_conv.inner = untag_ptr(this_arg);
67520         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67521         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67522         this_arg_conv.is_owned = false;
67523         InitFeatures_set_shutdown_any_segwit_optional(&this_arg_conv);
67524 }
67525
67526 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1shutdown_1any_1segwit_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
67527         LDKInitFeatures this_arg_conv;
67528         this_arg_conv.inner = untag_ptr(this_arg);
67529         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67530         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67531         this_arg_conv.is_owned = false;
67532         InitFeatures_set_shutdown_any_segwit_required(&this_arg_conv);
67533 }
67534
67535 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1shutdown_1anysegwit(JNIEnv *env, jclass clz, int64_t this_arg) {
67536         LDKInitFeatures this_arg_conv;
67537         this_arg_conv.inner = untag_ptr(this_arg);
67538         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67539         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67540         this_arg_conv.is_owned = false;
67541         jboolean ret_conv = InitFeatures_supports_shutdown_anysegwit(&this_arg_conv);
67542         return ret_conv;
67543 }
67544
67545 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1shutdown_1any_1segwit_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
67546         LDKNodeFeatures this_arg_conv;
67547         this_arg_conv.inner = untag_ptr(this_arg);
67548         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67549         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67550         this_arg_conv.is_owned = false;
67551         NodeFeatures_set_shutdown_any_segwit_optional(&this_arg_conv);
67552 }
67553
67554 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1shutdown_1any_1segwit_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
67555         LDKNodeFeatures this_arg_conv;
67556         this_arg_conv.inner = untag_ptr(this_arg);
67557         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67558         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67559         this_arg_conv.is_owned = false;
67560         NodeFeatures_set_shutdown_any_segwit_required(&this_arg_conv);
67561 }
67562
67563 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1shutdown_1anysegwit(JNIEnv *env, jclass clz, int64_t this_arg) {
67564         LDKNodeFeatures this_arg_conv;
67565         this_arg_conv.inner = untag_ptr(this_arg);
67566         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67567         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67568         this_arg_conv.is_owned = false;
67569         jboolean ret_conv = NodeFeatures_supports_shutdown_anysegwit(&this_arg_conv);
67570         return ret_conv;
67571 }
67572
67573 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1shutdown_1anysegwit(JNIEnv *env, jclass clz, int64_t this_arg) {
67574         LDKInitFeatures this_arg_conv;
67575         this_arg_conv.inner = untag_ptr(this_arg);
67576         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67577         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67578         this_arg_conv.is_owned = false;
67579         jboolean ret_conv = InitFeatures_requires_shutdown_anysegwit(&this_arg_conv);
67580         return ret_conv;
67581 }
67582
67583 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1shutdown_1anysegwit(JNIEnv *env, jclass clz, int64_t this_arg) {
67584         LDKNodeFeatures this_arg_conv;
67585         this_arg_conv.inner = untag_ptr(this_arg);
67586         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67587         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67588         this_arg_conv.is_owned = false;
67589         jboolean ret_conv = NodeFeatures_requires_shutdown_anysegwit(&this_arg_conv);
67590         return ret_conv;
67591 }
67592
67593 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1taproot_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
67594         LDKInitFeatures this_arg_conv;
67595         this_arg_conv.inner = untag_ptr(this_arg);
67596         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67597         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67598         this_arg_conv.is_owned = false;
67599         InitFeatures_set_taproot_optional(&this_arg_conv);
67600 }
67601
67602 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1taproot_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
67603         LDKInitFeatures this_arg_conv;
67604         this_arg_conv.inner = untag_ptr(this_arg);
67605         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67606         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67607         this_arg_conv.is_owned = false;
67608         InitFeatures_set_taproot_required(&this_arg_conv);
67609 }
67610
67611 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1taproot(JNIEnv *env, jclass clz, int64_t this_arg) {
67612         LDKInitFeatures this_arg_conv;
67613         this_arg_conv.inner = untag_ptr(this_arg);
67614         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67615         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67616         this_arg_conv.is_owned = false;
67617         jboolean ret_conv = InitFeatures_supports_taproot(&this_arg_conv);
67618         return ret_conv;
67619 }
67620
67621 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1taproot_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
67622         LDKNodeFeatures this_arg_conv;
67623         this_arg_conv.inner = untag_ptr(this_arg);
67624         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67625         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67626         this_arg_conv.is_owned = false;
67627         NodeFeatures_set_taproot_optional(&this_arg_conv);
67628 }
67629
67630 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1taproot_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
67631         LDKNodeFeatures this_arg_conv;
67632         this_arg_conv.inner = untag_ptr(this_arg);
67633         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67634         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67635         this_arg_conv.is_owned = false;
67636         NodeFeatures_set_taproot_required(&this_arg_conv);
67637 }
67638
67639 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1taproot(JNIEnv *env, jclass clz, int64_t this_arg) {
67640         LDKNodeFeatures this_arg_conv;
67641         this_arg_conv.inner = untag_ptr(this_arg);
67642         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67643         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67644         this_arg_conv.is_owned = false;
67645         jboolean ret_conv = NodeFeatures_supports_taproot(&this_arg_conv);
67646         return ret_conv;
67647 }
67648
67649 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1set_1taproot_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
67650         LDKChannelTypeFeatures this_arg_conv;
67651         this_arg_conv.inner = untag_ptr(this_arg);
67652         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67653         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67654         this_arg_conv.is_owned = false;
67655         ChannelTypeFeatures_set_taproot_optional(&this_arg_conv);
67656 }
67657
67658 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1set_1taproot_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
67659         LDKChannelTypeFeatures this_arg_conv;
67660         this_arg_conv.inner = untag_ptr(this_arg);
67661         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67662         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67663         this_arg_conv.is_owned = false;
67664         ChannelTypeFeatures_set_taproot_required(&this_arg_conv);
67665 }
67666
67667 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1supports_1taproot(JNIEnv *env, jclass clz, int64_t this_arg) {
67668         LDKChannelTypeFeatures this_arg_conv;
67669         this_arg_conv.inner = untag_ptr(this_arg);
67670         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67671         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67672         this_arg_conv.is_owned = false;
67673         jboolean ret_conv = ChannelTypeFeatures_supports_taproot(&this_arg_conv);
67674         return ret_conv;
67675 }
67676
67677 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1taproot(JNIEnv *env, jclass clz, int64_t this_arg) {
67678         LDKInitFeatures this_arg_conv;
67679         this_arg_conv.inner = untag_ptr(this_arg);
67680         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67681         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67682         this_arg_conv.is_owned = false;
67683         jboolean ret_conv = InitFeatures_requires_taproot(&this_arg_conv);
67684         return ret_conv;
67685 }
67686
67687 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1taproot(JNIEnv *env, jclass clz, int64_t this_arg) {
67688         LDKNodeFeatures this_arg_conv;
67689         this_arg_conv.inner = untag_ptr(this_arg);
67690         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67691         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67692         this_arg_conv.is_owned = false;
67693         jboolean ret_conv = NodeFeatures_requires_taproot(&this_arg_conv);
67694         return ret_conv;
67695 }
67696
67697 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1requires_1taproot(JNIEnv *env, jclass clz, int64_t this_arg) {
67698         LDKChannelTypeFeatures this_arg_conv;
67699         this_arg_conv.inner = untag_ptr(this_arg);
67700         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67701         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67702         this_arg_conv.is_owned = false;
67703         jboolean ret_conv = ChannelTypeFeatures_requires_taproot(&this_arg_conv);
67704         return ret_conv;
67705 }
67706
67707 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1onion_1messages_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
67708         LDKInitFeatures this_arg_conv;
67709         this_arg_conv.inner = untag_ptr(this_arg);
67710         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67711         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67712         this_arg_conv.is_owned = false;
67713         InitFeatures_set_onion_messages_optional(&this_arg_conv);
67714 }
67715
67716 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1onion_1messages_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
67717         LDKInitFeatures this_arg_conv;
67718         this_arg_conv.inner = untag_ptr(this_arg);
67719         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67720         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67721         this_arg_conv.is_owned = false;
67722         InitFeatures_set_onion_messages_required(&this_arg_conv);
67723 }
67724
67725 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1onion_1messages(JNIEnv *env, jclass clz, int64_t this_arg) {
67726         LDKInitFeatures this_arg_conv;
67727         this_arg_conv.inner = untag_ptr(this_arg);
67728         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67729         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67730         this_arg_conv.is_owned = false;
67731         jboolean ret_conv = InitFeatures_supports_onion_messages(&this_arg_conv);
67732         return ret_conv;
67733 }
67734
67735 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1onion_1messages_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
67736         LDKNodeFeatures this_arg_conv;
67737         this_arg_conv.inner = untag_ptr(this_arg);
67738         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67739         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67740         this_arg_conv.is_owned = false;
67741         NodeFeatures_set_onion_messages_optional(&this_arg_conv);
67742 }
67743
67744 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1onion_1messages_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
67745         LDKNodeFeatures this_arg_conv;
67746         this_arg_conv.inner = untag_ptr(this_arg);
67747         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67748         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67749         this_arg_conv.is_owned = false;
67750         NodeFeatures_set_onion_messages_required(&this_arg_conv);
67751 }
67752
67753 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1onion_1messages(JNIEnv *env, jclass clz, int64_t this_arg) {
67754         LDKNodeFeatures this_arg_conv;
67755         this_arg_conv.inner = untag_ptr(this_arg);
67756         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67757         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67758         this_arg_conv.is_owned = false;
67759         jboolean ret_conv = NodeFeatures_supports_onion_messages(&this_arg_conv);
67760         return ret_conv;
67761 }
67762
67763 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1onion_1messages(JNIEnv *env, jclass clz, int64_t this_arg) {
67764         LDKInitFeatures this_arg_conv;
67765         this_arg_conv.inner = untag_ptr(this_arg);
67766         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67767         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67768         this_arg_conv.is_owned = false;
67769         jboolean ret_conv = InitFeatures_requires_onion_messages(&this_arg_conv);
67770         return ret_conv;
67771 }
67772
67773 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1onion_1messages(JNIEnv *env, jclass clz, int64_t this_arg) {
67774         LDKNodeFeatures this_arg_conv;
67775         this_arg_conv.inner = untag_ptr(this_arg);
67776         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67777         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67778         this_arg_conv.is_owned = false;
67779         jboolean ret_conv = NodeFeatures_requires_onion_messages(&this_arg_conv);
67780         return ret_conv;
67781 }
67782
67783 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1channel_1type_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
67784         LDKInitFeatures this_arg_conv;
67785         this_arg_conv.inner = untag_ptr(this_arg);
67786         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67787         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67788         this_arg_conv.is_owned = false;
67789         InitFeatures_set_channel_type_optional(&this_arg_conv);
67790 }
67791
67792 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1channel_1type_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
67793         LDKInitFeatures this_arg_conv;
67794         this_arg_conv.inner = untag_ptr(this_arg);
67795         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67796         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67797         this_arg_conv.is_owned = false;
67798         InitFeatures_set_channel_type_required(&this_arg_conv);
67799 }
67800
67801 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1channel_1type(JNIEnv *env, jclass clz, int64_t this_arg) {
67802         LDKInitFeatures this_arg_conv;
67803         this_arg_conv.inner = untag_ptr(this_arg);
67804         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67805         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67806         this_arg_conv.is_owned = false;
67807         jboolean ret_conv = InitFeatures_supports_channel_type(&this_arg_conv);
67808         return ret_conv;
67809 }
67810
67811 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1channel_1type_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
67812         LDKNodeFeatures this_arg_conv;
67813         this_arg_conv.inner = untag_ptr(this_arg);
67814         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67815         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67816         this_arg_conv.is_owned = false;
67817         NodeFeatures_set_channel_type_optional(&this_arg_conv);
67818 }
67819
67820 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1channel_1type_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
67821         LDKNodeFeatures this_arg_conv;
67822         this_arg_conv.inner = untag_ptr(this_arg);
67823         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67824         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67825         this_arg_conv.is_owned = false;
67826         NodeFeatures_set_channel_type_required(&this_arg_conv);
67827 }
67828
67829 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1channel_1type(JNIEnv *env, jclass clz, int64_t this_arg) {
67830         LDKNodeFeatures this_arg_conv;
67831         this_arg_conv.inner = untag_ptr(this_arg);
67832         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67833         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67834         this_arg_conv.is_owned = false;
67835         jboolean ret_conv = NodeFeatures_supports_channel_type(&this_arg_conv);
67836         return ret_conv;
67837 }
67838
67839 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1channel_1type(JNIEnv *env, jclass clz, int64_t this_arg) {
67840         LDKInitFeatures this_arg_conv;
67841         this_arg_conv.inner = untag_ptr(this_arg);
67842         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67843         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67844         this_arg_conv.is_owned = false;
67845         jboolean ret_conv = InitFeatures_requires_channel_type(&this_arg_conv);
67846         return ret_conv;
67847 }
67848
67849 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1channel_1type(JNIEnv *env, jclass clz, int64_t this_arg) {
67850         LDKNodeFeatures this_arg_conv;
67851         this_arg_conv.inner = untag_ptr(this_arg);
67852         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67853         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67854         this_arg_conv.is_owned = false;
67855         jboolean ret_conv = NodeFeatures_requires_channel_type(&this_arg_conv);
67856         return ret_conv;
67857 }
67858
67859 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1scid_1privacy_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
67860         LDKInitFeatures this_arg_conv;
67861         this_arg_conv.inner = untag_ptr(this_arg);
67862         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67863         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67864         this_arg_conv.is_owned = false;
67865         InitFeatures_set_scid_privacy_optional(&this_arg_conv);
67866 }
67867
67868 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1scid_1privacy_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
67869         LDKInitFeatures this_arg_conv;
67870         this_arg_conv.inner = untag_ptr(this_arg);
67871         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67872         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67873         this_arg_conv.is_owned = false;
67874         InitFeatures_set_scid_privacy_required(&this_arg_conv);
67875 }
67876
67877 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1scid_1privacy(JNIEnv *env, jclass clz, int64_t this_arg) {
67878         LDKInitFeatures this_arg_conv;
67879         this_arg_conv.inner = untag_ptr(this_arg);
67880         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67881         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67882         this_arg_conv.is_owned = false;
67883         jboolean ret_conv = InitFeatures_supports_scid_privacy(&this_arg_conv);
67884         return ret_conv;
67885 }
67886
67887 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1scid_1privacy_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
67888         LDKNodeFeatures this_arg_conv;
67889         this_arg_conv.inner = untag_ptr(this_arg);
67890         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67891         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67892         this_arg_conv.is_owned = false;
67893         NodeFeatures_set_scid_privacy_optional(&this_arg_conv);
67894 }
67895
67896 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1scid_1privacy_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
67897         LDKNodeFeatures this_arg_conv;
67898         this_arg_conv.inner = untag_ptr(this_arg);
67899         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67900         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67901         this_arg_conv.is_owned = false;
67902         NodeFeatures_set_scid_privacy_required(&this_arg_conv);
67903 }
67904
67905 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1scid_1privacy(JNIEnv *env, jclass clz, int64_t this_arg) {
67906         LDKNodeFeatures this_arg_conv;
67907         this_arg_conv.inner = untag_ptr(this_arg);
67908         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67909         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67910         this_arg_conv.is_owned = false;
67911         jboolean ret_conv = NodeFeatures_supports_scid_privacy(&this_arg_conv);
67912         return ret_conv;
67913 }
67914
67915 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1set_1scid_1privacy_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
67916         LDKChannelTypeFeatures this_arg_conv;
67917         this_arg_conv.inner = untag_ptr(this_arg);
67918         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67919         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67920         this_arg_conv.is_owned = false;
67921         ChannelTypeFeatures_set_scid_privacy_optional(&this_arg_conv);
67922 }
67923
67924 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1set_1scid_1privacy_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
67925         LDKChannelTypeFeatures this_arg_conv;
67926         this_arg_conv.inner = untag_ptr(this_arg);
67927         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67928         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67929         this_arg_conv.is_owned = false;
67930         ChannelTypeFeatures_set_scid_privacy_required(&this_arg_conv);
67931 }
67932
67933 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1supports_1scid_1privacy(JNIEnv *env, jclass clz, int64_t this_arg) {
67934         LDKChannelTypeFeatures this_arg_conv;
67935         this_arg_conv.inner = untag_ptr(this_arg);
67936         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67937         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67938         this_arg_conv.is_owned = false;
67939         jboolean ret_conv = ChannelTypeFeatures_supports_scid_privacy(&this_arg_conv);
67940         return ret_conv;
67941 }
67942
67943 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1scid_1privacy(JNIEnv *env, jclass clz, int64_t this_arg) {
67944         LDKInitFeatures this_arg_conv;
67945         this_arg_conv.inner = untag_ptr(this_arg);
67946         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67947         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67948         this_arg_conv.is_owned = false;
67949         jboolean ret_conv = InitFeatures_requires_scid_privacy(&this_arg_conv);
67950         return ret_conv;
67951 }
67952
67953 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1scid_1privacy(JNIEnv *env, jclass clz, int64_t this_arg) {
67954         LDKNodeFeatures this_arg_conv;
67955         this_arg_conv.inner = untag_ptr(this_arg);
67956         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67957         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67958         this_arg_conv.is_owned = false;
67959         jboolean ret_conv = NodeFeatures_requires_scid_privacy(&this_arg_conv);
67960         return ret_conv;
67961 }
67962
67963 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1requires_1scid_1privacy(JNIEnv *env, jclass clz, int64_t this_arg) {
67964         LDKChannelTypeFeatures this_arg_conv;
67965         this_arg_conv.inner = untag_ptr(this_arg);
67966         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67967         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67968         this_arg_conv.is_owned = false;
67969         jboolean ret_conv = ChannelTypeFeatures_requires_scid_privacy(&this_arg_conv);
67970         return ret_conv;
67971 }
67972
67973 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1set_1payment_1metadata_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
67974         LDKBolt11InvoiceFeatures this_arg_conv;
67975         this_arg_conv.inner = untag_ptr(this_arg);
67976         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67977         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67978         this_arg_conv.is_owned = false;
67979         Bolt11InvoiceFeatures_set_payment_metadata_optional(&this_arg_conv);
67980 }
67981
67982 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1set_1payment_1metadata_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
67983         LDKBolt11InvoiceFeatures this_arg_conv;
67984         this_arg_conv.inner = untag_ptr(this_arg);
67985         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67986         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67987         this_arg_conv.is_owned = false;
67988         Bolt11InvoiceFeatures_set_payment_metadata_required(&this_arg_conv);
67989 }
67990
67991 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1supports_1payment_1metadata(JNIEnv *env, jclass clz, int64_t this_arg) {
67992         LDKBolt11InvoiceFeatures this_arg_conv;
67993         this_arg_conv.inner = untag_ptr(this_arg);
67994         this_arg_conv.is_owned = ptr_is_owned(this_arg);
67995         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
67996         this_arg_conv.is_owned = false;
67997         jboolean ret_conv = Bolt11InvoiceFeatures_supports_payment_metadata(&this_arg_conv);
67998         return ret_conv;
67999 }
68000
68001 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1requires_1payment_1metadata(JNIEnv *env, jclass clz, int64_t this_arg) {
68002         LDKBolt11InvoiceFeatures this_arg_conv;
68003         this_arg_conv.inner = untag_ptr(this_arg);
68004         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68005         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68006         this_arg_conv.is_owned = false;
68007         jboolean ret_conv = Bolt11InvoiceFeatures_requires_payment_metadata(&this_arg_conv);
68008         return ret_conv;
68009 }
68010
68011 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1zero_1conf_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
68012         LDKInitFeatures this_arg_conv;
68013         this_arg_conv.inner = untag_ptr(this_arg);
68014         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68015         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68016         this_arg_conv.is_owned = false;
68017         InitFeatures_set_zero_conf_optional(&this_arg_conv);
68018 }
68019
68020 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1zero_1conf_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
68021         LDKInitFeatures this_arg_conv;
68022         this_arg_conv.inner = untag_ptr(this_arg);
68023         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68024         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68025         this_arg_conv.is_owned = false;
68026         InitFeatures_set_zero_conf_required(&this_arg_conv);
68027 }
68028
68029 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1zero_1conf(JNIEnv *env, jclass clz, int64_t this_arg) {
68030         LDKInitFeatures this_arg_conv;
68031         this_arg_conv.inner = untag_ptr(this_arg);
68032         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68033         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68034         this_arg_conv.is_owned = false;
68035         jboolean ret_conv = InitFeatures_supports_zero_conf(&this_arg_conv);
68036         return ret_conv;
68037 }
68038
68039 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1zero_1conf_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
68040         LDKNodeFeatures this_arg_conv;
68041         this_arg_conv.inner = untag_ptr(this_arg);
68042         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68043         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68044         this_arg_conv.is_owned = false;
68045         NodeFeatures_set_zero_conf_optional(&this_arg_conv);
68046 }
68047
68048 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1zero_1conf_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
68049         LDKNodeFeatures this_arg_conv;
68050         this_arg_conv.inner = untag_ptr(this_arg);
68051         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68052         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68053         this_arg_conv.is_owned = false;
68054         NodeFeatures_set_zero_conf_required(&this_arg_conv);
68055 }
68056
68057 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1zero_1conf(JNIEnv *env, jclass clz, int64_t this_arg) {
68058         LDKNodeFeatures this_arg_conv;
68059         this_arg_conv.inner = untag_ptr(this_arg);
68060         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68061         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68062         this_arg_conv.is_owned = false;
68063         jboolean ret_conv = NodeFeatures_supports_zero_conf(&this_arg_conv);
68064         return ret_conv;
68065 }
68066
68067 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1set_1zero_1conf_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
68068         LDKChannelTypeFeatures this_arg_conv;
68069         this_arg_conv.inner = untag_ptr(this_arg);
68070         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68071         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68072         this_arg_conv.is_owned = false;
68073         ChannelTypeFeatures_set_zero_conf_optional(&this_arg_conv);
68074 }
68075
68076 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1set_1zero_1conf_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
68077         LDKChannelTypeFeatures this_arg_conv;
68078         this_arg_conv.inner = untag_ptr(this_arg);
68079         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68080         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68081         this_arg_conv.is_owned = false;
68082         ChannelTypeFeatures_set_zero_conf_required(&this_arg_conv);
68083 }
68084
68085 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1supports_1zero_1conf(JNIEnv *env, jclass clz, int64_t this_arg) {
68086         LDKChannelTypeFeatures this_arg_conv;
68087         this_arg_conv.inner = untag_ptr(this_arg);
68088         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68089         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68090         this_arg_conv.is_owned = false;
68091         jboolean ret_conv = ChannelTypeFeatures_supports_zero_conf(&this_arg_conv);
68092         return ret_conv;
68093 }
68094
68095 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1zero_1conf(JNIEnv *env, jclass clz, int64_t this_arg) {
68096         LDKInitFeatures this_arg_conv;
68097         this_arg_conv.inner = untag_ptr(this_arg);
68098         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68099         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68100         this_arg_conv.is_owned = false;
68101         jboolean ret_conv = InitFeatures_requires_zero_conf(&this_arg_conv);
68102         return ret_conv;
68103 }
68104
68105 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1zero_1conf(JNIEnv *env, jclass clz, int64_t this_arg) {
68106         LDKNodeFeatures this_arg_conv;
68107         this_arg_conv.inner = untag_ptr(this_arg);
68108         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68109         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68110         this_arg_conv.is_owned = false;
68111         jboolean ret_conv = NodeFeatures_requires_zero_conf(&this_arg_conv);
68112         return ret_conv;
68113 }
68114
68115 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1requires_1zero_1conf(JNIEnv *env, jclass clz, int64_t this_arg) {
68116         LDKChannelTypeFeatures this_arg_conv;
68117         this_arg_conv.inner = untag_ptr(this_arg);
68118         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68119         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68120         this_arg_conv.is_owned = false;
68121         jboolean ret_conv = ChannelTypeFeatures_requires_zero_conf(&this_arg_conv);
68122         return ret_conv;
68123 }
68124
68125 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1keysend_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
68126         LDKNodeFeatures this_arg_conv;
68127         this_arg_conv.inner = untag_ptr(this_arg);
68128         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68129         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68130         this_arg_conv.is_owned = false;
68131         NodeFeatures_set_keysend_optional(&this_arg_conv);
68132 }
68133
68134 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1keysend_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
68135         LDKNodeFeatures this_arg_conv;
68136         this_arg_conv.inner = untag_ptr(this_arg);
68137         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68138         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68139         this_arg_conv.is_owned = false;
68140         NodeFeatures_set_keysend_required(&this_arg_conv);
68141 }
68142
68143 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1keysend(JNIEnv *env, jclass clz, int64_t this_arg) {
68144         LDKNodeFeatures this_arg_conv;
68145         this_arg_conv.inner = untag_ptr(this_arg);
68146         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68147         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68148         this_arg_conv.is_owned = false;
68149         jboolean ret_conv = NodeFeatures_supports_keysend(&this_arg_conv);
68150         return ret_conv;
68151 }
68152
68153 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1keysend(JNIEnv *env, jclass clz, int64_t this_arg) {
68154         LDKNodeFeatures this_arg_conv;
68155         this_arg_conv.inner = untag_ptr(this_arg);
68156         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68157         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68158         this_arg_conv.is_owned = false;
68159         jboolean ret_conv = NodeFeatures_requires_keysend(&this_arg_conv);
68160         return ret_conv;
68161 }
68162
68163 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1trampoline_1routing_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
68164         LDKInitFeatures this_arg_conv;
68165         this_arg_conv.inner = untag_ptr(this_arg);
68166         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68167         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68168         this_arg_conv.is_owned = false;
68169         InitFeatures_set_trampoline_routing_optional(&this_arg_conv);
68170 }
68171
68172 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1set_1trampoline_1routing_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
68173         LDKInitFeatures this_arg_conv;
68174         this_arg_conv.inner = untag_ptr(this_arg);
68175         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68176         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68177         this_arg_conv.is_owned = false;
68178         InitFeatures_set_trampoline_routing_required(&this_arg_conv);
68179 }
68180
68181 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1trampoline_1routing(JNIEnv *env, jclass clz, int64_t this_arg) {
68182         LDKInitFeatures this_arg_conv;
68183         this_arg_conv.inner = untag_ptr(this_arg);
68184         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68185         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68186         this_arg_conv.is_owned = false;
68187         jboolean ret_conv = InitFeatures_supports_trampoline_routing(&this_arg_conv);
68188         return ret_conv;
68189 }
68190
68191 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1trampoline_1routing_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
68192         LDKNodeFeatures this_arg_conv;
68193         this_arg_conv.inner = untag_ptr(this_arg);
68194         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68195         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68196         this_arg_conv.is_owned = false;
68197         NodeFeatures_set_trampoline_routing_optional(&this_arg_conv);
68198 }
68199
68200 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1set_1trampoline_1routing_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
68201         LDKNodeFeatures this_arg_conv;
68202         this_arg_conv.inner = untag_ptr(this_arg);
68203         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68204         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68205         this_arg_conv.is_owned = false;
68206         NodeFeatures_set_trampoline_routing_required(&this_arg_conv);
68207 }
68208
68209 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1trampoline_1routing(JNIEnv *env, jclass clz, int64_t this_arg) {
68210         LDKNodeFeatures this_arg_conv;
68211         this_arg_conv.inner = untag_ptr(this_arg);
68212         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68213         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68214         this_arg_conv.is_owned = false;
68215         jboolean ret_conv = NodeFeatures_supports_trampoline_routing(&this_arg_conv);
68216         return ret_conv;
68217 }
68218
68219 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1set_1trampoline_1routing_1optional(JNIEnv *env, jclass clz, int64_t this_arg) {
68220         LDKBolt11InvoiceFeatures this_arg_conv;
68221         this_arg_conv.inner = untag_ptr(this_arg);
68222         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68223         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68224         this_arg_conv.is_owned = false;
68225         Bolt11InvoiceFeatures_set_trampoline_routing_optional(&this_arg_conv);
68226 }
68227
68228 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1set_1trampoline_1routing_1required(JNIEnv *env, jclass clz, int64_t this_arg) {
68229         LDKBolt11InvoiceFeatures this_arg_conv;
68230         this_arg_conv.inner = untag_ptr(this_arg);
68231         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68232         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68233         this_arg_conv.is_owned = false;
68234         Bolt11InvoiceFeatures_set_trampoline_routing_required(&this_arg_conv);
68235 }
68236
68237 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1supports_1trampoline_1routing(JNIEnv *env, jclass clz, int64_t this_arg) {
68238         LDKBolt11InvoiceFeatures this_arg_conv;
68239         this_arg_conv.inner = untag_ptr(this_arg);
68240         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68241         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68242         this_arg_conv.is_owned = false;
68243         jboolean ret_conv = Bolt11InvoiceFeatures_supports_trampoline_routing(&this_arg_conv);
68244         return ret_conv;
68245 }
68246
68247 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1trampoline_1routing(JNIEnv *env, jclass clz, int64_t this_arg) {
68248         LDKInitFeatures this_arg_conv;
68249         this_arg_conv.inner = untag_ptr(this_arg);
68250         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68251         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68252         this_arg_conv.is_owned = false;
68253         jboolean ret_conv = InitFeatures_requires_trampoline_routing(&this_arg_conv);
68254         return ret_conv;
68255 }
68256
68257 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1trampoline_1routing(JNIEnv *env, jclass clz, int64_t this_arg) {
68258         LDKNodeFeatures this_arg_conv;
68259         this_arg_conv.inner = untag_ptr(this_arg);
68260         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68261         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68262         this_arg_conv.is_owned = false;
68263         jboolean ret_conv = NodeFeatures_requires_trampoline_routing(&this_arg_conv);
68264         return ret_conv;
68265 }
68266
68267 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceFeatures_1requires_1trampoline_1routing(JNIEnv *env, jclass clz, int64_t this_arg) {
68268         LDKBolt11InvoiceFeatures this_arg_conv;
68269         this_arg_conv.inner = untag_ptr(this_arg);
68270         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68271         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68272         this_arg_conv.is_owned = false;
68273         jboolean ret_conv = Bolt11InvoiceFeatures_requires_trampoline_routing(&this_arg_conv);
68274         return ret_conv;
68275 }
68276
68277 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
68278         LDKShutdownScript this_obj_conv;
68279         this_obj_conv.inner = untag_ptr(this_obj);
68280         this_obj_conv.is_owned = ptr_is_owned(this_obj);
68281         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
68282         ShutdownScript_free(this_obj_conv);
68283 }
68284
68285 static inline uint64_t ShutdownScript_clone_ptr(LDKShutdownScript *NONNULL_PTR arg) {
68286         LDKShutdownScript ret_var = ShutdownScript_clone(arg);
68287         int64_t ret_ref = 0;
68288         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68289         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68290         return ret_ref;
68291 }
68292 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
68293         LDKShutdownScript arg_conv;
68294         arg_conv.inner = untag_ptr(arg);
68295         arg_conv.is_owned = ptr_is_owned(arg);
68296         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
68297         arg_conv.is_owned = false;
68298         int64_t ret_conv = ShutdownScript_clone_ptr(&arg_conv);
68299         return ret_conv;
68300 }
68301
68302 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1clone(JNIEnv *env, jclass clz, int64_t orig) {
68303         LDKShutdownScript orig_conv;
68304         orig_conv.inner = untag_ptr(orig);
68305         orig_conv.is_owned = ptr_is_owned(orig);
68306         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
68307         orig_conv.is_owned = false;
68308         LDKShutdownScript ret_var = ShutdownScript_clone(&orig_conv);
68309         int64_t ret_ref = 0;
68310         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68311         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68312         return ret_ref;
68313 }
68314
68315 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
68316         LDKShutdownScript a_conv;
68317         a_conv.inner = untag_ptr(a);
68318         a_conv.is_owned = ptr_is_owned(a);
68319         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
68320         a_conv.is_owned = false;
68321         LDKShutdownScript b_conv;
68322         b_conv.inner = untag_ptr(b);
68323         b_conv.is_owned = ptr_is_owned(b);
68324         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
68325         b_conv.is_owned = false;
68326         jboolean ret_conv = ShutdownScript_eq(&a_conv, &b_conv);
68327         return ret_conv;
68328 }
68329
68330 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvalidShutdownScript_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
68331         LDKInvalidShutdownScript this_obj_conv;
68332         this_obj_conv.inner = untag_ptr(this_obj);
68333         this_obj_conv.is_owned = ptr_is_owned(this_obj);
68334         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
68335         InvalidShutdownScript_free(this_obj_conv);
68336 }
68337
68338 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InvalidShutdownScript_1get_1script(JNIEnv *env, jclass clz, int64_t this_ptr) {
68339         LDKInvalidShutdownScript this_ptr_conv;
68340         this_ptr_conv.inner = untag_ptr(this_ptr);
68341         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68342         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68343         this_ptr_conv.is_owned = false;
68344         LDKCVec_u8Z ret_var = InvalidShutdownScript_get_script(&this_ptr_conv);
68345         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
68346         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
68347         CVec_u8Z_free(ret_var);
68348         return ret_arr;
68349 }
68350
68351 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvalidShutdownScript_1set_1script(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
68352         LDKInvalidShutdownScript this_ptr_conv;
68353         this_ptr_conv.inner = untag_ptr(this_ptr);
68354         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68355         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68356         this_ptr_conv.is_owned = false;
68357         LDKCVec_u8Z val_ref;
68358         val_ref.datalen = (*env)->GetArrayLength(env, val);
68359         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
68360         (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
68361         InvalidShutdownScript_set_script(&this_ptr_conv, val_ref);
68362 }
68363
68364 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvalidShutdownScript_1new(JNIEnv *env, jclass clz, int8_tArray script_arg) {
68365         LDKCVec_u8Z script_arg_ref;
68366         script_arg_ref.datalen = (*env)->GetArrayLength(env, script_arg);
68367         script_arg_ref.data = MALLOC(script_arg_ref.datalen, "LDKCVec_u8Z Bytes");
68368         (*env)->GetByteArrayRegion(env, script_arg, 0, script_arg_ref.datalen, script_arg_ref.data);
68369         LDKInvalidShutdownScript ret_var = InvalidShutdownScript_new(script_arg_ref);
68370         int64_t ret_ref = 0;
68371         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68372         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68373         return ret_ref;
68374 }
68375
68376 static inline uint64_t InvalidShutdownScript_clone_ptr(LDKInvalidShutdownScript *NONNULL_PTR arg) {
68377         LDKInvalidShutdownScript ret_var = InvalidShutdownScript_clone(arg);
68378         int64_t ret_ref = 0;
68379         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68380         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68381         return ret_ref;
68382 }
68383 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvalidShutdownScript_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
68384         LDKInvalidShutdownScript arg_conv;
68385         arg_conv.inner = untag_ptr(arg);
68386         arg_conv.is_owned = ptr_is_owned(arg);
68387         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
68388         arg_conv.is_owned = false;
68389         int64_t ret_conv = InvalidShutdownScript_clone_ptr(&arg_conv);
68390         return ret_conv;
68391 }
68392
68393 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvalidShutdownScript_1clone(JNIEnv *env, jclass clz, int64_t orig) {
68394         LDKInvalidShutdownScript orig_conv;
68395         orig_conv.inner = untag_ptr(orig);
68396         orig_conv.is_owned = ptr_is_owned(orig);
68397         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
68398         orig_conv.is_owned = false;
68399         LDKInvalidShutdownScript ret_var = InvalidShutdownScript_clone(&orig_conv);
68400         int64_t ret_ref = 0;
68401         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68402         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68403         return ret_ref;
68404 }
68405
68406 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1write(JNIEnv *env, jclass clz, int64_t obj) {
68407         LDKShutdownScript obj_conv;
68408         obj_conv.inner = untag_ptr(obj);
68409         obj_conv.is_owned = ptr_is_owned(obj);
68410         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
68411         obj_conv.is_owned = false;
68412         LDKCVec_u8Z ret_var = ShutdownScript_write(&obj_conv);
68413         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
68414         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
68415         CVec_u8Z_free(ret_var);
68416         return ret_arr;
68417 }
68418
68419 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
68420         LDKu8slice ser_ref;
68421         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
68422         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
68423         LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
68424         *ret_conv = ShutdownScript_read(ser_ref);
68425         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
68426         return tag_ptr(ret_conv, true);
68427 }
68428
68429 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1new_1p2wpkh(JNIEnv *env, jclass clz, int8_tArray pubkey_hash) {
68430         uint8_t pubkey_hash_arr[20];
68431         CHECK((*env)->GetArrayLength(env, pubkey_hash) == 20);
68432         (*env)->GetByteArrayRegion(env, pubkey_hash, 0, 20, pubkey_hash_arr);
68433         uint8_t (*pubkey_hash_ref)[20] = &pubkey_hash_arr;
68434         LDKShutdownScript ret_var = ShutdownScript_new_p2wpkh(pubkey_hash_ref);
68435         int64_t ret_ref = 0;
68436         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68437         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68438         return ret_ref;
68439 }
68440
68441 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1new_1p2wsh(JNIEnv *env, jclass clz, int8_tArray script_hash) {
68442         uint8_t script_hash_arr[32];
68443         CHECK((*env)->GetArrayLength(env, script_hash) == 32);
68444         (*env)->GetByteArrayRegion(env, script_hash, 0, 32, script_hash_arr);
68445         uint8_t (*script_hash_ref)[32] = &script_hash_arr;
68446         LDKShutdownScript ret_var = ShutdownScript_new_p2wsh(script_hash_ref);
68447         int64_t ret_ref = 0;
68448         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68449         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68450         return ret_ref;
68451 }
68452
68453 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1new_1witness_1program(JNIEnv *env, jclass clz, int64_t witness_program) {
68454         void* witness_program_ptr = untag_ptr(witness_program);
68455         CHECK_ACCESS(witness_program_ptr);
68456         LDKWitnessProgram witness_program_conv = *(LDKWitnessProgram*)(witness_program_ptr);
68457         witness_program_conv = WitnessProgram_clone((LDKWitnessProgram*)untag_ptr(witness_program));
68458         LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
68459         *ret_conv = ShutdownScript_new_witness_program(witness_program_conv);
68460         return tag_ptr(ret_conv, true);
68461 }
68462
68463 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1into_1inner(JNIEnv *env, jclass clz, int64_t this_arg) {
68464         LDKShutdownScript this_arg_conv;
68465         this_arg_conv.inner = untag_ptr(this_arg);
68466         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68467         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68468         this_arg_conv = ShutdownScript_clone(&this_arg_conv);
68469         LDKCVec_u8Z ret_var = ShutdownScript_into_inner(this_arg_conv);
68470         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
68471         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
68472         CVec_u8Z_free(ret_var);
68473         return ret_arr;
68474 }
68475
68476 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1as_1legacy_1pubkey(JNIEnv *env, jclass clz, int64_t this_arg) {
68477         LDKShutdownScript this_arg_conv;
68478         this_arg_conv.inner = untag_ptr(this_arg);
68479         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68480         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68481         this_arg_conv.is_owned = false;
68482         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
68483         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ShutdownScript_as_legacy_pubkey(&this_arg_conv).compressed_form);
68484         return ret_arr;
68485 }
68486
68487 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1is_1compatible(JNIEnv *env, jclass clz, int64_t this_arg, int64_t features) {
68488         LDKShutdownScript this_arg_conv;
68489         this_arg_conv.inner = untag_ptr(this_arg);
68490         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68491         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68492         this_arg_conv.is_owned = false;
68493         LDKInitFeatures features_conv;
68494         features_conv.inner = untag_ptr(features);
68495         features_conv.is_owned = ptr_is_owned(features);
68496         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_conv);
68497         features_conv.is_owned = false;
68498         jboolean ret_conv = ShutdownScript_is_compatible(&this_arg_conv, &features_conv);
68499         return ret_conv;
68500 }
68501
68502 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelId_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
68503         LDKChannelId this_obj_conv;
68504         this_obj_conv.inner = untag_ptr(this_obj);
68505         this_obj_conv.is_owned = ptr_is_owned(this_obj);
68506         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
68507         ChannelId_free(this_obj_conv);
68508 }
68509
68510 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelId_1get_1a(JNIEnv *env, jclass clz, int64_t this_ptr) {
68511         LDKChannelId this_ptr_conv;
68512         this_ptr_conv.inner = untag_ptr(this_ptr);
68513         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68514         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68515         this_ptr_conv.is_owned = false;
68516         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
68517         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ChannelId_get_a(&this_ptr_conv));
68518         return ret_arr;
68519 }
68520
68521 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelId_1set_1a(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
68522         LDKChannelId this_ptr_conv;
68523         this_ptr_conv.inner = untag_ptr(this_ptr);
68524         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
68525         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
68526         this_ptr_conv.is_owned = false;
68527         LDKThirtyTwoBytes val_ref;
68528         CHECK((*env)->GetArrayLength(env, val) == 32);
68529         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
68530         ChannelId_set_a(&this_ptr_conv, val_ref);
68531 }
68532
68533 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelId_1new(JNIEnv *env, jclass clz, int8_tArray a_arg) {
68534         LDKThirtyTwoBytes a_arg_ref;
68535         CHECK((*env)->GetArrayLength(env, a_arg) == 32);
68536         (*env)->GetByteArrayRegion(env, a_arg, 0, 32, a_arg_ref.data);
68537         LDKChannelId ret_var = ChannelId_new(a_arg_ref);
68538         int64_t ret_ref = 0;
68539         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68540         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68541         return ret_ref;
68542 }
68543
68544 static inline uint64_t ChannelId_clone_ptr(LDKChannelId *NONNULL_PTR arg) {
68545         LDKChannelId ret_var = ChannelId_clone(arg);
68546         int64_t ret_ref = 0;
68547         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68548         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68549         return ret_ref;
68550 }
68551 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelId_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
68552         LDKChannelId arg_conv;
68553         arg_conv.inner = untag_ptr(arg);
68554         arg_conv.is_owned = ptr_is_owned(arg);
68555         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
68556         arg_conv.is_owned = false;
68557         int64_t ret_conv = ChannelId_clone_ptr(&arg_conv);
68558         return ret_conv;
68559 }
68560
68561 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelId_1clone(JNIEnv *env, jclass clz, int64_t orig) {
68562         LDKChannelId orig_conv;
68563         orig_conv.inner = untag_ptr(orig);
68564         orig_conv.is_owned = ptr_is_owned(orig);
68565         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
68566         orig_conv.is_owned = false;
68567         LDKChannelId ret_var = ChannelId_clone(&orig_conv);
68568         int64_t ret_ref = 0;
68569         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68570         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68571         return ret_ref;
68572 }
68573
68574 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelId_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
68575         LDKChannelId a_conv;
68576         a_conv.inner = untag_ptr(a);
68577         a_conv.is_owned = ptr_is_owned(a);
68578         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
68579         a_conv.is_owned = false;
68580         LDKChannelId b_conv;
68581         b_conv.inner = untag_ptr(b);
68582         b_conv.is_owned = ptr_is_owned(b);
68583         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
68584         b_conv.is_owned = false;
68585         jboolean ret_conv = ChannelId_eq(&a_conv, &b_conv);
68586         return ret_conv;
68587 }
68588
68589 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelId_1hash(JNIEnv *env, jclass clz, int64_t o) {
68590         LDKChannelId o_conv;
68591         o_conv.inner = untag_ptr(o);
68592         o_conv.is_owned = ptr_is_owned(o);
68593         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
68594         o_conv.is_owned = false;
68595         int64_t ret_conv = ChannelId_hash(&o_conv);
68596         return ret_conv;
68597 }
68598
68599 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelId_1v1_1from_1funding_1txid(JNIEnv *env, jclass clz, int8_tArray txid, int16_t output_index) {
68600         uint8_t txid_arr[32];
68601         CHECK((*env)->GetArrayLength(env, txid) == 32);
68602         (*env)->GetByteArrayRegion(env, txid, 0, 32, txid_arr);
68603         uint8_t (*txid_ref)[32] = &txid_arr;
68604         LDKChannelId ret_var = ChannelId_v1_from_funding_txid(txid_ref, output_index);
68605         int64_t ret_ref = 0;
68606         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68607         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68608         return ret_ref;
68609 }
68610
68611 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelId_1v1_1from_1funding_1outpoint(JNIEnv *env, jclass clz, int64_t outpoint) {
68612         LDKOutPoint outpoint_conv;
68613         outpoint_conv.inner = untag_ptr(outpoint);
68614         outpoint_conv.is_owned = ptr_is_owned(outpoint);
68615         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_conv);
68616         outpoint_conv = OutPoint_clone(&outpoint_conv);
68617         LDKChannelId ret_var = ChannelId_v1_from_funding_outpoint(outpoint_conv);
68618         int64_t ret_ref = 0;
68619         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68620         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68621         return ret_ref;
68622 }
68623
68624 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelId_1temporary_1from_1entropy_1source(JNIEnv *env, jclass clz, int64_t entropy_source) {
68625         void* entropy_source_ptr = untag_ptr(entropy_source);
68626         if (ptr_is_owned(entropy_source)) { CHECK_ACCESS(entropy_source_ptr); }
68627         LDKEntropySource* entropy_source_conv = (LDKEntropySource*)entropy_source_ptr;
68628         LDKChannelId ret_var = ChannelId_temporary_from_entropy_source(entropy_source_conv);
68629         int64_t ret_ref = 0;
68630         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68631         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68632         return ret_ref;
68633 }
68634
68635 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelId_1from_1bytes(JNIEnv *env, jclass clz, int8_tArray data) {
68636         LDKThirtyTwoBytes data_ref;
68637         CHECK((*env)->GetArrayLength(env, data) == 32);
68638         (*env)->GetByteArrayRegion(env, data, 0, 32, data_ref.data);
68639         LDKChannelId ret_var = ChannelId_from_bytes(data_ref);
68640         int64_t ret_ref = 0;
68641         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68642         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68643         return ret_ref;
68644 }
68645
68646 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelId_1new_1zero(JNIEnv *env, jclass clz) {
68647         LDKChannelId ret_var = ChannelId_new_zero();
68648         int64_t ret_ref = 0;
68649         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68650         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68651         return ret_ref;
68652 }
68653
68654 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelId_1is_1zero(JNIEnv *env, jclass clz, int64_t this_arg) {
68655         LDKChannelId this_arg_conv;
68656         this_arg_conv.inner = untag_ptr(this_arg);
68657         this_arg_conv.is_owned = ptr_is_owned(this_arg);
68658         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
68659         this_arg_conv.is_owned = false;
68660         jboolean ret_conv = ChannelId_is_zero(&this_arg_conv);
68661         return ret_conv;
68662 }
68663
68664 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelId_1v2_1from_1revocation_1basepoints(JNIEnv *env, jclass clz, int64_t ours, int64_t theirs) {
68665         LDKRevocationBasepoint ours_conv;
68666         ours_conv.inner = untag_ptr(ours);
68667         ours_conv.is_owned = ptr_is_owned(ours);
68668         CHECK_INNER_FIELD_ACCESS_OR_NULL(ours_conv);
68669         ours_conv.is_owned = false;
68670         LDKRevocationBasepoint theirs_conv;
68671         theirs_conv.inner = untag_ptr(theirs);
68672         theirs_conv.is_owned = ptr_is_owned(theirs);
68673         CHECK_INNER_FIELD_ACCESS_OR_NULL(theirs_conv);
68674         theirs_conv.is_owned = false;
68675         LDKChannelId ret_var = ChannelId_v2_from_revocation_basepoints(&ours_conv, &theirs_conv);
68676         int64_t ret_ref = 0;
68677         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68678         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68679         return ret_ref;
68680 }
68681
68682 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelId_1temporary_1v2_1from_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t our_revocation_basepoint) {
68683         LDKRevocationBasepoint our_revocation_basepoint_conv;
68684         our_revocation_basepoint_conv.inner = untag_ptr(our_revocation_basepoint);
68685         our_revocation_basepoint_conv.is_owned = ptr_is_owned(our_revocation_basepoint);
68686         CHECK_INNER_FIELD_ACCESS_OR_NULL(our_revocation_basepoint_conv);
68687         our_revocation_basepoint_conv.is_owned = false;
68688         LDKChannelId ret_var = ChannelId_temporary_v2_from_revocation_basepoint(&our_revocation_basepoint_conv);
68689         int64_t ret_ref = 0;
68690         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
68691         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
68692         return ret_ref;
68693 }
68694
68695 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelId_1write(JNIEnv *env, jclass clz, int64_t obj) {
68696         LDKChannelId obj_conv;
68697         obj_conv.inner = untag_ptr(obj);
68698         obj_conv.is_owned = ptr_is_owned(obj);
68699         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
68700         obj_conv.is_owned = false;
68701         LDKCVec_u8Z ret_var = ChannelId_write(&obj_conv);
68702         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
68703         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
68704         CVec_u8Z_free(ret_var);
68705         return ret_arr;
68706 }
68707
68708 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelId_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
68709         LDKu8slice ser_ref;
68710         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
68711         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
68712         LDKCResult_ChannelIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelIdDecodeErrorZ), "LDKCResult_ChannelIdDecodeErrorZ");
68713         *ret_conv = ChannelId_read(ser_ref);
68714         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
68715         return tag_ptr(ret_conv, true);
68716 }
68717
68718 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Retry_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
68719         if (!ptr_is_owned(this_ptr)) return;
68720         void* this_ptr_ptr = untag_ptr(this_ptr);
68721         CHECK_ACCESS(this_ptr_ptr);
68722         LDKRetry this_ptr_conv = *(LDKRetry*)(this_ptr_ptr);
68723         FREE(untag_ptr(this_ptr));
68724         Retry_free(this_ptr_conv);
68725 }
68726
68727 static inline uint64_t Retry_clone_ptr(LDKRetry *NONNULL_PTR arg) {
68728         LDKRetry *ret_copy = MALLOC(sizeof(LDKRetry), "LDKRetry");
68729         *ret_copy = Retry_clone(arg);
68730         int64_t ret_ref = tag_ptr(ret_copy, true);
68731         return ret_ref;
68732 }
68733 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Retry_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
68734         LDKRetry* arg_conv = (LDKRetry*)untag_ptr(arg);
68735         int64_t ret_conv = Retry_clone_ptr(arg_conv);
68736         return ret_conv;
68737 }
68738
68739 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Retry_1clone(JNIEnv *env, jclass clz, int64_t orig) {
68740         LDKRetry* orig_conv = (LDKRetry*)untag_ptr(orig);
68741         LDKRetry *ret_copy = MALLOC(sizeof(LDKRetry), "LDKRetry");
68742         *ret_copy = Retry_clone(orig_conv);
68743         int64_t ret_ref = tag_ptr(ret_copy, true);
68744         return ret_ref;
68745 }
68746
68747 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Retry_1attempts(JNIEnv *env, jclass clz, int32_t a) {
68748         LDKRetry *ret_copy = MALLOC(sizeof(LDKRetry), "LDKRetry");
68749         *ret_copy = Retry_attempts(a);
68750         int64_t ret_ref = tag_ptr(ret_copy, true);
68751         return ret_ref;
68752 }
68753
68754 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Retry_1timeout(JNIEnv *env, jclass clz, int64_t a) {
68755         LDKRetry *ret_copy = MALLOC(sizeof(LDKRetry), "LDKRetry");
68756         *ret_copy = Retry_timeout(a);
68757         int64_t ret_ref = tag_ptr(ret_copy, true);
68758         return ret_ref;
68759 }
68760
68761 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Retry_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
68762         LDKRetry* a_conv = (LDKRetry*)untag_ptr(a);
68763         LDKRetry* b_conv = (LDKRetry*)untag_ptr(b);
68764         jboolean ret_conv = Retry_eq(a_conv, b_conv);
68765         return ret_conv;
68766 }
68767
68768 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Retry_1hash(JNIEnv *env, jclass clz, int64_t o) {
68769         LDKRetry* o_conv = (LDKRetry*)untag_ptr(o);
68770         int64_t ret_conv = Retry_hash(o_conv);
68771         return ret_conv;
68772 }
68773
68774 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Retry_1write(JNIEnv *env, jclass clz, int64_t obj) {
68775         LDKRetry* obj_conv = (LDKRetry*)untag_ptr(obj);
68776         LDKCVec_u8Z ret_var = Retry_write(obj_conv);
68777         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
68778         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
68779         CVec_u8Z_free(ret_var);
68780         return ret_arr;
68781 }
68782
68783 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Retry_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
68784         LDKu8slice ser_ref;
68785         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
68786         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
68787         LDKCResult_RetryDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RetryDecodeErrorZ), "LDKCResult_RetryDecodeErrorZ");
68788         *ret_conv = Retry_read(ser_ref);
68789         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
68790         return tag_ptr(ret_conv, true);
68791 }
68792
68793 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_RetryableSendFailure_1clone(JNIEnv *env, jclass clz, int64_t orig) {
68794         LDKRetryableSendFailure* orig_conv = (LDKRetryableSendFailure*)untag_ptr(orig);
68795         jclass ret_conv = LDKRetryableSendFailure_to_java(env, RetryableSendFailure_clone(orig_conv));
68796         return ret_conv;
68797 }
68798
68799 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_RetryableSendFailure_1payment_1expired(JNIEnv *env, jclass clz) {
68800         jclass ret_conv = LDKRetryableSendFailure_to_java(env, RetryableSendFailure_payment_expired());
68801         return ret_conv;
68802 }
68803
68804 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_RetryableSendFailure_1route_1not_1found(JNIEnv *env, jclass clz) {
68805         jclass ret_conv = LDKRetryableSendFailure_to_java(env, RetryableSendFailure_route_not_found());
68806         return ret_conv;
68807 }
68808
68809 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_RetryableSendFailure_1duplicate_1payment(JNIEnv *env, jclass clz) {
68810         jclass ret_conv = LDKRetryableSendFailure_to_java(env, RetryableSendFailure_duplicate_payment());
68811         return ret_conv;
68812 }
68813
68814 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RetryableSendFailure_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
68815         LDKRetryableSendFailure* a_conv = (LDKRetryableSendFailure*)untag_ptr(a);
68816         LDKRetryableSendFailure* b_conv = (LDKRetryableSendFailure*)untag_ptr(b);
68817         jboolean ret_conv = RetryableSendFailure_eq(a_conv, b_conv);
68818         return ret_conv;
68819 }
68820
68821 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
68822         if (!ptr_is_owned(this_ptr)) return;
68823         void* this_ptr_ptr = untag_ptr(this_ptr);
68824         CHECK_ACCESS(this_ptr_ptr);
68825         LDKPaymentSendFailure this_ptr_conv = *(LDKPaymentSendFailure*)(this_ptr_ptr);
68826         FREE(untag_ptr(this_ptr));
68827         PaymentSendFailure_free(this_ptr_conv);
68828 }
68829
68830 static inline uint64_t PaymentSendFailure_clone_ptr(LDKPaymentSendFailure *NONNULL_PTR arg) {
68831         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
68832         *ret_copy = PaymentSendFailure_clone(arg);
68833         int64_t ret_ref = tag_ptr(ret_copy, true);
68834         return ret_ref;
68835 }
68836 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
68837         LDKPaymentSendFailure* arg_conv = (LDKPaymentSendFailure*)untag_ptr(arg);
68838         int64_t ret_conv = PaymentSendFailure_clone_ptr(arg_conv);
68839         return ret_conv;
68840 }
68841
68842 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1clone(JNIEnv *env, jclass clz, int64_t orig) {
68843         LDKPaymentSendFailure* orig_conv = (LDKPaymentSendFailure*)untag_ptr(orig);
68844         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
68845         *ret_copy = PaymentSendFailure_clone(orig_conv);
68846         int64_t ret_ref = tag_ptr(ret_copy, true);
68847         return ret_ref;
68848 }
68849
68850 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1parameter_1error(JNIEnv *env, jclass clz, int64_t a) {
68851         void* a_ptr = untag_ptr(a);
68852         CHECK_ACCESS(a_ptr);
68853         LDKAPIError a_conv = *(LDKAPIError*)(a_ptr);
68854         a_conv = APIError_clone((LDKAPIError*)untag_ptr(a));
68855         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
68856         *ret_copy = PaymentSendFailure_parameter_error(a_conv);
68857         int64_t ret_ref = tag_ptr(ret_copy, true);
68858         return ret_ref;
68859 }
68860
68861 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1path_1parameter_1error(JNIEnv *env, jclass clz, int64_tArray a) {
68862         LDKCVec_CResult_NoneAPIErrorZZ a_constr;
68863         a_constr.datalen = (*env)->GetArrayLength(env, a);
68864         if (a_constr.datalen > 0)
68865                 a_constr.data = MALLOC(a_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
68866         else
68867                 a_constr.data = NULL;
68868         int64_t* a_vals = (*env)->GetLongArrayElements (env, a, NULL);
68869         for (size_t w = 0; w < a_constr.datalen; w++) {
68870                 int64_t a_conv_22 = a_vals[w];
68871                 void* a_conv_22_ptr = untag_ptr(a_conv_22);
68872                 CHECK_ACCESS(a_conv_22_ptr);
68873                 LDKCResult_NoneAPIErrorZ a_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(a_conv_22_ptr);
68874                 a_conv_22_conv = CResult_NoneAPIErrorZ_clone((LDKCResult_NoneAPIErrorZ*)untag_ptr(a_conv_22));
68875                 a_constr.data[w] = a_conv_22_conv;
68876         }
68877         (*env)->ReleaseLongArrayElements(env, a, a_vals, 0);
68878         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
68879         *ret_copy = PaymentSendFailure_path_parameter_error(a_constr);
68880         int64_t ret_ref = tag_ptr(ret_copy, true);
68881         return ret_ref;
68882 }
68883
68884 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1all_1failed_1resend_1safe(JNIEnv *env, jclass clz, int64_tArray a) {
68885         LDKCVec_APIErrorZ a_constr;
68886         a_constr.datalen = (*env)->GetArrayLength(env, a);
68887         if (a_constr.datalen > 0)
68888                 a_constr.data = MALLOC(a_constr.datalen * sizeof(LDKAPIError), "LDKCVec_APIErrorZ Elements");
68889         else
68890                 a_constr.data = NULL;
68891         int64_t* a_vals = (*env)->GetLongArrayElements (env, a, NULL);
68892         for (size_t k = 0; k < a_constr.datalen; k++) {
68893                 int64_t a_conv_10 = a_vals[k];
68894                 void* a_conv_10_ptr = untag_ptr(a_conv_10);
68895                 CHECK_ACCESS(a_conv_10_ptr);
68896                 LDKAPIError a_conv_10_conv = *(LDKAPIError*)(a_conv_10_ptr);
68897                 a_conv_10_conv = APIError_clone((LDKAPIError*)untag_ptr(a_conv_10));
68898                 a_constr.data[k] = a_conv_10_conv;
68899         }
68900         (*env)->ReleaseLongArrayElements(env, a, a_vals, 0);
68901         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
68902         *ret_copy = PaymentSendFailure_all_failed_resend_safe(a_constr);
68903         int64_t ret_ref = tag_ptr(ret_copy, true);
68904         return ret_ref;
68905 }
68906
68907 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1duplicate_1payment(JNIEnv *env, jclass clz) {
68908         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
68909         *ret_copy = PaymentSendFailure_duplicate_payment();
68910         int64_t ret_ref = tag_ptr(ret_copy, true);
68911         return ret_ref;
68912 }
68913
68914 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) {
68915         LDKCVec_CResult_NoneAPIErrorZZ results_constr;
68916         results_constr.datalen = (*env)->GetArrayLength(env, results);
68917         if (results_constr.datalen > 0)
68918                 results_constr.data = MALLOC(results_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
68919         else
68920                 results_constr.data = NULL;
68921         int64_t* results_vals = (*env)->GetLongArrayElements (env, results, NULL);
68922         for (size_t w = 0; w < results_constr.datalen; w++) {
68923                 int64_t results_conv_22 = results_vals[w];
68924                 void* results_conv_22_ptr = untag_ptr(results_conv_22);
68925                 CHECK_ACCESS(results_conv_22_ptr);
68926                 LDKCResult_NoneAPIErrorZ results_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(results_conv_22_ptr);
68927                 results_constr.data[w] = results_conv_22_conv;
68928         }
68929         (*env)->ReleaseLongArrayElements(env, results, results_vals, 0);
68930         LDKRouteParameters failed_paths_retry_conv;
68931         failed_paths_retry_conv.inner = untag_ptr(failed_paths_retry);
68932         failed_paths_retry_conv.is_owned = ptr_is_owned(failed_paths_retry);
68933         CHECK_INNER_FIELD_ACCESS_OR_NULL(failed_paths_retry_conv);
68934         failed_paths_retry_conv = RouteParameters_clone(&failed_paths_retry_conv);
68935         LDKThirtyTwoBytes payment_id_ref;
68936         CHECK((*env)->GetArrayLength(env, payment_id) == 32);
68937         (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
68938         LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
68939         *ret_copy = PaymentSendFailure_partial_failure(results_constr, failed_paths_retry_conv, payment_id_ref);
68940         int64_t ret_ref = tag_ptr(ret_copy, true);
68941         return ret_ref;
68942 }
68943
68944 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
68945         LDKPaymentSendFailure* a_conv = (LDKPaymentSendFailure*)untag_ptr(a);
68946         LDKPaymentSendFailure* b_conv = (LDKPaymentSendFailure*)untag_ptr(b);
68947         jboolean ret_conv = PaymentSendFailure_eq(a_conv, b_conv);
68948         return ret_conv;
68949 }
68950
68951 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbeSendFailure_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
68952         if (!ptr_is_owned(this_ptr)) return;
68953         void* this_ptr_ptr = untag_ptr(this_ptr);
68954         CHECK_ACCESS(this_ptr_ptr);
68955         LDKProbeSendFailure this_ptr_conv = *(LDKProbeSendFailure*)(this_ptr_ptr);
68956         FREE(untag_ptr(this_ptr));
68957         ProbeSendFailure_free(this_ptr_conv);
68958 }
68959
68960 static inline uint64_t ProbeSendFailure_clone_ptr(LDKProbeSendFailure *NONNULL_PTR arg) {
68961         LDKProbeSendFailure *ret_copy = MALLOC(sizeof(LDKProbeSendFailure), "LDKProbeSendFailure");
68962         *ret_copy = ProbeSendFailure_clone(arg);
68963         int64_t ret_ref = tag_ptr(ret_copy, true);
68964         return ret_ref;
68965 }
68966 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbeSendFailure_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
68967         LDKProbeSendFailure* arg_conv = (LDKProbeSendFailure*)untag_ptr(arg);
68968         int64_t ret_conv = ProbeSendFailure_clone_ptr(arg_conv);
68969         return ret_conv;
68970 }
68971
68972 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbeSendFailure_1clone(JNIEnv *env, jclass clz, int64_t orig) {
68973         LDKProbeSendFailure* orig_conv = (LDKProbeSendFailure*)untag_ptr(orig);
68974         LDKProbeSendFailure *ret_copy = MALLOC(sizeof(LDKProbeSendFailure), "LDKProbeSendFailure");
68975         *ret_copy = ProbeSendFailure_clone(orig_conv);
68976         int64_t ret_ref = tag_ptr(ret_copy, true);
68977         return ret_ref;
68978 }
68979
68980 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbeSendFailure_1route_1not_1found(JNIEnv *env, jclass clz) {
68981         LDKProbeSendFailure *ret_copy = MALLOC(sizeof(LDKProbeSendFailure), "LDKProbeSendFailure");
68982         *ret_copy = ProbeSendFailure_route_not_found();
68983         int64_t ret_ref = tag_ptr(ret_copy, true);
68984         return ret_ref;
68985 }
68986
68987 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbeSendFailure_1sending_1failed(JNIEnv *env, jclass clz, int64_t a) {
68988         void* a_ptr = untag_ptr(a);
68989         CHECK_ACCESS(a_ptr);
68990         LDKPaymentSendFailure a_conv = *(LDKPaymentSendFailure*)(a_ptr);
68991         a_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)untag_ptr(a));
68992         LDKProbeSendFailure *ret_copy = MALLOC(sizeof(LDKProbeSendFailure), "LDKProbeSendFailure");
68993         *ret_copy = ProbeSendFailure_sending_failed(a_conv);
68994         int64_t ret_ref = tag_ptr(ret_copy, true);
68995         return ret_ref;
68996 }
68997
68998 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ProbeSendFailure_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
68999         LDKProbeSendFailure* a_conv = (LDKProbeSendFailure*)untag_ptr(a);
69000         LDKProbeSendFailure* b_conv = (LDKProbeSendFailure*)untag_ptr(b);
69001         jboolean ret_conv = ProbeSendFailure_eq(a_conv, b_conv);
69002         return ret_conv;
69003 }
69004
69005 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RecipientOnionFields_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
69006         LDKRecipientOnionFields this_obj_conv;
69007         this_obj_conv.inner = untag_ptr(this_obj);
69008         this_obj_conv.is_owned = ptr_is_owned(this_obj);
69009         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
69010         RecipientOnionFields_free(this_obj_conv);
69011 }
69012
69013 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RecipientOnionFields_1get_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_ptr) {
69014         LDKRecipientOnionFields this_ptr_conv;
69015         this_ptr_conv.inner = untag_ptr(this_ptr);
69016         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69017         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69018         this_ptr_conv.is_owned = false;
69019         LDKCOption_ThirtyTwoBytesZ *ret_copy = MALLOC(sizeof(LDKCOption_ThirtyTwoBytesZ), "LDKCOption_ThirtyTwoBytesZ");
69020         *ret_copy = RecipientOnionFields_get_payment_secret(&this_ptr_conv);
69021         int64_t ret_ref = tag_ptr(ret_copy, true);
69022         return ret_ref;
69023 }
69024
69025 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RecipientOnionFields_1set_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
69026         LDKRecipientOnionFields this_ptr_conv;
69027         this_ptr_conv.inner = untag_ptr(this_ptr);
69028         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69029         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69030         this_ptr_conv.is_owned = false;
69031         void* val_ptr = untag_ptr(val);
69032         CHECK_ACCESS(val_ptr);
69033         LDKCOption_ThirtyTwoBytesZ val_conv = *(LDKCOption_ThirtyTwoBytesZ*)(val_ptr);
69034         val_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(val));
69035         RecipientOnionFields_set_payment_secret(&this_ptr_conv, val_conv);
69036 }
69037
69038 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RecipientOnionFields_1get_1payment_1metadata(JNIEnv *env, jclass clz, int64_t this_ptr) {
69039         LDKRecipientOnionFields this_ptr_conv;
69040         this_ptr_conv.inner = untag_ptr(this_ptr);
69041         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69042         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69043         this_ptr_conv.is_owned = false;
69044         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
69045         *ret_copy = RecipientOnionFields_get_payment_metadata(&this_ptr_conv);
69046         int64_t ret_ref = tag_ptr(ret_copy, true);
69047         return ret_ref;
69048 }
69049
69050 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RecipientOnionFields_1set_1payment_1metadata(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
69051         LDKRecipientOnionFields this_ptr_conv;
69052         this_ptr_conv.inner = untag_ptr(this_ptr);
69053         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69054         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69055         this_ptr_conv.is_owned = false;
69056         void* val_ptr = untag_ptr(val);
69057         CHECK_ACCESS(val_ptr);
69058         LDKCOption_CVec_u8ZZ val_conv = *(LDKCOption_CVec_u8ZZ*)(val_ptr);
69059         val_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(val));
69060         RecipientOnionFields_set_payment_metadata(&this_ptr_conv, val_conv);
69061 }
69062
69063 static inline uint64_t RecipientOnionFields_clone_ptr(LDKRecipientOnionFields *NONNULL_PTR arg) {
69064         LDKRecipientOnionFields ret_var = RecipientOnionFields_clone(arg);
69065         int64_t ret_ref = 0;
69066         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69067         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69068         return ret_ref;
69069 }
69070 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RecipientOnionFields_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
69071         LDKRecipientOnionFields arg_conv;
69072         arg_conv.inner = untag_ptr(arg);
69073         arg_conv.is_owned = ptr_is_owned(arg);
69074         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
69075         arg_conv.is_owned = false;
69076         int64_t ret_conv = RecipientOnionFields_clone_ptr(&arg_conv);
69077         return ret_conv;
69078 }
69079
69080 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RecipientOnionFields_1clone(JNIEnv *env, jclass clz, int64_t orig) {
69081         LDKRecipientOnionFields orig_conv;
69082         orig_conv.inner = untag_ptr(orig);
69083         orig_conv.is_owned = ptr_is_owned(orig);
69084         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
69085         orig_conv.is_owned = false;
69086         LDKRecipientOnionFields ret_var = RecipientOnionFields_clone(&orig_conv);
69087         int64_t ret_ref = 0;
69088         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69089         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69090         return ret_ref;
69091 }
69092
69093 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RecipientOnionFields_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
69094         LDKRecipientOnionFields a_conv;
69095         a_conv.inner = untag_ptr(a);
69096         a_conv.is_owned = ptr_is_owned(a);
69097         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
69098         a_conv.is_owned = false;
69099         LDKRecipientOnionFields b_conv;
69100         b_conv.inner = untag_ptr(b);
69101         b_conv.is_owned = ptr_is_owned(b);
69102         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
69103         b_conv.is_owned = false;
69104         jboolean ret_conv = RecipientOnionFields_eq(&a_conv, &b_conv);
69105         return ret_conv;
69106 }
69107
69108 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RecipientOnionFields_1write(JNIEnv *env, jclass clz, int64_t obj) {
69109         LDKRecipientOnionFields obj_conv;
69110         obj_conv.inner = untag_ptr(obj);
69111         obj_conv.is_owned = ptr_is_owned(obj);
69112         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
69113         obj_conv.is_owned = false;
69114         LDKCVec_u8Z ret_var = RecipientOnionFields_write(&obj_conv);
69115         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
69116         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
69117         CVec_u8Z_free(ret_var);
69118         return ret_arr;
69119 }
69120
69121 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RecipientOnionFields_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
69122         LDKu8slice ser_ref;
69123         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
69124         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
69125         LDKCResult_RecipientOnionFieldsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RecipientOnionFieldsDecodeErrorZ), "LDKCResult_RecipientOnionFieldsDecodeErrorZ");
69126         *ret_conv = RecipientOnionFields_read(ser_ref);
69127         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
69128         return tag_ptr(ret_conv, true);
69129 }
69130
69131 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RecipientOnionFields_1secret_1only(JNIEnv *env, jclass clz, int8_tArray payment_secret) {
69132         LDKThirtyTwoBytes payment_secret_ref;
69133         CHECK((*env)->GetArrayLength(env, payment_secret) == 32);
69134         (*env)->GetByteArrayRegion(env, payment_secret, 0, 32, payment_secret_ref.data);
69135         LDKRecipientOnionFields ret_var = RecipientOnionFields_secret_only(payment_secret_ref);
69136         int64_t ret_ref = 0;
69137         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69138         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69139         return ret_ref;
69140 }
69141
69142 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RecipientOnionFields_1spontaneous_1empty(JNIEnv *env, jclass clz) {
69143         LDKRecipientOnionFields ret_var = RecipientOnionFields_spontaneous_empty();
69144         int64_t ret_ref = 0;
69145         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69146         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69147         return ret_ref;
69148 }
69149
69150 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RecipientOnionFields_1with_1custom_1tlvs(JNIEnv *env, jclass clz, int64_t this_arg, int64_tArray custom_tlvs) {
69151         LDKRecipientOnionFields this_arg_conv;
69152         this_arg_conv.inner = untag_ptr(this_arg);
69153         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69154         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69155         this_arg_conv = RecipientOnionFields_clone(&this_arg_conv);
69156         LDKCVec_C2Tuple_u64CVec_u8ZZZ custom_tlvs_constr;
69157         custom_tlvs_constr.datalen = (*env)->GetArrayLength(env, custom_tlvs);
69158         if (custom_tlvs_constr.datalen > 0)
69159                 custom_tlvs_constr.data = MALLOC(custom_tlvs_constr.datalen * sizeof(LDKC2Tuple_u64CVec_u8ZZ), "LDKCVec_C2Tuple_u64CVec_u8ZZZ Elements");
69160         else
69161                 custom_tlvs_constr.data = NULL;
69162         int64_t* custom_tlvs_vals = (*env)->GetLongArrayElements (env, custom_tlvs, NULL);
69163         for (size_t x = 0; x < custom_tlvs_constr.datalen; x++) {
69164                 int64_t custom_tlvs_conv_23 = custom_tlvs_vals[x];
69165                 void* custom_tlvs_conv_23_ptr = untag_ptr(custom_tlvs_conv_23);
69166                 CHECK_ACCESS(custom_tlvs_conv_23_ptr);
69167                 LDKC2Tuple_u64CVec_u8ZZ custom_tlvs_conv_23_conv = *(LDKC2Tuple_u64CVec_u8ZZ*)(custom_tlvs_conv_23_ptr);
69168                 custom_tlvs_conv_23_conv = C2Tuple_u64CVec_u8ZZ_clone((LDKC2Tuple_u64CVec_u8ZZ*)untag_ptr(custom_tlvs_conv_23));
69169                 custom_tlvs_constr.data[x] = custom_tlvs_conv_23_conv;
69170         }
69171         (*env)->ReleaseLongArrayElements(env, custom_tlvs, custom_tlvs_vals, 0);
69172         LDKCResult_RecipientOnionFieldsNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecipientOnionFieldsNoneZ), "LDKCResult_RecipientOnionFieldsNoneZ");
69173         *ret_conv = RecipientOnionFields_with_custom_tlvs(this_arg_conv, custom_tlvs_constr);
69174         return tag_ptr(ret_conv, true);
69175 }
69176
69177 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_RecipientOnionFields_1custom_1tlvs(JNIEnv *env, jclass clz, int64_t this_arg) {
69178         LDKRecipientOnionFields this_arg_conv;
69179         this_arg_conv.inner = untag_ptr(this_arg);
69180         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69181         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69182         this_arg_conv.is_owned = false;
69183         LDKCVec_C2Tuple_u64CVec_u8ZZZ ret_var = RecipientOnionFields_custom_tlvs(&this_arg_conv);
69184         int64_tArray ret_arr = NULL;
69185         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
69186         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
69187         for (size_t x = 0; x < ret_var.datalen; x++) {
69188                 LDKC2Tuple_u64CVec_u8ZZ* ret_conv_23_conv = MALLOC(sizeof(LDKC2Tuple_u64CVec_u8ZZ), "LDKC2Tuple_u64CVec_u8ZZ");
69189                 *ret_conv_23_conv = ret_var.data[x];
69190                 ret_arr_ptr[x] = tag_ptr(ret_conv_23_conv, true);
69191         }
69192         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
69193         FREE(ret_var.data);
69194         return ret_arr;
69195 }
69196
69197 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CustomMessageReader_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
69198         if (!ptr_is_owned(this_ptr)) return;
69199         void* this_ptr_ptr = untag_ptr(this_ptr);
69200         CHECK_ACCESS(this_ptr_ptr);
69201         LDKCustomMessageReader this_ptr_conv = *(LDKCustomMessageReader*)(this_ptr_ptr);
69202         FREE(untag_ptr(this_ptr));
69203         CustomMessageReader_free(this_ptr_conv);
69204 }
69205
69206 static inline uint64_t Type_clone_ptr(LDKType *NONNULL_PTR arg) {
69207         LDKType* ret_ret = MALLOC(sizeof(LDKType), "LDKType");
69208         *ret_ret = Type_clone(arg);
69209         return tag_ptr(ret_ret, true);
69210 }
69211 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Type_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
69212         void* arg_ptr = untag_ptr(arg);
69213         if (ptr_is_owned(arg)) { CHECK_ACCESS(arg_ptr); }
69214         LDKType* arg_conv = (LDKType*)arg_ptr;
69215         int64_t ret_conv = Type_clone_ptr(arg_conv);
69216         return ret_conv;
69217 }
69218
69219 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Type_1clone(JNIEnv *env, jclass clz, int64_t orig) {
69220         void* orig_ptr = untag_ptr(orig);
69221         if (ptr_is_owned(orig)) { CHECK_ACCESS(orig_ptr); }
69222         LDKType* orig_conv = (LDKType*)orig_ptr;
69223         LDKType* ret_ret = MALLOC(sizeof(LDKType), "LDKType");
69224         *ret_ret = Type_clone(orig_conv);
69225         return tag_ptr(ret_ret, true);
69226 }
69227
69228 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Type_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
69229         if (!ptr_is_owned(this_ptr)) return;
69230         void* this_ptr_ptr = untag_ptr(this_ptr);
69231         CHECK_ACCESS(this_ptr_ptr);
69232         LDKType this_ptr_conv = *(LDKType*)(this_ptr_ptr);
69233         FREE(untag_ptr(this_ptr));
69234         Type_free(this_ptr_conv);
69235 }
69236
69237 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OfferId_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
69238         LDKOfferId this_obj_conv;
69239         this_obj_conv.inner = untag_ptr(this_obj);
69240         this_obj_conv.is_owned = ptr_is_owned(this_obj);
69241         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
69242         OfferId_free(this_obj_conv);
69243 }
69244
69245 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OfferId_1get_1a(JNIEnv *env, jclass clz, int64_t this_ptr) {
69246         LDKOfferId this_ptr_conv;
69247         this_ptr_conv.inner = untag_ptr(this_ptr);
69248         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69249         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69250         this_ptr_conv.is_owned = false;
69251         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
69252         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *OfferId_get_a(&this_ptr_conv));
69253         return ret_arr;
69254 }
69255
69256 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OfferId_1set_1a(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
69257         LDKOfferId this_ptr_conv;
69258         this_ptr_conv.inner = untag_ptr(this_ptr);
69259         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
69260         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
69261         this_ptr_conv.is_owned = false;
69262         LDKThirtyTwoBytes val_ref;
69263         CHECK((*env)->GetArrayLength(env, val) == 32);
69264         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
69265         OfferId_set_a(&this_ptr_conv, val_ref);
69266 }
69267
69268 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OfferId_1new(JNIEnv *env, jclass clz, int8_tArray a_arg) {
69269         LDKThirtyTwoBytes a_arg_ref;
69270         CHECK((*env)->GetArrayLength(env, a_arg) == 32);
69271         (*env)->GetByteArrayRegion(env, a_arg, 0, 32, a_arg_ref.data);
69272         LDKOfferId ret_var = OfferId_new(a_arg_ref);
69273         int64_t ret_ref = 0;
69274         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69275         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69276         return ret_ref;
69277 }
69278
69279 static inline uint64_t OfferId_clone_ptr(LDKOfferId *NONNULL_PTR arg) {
69280         LDKOfferId ret_var = OfferId_clone(arg);
69281         int64_t ret_ref = 0;
69282         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69283         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69284         return ret_ref;
69285 }
69286 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OfferId_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
69287         LDKOfferId arg_conv;
69288         arg_conv.inner = untag_ptr(arg);
69289         arg_conv.is_owned = ptr_is_owned(arg);
69290         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
69291         arg_conv.is_owned = false;
69292         int64_t ret_conv = OfferId_clone_ptr(&arg_conv);
69293         return ret_conv;
69294 }
69295
69296 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OfferId_1clone(JNIEnv *env, jclass clz, int64_t orig) {
69297         LDKOfferId orig_conv;
69298         orig_conv.inner = untag_ptr(orig);
69299         orig_conv.is_owned = ptr_is_owned(orig);
69300         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
69301         orig_conv.is_owned = false;
69302         LDKOfferId ret_var = OfferId_clone(&orig_conv);
69303         int64_t ret_ref = 0;
69304         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69305         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69306         return ret_ref;
69307 }
69308
69309 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_OfferId_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
69310         LDKOfferId a_conv;
69311         a_conv.inner = untag_ptr(a);
69312         a_conv.is_owned = ptr_is_owned(a);
69313         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
69314         a_conv.is_owned = false;
69315         LDKOfferId b_conv;
69316         b_conv.inner = untag_ptr(b);
69317         b_conv.is_owned = ptr_is_owned(b);
69318         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
69319         b_conv.is_owned = false;
69320         jboolean ret_conv = OfferId_eq(&a_conv, &b_conv);
69321         return ret_conv;
69322 }
69323
69324 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OfferId_1write(JNIEnv *env, jclass clz, int64_t obj) {
69325         LDKOfferId obj_conv;
69326         obj_conv.inner = untag_ptr(obj);
69327         obj_conv.is_owned = ptr_is_owned(obj);
69328         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
69329         obj_conv.is_owned = false;
69330         LDKCVec_u8Z ret_var = OfferId_write(&obj_conv);
69331         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
69332         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
69333         CVec_u8Z_free(ret_var);
69334         return ret_arr;
69335 }
69336
69337 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OfferId_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
69338         LDKu8slice ser_ref;
69339         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
69340         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
69341         LDKCResult_OfferIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferIdDecodeErrorZ), "LDKCResult_OfferIdDecodeErrorZ");
69342         *ret_conv = OfferId_read(ser_ref);
69343         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
69344         return tag_ptr(ret_conv, true);
69345 }
69346
69347 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OfferWithExplicitMetadataBuilder_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
69348         LDKOfferWithExplicitMetadataBuilder this_obj_conv;
69349         this_obj_conv.inner = untag_ptr(this_obj);
69350         this_obj_conv.is_owned = ptr_is_owned(this_obj);
69351         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
69352         OfferWithExplicitMetadataBuilder_free(this_obj_conv);
69353 }
69354
69355 static inline uint64_t OfferWithExplicitMetadataBuilder_clone_ptr(LDKOfferWithExplicitMetadataBuilder *NONNULL_PTR arg) {
69356         LDKOfferWithExplicitMetadataBuilder ret_var = OfferWithExplicitMetadataBuilder_clone(arg);
69357         int64_t ret_ref = 0;
69358         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69359         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69360         return ret_ref;
69361 }
69362 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OfferWithExplicitMetadataBuilder_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
69363         LDKOfferWithExplicitMetadataBuilder arg_conv;
69364         arg_conv.inner = untag_ptr(arg);
69365         arg_conv.is_owned = ptr_is_owned(arg);
69366         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
69367         arg_conv.is_owned = false;
69368         int64_t ret_conv = OfferWithExplicitMetadataBuilder_clone_ptr(&arg_conv);
69369         return ret_conv;
69370 }
69371
69372 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OfferWithExplicitMetadataBuilder_1clone(JNIEnv *env, jclass clz, int64_t orig) {
69373         LDKOfferWithExplicitMetadataBuilder orig_conv;
69374         orig_conv.inner = untag_ptr(orig);
69375         orig_conv.is_owned = ptr_is_owned(orig);
69376         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
69377         orig_conv.is_owned = false;
69378         LDKOfferWithExplicitMetadataBuilder ret_var = OfferWithExplicitMetadataBuilder_clone(&orig_conv);
69379         int64_t ret_ref = 0;
69380         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69381         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69382         return ret_ref;
69383 }
69384
69385 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OfferWithDerivedMetadataBuilder_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
69386         LDKOfferWithDerivedMetadataBuilder this_obj_conv;
69387         this_obj_conv.inner = untag_ptr(this_obj);
69388         this_obj_conv.is_owned = ptr_is_owned(this_obj);
69389         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
69390         OfferWithDerivedMetadataBuilder_free(this_obj_conv);
69391 }
69392
69393 static inline uint64_t OfferWithDerivedMetadataBuilder_clone_ptr(LDKOfferWithDerivedMetadataBuilder *NONNULL_PTR arg) {
69394         LDKOfferWithDerivedMetadataBuilder ret_var = OfferWithDerivedMetadataBuilder_clone(arg);
69395         int64_t ret_ref = 0;
69396         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69397         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69398         return ret_ref;
69399 }
69400 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OfferWithDerivedMetadataBuilder_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
69401         LDKOfferWithDerivedMetadataBuilder arg_conv;
69402         arg_conv.inner = untag_ptr(arg);
69403         arg_conv.is_owned = ptr_is_owned(arg);
69404         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
69405         arg_conv.is_owned = false;
69406         int64_t ret_conv = OfferWithDerivedMetadataBuilder_clone_ptr(&arg_conv);
69407         return ret_conv;
69408 }
69409
69410 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OfferWithDerivedMetadataBuilder_1clone(JNIEnv *env, jclass clz, int64_t orig) {
69411         LDKOfferWithDerivedMetadataBuilder orig_conv;
69412         orig_conv.inner = untag_ptr(orig);
69413         orig_conv.is_owned = ptr_is_owned(orig);
69414         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
69415         orig_conv.is_owned = false;
69416         LDKOfferWithDerivedMetadataBuilder ret_var = OfferWithDerivedMetadataBuilder_clone(&orig_conv);
69417         int64_t ret_ref = 0;
69418         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69419         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69420         return ret_ref;
69421 }
69422
69423 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OfferWithExplicitMetadataBuilder_1new(JNIEnv *env, jclass clz, int8_tArray signing_pubkey) {
69424         LDKPublicKey signing_pubkey_ref;
69425         CHECK((*env)->GetArrayLength(env, signing_pubkey) == 33);
69426         (*env)->GetByteArrayRegion(env, signing_pubkey, 0, 33, signing_pubkey_ref.compressed_form);
69427         LDKOfferWithExplicitMetadataBuilder ret_var = OfferWithExplicitMetadataBuilder_new(signing_pubkey_ref);
69428         int64_t ret_ref = 0;
69429         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69430         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69431         return ret_ref;
69432 }
69433
69434 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OfferWithExplicitMetadataBuilder_1metadata(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray metadata) {
69435         LDKOfferWithExplicitMetadataBuilder this_arg_conv;
69436         this_arg_conv.inner = untag_ptr(this_arg);
69437         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69438         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69439         this_arg_conv = OfferWithExplicitMetadataBuilder_clone(&this_arg_conv);
69440         LDKCVec_u8Z metadata_ref;
69441         metadata_ref.datalen = (*env)->GetArrayLength(env, metadata);
69442         metadata_ref.data = MALLOC(metadata_ref.datalen, "LDKCVec_u8Z Bytes");
69443         (*env)->GetByteArrayRegion(env, metadata, 0, metadata_ref.datalen, metadata_ref.data);
69444         LDKCResult_NoneBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt12SemanticErrorZ), "LDKCResult_NoneBolt12SemanticErrorZ");
69445         *ret_conv = OfferWithExplicitMetadataBuilder_metadata(this_arg_conv, metadata_ref);
69446         return tag_ptr(ret_conv, true);
69447 }
69448
69449 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OfferWithExplicitMetadataBuilder_1chain(JNIEnv *env, jclass clz, int64_t this_arg, jclass network) {
69450         LDKOfferWithExplicitMetadataBuilder this_arg_conv;
69451         this_arg_conv.inner = untag_ptr(this_arg);
69452         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69453         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69454         this_arg_conv = OfferWithExplicitMetadataBuilder_clone(&this_arg_conv);
69455         LDKNetwork network_conv = LDKNetwork_from_java(env, network);
69456         OfferWithExplicitMetadataBuilder_chain(this_arg_conv, network_conv);
69457 }
69458
69459 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OfferWithExplicitMetadataBuilder_1amount_1msats(JNIEnv *env, jclass clz, int64_t this_arg, int64_t amount_msats) {
69460         LDKOfferWithExplicitMetadataBuilder this_arg_conv;
69461         this_arg_conv.inner = untag_ptr(this_arg);
69462         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69463         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69464         this_arg_conv = OfferWithExplicitMetadataBuilder_clone(&this_arg_conv);
69465         OfferWithExplicitMetadataBuilder_amount_msats(this_arg_conv, amount_msats);
69466 }
69467
69468 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OfferWithExplicitMetadataBuilder_1absolute_1expiry(JNIEnv *env, jclass clz, int64_t this_arg, int64_t absolute_expiry) {
69469         LDKOfferWithExplicitMetadataBuilder this_arg_conv;
69470         this_arg_conv.inner = untag_ptr(this_arg);
69471         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69472         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69473         this_arg_conv = OfferWithExplicitMetadataBuilder_clone(&this_arg_conv);
69474         OfferWithExplicitMetadataBuilder_absolute_expiry(this_arg_conv, absolute_expiry);
69475 }
69476
69477 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OfferWithExplicitMetadataBuilder_1description(JNIEnv *env, jclass clz, int64_t this_arg, jstring description) {
69478         LDKOfferWithExplicitMetadataBuilder this_arg_conv;
69479         this_arg_conv.inner = untag_ptr(this_arg);
69480         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69481         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69482         this_arg_conv = OfferWithExplicitMetadataBuilder_clone(&this_arg_conv);
69483         LDKStr description_conv = java_to_owned_str(env, description);
69484         OfferWithExplicitMetadataBuilder_description(this_arg_conv, description_conv);
69485 }
69486
69487 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OfferWithExplicitMetadataBuilder_1issuer(JNIEnv *env, jclass clz, int64_t this_arg, jstring issuer) {
69488         LDKOfferWithExplicitMetadataBuilder this_arg_conv;
69489         this_arg_conv.inner = untag_ptr(this_arg);
69490         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69491         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69492         this_arg_conv = OfferWithExplicitMetadataBuilder_clone(&this_arg_conv);
69493         LDKStr issuer_conv = java_to_owned_str(env, issuer);
69494         OfferWithExplicitMetadataBuilder_issuer(this_arg_conv, issuer_conv);
69495 }
69496
69497 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OfferWithExplicitMetadataBuilder_1path(JNIEnv *env, jclass clz, int64_t this_arg, int64_t path) {
69498         LDKOfferWithExplicitMetadataBuilder this_arg_conv;
69499         this_arg_conv.inner = untag_ptr(this_arg);
69500         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69501         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69502         this_arg_conv = OfferWithExplicitMetadataBuilder_clone(&this_arg_conv);
69503         LDKBlindedPath path_conv;
69504         path_conv.inner = untag_ptr(path);
69505         path_conv.is_owned = ptr_is_owned(path);
69506         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
69507         path_conv = BlindedPath_clone(&path_conv);
69508         OfferWithExplicitMetadataBuilder_path(this_arg_conv, path_conv);
69509 }
69510
69511 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OfferWithExplicitMetadataBuilder_1supported_1quantity(JNIEnv *env, jclass clz, int64_t this_arg, int64_t quantity) {
69512         LDKOfferWithExplicitMetadataBuilder this_arg_conv;
69513         this_arg_conv.inner = untag_ptr(this_arg);
69514         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69515         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69516         this_arg_conv = OfferWithExplicitMetadataBuilder_clone(&this_arg_conv);
69517         void* quantity_ptr = untag_ptr(quantity);
69518         CHECK_ACCESS(quantity_ptr);
69519         LDKQuantity quantity_conv = *(LDKQuantity*)(quantity_ptr);
69520         quantity_conv = Quantity_clone((LDKQuantity*)untag_ptr(quantity));
69521         OfferWithExplicitMetadataBuilder_supported_quantity(this_arg_conv, quantity_conv);
69522 }
69523
69524 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OfferWithExplicitMetadataBuilder_1build(JNIEnv *env, jclass clz, int64_t this_arg) {
69525         LDKOfferWithExplicitMetadataBuilder this_arg_conv;
69526         this_arg_conv.inner = untag_ptr(this_arg);
69527         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69528         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69529         this_arg_conv = OfferWithExplicitMetadataBuilder_clone(&this_arg_conv);
69530         LDKCResult_OfferBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferBolt12SemanticErrorZ), "LDKCResult_OfferBolt12SemanticErrorZ");
69531         *ret_conv = OfferWithExplicitMetadataBuilder_build(this_arg_conv);
69532         return tag_ptr(ret_conv, true);
69533 }
69534
69535 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OfferWithDerivedMetadataBuilder_1deriving_1signing_1pubkey(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t expanded_key, int64_t entropy_source) {
69536         LDKPublicKey node_id_ref;
69537         CHECK((*env)->GetArrayLength(env, node_id) == 33);
69538         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
69539         LDKExpandedKey expanded_key_conv;
69540         expanded_key_conv.inner = untag_ptr(expanded_key);
69541         expanded_key_conv.is_owned = ptr_is_owned(expanded_key);
69542         CHECK_INNER_FIELD_ACCESS_OR_NULL(expanded_key_conv);
69543         expanded_key_conv.is_owned = false;
69544         void* entropy_source_ptr = untag_ptr(entropy_source);
69545         CHECK_ACCESS(entropy_source_ptr);
69546         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
69547         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
69548                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
69549                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
69550         }
69551         LDKOfferWithDerivedMetadataBuilder ret_var = OfferWithDerivedMetadataBuilder_deriving_signing_pubkey(node_id_ref, &expanded_key_conv, entropy_source_conv);
69552         int64_t ret_ref = 0;
69553         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69554         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69555         return ret_ref;
69556 }
69557
69558 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OfferWithDerivedMetadataBuilder_1chain(JNIEnv *env, jclass clz, int64_t this_arg, jclass network) {
69559         LDKOfferWithDerivedMetadataBuilder this_arg_conv;
69560         this_arg_conv.inner = untag_ptr(this_arg);
69561         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69562         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69563         this_arg_conv = OfferWithDerivedMetadataBuilder_clone(&this_arg_conv);
69564         LDKNetwork network_conv = LDKNetwork_from_java(env, network);
69565         OfferWithDerivedMetadataBuilder_chain(this_arg_conv, network_conv);
69566 }
69567
69568 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OfferWithDerivedMetadataBuilder_1amount_1msats(JNIEnv *env, jclass clz, int64_t this_arg, int64_t amount_msats) {
69569         LDKOfferWithDerivedMetadataBuilder this_arg_conv;
69570         this_arg_conv.inner = untag_ptr(this_arg);
69571         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69572         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69573         this_arg_conv = OfferWithDerivedMetadataBuilder_clone(&this_arg_conv);
69574         OfferWithDerivedMetadataBuilder_amount_msats(this_arg_conv, amount_msats);
69575 }
69576
69577 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OfferWithDerivedMetadataBuilder_1absolute_1expiry(JNIEnv *env, jclass clz, int64_t this_arg, int64_t absolute_expiry) {
69578         LDKOfferWithDerivedMetadataBuilder this_arg_conv;
69579         this_arg_conv.inner = untag_ptr(this_arg);
69580         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69581         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69582         this_arg_conv = OfferWithDerivedMetadataBuilder_clone(&this_arg_conv);
69583         OfferWithDerivedMetadataBuilder_absolute_expiry(this_arg_conv, absolute_expiry);
69584 }
69585
69586 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OfferWithDerivedMetadataBuilder_1description(JNIEnv *env, jclass clz, int64_t this_arg, jstring description) {
69587         LDKOfferWithDerivedMetadataBuilder 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 = OfferWithDerivedMetadataBuilder_clone(&this_arg_conv);
69592         LDKStr description_conv = java_to_owned_str(env, description);
69593         OfferWithDerivedMetadataBuilder_description(this_arg_conv, description_conv);
69594 }
69595
69596 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OfferWithDerivedMetadataBuilder_1issuer(JNIEnv *env, jclass clz, int64_t this_arg, jstring issuer) {
69597         LDKOfferWithDerivedMetadataBuilder this_arg_conv;
69598         this_arg_conv.inner = untag_ptr(this_arg);
69599         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69600         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69601         this_arg_conv = OfferWithDerivedMetadataBuilder_clone(&this_arg_conv);
69602         LDKStr issuer_conv = java_to_owned_str(env, issuer);
69603         OfferWithDerivedMetadataBuilder_issuer(this_arg_conv, issuer_conv);
69604 }
69605
69606 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OfferWithDerivedMetadataBuilder_1path(JNIEnv *env, jclass clz, int64_t this_arg, int64_t path) {
69607         LDKOfferWithDerivedMetadataBuilder this_arg_conv;
69608         this_arg_conv.inner = untag_ptr(this_arg);
69609         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69610         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69611         this_arg_conv = OfferWithDerivedMetadataBuilder_clone(&this_arg_conv);
69612         LDKBlindedPath path_conv;
69613         path_conv.inner = untag_ptr(path);
69614         path_conv.is_owned = ptr_is_owned(path);
69615         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
69616         path_conv = BlindedPath_clone(&path_conv);
69617         OfferWithDerivedMetadataBuilder_path(this_arg_conv, path_conv);
69618 }
69619
69620 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OfferWithDerivedMetadataBuilder_1supported_1quantity(JNIEnv *env, jclass clz, int64_t this_arg, int64_t quantity) {
69621         LDKOfferWithDerivedMetadataBuilder this_arg_conv;
69622         this_arg_conv.inner = untag_ptr(this_arg);
69623         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69624         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69625         this_arg_conv = OfferWithDerivedMetadataBuilder_clone(&this_arg_conv);
69626         void* quantity_ptr = untag_ptr(quantity);
69627         CHECK_ACCESS(quantity_ptr);
69628         LDKQuantity quantity_conv = *(LDKQuantity*)(quantity_ptr);
69629         quantity_conv = Quantity_clone((LDKQuantity*)untag_ptr(quantity));
69630         OfferWithDerivedMetadataBuilder_supported_quantity(this_arg_conv, quantity_conv);
69631 }
69632
69633 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OfferWithDerivedMetadataBuilder_1build(JNIEnv *env, jclass clz, int64_t this_arg) {
69634         LDKOfferWithDerivedMetadataBuilder this_arg_conv;
69635         this_arg_conv.inner = untag_ptr(this_arg);
69636         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69637         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69638         this_arg_conv = OfferWithDerivedMetadataBuilder_clone(&this_arg_conv);
69639         LDKCResult_OfferBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferBolt12SemanticErrorZ), "LDKCResult_OfferBolt12SemanticErrorZ");
69640         *ret_conv = OfferWithDerivedMetadataBuilder_build(this_arg_conv);
69641         return tag_ptr(ret_conv, true);
69642 }
69643
69644 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Offer_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
69645         LDKOffer this_obj_conv;
69646         this_obj_conv.inner = untag_ptr(this_obj);
69647         this_obj_conv.is_owned = ptr_is_owned(this_obj);
69648         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
69649         Offer_free(this_obj_conv);
69650 }
69651
69652 static inline uint64_t Offer_clone_ptr(LDKOffer *NONNULL_PTR arg) {
69653         LDKOffer ret_var = Offer_clone(arg);
69654         int64_t ret_ref = 0;
69655         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69656         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69657         return ret_ref;
69658 }
69659 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Offer_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
69660         LDKOffer arg_conv;
69661         arg_conv.inner = untag_ptr(arg);
69662         arg_conv.is_owned = ptr_is_owned(arg);
69663         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
69664         arg_conv.is_owned = false;
69665         int64_t ret_conv = Offer_clone_ptr(&arg_conv);
69666         return ret_conv;
69667 }
69668
69669 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Offer_1clone(JNIEnv *env, jclass clz, int64_t orig) {
69670         LDKOffer orig_conv;
69671         orig_conv.inner = untag_ptr(orig);
69672         orig_conv.is_owned = ptr_is_owned(orig);
69673         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
69674         orig_conv.is_owned = false;
69675         LDKOffer ret_var = Offer_clone(&orig_conv);
69676         int64_t ret_ref = 0;
69677         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69678         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69679         return ret_ref;
69680 }
69681
69682 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_Offer_1chains(JNIEnv *env, jclass clz, int64_t this_arg) {
69683         LDKOffer this_arg_conv;
69684         this_arg_conv.inner = untag_ptr(this_arg);
69685         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69686         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69687         this_arg_conv.is_owned = false;
69688         LDKCVec_ThirtyTwoBytesZ ret_var = Offer_chains(&this_arg_conv);
69689         jobjectArray ret_arr = NULL;
69690         ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
69691         ;
69692         for (size_t i = 0; i < ret_var.datalen; i++) {
69693                 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, 32);
69694                 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, 32, ret_var.data[i].data);
69695                 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
69696         }
69697         
69698         FREE(ret_var.data);
69699         return ret_arr;
69700 }
69701
69702 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Offer_1metadata(JNIEnv *env, jclass clz, int64_t this_arg) {
69703         LDKOffer this_arg_conv;
69704         this_arg_conv.inner = untag_ptr(this_arg);
69705         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69706         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69707         this_arg_conv.is_owned = false;
69708         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
69709         *ret_copy = Offer_metadata(&this_arg_conv);
69710         int64_t ret_ref = tag_ptr(ret_copy, true);
69711         return ret_ref;
69712 }
69713
69714 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Offer_1amount(JNIEnv *env, jclass clz, int64_t this_arg) {
69715         LDKOffer this_arg_conv;
69716         this_arg_conv.inner = untag_ptr(this_arg);
69717         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69718         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69719         this_arg_conv.is_owned = false;
69720         LDKCOption_AmountZ *ret_copy = MALLOC(sizeof(LDKCOption_AmountZ), "LDKCOption_AmountZ");
69721         *ret_copy = Offer_amount(&this_arg_conv);
69722         int64_t ret_ref = tag_ptr(ret_copy, true);
69723         return ret_ref;
69724 }
69725
69726 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Offer_1description(JNIEnv *env, jclass clz, int64_t this_arg) {
69727         LDKOffer this_arg_conv;
69728         this_arg_conv.inner = untag_ptr(this_arg);
69729         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69730         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69731         this_arg_conv.is_owned = false;
69732         LDKPrintableString ret_var = Offer_description(&this_arg_conv);
69733         int64_t ret_ref = 0;
69734         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69735         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69736         return ret_ref;
69737 }
69738
69739 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Offer_1offer_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
69740         LDKOffer this_arg_conv;
69741         this_arg_conv.inner = untag_ptr(this_arg);
69742         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69743         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69744         this_arg_conv.is_owned = false;
69745         LDKOfferFeatures ret_var = Offer_offer_features(&this_arg_conv);
69746         int64_t ret_ref = 0;
69747         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69748         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69749         return ret_ref;
69750 }
69751
69752 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Offer_1absolute_1expiry(JNIEnv *env, jclass clz, int64_t this_arg) {
69753         LDKOffer this_arg_conv;
69754         this_arg_conv.inner = untag_ptr(this_arg);
69755         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69756         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69757         this_arg_conv.is_owned = false;
69758         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
69759         *ret_copy = Offer_absolute_expiry(&this_arg_conv);
69760         int64_t ret_ref = tag_ptr(ret_copy, true);
69761         return ret_ref;
69762 }
69763
69764 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Offer_1issuer(JNIEnv *env, jclass clz, int64_t this_arg) {
69765         LDKOffer this_arg_conv;
69766         this_arg_conv.inner = untag_ptr(this_arg);
69767         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69768         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69769         this_arg_conv.is_owned = false;
69770         LDKPrintableString ret_var = Offer_issuer(&this_arg_conv);
69771         int64_t ret_ref = 0;
69772         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69773         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69774         return ret_ref;
69775 }
69776
69777 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_Offer_1paths(JNIEnv *env, jclass clz, int64_t this_arg) {
69778         LDKOffer this_arg_conv;
69779         this_arg_conv.inner = untag_ptr(this_arg);
69780         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69781         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69782         this_arg_conv.is_owned = false;
69783         LDKCVec_BlindedPathZ ret_var = Offer_paths(&this_arg_conv);
69784         int64_tArray ret_arr = NULL;
69785         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
69786         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
69787         for (size_t n = 0; n < ret_var.datalen; n++) {
69788                 LDKBlindedPath ret_conv_13_var = ret_var.data[n];
69789                 int64_t ret_conv_13_ref = 0;
69790                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_13_var);
69791                 ret_conv_13_ref = tag_ptr(ret_conv_13_var.inner, ret_conv_13_var.is_owned);
69792                 ret_arr_ptr[n] = ret_conv_13_ref;
69793         }
69794         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
69795         FREE(ret_var.data);
69796         return ret_arr;
69797 }
69798
69799 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Offer_1supported_1quantity(JNIEnv *env, jclass clz, int64_t this_arg) {
69800         LDKOffer this_arg_conv;
69801         this_arg_conv.inner = untag_ptr(this_arg);
69802         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69803         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69804         this_arg_conv.is_owned = false;
69805         LDKQuantity *ret_copy = MALLOC(sizeof(LDKQuantity), "LDKQuantity");
69806         *ret_copy = Offer_supported_quantity(&this_arg_conv);
69807         int64_t ret_ref = tag_ptr(ret_copy, true);
69808         return ret_ref;
69809 }
69810
69811 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Offer_1signing_1pubkey(JNIEnv *env, jclass clz, int64_t this_arg) {
69812         LDKOffer this_arg_conv;
69813         this_arg_conv.inner = untag_ptr(this_arg);
69814         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69815         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69816         this_arg_conv.is_owned = false;
69817         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
69818         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, Offer_signing_pubkey(&this_arg_conv).compressed_form);
69819         return ret_arr;
69820 }
69821
69822 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Offer_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
69823         LDKOffer this_arg_conv;
69824         this_arg_conv.inner = untag_ptr(this_arg);
69825         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69826         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69827         this_arg_conv.is_owned = false;
69828         LDKOfferId ret_var = Offer_id(&this_arg_conv);
69829         int64_t ret_ref = 0;
69830         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
69831         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
69832         return ret_ref;
69833 }
69834
69835 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Offer_1supports_1chain(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray chain) {
69836         LDKOffer this_arg_conv;
69837         this_arg_conv.inner = untag_ptr(this_arg);
69838         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69839         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69840         this_arg_conv.is_owned = false;
69841         LDKThirtyTwoBytes chain_ref;
69842         CHECK((*env)->GetArrayLength(env, chain) == 32);
69843         (*env)->GetByteArrayRegion(env, chain, 0, 32, chain_ref.data);
69844         jboolean ret_conv = Offer_supports_chain(&this_arg_conv, chain_ref);
69845         return ret_conv;
69846 }
69847
69848 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Offer_1is_1expired(JNIEnv *env, jclass clz, int64_t this_arg) {
69849         LDKOffer this_arg_conv;
69850         this_arg_conv.inner = untag_ptr(this_arg);
69851         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69852         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69853         this_arg_conv.is_owned = false;
69854         jboolean ret_conv = Offer_is_expired(&this_arg_conv);
69855         return ret_conv;
69856 }
69857
69858 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) {
69859         LDKOffer this_arg_conv;
69860         this_arg_conv.inner = untag_ptr(this_arg);
69861         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69862         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69863         this_arg_conv.is_owned = false;
69864         jboolean ret_conv = Offer_is_expired_no_std(&this_arg_conv, duration_since_epoch);
69865         return ret_conv;
69866 }
69867
69868 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Offer_1is_1valid_1quantity(JNIEnv *env, jclass clz, int64_t this_arg, int64_t quantity) {
69869         LDKOffer this_arg_conv;
69870         this_arg_conv.inner = untag_ptr(this_arg);
69871         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69872         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69873         this_arg_conv.is_owned = false;
69874         jboolean ret_conv = Offer_is_valid_quantity(&this_arg_conv, quantity);
69875         return ret_conv;
69876 }
69877
69878 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Offer_1expects_1quantity(JNIEnv *env, jclass clz, int64_t this_arg) {
69879         LDKOffer this_arg_conv;
69880         this_arg_conv.inner = untag_ptr(this_arg);
69881         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69882         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69883         this_arg_conv.is_owned = false;
69884         jboolean ret_conv = Offer_expects_quantity(&this_arg_conv);
69885         return ret_conv;
69886 }
69887
69888 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Offer_1request_1invoice_1deriving_1payer_1id(JNIEnv *env, jclass clz, int64_t this_arg, int64_t expanded_key, int64_t entropy_source, int8_tArray payment_id) {
69889         LDKOffer this_arg_conv;
69890         this_arg_conv.inner = untag_ptr(this_arg);
69891         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69892         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69893         this_arg_conv.is_owned = false;
69894         LDKExpandedKey expanded_key_conv;
69895         expanded_key_conv.inner = untag_ptr(expanded_key);
69896         expanded_key_conv.is_owned = ptr_is_owned(expanded_key);
69897         CHECK_INNER_FIELD_ACCESS_OR_NULL(expanded_key_conv);
69898         expanded_key_conv.is_owned = false;
69899         void* entropy_source_ptr = untag_ptr(entropy_source);
69900         CHECK_ACCESS(entropy_source_ptr);
69901         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
69902         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
69903                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
69904                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
69905         }
69906         LDKThirtyTwoBytes payment_id_ref;
69907         CHECK((*env)->GetArrayLength(env, payment_id) == 32);
69908         (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
69909         LDKCResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ), "LDKCResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ");
69910         *ret_conv = Offer_request_invoice_deriving_payer_id(&this_arg_conv, &expanded_key_conv, entropy_source_conv, payment_id_ref);
69911         return tag_ptr(ret_conv, true);
69912 }
69913
69914 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Offer_1request_1invoice_1deriving_1metadata(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray payer_id, int64_t expanded_key, int64_t entropy_source, int8_tArray payment_id) {
69915         LDKOffer this_arg_conv;
69916         this_arg_conv.inner = untag_ptr(this_arg);
69917         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69918         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69919         this_arg_conv.is_owned = false;
69920         LDKPublicKey payer_id_ref;
69921         CHECK((*env)->GetArrayLength(env, payer_id) == 33);
69922         (*env)->GetByteArrayRegion(env, payer_id, 0, 33, payer_id_ref.compressed_form);
69923         LDKExpandedKey expanded_key_conv;
69924         expanded_key_conv.inner = untag_ptr(expanded_key);
69925         expanded_key_conv.is_owned = ptr_is_owned(expanded_key);
69926         CHECK_INNER_FIELD_ACCESS_OR_NULL(expanded_key_conv);
69927         expanded_key_conv.is_owned = false;
69928         void* entropy_source_ptr = untag_ptr(entropy_source);
69929         CHECK_ACCESS(entropy_source_ptr);
69930         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
69931         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
69932                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
69933                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
69934         }
69935         LDKThirtyTwoBytes payment_id_ref;
69936         CHECK((*env)->GetArrayLength(env, payment_id) == 32);
69937         (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
69938         LDKCResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ), "LDKCResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ");
69939         *ret_conv = Offer_request_invoice_deriving_metadata(&this_arg_conv, payer_id_ref, &expanded_key_conv, entropy_source_conv, payment_id_ref);
69940         return tag_ptr(ret_conv, true);
69941 }
69942
69943 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Offer_1request_1invoice(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray metadata, int8_tArray payer_id) {
69944         LDKOffer this_arg_conv;
69945         this_arg_conv.inner = untag_ptr(this_arg);
69946         this_arg_conv.is_owned = ptr_is_owned(this_arg);
69947         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
69948         this_arg_conv.is_owned = false;
69949         LDKCVec_u8Z metadata_ref;
69950         metadata_ref.datalen = (*env)->GetArrayLength(env, metadata);
69951         metadata_ref.data = MALLOC(metadata_ref.datalen, "LDKCVec_u8Z Bytes");
69952         (*env)->GetByteArrayRegion(env, metadata, 0, metadata_ref.datalen, metadata_ref.data);
69953         LDKPublicKey payer_id_ref;
69954         CHECK((*env)->GetArrayLength(env, payer_id) == 33);
69955         (*env)->GetByteArrayRegion(env, payer_id, 0, 33, payer_id_ref.compressed_form);
69956         LDKCResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ), "LDKCResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ");
69957         *ret_conv = Offer_request_invoice(&this_arg_conv, metadata_ref, payer_id_ref);
69958         return tag_ptr(ret_conv, true);
69959 }
69960
69961 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Offer_1hash(JNIEnv *env, jclass clz, int64_t o) {
69962         LDKOffer o_conv;
69963         o_conv.inner = untag_ptr(o);
69964         o_conv.is_owned = ptr_is_owned(o);
69965         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
69966         o_conv.is_owned = false;
69967         int64_t ret_conv = Offer_hash(&o_conv);
69968         return ret_conv;
69969 }
69970
69971 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Offer_1write(JNIEnv *env, jclass clz, int64_t obj) {
69972         LDKOffer obj_conv;
69973         obj_conv.inner = untag_ptr(obj);
69974         obj_conv.is_owned = ptr_is_owned(obj);
69975         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
69976         obj_conv.is_owned = false;
69977         LDKCVec_u8Z ret_var = Offer_write(&obj_conv);
69978         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
69979         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
69980         CVec_u8Z_free(ret_var);
69981         return ret_arr;
69982 }
69983
69984 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Amount_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
69985         if (!ptr_is_owned(this_ptr)) return;
69986         void* this_ptr_ptr = untag_ptr(this_ptr);
69987         CHECK_ACCESS(this_ptr_ptr);
69988         LDKAmount this_ptr_conv = *(LDKAmount*)(this_ptr_ptr);
69989         FREE(untag_ptr(this_ptr));
69990         Amount_free(this_ptr_conv);
69991 }
69992
69993 static inline uint64_t Amount_clone_ptr(LDKAmount *NONNULL_PTR arg) {
69994         LDKAmount *ret_copy = MALLOC(sizeof(LDKAmount), "LDKAmount");
69995         *ret_copy = Amount_clone(arg);
69996         int64_t ret_ref = tag_ptr(ret_copy, true);
69997         return ret_ref;
69998 }
69999 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Amount_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
70000         LDKAmount* arg_conv = (LDKAmount*)untag_ptr(arg);
70001         int64_t ret_conv = Amount_clone_ptr(arg_conv);
70002         return ret_conv;
70003 }
70004
70005 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Amount_1clone(JNIEnv *env, jclass clz, int64_t orig) {
70006         LDKAmount* orig_conv = (LDKAmount*)untag_ptr(orig);
70007         LDKAmount *ret_copy = MALLOC(sizeof(LDKAmount), "LDKAmount");
70008         *ret_copy = Amount_clone(orig_conv);
70009         int64_t ret_ref = tag_ptr(ret_copy, true);
70010         return ret_ref;
70011 }
70012
70013 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Amount_1bitcoin(JNIEnv *env, jclass clz, int64_t amount_msats) {
70014         LDKAmount *ret_copy = MALLOC(sizeof(LDKAmount), "LDKAmount");
70015         *ret_copy = Amount_bitcoin(amount_msats);
70016         int64_t ret_ref = tag_ptr(ret_copy, true);
70017         return ret_ref;
70018 }
70019
70020 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Amount_1currency(JNIEnv *env, jclass clz, int8_tArray iso4217_code, int64_t amount) {
70021         LDKThreeBytes iso4217_code_ref;
70022         CHECK((*env)->GetArrayLength(env, iso4217_code) == 3);
70023         (*env)->GetByteArrayRegion(env, iso4217_code, 0, 3, iso4217_code_ref.data);
70024         LDKAmount *ret_copy = MALLOC(sizeof(LDKAmount), "LDKAmount");
70025         *ret_copy = Amount_currency(iso4217_code_ref, amount);
70026         int64_t ret_ref = tag_ptr(ret_copy, true);
70027         return ret_ref;
70028 }
70029
70030 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Quantity_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
70031         if (!ptr_is_owned(this_ptr)) return;
70032         void* this_ptr_ptr = untag_ptr(this_ptr);
70033         CHECK_ACCESS(this_ptr_ptr);
70034         LDKQuantity this_ptr_conv = *(LDKQuantity*)(this_ptr_ptr);
70035         FREE(untag_ptr(this_ptr));
70036         Quantity_free(this_ptr_conv);
70037 }
70038
70039 static inline uint64_t Quantity_clone_ptr(LDKQuantity *NONNULL_PTR arg) {
70040         LDKQuantity *ret_copy = MALLOC(sizeof(LDKQuantity), "LDKQuantity");
70041         *ret_copy = Quantity_clone(arg);
70042         int64_t ret_ref = tag_ptr(ret_copy, true);
70043         return ret_ref;
70044 }
70045 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Quantity_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
70046         LDKQuantity* arg_conv = (LDKQuantity*)untag_ptr(arg);
70047         int64_t ret_conv = Quantity_clone_ptr(arg_conv);
70048         return ret_conv;
70049 }
70050
70051 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Quantity_1clone(JNIEnv *env, jclass clz, int64_t orig) {
70052         LDKQuantity* orig_conv = (LDKQuantity*)untag_ptr(orig);
70053         LDKQuantity *ret_copy = MALLOC(sizeof(LDKQuantity), "LDKQuantity");
70054         *ret_copy = Quantity_clone(orig_conv);
70055         int64_t ret_ref = tag_ptr(ret_copy, true);
70056         return ret_ref;
70057 }
70058
70059 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Quantity_1bounded(JNIEnv *env, jclass clz, int64_t a) {
70060         LDKQuantity *ret_copy = MALLOC(sizeof(LDKQuantity), "LDKQuantity");
70061         *ret_copy = Quantity_bounded(a);
70062         int64_t ret_ref = tag_ptr(ret_copy, true);
70063         return ret_ref;
70064 }
70065
70066 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Quantity_1unbounded(JNIEnv *env, jclass clz) {
70067         LDKQuantity *ret_copy = MALLOC(sizeof(LDKQuantity), "LDKQuantity");
70068         *ret_copy = Quantity_unbounded();
70069         int64_t ret_ref = tag_ptr(ret_copy, true);
70070         return ret_ref;
70071 }
70072
70073 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Quantity_1one(JNIEnv *env, jclass clz) {
70074         LDKQuantity *ret_copy = MALLOC(sizeof(LDKQuantity), "LDKQuantity");
70075         *ret_copy = Quantity_one();
70076         int64_t ret_ref = tag_ptr(ret_copy, true);
70077         return ret_ref;
70078 }
70079
70080 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Offer_1from_1str(JNIEnv *env, jclass clz, jstring s) {
70081         LDKStr s_conv = java_to_owned_str(env, s);
70082         LDKCResult_OfferBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferBolt12ParseErrorZ), "LDKCResult_OfferBolt12ParseErrorZ");
70083         *ret_conv = Offer_from_str(s_conv);
70084         return tag_ptr(ret_conv, true);
70085 }
70086
70087 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoiceWithExplicitSigningPubkeyBuilder_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
70088         LDKInvoiceWithExplicitSigningPubkeyBuilder this_obj_conv;
70089         this_obj_conv.inner = untag_ptr(this_obj);
70090         this_obj_conv.is_owned = ptr_is_owned(this_obj);
70091         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
70092         InvoiceWithExplicitSigningPubkeyBuilder_free(this_obj_conv);
70093 }
70094
70095 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoiceWithDerivedSigningPubkeyBuilder_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
70096         LDKInvoiceWithDerivedSigningPubkeyBuilder this_obj_conv;
70097         this_obj_conv.inner = untag_ptr(this_obj);
70098         this_obj_conv.is_owned = ptr_is_owned(this_obj);
70099         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
70100         InvoiceWithDerivedSigningPubkeyBuilder_free(this_obj_conv);
70101 }
70102
70103 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceWithExplicitSigningPubkeyBuilder_1build(JNIEnv *env, jclass clz, int64_t this_arg) {
70104         LDKInvoiceWithExplicitSigningPubkeyBuilder this_arg_conv;
70105         this_arg_conv.inner = untag_ptr(this_arg);
70106         this_arg_conv.is_owned = ptr_is_owned(this_arg);
70107         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
70108         // WARNING: we need a move here but no clone is available for LDKInvoiceWithExplicitSigningPubkeyBuilder
70109         
70110         LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ), "LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ");
70111         *ret_conv = InvoiceWithExplicitSigningPubkeyBuilder_build(this_arg_conv);
70112         return tag_ptr(ret_conv, true);
70113 }
70114
70115 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoiceWithExplicitSigningPubkeyBuilder_1relative_1expiry(JNIEnv *env, jclass clz, int64_t this_arg, int32_t relative_expiry_secs) {
70116         LDKInvoiceWithExplicitSigningPubkeyBuilder this_arg_conv;
70117         this_arg_conv.inner = untag_ptr(this_arg);
70118         this_arg_conv.is_owned = ptr_is_owned(this_arg);
70119         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
70120         // WARNING: we need a move here but no clone is available for LDKInvoiceWithExplicitSigningPubkeyBuilder
70121         
70122         InvoiceWithExplicitSigningPubkeyBuilder_relative_expiry(this_arg_conv, relative_expiry_secs);
70123 }
70124
70125 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoiceWithExplicitSigningPubkeyBuilder_1fallback_1v0_1p2wsh(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray script_hash) {
70126         LDKInvoiceWithExplicitSigningPubkeyBuilder this_arg_conv;
70127         this_arg_conv.inner = untag_ptr(this_arg);
70128         this_arg_conv.is_owned = ptr_is_owned(this_arg);
70129         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
70130         // WARNING: we need a move here but no clone is available for LDKInvoiceWithExplicitSigningPubkeyBuilder
70131         
70132         uint8_t script_hash_arr[32];
70133         CHECK((*env)->GetArrayLength(env, script_hash) == 32);
70134         (*env)->GetByteArrayRegion(env, script_hash, 0, 32, script_hash_arr);
70135         uint8_t (*script_hash_ref)[32] = &script_hash_arr;
70136         InvoiceWithExplicitSigningPubkeyBuilder_fallback_v0_p2wsh(this_arg_conv, script_hash_ref);
70137 }
70138
70139 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoiceWithExplicitSigningPubkeyBuilder_1fallback_1v0_1p2wpkh(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray pubkey_hash) {
70140         LDKInvoiceWithExplicitSigningPubkeyBuilder this_arg_conv;
70141         this_arg_conv.inner = untag_ptr(this_arg);
70142         this_arg_conv.is_owned = ptr_is_owned(this_arg);
70143         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
70144         // WARNING: we need a move here but no clone is available for LDKInvoiceWithExplicitSigningPubkeyBuilder
70145         
70146         uint8_t pubkey_hash_arr[20];
70147         CHECK((*env)->GetArrayLength(env, pubkey_hash) == 20);
70148         (*env)->GetByteArrayRegion(env, pubkey_hash, 0, 20, pubkey_hash_arr);
70149         uint8_t (*pubkey_hash_ref)[20] = &pubkey_hash_arr;
70150         InvoiceWithExplicitSigningPubkeyBuilder_fallback_v0_p2wpkh(this_arg_conv, pubkey_hash_ref);
70151 }
70152
70153 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoiceWithExplicitSigningPubkeyBuilder_1fallback_1v1_1p2tr_1tweaked(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray utput_key) {
70154         LDKInvoiceWithExplicitSigningPubkeyBuilder this_arg_conv;
70155         this_arg_conv.inner = untag_ptr(this_arg);
70156         this_arg_conv.is_owned = ptr_is_owned(this_arg);
70157         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
70158         // WARNING: we need a move here but no clone is available for LDKInvoiceWithExplicitSigningPubkeyBuilder
70159         
70160         LDKTweakedPublicKey utput_key_ref;
70161         CHECK((*env)->GetArrayLength(env, utput_key) == 32);
70162         (*env)->GetByteArrayRegion(env, utput_key, 0, 32, utput_key_ref.x_coordinate);
70163         InvoiceWithExplicitSigningPubkeyBuilder_fallback_v1_p2tr_tweaked(this_arg_conv, utput_key_ref);
70164 }
70165
70166 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoiceWithExplicitSigningPubkeyBuilder_1allow_1mpp(JNIEnv *env, jclass clz, int64_t this_arg) {
70167         LDKInvoiceWithExplicitSigningPubkeyBuilder this_arg_conv;
70168         this_arg_conv.inner = untag_ptr(this_arg);
70169         this_arg_conv.is_owned = ptr_is_owned(this_arg);
70170         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
70171         // WARNING: we need a move here but no clone is available for LDKInvoiceWithExplicitSigningPubkeyBuilder
70172         
70173         InvoiceWithExplicitSigningPubkeyBuilder_allow_mpp(this_arg_conv);
70174 }
70175
70176 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceWithDerivedSigningPubkeyBuilder_1build_1and_1sign(JNIEnv *env, jclass clz, int64_t this_arg) {
70177         LDKInvoiceWithDerivedSigningPubkeyBuilder this_arg_conv;
70178         this_arg_conv.inner = untag_ptr(this_arg);
70179         this_arg_conv.is_owned = ptr_is_owned(this_arg);
70180         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
70181         // WARNING: we need a move here but no clone is available for LDKInvoiceWithDerivedSigningPubkeyBuilder
70182         
70183         LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ), "LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ");
70184         *ret_conv = InvoiceWithDerivedSigningPubkeyBuilder_build_and_sign(this_arg_conv);
70185         return tag_ptr(ret_conv, true);
70186 }
70187
70188 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoiceWithDerivedSigningPubkeyBuilder_1relative_1expiry(JNIEnv *env, jclass clz, int64_t this_arg, int32_t relative_expiry_secs) {
70189         LDKInvoiceWithDerivedSigningPubkeyBuilder this_arg_conv;
70190         this_arg_conv.inner = untag_ptr(this_arg);
70191         this_arg_conv.is_owned = ptr_is_owned(this_arg);
70192         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
70193         // WARNING: we need a move here but no clone is available for LDKInvoiceWithDerivedSigningPubkeyBuilder
70194         
70195         InvoiceWithDerivedSigningPubkeyBuilder_relative_expiry(this_arg_conv, relative_expiry_secs);
70196 }
70197
70198 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoiceWithDerivedSigningPubkeyBuilder_1fallback_1v0_1p2wsh(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray script_hash) {
70199         LDKInvoiceWithDerivedSigningPubkeyBuilder this_arg_conv;
70200         this_arg_conv.inner = untag_ptr(this_arg);
70201         this_arg_conv.is_owned = ptr_is_owned(this_arg);
70202         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
70203         // WARNING: we need a move here but no clone is available for LDKInvoiceWithDerivedSigningPubkeyBuilder
70204         
70205         uint8_t script_hash_arr[32];
70206         CHECK((*env)->GetArrayLength(env, script_hash) == 32);
70207         (*env)->GetByteArrayRegion(env, script_hash, 0, 32, script_hash_arr);
70208         uint8_t (*script_hash_ref)[32] = &script_hash_arr;
70209         InvoiceWithDerivedSigningPubkeyBuilder_fallback_v0_p2wsh(this_arg_conv, script_hash_ref);
70210 }
70211
70212 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoiceWithDerivedSigningPubkeyBuilder_1fallback_1v0_1p2wpkh(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray pubkey_hash) {
70213         LDKInvoiceWithDerivedSigningPubkeyBuilder this_arg_conv;
70214         this_arg_conv.inner = untag_ptr(this_arg);
70215         this_arg_conv.is_owned = ptr_is_owned(this_arg);
70216         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
70217         // WARNING: we need a move here but no clone is available for LDKInvoiceWithDerivedSigningPubkeyBuilder
70218         
70219         uint8_t pubkey_hash_arr[20];
70220         CHECK((*env)->GetArrayLength(env, pubkey_hash) == 20);
70221         (*env)->GetByteArrayRegion(env, pubkey_hash, 0, 20, pubkey_hash_arr);
70222         uint8_t (*pubkey_hash_ref)[20] = &pubkey_hash_arr;
70223         InvoiceWithDerivedSigningPubkeyBuilder_fallback_v0_p2wpkh(this_arg_conv, pubkey_hash_ref);
70224 }
70225
70226 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoiceWithDerivedSigningPubkeyBuilder_1fallback_1v1_1p2tr_1tweaked(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray utput_key) {
70227         LDKInvoiceWithDerivedSigningPubkeyBuilder this_arg_conv;
70228         this_arg_conv.inner = untag_ptr(this_arg);
70229         this_arg_conv.is_owned = ptr_is_owned(this_arg);
70230         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
70231         // WARNING: we need a move here but no clone is available for LDKInvoiceWithDerivedSigningPubkeyBuilder
70232         
70233         LDKTweakedPublicKey utput_key_ref;
70234         CHECK((*env)->GetArrayLength(env, utput_key) == 32);
70235         (*env)->GetByteArrayRegion(env, utput_key, 0, 32, utput_key_ref.x_coordinate);
70236         InvoiceWithDerivedSigningPubkeyBuilder_fallback_v1_p2tr_tweaked(this_arg_conv, utput_key_ref);
70237 }
70238
70239 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoiceWithDerivedSigningPubkeyBuilder_1allow_1mpp(JNIEnv *env, jclass clz, int64_t this_arg) {
70240         LDKInvoiceWithDerivedSigningPubkeyBuilder this_arg_conv;
70241         this_arg_conv.inner = untag_ptr(this_arg);
70242         this_arg_conv.is_owned = ptr_is_owned(this_arg);
70243         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
70244         // WARNING: we need a move here but no clone is available for LDKInvoiceWithDerivedSigningPubkeyBuilder
70245         
70246         InvoiceWithDerivedSigningPubkeyBuilder_allow_mpp(this_arg_conv);
70247 }
70248
70249 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedBolt12Invoice_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
70250         LDKUnsignedBolt12Invoice this_obj_conv;
70251         this_obj_conv.inner = untag_ptr(this_obj);
70252         this_obj_conv.is_owned = ptr_is_owned(this_obj);
70253         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
70254         UnsignedBolt12Invoice_free(this_obj_conv);
70255 }
70256
70257 static inline uint64_t UnsignedBolt12Invoice_clone_ptr(LDKUnsignedBolt12Invoice *NONNULL_PTR arg) {
70258         LDKUnsignedBolt12Invoice ret_var = UnsignedBolt12Invoice_clone(arg);
70259         int64_t ret_ref = 0;
70260         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70261         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70262         return ret_ref;
70263 }
70264 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedBolt12Invoice_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
70265         LDKUnsignedBolt12Invoice arg_conv;
70266         arg_conv.inner = untag_ptr(arg);
70267         arg_conv.is_owned = ptr_is_owned(arg);
70268         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
70269         arg_conv.is_owned = false;
70270         int64_t ret_conv = UnsignedBolt12Invoice_clone_ptr(&arg_conv);
70271         return ret_conv;
70272 }
70273
70274 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedBolt12Invoice_1clone(JNIEnv *env, jclass clz, int64_t orig) {
70275         LDKUnsignedBolt12Invoice orig_conv;
70276         orig_conv.inner = untag_ptr(orig);
70277         orig_conv.is_owned = ptr_is_owned(orig);
70278         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
70279         orig_conv.is_owned = false;
70280         LDKUnsignedBolt12Invoice ret_var = UnsignedBolt12Invoice_clone(&orig_conv);
70281         int64_t ret_ref = 0;
70282         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70283         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70284         return ret_ref;
70285 }
70286
70287 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SignBolt12InvoiceFn_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
70288         if (!ptr_is_owned(this_ptr)) return;
70289         void* this_ptr_ptr = untag_ptr(this_ptr);
70290         CHECK_ACCESS(this_ptr_ptr);
70291         LDKSignBolt12InvoiceFn this_ptr_conv = *(LDKSignBolt12InvoiceFn*)(this_ptr_ptr);
70292         FREE(untag_ptr(this_ptr));
70293         SignBolt12InvoiceFn_free(this_ptr_conv);
70294 }
70295
70296 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedBolt12Invoice_1tagged_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
70297         LDKUnsignedBolt12Invoice this_arg_conv;
70298         this_arg_conv.inner = untag_ptr(this_arg);
70299         this_arg_conv.is_owned = ptr_is_owned(this_arg);
70300         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
70301         this_arg_conv.is_owned = false;
70302         LDKTaggedHash ret_var = UnsignedBolt12Invoice_tagged_hash(&this_arg_conv);
70303         int64_t ret_ref = 0;
70304         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70305         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70306         return ret_ref;
70307 }
70308
70309 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
70310         LDKBolt12Invoice this_obj_conv;
70311         this_obj_conv.inner = untag_ptr(this_obj);
70312         this_obj_conv.is_owned = ptr_is_owned(this_obj);
70313         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
70314         Bolt12Invoice_free(this_obj_conv);
70315 }
70316
70317 static inline uint64_t Bolt12Invoice_clone_ptr(LDKBolt12Invoice *NONNULL_PTR arg) {
70318         LDKBolt12Invoice ret_var = Bolt12Invoice_clone(arg);
70319         int64_t ret_ref = 0;
70320         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70321         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70322         return ret_ref;
70323 }
70324 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
70325         LDKBolt12Invoice arg_conv;
70326         arg_conv.inner = untag_ptr(arg);
70327         arg_conv.is_owned = ptr_is_owned(arg);
70328         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
70329         arg_conv.is_owned = false;
70330         int64_t ret_conv = Bolt12Invoice_clone_ptr(&arg_conv);
70331         return ret_conv;
70332 }
70333
70334 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1clone(JNIEnv *env, jclass clz, int64_t orig) {
70335         LDKBolt12Invoice orig_conv;
70336         orig_conv.inner = untag_ptr(orig);
70337         orig_conv.is_owned = ptr_is_owned(orig);
70338         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
70339         orig_conv.is_owned = false;
70340         LDKBolt12Invoice ret_var = Bolt12Invoice_clone(&orig_conv);
70341         int64_t ret_ref = 0;
70342         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70343         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70344         return ret_ref;
70345 }
70346
70347 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedBolt12Invoice_1offer_1chains(JNIEnv *env, jclass clz, int64_t this_arg) {
70348         LDKUnsignedBolt12Invoice this_arg_conv;
70349         this_arg_conv.inner = untag_ptr(this_arg);
70350         this_arg_conv.is_owned = ptr_is_owned(this_arg);
70351         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
70352         this_arg_conv.is_owned = false;
70353         LDKCOption_CVec_ThirtyTwoBytesZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_ThirtyTwoBytesZZ), "LDKCOption_CVec_ThirtyTwoBytesZZ");
70354         *ret_copy = UnsignedBolt12Invoice_offer_chains(&this_arg_conv);
70355         int64_t ret_ref = tag_ptr(ret_copy, true);
70356         return ret_ref;
70357 }
70358
70359 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedBolt12Invoice_1chain(JNIEnv *env, jclass clz, int64_t this_arg) {
70360         LDKUnsignedBolt12Invoice this_arg_conv;
70361         this_arg_conv.inner = untag_ptr(this_arg);
70362         this_arg_conv.is_owned = ptr_is_owned(this_arg);
70363         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
70364         this_arg_conv.is_owned = false;
70365         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
70366         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, UnsignedBolt12Invoice_chain(&this_arg_conv).data);
70367         return ret_arr;
70368 }
70369
70370 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedBolt12Invoice_1metadata(JNIEnv *env, jclass clz, int64_t this_arg) {
70371         LDKUnsignedBolt12Invoice this_arg_conv;
70372         this_arg_conv.inner = untag_ptr(this_arg);
70373         this_arg_conv.is_owned = ptr_is_owned(this_arg);
70374         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
70375         this_arg_conv.is_owned = false;
70376         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
70377         *ret_copy = UnsignedBolt12Invoice_metadata(&this_arg_conv);
70378         int64_t ret_ref = tag_ptr(ret_copy, true);
70379         return ret_ref;
70380 }
70381
70382 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedBolt12Invoice_1amount(JNIEnv *env, jclass clz, int64_t this_arg) {
70383         LDKUnsignedBolt12Invoice this_arg_conv;
70384         this_arg_conv.inner = untag_ptr(this_arg);
70385         this_arg_conv.is_owned = ptr_is_owned(this_arg);
70386         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
70387         this_arg_conv.is_owned = false;
70388         LDKCOption_AmountZ *ret_copy = MALLOC(sizeof(LDKCOption_AmountZ), "LDKCOption_AmountZ");
70389         *ret_copy = UnsignedBolt12Invoice_amount(&this_arg_conv);
70390         int64_t ret_ref = tag_ptr(ret_copy, true);
70391         return ret_ref;
70392 }
70393
70394 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedBolt12Invoice_1offer_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
70395         LDKUnsignedBolt12Invoice this_arg_conv;
70396         this_arg_conv.inner = untag_ptr(this_arg);
70397         this_arg_conv.is_owned = ptr_is_owned(this_arg);
70398         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
70399         this_arg_conv.is_owned = false;
70400         LDKOfferFeatures ret_var = UnsignedBolt12Invoice_offer_features(&this_arg_conv);
70401         int64_t ret_ref = 0;
70402         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70403         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70404         return ret_ref;
70405 }
70406
70407 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedBolt12Invoice_1description(JNIEnv *env, jclass clz, int64_t this_arg) {
70408         LDKUnsignedBolt12Invoice this_arg_conv;
70409         this_arg_conv.inner = untag_ptr(this_arg);
70410         this_arg_conv.is_owned = ptr_is_owned(this_arg);
70411         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
70412         this_arg_conv.is_owned = false;
70413         LDKPrintableString ret_var = UnsignedBolt12Invoice_description(&this_arg_conv);
70414         int64_t ret_ref = 0;
70415         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70416         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70417         return ret_ref;
70418 }
70419
70420 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedBolt12Invoice_1absolute_1expiry(JNIEnv *env, jclass clz, int64_t this_arg) {
70421         LDKUnsignedBolt12Invoice this_arg_conv;
70422         this_arg_conv.inner = untag_ptr(this_arg);
70423         this_arg_conv.is_owned = ptr_is_owned(this_arg);
70424         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
70425         this_arg_conv.is_owned = false;
70426         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
70427         *ret_copy = UnsignedBolt12Invoice_absolute_expiry(&this_arg_conv);
70428         int64_t ret_ref = tag_ptr(ret_copy, true);
70429         return ret_ref;
70430 }
70431
70432 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedBolt12Invoice_1issuer(JNIEnv *env, jclass clz, int64_t this_arg) {
70433         LDKUnsignedBolt12Invoice this_arg_conv;
70434         this_arg_conv.inner = untag_ptr(this_arg);
70435         this_arg_conv.is_owned = ptr_is_owned(this_arg);
70436         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
70437         this_arg_conv.is_owned = false;
70438         LDKPrintableString ret_var = UnsignedBolt12Invoice_issuer(&this_arg_conv);
70439         int64_t ret_ref = 0;
70440         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70441         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70442         return ret_ref;
70443 }
70444
70445 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedBolt12Invoice_1message_1paths(JNIEnv *env, jclass clz, int64_t this_arg) {
70446         LDKUnsignedBolt12Invoice this_arg_conv;
70447         this_arg_conv.inner = untag_ptr(this_arg);
70448         this_arg_conv.is_owned = ptr_is_owned(this_arg);
70449         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
70450         this_arg_conv.is_owned = false;
70451         LDKCVec_BlindedPathZ ret_var = UnsignedBolt12Invoice_message_paths(&this_arg_conv);
70452         int64_tArray ret_arr = NULL;
70453         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
70454         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
70455         for (size_t n = 0; n < ret_var.datalen; n++) {
70456                 LDKBlindedPath ret_conv_13_var = ret_var.data[n];
70457                 int64_t ret_conv_13_ref = 0;
70458                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_13_var);
70459                 ret_conv_13_ref = tag_ptr(ret_conv_13_var.inner, ret_conv_13_var.is_owned);
70460                 ret_arr_ptr[n] = ret_conv_13_ref;
70461         }
70462         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
70463         FREE(ret_var.data);
70464         return ret_arr;
70465 }
70466
70467 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedBolt12Invoice_1supported_1quantity(JNIEnv *env, jclass clz, int64_t this_arg) {
70468         LDKUnsignedBolt12Invoice this_arg_conv;
70469         this_arg_conv.inner = untag_ptr(this_arg);
70470         this_arg_conv.is_owned = ptr_is_owned(this_arg);
70471         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
70472         this_arg_conv.is_owned = false;
70473         LDKCOption_QuantityZ *ret_copy = MALLOC(sizeof(LDKCOption_QuantityZ), "LDKCOption_QuantityZ");
70474         *ret_copy = UnsignedBolt12Invoice_supported_quantity(&this_arg_conv);
70475         int64_t ret_ref = tag_ptr(ret_copy, true);
70476         return ret_ref;
70477 }
70478
70479 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedBolt12Invoice_1payer_1metadata(JNIEnv *env, jclass clz, int64_t this_arg) {
70480         LDKUnsignedBolt12Invoice this_arg_conv;
70481         this_arg_conv.inner = untag_ptr(this_arg);
70482         this_arg_conv.is_owned = ptr_is_owned(this_arg);
70483         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
70484         this_arg_conv.is_owned = false;
70485         LDKu8slice ret_var = UnsignedBolt12Invoice_payer_metadata(&this_arg_conv);
70486         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
70487         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
70488         return ret_arr;
70489 }
70490
70491 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedBolt12Invoice_1invoice_1request_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
70492         LDKUnsignedBolt12Invoice this_arg_conv;
70493         this_arg_conv.inner = untag_ptr(this_arg);
70494         this_arg_conv.is_owned = ptr_is_owned(this_arg);
70495         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
70496         this_arg_conv.is_owned = false;
70497         LDKInvoiceRequestFeatures ret_var = UnsignedBolt12Invoice_invoice_request_features(&this_arg_conv);
70498         int64_t ret_ref = 0;
70499         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70500         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70501         return ret_ref;
70502 }
70503
70504 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedBolt12Invoice_1quantity(JNIEnv *env, jclass clz, int64_t this_arg) {
70505         LDKUnsignedBolt12Invoice this_arg_conv;
70506         this_arg_conv.inner = untag_ptr(this_arg);
70507         this_arg_conv.is_owned = ptr_is_owned(this_arg);
70508         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
70509         this_arg_conv.is_owned = false;
70510         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
70511         *ret_copy = UnsignedBolt12Invoice_quantity(&this_arg_conv);
70512         int64_t ret_ref = tag_ptr(ret_copy, true);
70513         return ret_ref;
70514 }
70515
70516 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedBolt12Invoice_1payer_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
70517         LDKUnsignedBolt12Invoice this_arg_conv;
70518         this_arg_conv.inner = untag_ptr(this_arg);
70519         this_arg_conv.is_owned = ptr_is_owned(this_arg);
70520         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
70521         this_arg_conv.is_owned = false;
70522         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
70523         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, UnsignedBolt12Invoice_payer_id(&this_arg_conv).compressed_form);
70524         return ret_arr;
70525 }
70526
70527 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedBolt12Invoice_1payer_1note(JNIEnv *env, jclass clz, int64_t this_arg) {
70528         LDKUnsignedBolt12Invoice this_arg_conv;
70529         this_arg_conv.inner = untag_ptr(this_arg);
70530         this_arg_conv.is_owned = ptr_is_owned(this_arg);
70531         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
70532         this_arg_conv.is_owned = false;
70533         LDKPrintableString ret_var = UnsignedBolt12Invoice_payer_note(&this_arg_conv);
70534         int64_t ret_ref = 0;
70535         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70536         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70537         return ret_ref;
70538 }
70539
70540 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedBolt12Invoice_1created_1at(JNIEnv *env, jclass clz, int64_t this_arg) {
70541         LDKUnsignedBolt12Invoice this_arg_conv;
70542         this_arg_conv.inner = untag_ptr(this_arg);
70543         this_arg_conv.is_owned = ptr_is_owned(this_arg);
70544         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
70545         this_arg_conv.is_owned = false;
70546         int64_t ret_conv = UnsignedBolt12Invoice_created_at(&this_arg_conv);
70547         return ret_conv;
70548 }
70549
70550 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedBolt12Invoice_1relative_1expiry(JNIEnv *env, jclass clz, int64_t this_arg) {
70551         LDKUnsignedBolt12Invoice this_arg_conv;
70552         this_arg_conv.inner = untag_ptr(this_arg);
70553         this_arg_conv.is_owned = ptr_is_owned(this_arg);
70554         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
70555         this_arg_conv.is_owned = false;
70556         int64_t ret_conv = UnsignedBolt12Invoice_relative_expiry(&this_arg_conv);
70557         return ret_conv;
70558 }
70559
70560 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_UnsignedBolt12Invoice_1is_1expired(JNIEnv *env, jclass clz, int64_t this_arg) {
70561         LDKUnsignedBolt12Invoice this_arg_conv;
70562         this_arg_conv.inner = untag_ptr(this_arg);
70563         this_arg_conv.is_owned = ptr_is_owned(this_arg);
70564         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
70565         this_arg_conv.is_owned = false;
70566         jboolean ret_conv = UnsignedBolt12Invoice_is_expired(&this_arg_conv);
70567         return ret_conv;
70568 }
70569
70570 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedBolt12Invoice_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
70571         LDKUnsignedBolt12Invoice this_arg_conv;
70572         this_arg_conv.inner = untag_ptr(this_arg);
70573         this_arg_conv.is_owned = ptr_is_owned(this_arg);
70574         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
70575         this_arg_conv.is_owned = false;
70576         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
70577         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, UnsignedBolt12Invoice_payment_hash(&this_arg_conv).data);
70578         return ret_arr;
70579 }
70580
70581 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedBolt12Invoice_1amount_1msats(JNIEnv *env, jclass clz, int64_t this_arg) {
70582         LDKUnsignedBolt12Invoice this_arg_conv;
70583         this_arg_conv.inner = untag_ptr(this_arg);
70584         this_arg_conv.is_owned = ptr_is_owned(this_arg);
70585         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
70586         this_arg_conv.is_owned = false;
70587         int64_t ret_conv = UnsignedBolt12Invoice_amount_msats(&this_arg_conv);
70588         return ret_conv;
70589 }
70590
70591 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedBolt12Invoice_1invoice_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
70592         LDKUnsignedBolt12Invoice this_arg_conv;
70593         this_arg_conv.inner = untag_ptr(this_arg);
70594         this_arg_conv.is_owned = ptr_is_owned(this_arg);
70595         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
70596         this_arg_conv.is_owned = false;
70597         LDKBolt12InvoiceFeatures ret_var = UnsignedBolt12Invoice_invoice_features(&this_arg_conv);
70598         int64_t ret_ref = 0;
70599         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70600         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70601         return ret_ref;
70602 }
70603
70604 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedBolt12Invoice_1signing_1pubkey(JNIEnv *env, jclass clz, int64_t this_arg) {
70605         LDKUnsignedBolt12Invoice this_arg_conv;
70606         this_arg_conv.inner = untag_ptr(this_arg);
70607         this_arg_conv.is_owned = ptr_is_owned(this_arg);
70608         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
70609         this_arg_conv.is_owned = false;
70610         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
70611         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, UnsignedBolt12Invoice_signing_pubkey(&this_arg_conv).compressed_form);
70612         return ret_arr;
70613 }
70614
70615 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1offer_1chains(JNIEnv *env, jclass clz, int64_t this_arg) {
70616         LDKBolt12Invoice this_arg_conv;
70617         this_arg_conv.inner = untag_ptr(this_arg);
70618         this_arg_conv.is_owned = ptr_is_owned(this_arg);
70619         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
70620         this_arg_conv.is_owned = false;
70621         LDKCOption_CVec_ThirtyTwoBytesZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_ThirtyTwoBytesZZ), "LDKCOption_CVec_ThirtyTwoBytesZZ");
70622         *ret_copy = Bolt12Invoice_offer_chains(&this_arg_conv);
70623         int64_t ret_ref = tag_ptr(ret_copy, true);
70624         return ret_ref;
70625 }
70626
70627 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1chain(JNIEnv *env, jclass clz, int64_t this_arg) {
70628         LDKBolt12Invoice this_arg_conv;
70629         this_arg_conv.inner = untag_ptr(this_arg);
70630         this_arg_conv.is_owned = ptr_is_owned(this_arg);
70631         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
70632         this_arg_conv.is_owned = false;
70633         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
70634         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, Bolt12Invoice_chain(&this_arg_conv).data);
70635         return ret_arr;
70636 }
70637
70638 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1metadata(JNIEnv *env, jclass clz, int64_t this_arg) {
70639         LDKBolt12Invoice this_arg_conv;
70640         this_arg_conv.inner = untag_ptr(this_arg);
70641         this_arg_conv.is_owned = ptr_is_owned(this_arg);
70642         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
70643         this_arg_conv.is_owned = false;
70644         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
70645         *ret_copy = Bolt12Invoice_metadata(&this_arg_conv);
70646         int64_t ret_ref = tag_ptr(ret_copy, true);
70647         return ret_ref;
70648 }
70649
70650 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1amount(JNIEnv *env, jclass clz, int64_t this_arg) {
70651         LDKBolt12Invoice this_arg_conv;
70652         this_arg_conv.inner = untag_ptr(this_arg);
70653         this_arg_conv.is_owned = ptr_is_owned(this_arg);
70654         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
70655         this_arg_conv.is_owned = false;
70656         LDKCOption_AmountZ *ret_copy = MALLOC(sizeof(LDKCOption_AmountZ), "LDKCOption_AmountZ");
70657         *ret_copy = Bolt12Invoice_amount(&this_arg_conv);
70658         int64_t ret_ref = tag_ptr(ret_copy, true);
70659         return ret_ref;
70660 }
70661
70662 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1offer_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
70663         LDKBolt12Invoice this_arg_conv;
70664         this_arg_conv.inner = untag_ptr(this_arg);
70665         this_arg_conv.is_owned = ptr_is_owned(this_arg);
70666         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
70667         this_arg_conv.is_owned = false;
70668         LDKOfferFeatures ret_var = Bolt12Invoice_offer_features(&this_arg_conv);
70669         int64_t ret_ref = 0;
70670         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70671         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70672         return ret_ref;
70673 }
70674
70675 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1description(JNIEnv *env, jclass clz, int64_t this_arg) {
70676         LDKBolt12Invoice this_arg_conv;
70677         this_arg_conv.inner = untag_ptr(this_arg);
70678         this_arg_conv.is_owned = ptr_is_owned(this_arg);
70679         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
70680         this_arg_conv.is_owned = false;
70681         LDKPrintableString ret_var = Bolt12Invoice_description(&this_arg_conv);
70682         int64_t ret_ref = 0;
70683         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70684         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70685         return ret_ref;
70686 }
70687
70688 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1absolute_1expiry(JNIEnv *env, jclass clz, int64_t this_arg) {
70689         LDKBolt12Invoice this_arg_conv;
70690         this_arg_conv.inner = untag_ptr(this_arg);
70691         this_arg_conv.is_owned = ptr_is_owned(this_arg);
70692         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
70693         this_arg_conv.is_owned = false;
70694         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
70695         *ret_copy = Bolt12Invoice_absolute_expiry(&this_arg_conv);
70696         int64_t ret_ref = tag_ptr(ret_copy, true);
70697         return ret_ref;
70698 }
70699
70700 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1issuer(JNIEnv *env, jclass clz, int64_t this_arg) {
70701         LDKBolt12Invoice this_arg_conv;
70702         this_arg_conv.inner = untag_ptr(this_arg);
70703         this_arg_conv.is_owned = ptr_is_owned(this_arg);
70704         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
70705         this_arg_conv.is_owned = false;
70706         LDKPrintableString ret_var = Bolt12Invoice_issuer(&this_arg_conv);
70707         int64_t ret_ref = 0;
70708         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70709         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70710         return ret_ref;
70711 }
70712
70713 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1message_1paths(JNIEnv *env, jclass clz, int64_t this_arg) {
70714         LDKBolt12Invoice this_arg_conv;
70715         this_arg_conv.inner = untag_ptr(this_arg);
70716         this_arg_conv.is_owned = ptr_is_owned(this_arg);
70717         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
70718         this_arg_conv.is_owned = false;
70719         LDKCVec_BlindedPathZ ret_var = Bolt12Invoice_message_paths(&this_arg_conv);
70720         int64_tArray ret_arr = NULL;
70721         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
70722         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
70723         for (size_t n = 0; n < ret_var.datalen; n++) {
70724                 LDKBlindedPath ret_conv_13_var = ret_var.data[n];
70725                 int64_t ret_conv_13_ref = 0;
70726                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_13_var);
70727                 ret_conv_13_ref = tag_ptr(ret_conv_13_var.inner, ret_conv_13_var.is_owned);
70728                 ret_arr_ptr[n] = ret_conv_13_ref;
70729         }
70730         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
70731         FREE(ret_var.data);
70732         return ret_arr;
70733 }
70734
70735 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1supported_1quantity(JNIEnv *env, jclass clz, int64_t this_arg) {
70736         LDKBolt12Invoice this_arg_conv;
70737         this_arg_conv.inner = untag_ptr(this_arg);
70738         this_arg_conv.is_owned = ptr_is_owned(this_arg);
70739         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
70740         this_arg_conv.is_owned = false;
70741         LDKCOption_QuantityZ *ret_copy = MALLOC(sizeof(LDKCOption_QuantityZ), "LDKCOption_QuantityZ");
70742         *ret_copy = Bolt12Invoice_supported_quantity(&this_arg_conv);
70743         int64_t ret_ref = tag_ptr(ret_copy, true);
70744         return ret_ref;
70745 }
70746
70747 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1payer_1metadata(JNIEnv *env, jclass clz, int64_t this_arg) {
70748         LDKBolt12Invoice this_arg_conv;
70749         this_arg_conv.inner = untag_ptr(this_arg);
70750         this_arg_conv.is_owned = ptr_is_owned(this_arg);
70751         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
70752         this_arg_conv.is_owned = false;
70753         LDKu8slice ret_var = Bolt12Invoice_payer_metadata(&this_arg_conv);
70754         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
70755         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
70756         return ret_arr;
70757 }
70758
70759 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1invoice_1request_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
70760         LDKBolt12Invoice this_arg_conv;
70761         this_arg_conv.inner = untag_ptr(this_arg);
70762         this_arg_conv.is_owned = ptr_is_owned(this_arg);
70763         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
70764         this_arg_conv.is_owned = false;
70765         LDKInvoiceRequestFeatures ret_var = Bolt12Invoice_invoice_request_features(&this_arg_conv);
70766         int64_t ret_ref = 0;
70767         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70768         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70769         return ret_ref;
70770 }
70771
70772 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1quantity(JNIEnv *env, jclass clz, int64_t this_arg) {
70773         LDKBolt12Invoice this_arg_conv;
70774         this_arg_conv.inner = untag_ptr(this_arg);
70775         this_arg_conv.is_owned = ptr_is_owned(this_arg);
70776         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
70777         this_arg_conv.is_owned = false;
70778         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
70779         *ret_copy = Bolt12Invoice_quantity(&this_arg_conv);
70780         int64_t ret_ref = tag_ptr(ret_copy, true);
70781         return ret_ref;
70782 }
70783
70784 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1payer_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
70785         LDKBolt12Invoice this_arg_conv;
70786         this_arg_conv.inner = untag_ptr(this_arg);
70787         this_arg_conv.is_owned = ptr_is_owned(this_arg);
70788         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
70789         this_arg_conv.is_owned = false;
70790         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
70791         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, Bolt12Invoice_payer_id(&this_arg_conv).compressed_form);
70792         return ret_arr;
70793 }
70794
70795 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1payer_1note(JNIEnv *env, jclass clz, int64_t this_arg) {
70796         LDKBolt12Invoice this_arg_conv;
70797         this_arg_conv.inner = untag_ptr(this_arg);
70798         this_arg_conv.is_owned = ptr_is_owned(this_arg);
70799         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
70800         this_arg_conv.is_owned = false;
70801         LDKPrintableString ret_var = Bolt12Invoice_payer_note(&this_arg_conv);
70802         int64_t ret_ref = 0;
70803         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70804         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70805         return ret_ref;
70806 }
70807
70808 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1created_1at(JNIEnv *env, jclass clz, int64_t this_arg) {
70809         LDKBolt12Invoice this_arg_conv;
70810         this_arg_conv.inner = untag_ptr(this_arg);
70811         this_arg_conv.is_owned = ptr_is_owned(this_arg);
70812         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
70813         this_arg_conv.is_owned = false;
70814         int64_t ret_conv = Bolt12Invoice_created_at(&this_arg_conv);
70815         return ret_conv;
70816 }
70817
70818 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1relative_1expiry(JNIEnv *env, jclass clz, int64_t this_arg) {
70819         LDKBolt12Invoice this_arg_conv;
70820         this_arg_conv.inner = untag_ptr(this_arg);
70821         this_arg_conv.is_owned = ptr_is_owned(this_arg);
70822         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
70823         this_arg_conv.is_owned = false;
70824         int64_t ret_conv = Bolt12Invoice_relative_expiry(&this_arg_conv);
70825         return ret_conv;
70826 }
70827
70828 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1is_1expired(JNIEnv *env, jclass clz, int64_t this_arg) {
70829         LDKBolt12Invoice this_arg_conv;
70830         this_arg_conv.inner = untag_ptr(this_arg);
70831         this_arg_conv.is_owned = ptr_is_owned(this_arg);
70832         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
70833         this_arg_conv.is_owned = false;
70834         jboolean ret_conv = Bolt12Invoice_is_expired(&this_arg_conv);
70835         return ret_conv;
70836 }
70837
70838 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
70839         LDKBolt12Invoice this_arg_conv;
70840         this_arg_conv.inner = untag_ptr(this_arg);
70841         this_arg_conv.is_owned = ptr_is_owned(this_arg);
70842         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
70843         this_arg_conv.is_owned = false;
70844         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
70845         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, Bolt12Invoice_payment_hash(&this_arg_conv).data);
70846         return ret_arr;
70847 }
70848
70849 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1amount_1msats(JNIEnv *env, jclass clz, int64_t this_arg) {
70850         LDKBolt12Invoice this_arg_conv;
70851         this_arg_conv.inner = untag_ptr(this_arg);
70852         this_arg_conv.is_owned = ptr_is_owned(this_arg);
70853         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
70854         this_arg_conv.is_owned = false;
70855         int64_t ret_conv = Bolt12Invoice_amount_msats(&this_arg_conv);
70856         return ret_conv;
70857 }
70858
70859 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1invoice_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
70860         LDKBolt12Invoice this_arg_conv;
70861         this_arg_conv.inner = untag_ptr(this_arg);
70862         this_arg_conv.is_owned = ptr_is_owned(this_arg);
70863         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
70864         this_arg_conv.is_owned = false;
70865         LDKBolt12InvoiceFeatures ret_var = Bolt12Invoice_invoice_features(&this_arg_conv);
70866         int64_t ret_ref = 0;
70867         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
70868         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
70869         return ret_ref;
70870 }
70871
70872 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1signing_1pubkey(JNIEnv *env, jclass clz, int64_t this_arg) {
70873         LDKBolt12Invoice this_arg_conv;
70874         this_arg_conv.inner = untag_ptr(this_arg);
70875         this_arg_conv.is_owned = ptr_is_owned(this_arg);
70876         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
70877         this_arg_conv.is_owned = false;
70878         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
70879         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, Bolt12Invoice_signing_pubkey(&this_arg_conv).compressed_form);
70880         return ret_arr;
70881 }
70882
70883 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1signature(JNIEnv *env, jclass clz, int64_t this_arg) {
70884         LDKBolt12Invoice this_arg_conv;
70885         this_arg_conv.inner = untag_ptr(this_arg);
70886         this_arg_conv.is_owned = ptr_is_owned(this_arg);
70887         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
70888         this_arg_conv.is_owned = false;
70889         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
70890         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, Bolt12Invoice_signature(&this_arg_conv).compact_form);
70891         return ret_arr;
70892 }
70893
70894 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1signable_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
70895         LDKBolt12Invoice this_arg_conv;
70896         this_arg_conv.inner = untag_ptr(this_arg);
70897         this_arg_conv.is_owned = ptr_is_owned(this_arg);
70898         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
70899         this_arg_conv.is_owned = false;
70900         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
70901         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, Bolt12Invoice_signable_hash(&this_arg_conv).data);
70902         return ret_arr;
70903 }
70904
70905 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1verify(JNIEnv *env, jclass clz, int64_t this_arg, int64_t key) {
70906         LDKBolt12Invoice this_arg_conv;
70907         this_arg_conv.inner = untag_ptr(this_arg);
70908         this_arg_conv.is_owned = ptr_is_owned(this_arg);
70909         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
70910         this_arg_conv.is_owned = false;
70911         LDKExpandedKey key_conv;
70912         key_conv.inner = untag_ptr(key);
70913         key_conv.is_owned = ptr_is_owned(key);
70914         CHECK_INNER_FIELD_ACCESS_OR_NULL(key_conv);
70915         key_conv.is_owned = false;
70916         LDKCResult_ThirtyTwoBytesNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ThirtyTwoBytesNoneZ), "LDKCResult_ThirtyTwoBytesNoneZ");
70917         *ret_conv = Bolt12Invoice_verify(&this_arg_conv, &key_conv);
70918         return tag_ptr(ret_conv, true);
70919 }
70920
70921 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1hash(JNIEnv *env, jclass clz, int64_t o) {
70922         LDKBolt12Invoice o_conv;
70923         o_conv.inner = untag_ptr(o);
70924         o_conv.is_owned = ptr_is_owned(o);
70925         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
70926         o_conv.is_owned = false;
70927         int64_t ret_conv = Bolt12Invoice_hash(&o_conv);
70928         return ret_conv;
70929 }
70930
70931 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedBolt12Invoice_1write(JNIEnv *env, jclass clz, int64_t obj) {
70932         LDKUnsignedBolt12Invoice obj_conv;
70933         obj_conv.inner = untag_ptr(obj);
70934         obj_conv.is_owned = ptr_is_owned(obj);
70935         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
70936         obj_conv.is_owned = false;
70937         LDKCVec_u8Z ret_var = UnsignedBolt12Invoice_write(&obj_conv);
70938         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
70939         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
70940         CVec_u8Z_free(ret_var);
70941         return ret_arr;
70942 }
70943
70944 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Bolt12Invoice_1write(JNIEnv *env, jclass clz, int64_t obj) {
70945         LDKBolt12Invoice obj_conv;
70946         obj_conv.inner = untag_ptr(obj);
70947         obj_conv.is_owned = ptr_is_owned(obj);
70948         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
70949         obj_conv.is_owned = false;
70950         LDKCVec_u8Z ret_var = Bolt12Invoice_write(&obj_conv);
70951         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
70952         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
70953         CVec_u8Z_free(ret_var);
70954         return ret_arr;
70955 }
70956
70957 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BlindedPayInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
70958         LDKBlindedPayInfo this_obj_conv;
70959         this_obj_conv.inner = untag_ptr(this_obj);
70960         this_obj_conv.is_owned = ptr_is_owned(this_obj);
70961         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
70962         BlindedPayInfo_free(this_obj_conv);
70963 }
70964
70965 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_BlindedPayInfo_1get_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
70966         LDKBlindedPayInfo this_ptr_conv;
70967         this_ptr_conv.inner = untag_ptr(this_ptr);
70968         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70969         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70970         this_ptr_conv.is_owned = false;
70971         int32_t ret_conv = BlindedPayInfo_get_fee_base_msat(&this_ptr_conv);
70972         return ret_conv;
70973 }
70974
70975 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BlindedPayInfo_1set_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
70976         LDKBlindedPayInfo this_ptr_conv;
70977         this_ptr_conv.inner = untag_ptr(this_ptr);
70978         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70979         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70980         this_ptr_conv.is_owned = false;
70981         BlindedPayInfo_set_fee_base_msat(&this_ptr_conv, val);
70982 }
70983
70984 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_BlindedPayInfo_1get_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr) {
70985         LDKBlindedPayInfo this_ptr_conv;
70986         this_ptr_conv.inner = untag_ptr(this_ptr);
70987         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70988         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70989         this_ptr_conv.is_owned = false;
70990         int32_t ret_conv = BlindedPayInfo_get_fee_proportional_millionths(&this_ptr_conv);
70991         return ret_conv;
70992 }
70993
70994 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BlindedPayInfo_1set_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
70995         LDKBlindedPayInfo this_ptr_conv;
70996         this_ptr_conv.inner = untag_ptr(this_ptr);
70997         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
70998         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
70999         this_ptr_conv.is_owned = false;
71000         BlindedPayInfo_set_fee_proportional_millionths(&this_ptr_conv, val);
71001 }
71002
71003 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_BlindedPayInfo_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
71004         LDKBlindedPayInfo this_ptr_conv;
71005         this_ptr_conv.inner = untag_ptr(this_ptr);
71006         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71007         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71008         this_ptr_conv.is_owned = false;
71009         int16_t ret_conv = BlindedPayInfo_get_cltv_expiry_delta(&this_ptr_conv);
71010         return ret_conv;
71011 }
71012
71013 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BlindedPayInfo_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
71014         LDKBlindedPayInfo this_ptr_conv;
71015         this_ptr_conv.inner = untag_ptr(this_ptr);
71016         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71017         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71018         this_ptr_conv.is_owned = false;
71019         BlindedPayInfo_set_cltv_expiry_delta(&this_ptr_conv, val);
71020 }
71021
71022 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedPayInfo_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
71023         LDKBlindedPayInfo this_ptr_conv;
71024         this_ptr_conv.inner = untag_ptr(this_ptr);
71025         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71026         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71027         this_ptr_conv.is_owned = false;
71028         int64_t ret_conv = BlindedPayInfo_get_htlc_minimum_msat(&this_ptr_conv);
71029         return ret_conv;
71030 }
71031
71032 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BlindedPayInfo_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
71033         LDKBlindedPayInfo this_ptr_conv;
71034         this_ptr_conv.inner = untag_ptr(this_ptr);
71035         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71036         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71037         this_ptr_conv.is_owned = false;
71038         BlindedPayInfo_set_htlc_minimum_msat(&this_ptr_conv, val);
71039 }
71040
71041 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedPayInfo_1get_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
71042         LDKBlindedPayInfo this_ptr_conv;
71043         this_ptr_conv.inner = untag_ptr(this_ptr);
71044         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71045         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71046         this_ptr_conv.is_owned = false;
71047         int64_t ret_conv = BlindedPayInfo_get_htlc_maximum_msat(&this_ptr_conv);
71048         return ret_conv;
71049 }
71050
71051 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BlindedPayInfo_1set_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
71052         LDKBlindedPayInfo this_ptr_conv;
71053         this_ptr_conv.inner = untag_ptr(this_ptr);
71054         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71055         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71056         this_ptr_conv.is_owned = false;
71057         BlindedPayInfo_set_htlc_maximum_msat(&this_ptr_conv, val);
71058 }
71059
71060 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedPayInfo_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
71061         LDKBlindedPayInfo this_ptr_conv;
71062         this_ptr_conv.inner = untag_ptr(this_ptr);
71063         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71064         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71065         this_ptr_conv.is_owned = false;
71066         LDKBlindedHopFeatures ret_var = BlindedPayInfo_get_features(&this_ptr_conv);
71067         int64_t ret_ref = 0;
71068         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71069         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71070         return ret_ref;
71071 }
71072
71073 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BlindedPayInfo_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
71074         LDKBlindedPayInfo this_ptr_conv;
71075         this_ptr_conv.inner = untag_ptr(this_ptr);
71076         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71077         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71078         this_ptr_conv.is_owned = false;
71079         LDKBlindedHopFeatures val_conv;
71080         val_conv.inner = untag_ptr(val);
71081         val_conv.is_owned = ptr_is_owned(val);
71082         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
71083         val_conv = BlindedHopFeatures_clone(&val_conv);
71084         BlindedPayInfo_set_features(&this_ptr_conv, val_conv);
71085 }
71086
71087 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) {
71088         LDKBlindedHopFeatures features_arg_conv;
71089         features_arg_conv.inner = untag_ptr(features_arg);
71090         features_arg_conv.is_owned = ptr_is_owned(features_arg);
71091         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
71092         features_arg_conv = BlindedHopFeatures_clone(&features_arg_conv);
71093         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);
71094         int64_t ret_ref = 0;
71095         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71096         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71097         return ret_ref;
71098 }
71099
71100 static inline uint64_t BlindedPayInfo_clone_ptr(LDKBlindedPayInfo *NONNULL_PTR arg) {
71101         LDKBlindedPayInfo ret_var = BlindedPayInfo_clone(arg);
71102         int64_t ret_ref = 0;
71103         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71104         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71105         return ret_ref;
71106 }
71107 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedPayInfo_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
71108         LDKBlindedPayInfo arg_conv;
71109         arg_conv.inner = untag_ptr(arg);
71110         arg_conv.is_owned = ptr_is_owned(arg);
71111         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
71112         arg_conv.is_owned = false;
71113         int64_t ret_conv = BlindedPayInfo_clone_ptr(&arg_conv);
71114         return ret_conv;
71115 }
71116
71117 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedPayInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
71118         LDKBlindedPayInfo orig_conv;
71119         orig_conv.inner = untag_ptr(orig);
71120         orig_conv.is_owned = ptr_is_owned(orig);
71121         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
71122         orig_conv.is_owned = false;
71123         LDKBlindedPayInfo ret_var = BlindedPayInfo_clone(&orig_conv);
71124         int64_t ret_ref = 0;
71125         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71126         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71127         return ret_ref;
71128 }
71129
71130 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedPayInfo_1hash(JNIEnv *env, jclass clz, int64_t o) {
71131         LDKBlindedPayInfo o_conv;
71132         o_conv.inner = untag_ptr(o);
71133         o_conv.is_owned = ptr_is_owned(o);
71134         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
71135         o_conv.is_owned = false;
71136         int64_t ret_conv = BlindedPayInfo_hash(&o_conv);
71137         return ret_conv;
71138 }
71139
71140 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_BlindedPayInfo_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
71141         LDKBlindedPayInfo a_conv;
71142         a_conv.inner = untag_ptr(a);
71143         a_conv.is_owned = ptr_is_owned(a);
71144         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
71145         a_conv.is_owned = false;
71146         LDKBlindedPayInfo b_conv;
71147         b_conv.inner = untag_ptr(b);
71148         b_conv.is_owned = ptr_is_owned(b);
71149         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
71150         b_conv.is_owned = false;
71151         jboolean ret_conv = BlindedPayInfo_eq(&a_conv, &b_conv);
71152         return ret_conv;
71153 }
71154
71155 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BlindedPayInfo_1write(JNIEnv *env, jclass clz, int64_t obj) {
71156         LDKBlindedPayInfo obj_conv;
71157         obj_conv.inner = untag_ptr(obj);
71158         obj_conv.is_owned = ptr_is_owned(obj);
71159         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
71160         obj_conv.is_owned = false;
71161         LDKCVec_u8Z ret_var = BlindedPayInfo_write(&obj_conv);
71162         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
71163         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
71164         CVec_u8Z_free(ret_var);
71165         return ret_arr;
71166 }
71167
71168 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedPayInfo_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
71169         LDKu8slice ser_ref;
71170         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
71171         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
71172         LDKCResult_BlindedPayInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPayInfoDecodeErrorZ), "LDKCResult_BlindedPayInfoDecodeErrorZ");
71173         *ret_conv = BlindedPayInfo_read(ser_ref);
71174         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
71175         return tag_ptr(ret_conv, true);
71176 }
71177
71178 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoiceError_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
71179         LDKInvoiceError this_obj_conv;
71180         this_obj_conv.inner = untag_ptr(this_obj);
71181         this_obj_conv.is_owned = ptr_is_owned(this_obj);
71182         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
71183         InvoiceError_free(this_obj_conv);
71184 }
71185
71186 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceError_1get_1erroneous_1field(JNIEnv *env, jclass clz, int64_t this_ptr) {
71187         LDKInvoiceError this_ptr_conv;
71188         this_ptr_conv.inner = untag_ptr(this_ptr);
71189         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71190         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71191         this_ptr_conv.is_owned = false;
71192         LDKErroneousField ret_var = InvoiceError_get_erroneous_field(&this_ptr_conv);
71193         int64_t ret_ref = 0;
71194         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71195         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71196         return ret_ref;
71197 }
71198
71199 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoiceError_1set_1erroneous_1field(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
71200         LDKInvoiceError this_ptr_conv;
71201         this_ptr_conv.inner = untag_ptr(this_ptr);
71202         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71203         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71204         this_ptr_conv.is_owned = false;
71205         LDKErroneousField val_conv;
71206         val_conv.inner = untag_ptr(val);
71207         val_conv.is_owned = ptr_is_owned(val);
71208         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
71209         val_conv = ErroneousField_clone(&val_conv);
71210         InvoiceError_set_erroneous_field(&this_ptr_conv, val_conv);
71211 }
71212
71213 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceError_1get_1message(JNIEnv *env, jclass clz, int64_t this_ptr) {
71214         LDKInvoiceError this_ptr_conv;
71215         this_ptr_conv.inner = untag_ptr(this_ptr);
71216         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71217         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71218         this_ptr_conv.is_owned = false;
71219         LDKUntrustedString ret_var = InvoiceError_get_message(&this_ptr_conv);
71220         int64_t ret_ref = 0;
71221         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71222         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71223         return ret_ref;
71224 }
71225
71226 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoiceError_1set_1message(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
71227         LDKInvoiceError this_ptr_conv;
71228         this_ptr_conv.inner = untag_ptr(this_ptr);
71229         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71230         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71231         this_ptr_conv.is_owned = false;
71232         LDKUntrustedString val_conv;
71233         val_conv.inner = untag_ptr(val);
71234         val_conv.is_owned = ptr_is_owned(val);
71235         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
71236         val_conv = UntrustedString_clone(&val_conv);
71237         InvoiceError_set_message(&this_ptr_conv, val_conv);
71238 }
71239
71240 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceError_1new(JNIEnv *env, jclass clz, int64_t erroneous_field_arg, int64_t message_arg) {
71241         LDKErroneousField erroneous_field_arg_conv;
71242         erroneous_field_arg_conv.inner = untag_ptr(erroneous_field_arg);
71243         erroneous_field_arg_conv.is_owned = ptr_is_owned(erroneous_field_arg);
71244         CHECK_INNER_FIELD_ACCESS_OR_NULL(erroneous_field_arg_conv);
71245         erroneous_field_arg_conv = ErroneousField_clone(&erroneous_field_arg_conv);
71246         LDKUntrustedString message_arg_conv;
71247         message_arg_conv.inner = untag_ptr(message_arg);
71248         message_arg_conv.is_owned = ptr_is_owned(message_arg);
71249         CHECK_INNER_FIELD_ACCESS_OR_NULL(message_arg_conv);
71250         message_arg_conv = UntrustedString_clone(&message_arg_conv);
71251         LDKInvoiceError ret_var = InvoiceError_new(erroneous_field_arg_conv, message_arg_conv);
71252         int64_t ret_ref = 0;
71253         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71254         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71255         return ret_ref;
71256 }
71257
71258 static inline uint64_t InvoiceError_clone_ptr(LDKInvoiceError *NONNULL_PTR arg) {
71259         LDKInvoiceError ret_var = InvoiceError_clone(arg);
71260         int64_t ret_ref = 0;
71261         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71262         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71263         return ret_ref;
71264 }
71265 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
71266         LDKInvoiceError arg_conv;
71267         arg_conv.inner = untag_ptr(arg);
71268         arg_conv.is_owned = ptr_is_owned(arg);
71269         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
71270         arg_conv.is_owned = false;
71271         int64_t ret_conv = InvoiceError_clone_ptr(&arg_conv);
71272         return ret_conv;
71273 }
71274
71275 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
71276         LDKInvoiceError orig_conv;
71277         orig_conv.inner = untag_ptr(orig);
71278         orig_conv.is_owned = ptr_is_owned(orig);
71279         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
71280         orig_conv.is_owned = false;
71281         LDKInvoiceError ret_var = InvoiceError_clone(&orig_conv);
71282         int64_t ret_ref = 0;
71283         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71284         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71285         return ret_ref;
71286 }
71287
71288 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErroneousField_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
71289         LDKErroneousField this_obj_conv;
71290         this_obj_conv.inner = untag_ptr(this_obj);
71291         this_obj_conv.is_owned = ptr_is_owned(this_obj);
71292         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
71293         ErroneousField_free(this_obj_conv);
71294 }
71295
71296 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErroneousField_1get_1tlv_1fieldnum(JNIEnv *env, jclass clz, int64_t this_ptr) {
71297         LDKErroneousField this_ptr_conv;
71298         this_ptr_conv.inner = untag_ptr(this_ptr);
71299         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71300         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71301         this_ptr_conv.is_owned = false;
71302         int64_t ret_conv = ErroneousField_get_tlv_fieldnum(&this_ptr_conv);
71303         return ret_conv;
71304 }
71305
71306 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErroneousField_1set_1tlv_1fieldnum(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
71307         LDKErroneousField this_ptr_conv;
71308         this_ptr_conv.inner = untag_ptr(this_ptr);
71309         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71310         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71311         this_ptr_conv.is_owned = false;
71312         ErroneousField_set_tlv_fieldnum(&this_ptr_conv, val);
71313 }
71314
71315 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErroneousField_1get_1suggested_1value(JNIEnv *env, jclass clz, int64_t this_ptr) {
71316         LDKErroneousField this_ptr_conv;
71317         this_ptr_conv.inner = untag_ptr(this_ptr);
71318         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71319         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71320         this_ptr_conv.is_owned = false;
71321         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
71322         *ret_copy = ErroneousField_get_suggested_value(&this_ptr_conv);
71323         int64_t ret_ref = tag_ptr(ret_copy, true);
71324         return ret_ref;
71325 }
71326
71327 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErroneousField_1set_1suggested_1value(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
71328         LDKErroneousField this_ptr_conv;
71329         this_ptr_conv.inner = untag_ptr(this_ptr);
71330         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71331         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71332         this_ptr_conv.is_owned = false;
71333         void* val_ptr = untag_ptr(val);
71334         CHECK_ACCESS(val_ptr);
71335         LDKCOption_CVec_u8ZZ val_conv = *(LDKCOption_CVec_u8ZZ*)(val_ptr);
71336         val_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(val));
71337         ErroneousField_set_suggested_value(&this_ptr_conv, val_conv);
71338 }
71339
71340 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) {
71341         void* suggested_value_arg_ptr = untag_ptr(suggested_value_arg);
71342         CHECK_ACCESS(suggested_value_arg_ptr);
71343         LDKCOption_CVec_u8ZZ suggested_value_arg_conv = *(LDKCOption_CVec_u8ZZ*)(suggested_value_arg_ptr);
71344         suggested_value_arg_conv = COption_CVec_u8ZZ_clone((LDKCOption_CVec_u8ZZ*)untag_ptr(suggested_value_arg));
71345         LDKErroneousField ret_var = ErroneousField_new(tlv_fieldnum_arg, suggested_value_arg_conv);
71346         int64_t ret_ref = 0;
71347         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71348         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71349         return ret_ref;
71350 }
71351
71352 static inline uint64_t ErroneousField_clone_ptr(LDKErroneousField *NONNULL_PTR arg) {
71353         LDKErroneousField ret_var = ErroneousField_clone(arg);
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 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErroneousField_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
71360         LDKErroneousField arg_conv;
71361         arg_conv.inner = untag_ptr(arg);
71362         arg_conv.is_owned = ptr_is_owned(arg);
71363         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
71364         arg_conv.is_owned = false;
71365         int64_t ret_conv = ErroneousField_clone_ptr(&arg_conv);
71366         return ret_conv;
71367 }
71368
71369 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErroneousField_1clone(JNIEnv *env, jclass clz, int64_t orig) {
71370         LDKErroneousField orig_conv;
71371         orig_conv.inner = untag_ptr(orig);
71372         orig_conv.is_owned = ptr_is_owned(orig);
71373         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
71374         orig_conv.is_owned = false;
71375         LDKErroneousField ret_var = ErroneousField_clone(&orig_conv);
71376         int64_t ret_ref = 0;
71377         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71378         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71379         return ret_ref;
71380 }
71381
71382 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceError_1from_1string(JNIEnv *env, jclass clz, jstring s) {
71383         LDKStr s_conv = java_to_owned_str(env, s);
71384         LDKInvoiceError ret_var = InvoiceError_from_string(s_conv);
71385         int64_t ret_ref = 0;
71386         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71387         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71388         return ret_ref;
71389 }
71390
71391 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InvoiceError_1write(JNIEnv *env, jclass clz, int64_t obj) {
71392         LDKInvoiceError obj_conv;
71393         obj_conv.inner = untag_ptr(obj);
71394         obj_conv.is_owned = ptr_is_owned(obj);
71395         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
71396         obj_conv.is_owned = false;
71397         LDKCVec_u8Z ret_var = InvoiceError_write(&obj_conv);
71398         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
71399         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
71400         CVec_u8Z_free(ret_var);
71401         return ret_arr;
71402 }
71403
71404 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceError_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
71405         LDKu8slice ser_ref;
71406         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
71407         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
71408         LDKCResult_InvoiceErrorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceErrorDecodeErrorZ), "LDKCResult_InvoiceErrorDecodeErrorZ");
71409         *ret_conv = InvoiceError_read(ser_ref);
71410         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
71411         return tag_ptr(ret_conv, true);
71412 }
71413
71414 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoiceRequestWithExplicitPayerIdBuilder_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
71415         LDKInvoiceRequestWithExplicitPayerIdBuilder this_obj_conv;
71416         this_obj_conv.inner = untag_ptr(this_obj);
71417         this_obj_conv.is_owned = ptr_is_owned(this_obj);
71418         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
71419         InvoiceRequestWithExplicitPayerIdBuilder_free(this_obj_conv);
71420 }
71421
71422 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoiceRequestWithDerivedPayerIdBuilder_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
71423         LDKInvoiceRequestWithDerivedPayerIdBuilder this_obj_conv;
71424         this_obj_conv.inner = untag_ptr(this_obj);
71425         this_obj_conv.is_owned = ptr_is_owned(this_obj);
71426         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
71427         InvoiceRequestWithDerivedPayerIdBuilder_free(this_obj_conv);
71428 }
71429
71430 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceRequestWithExplicitPayerIdBuilder_1build(JNIEnv *env, jclass clz, int64_t this_arg) {
71431         LDKInvoiceRequestWithExplicitPayerIdBuilder this_arg_conv;
71432         this_arg_conv.inner = untag_ptr(this_arg);
71433         this_arg_conv.is_owned = ptr_is_owned(this_arg);
71434         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
71435         // WARNING: we need a move here but no clone is available for LDKInvoiceRequestWithExplicitPayerIdBuilder
71436         
71437         LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ), "LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ");
71438         *ret_conv = InvoiceRequestWithExplicitPayerIdBuilder_build(this_arg_conv);
71439         return tag_ptr(ret_conv, true);
71440 }
71441
71442 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceRequestWithExplicitPayerIdBuilder_1chain(JNIEnv *env, jclass clz, int64_t this_arg, jclass network) {
71443         LDKInvoiceRequestWithExplicitPayerIdBuilder this_arg_conv;
71444         this_arg_conv.inner = untag_ptr(this_arg);
71445         this_arg_conv.is_owned = ptr_is_owned(this_arg);
71446         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
71447         // WARNING: we need a move here but no clone is available for LDKInvoiceRequestWithExplicitPayerIdBuilder
71448         
71449         LDKNetwork network_conv = LDKNetwork_from_java(env, network);
71450         LDKCResult_NoneBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt12SemanticErrorZ), "LDKCResult_NoneBolt12SemanticErrorZ");
71451         *ret_conv = InvoiceRequestWithExplicitPayerIdBuilder_chain(this_arg_conv, network_conv);
71452         return tag_ptr(ret_conv, true);
71453 }
71454
71455 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceRequestWithExplicitPayerIdBuilder_1amount_1msats(JNIEnv *env, jclass clz, int64_t this_arg, int64_t amount_msats) {
71456         LDKInvoiceRequestWithExplicitPayerIdBuilder this_arg_conv;
71457         this_arg_conv.inner = untag_ptr(this_arg);
71458         this_arg_conv.is_owned = ptr_is_owned(this_arg);
71459         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
71460         // WARNING: we need a move here but no clone is available for LDKInvoiceRequestWithExplicitPayerIdBuilder
71461         
71462         LDKCResult_NoneBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt12SemanticErrorZ), "LDKCResult_NoneBolt12SemanticErrorZ");
71463         *ret_conv = InvoiceRequestWithExplicitPayerIdBuilder_amount_msats(this_arg_conv, amount_msats);
71464         return tag_ptr(ret_conv, true);
71465 }
71466
71467 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceRequestWithExplicitPayerIdBuilder_1quantity(JNIEnv *env, jclass clz, int64_t this_arg, int64_t quantity) {
71468         LDKInvoiceRequestWithExplicitPayerIdBuilder this_arg_conv;
71469         this_arg_conv.inner = untag_ptr(this_arg);
71470         this_arg_conv.is_owned = ptr_is_owned(this_arg);
71471         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
71472         // WARNING: we need a move here but no clone is available for LDKInvoiceRequestWithExplicitPayerIdBuilder
71473         
71474         LDKCResult_NoneBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt12SemanticErrorZ), "LDKCResult_NoneBolt12SemanticErrorZ");
71475         *ret_conv = InvoiceRequestWithExplicitPayerIdBuilder_quantity(this_arg_conv, quantity);
71476         return tag_ptr(ret_conv, true);
71477 }
71478
71479 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoiceRequestWithExplicitPayerIdBuilder_1payer_1note(JNIEnv *env, jclass clz, int64_t this_arg, jstring payer_note) {
71480         LDKInvoiceRequestWithExplicitPayerIdBuilder this_arg_conv;
71481         this_arg_conv.inner = untag_ptr(this_arg);
71482         this_arg_conv.is_owned = ptr_is_owned(this_arg);
71483         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
71484         // WARNING: we need a move here but no clone is available for LDKInvoiceRequestWithExplicitPayerIdBuilder
71485         
71486         LDKStr payer_note_conv = java_to_owned_str(env, payer_note);
71487         InvoiceRequestWithExplicitPayerIdBuilder_payer_note(this_arg_conv, payer_note_conv);
71488 }
71489
71490 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceRequestWithDerivedPayerIdBuilder_1build_1and_1sign(JNIEnv *env, jclass clz, int64_t this_arg) {
71491         LDKInvoiceRequestWithDerivedPayerIdBuilder this_arg_conv;
71492         this_arg_conv.inner = untag_ptr(this_arg);
71493         this_arg_conv.is_owned = ptr_is_owned(this_arg);
71494         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
71495         // WARNING: we need a move here but no clone is available for LDKInvoiceRequestWithDerivedPayerIdBuilder
71496         
71497         LDKCResult_InvoiceRequestBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceRequestBolt12SemanticErrorZ), "LDKCResult_InvoiceRequestBolt12SemanticErrorZ");
71498         *ret_conv = InvoiceRequestWithDerivedPayerIdBuilder_build_and_sign(this_arg_conv);
71499         return tag_ptr(ret_conv, true);
71500 }
71501
71502 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceRequestWithDerivedPayerIdBuilder_1chain(JNIEnv *env, jclass clz, int64_t this_arg, jclass network) {
71503         LDKInvoiceRequestWithDerivedPayerIdBuilder this_arg_conv;
71504         this_arg_conv.inner = untag_ptr(this_arg);
71505         this_arg_conv.is_owned = ptr_is_owned(this_arg);
71506         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
71507         // WARNING: we need a move here but no clone is available for LDKInvoiceRequestWithDerivedPayerIdBuilder
71508         
71509         LDKNetwork network_conv = LDKNetwork_from_java(env, network);
71510         LDKCResult_NoneBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt12SemanticErrorZ), "LDKCResult_NoneBolt12SemanticErrorZ");
71511         *ret_conv = InvoiceRequestWithDerivedPayerIdBuilder_chain(this_arg_conv, network_conv);
71512         return tag_ptr(ret_conv, true);
71513 }
71514
71515 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceRequestWithDerivedPayerIdBuilder_1amount_1msats(JNIEnv *env, jclass clz, int64_t this_arg, int64_t amount_msats) {
71516         LDKInvoiceRequestWithDerivedPayerIdBuilder this_arg_conv;
71517         this_arg_conv.inner = untag_ptr(this_arg);
71518         this_arg_conv.is_owned = ptr_is_owned(this_arg);
71519         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
71520         // WARNING: we need a move here but no clone is available for LDKInvoiceRequestWithDerivedPayerIdBuilder
71521         
71522         LDKCResult_NoneBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt12SemanticErrorZ), "LDKCResult_NoneBolt12SemanticErrorZ");
71523         *ret_conv = InvoiceRequestWithDerivedPayerIdBuilder_amount_msats(this_arg_conv, amount_msats);
71524         return tag_ptr(ret_conv, true);
71525 }
71526
71527 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceRequestWithDerivedPayerIdBuilder_1quantity(JNIEnv *env, jclass clz, int64_t this_arg, int64_t quantity) {
71528         LDKInvoiceRequestWithDerivedPayerIdBuilder this_arg_conv;
71529         this_arg_conv.inner = untag_ptr(this_arg);
71530         this_arg_conv.is_owned = ptr_is_owned(this_arg);
71531         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
71532         // WARNING: we need a move here but no clone is available for LDKInvoiceRequestWithDerivedPayerIdBuilder
71533         
71534         LDKCResult_NoneBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt12SemanticErrorZ), "LDKCResult_NoneBolt12SemanticErrorZ");
71535         *ret_conv = InvoiceRequestWithDerivedPayerIdBuilder_quantity(this_arg_conv, quantity);
71536         return tag_ptr(ret_conv, true);
71537 }
71538
71539 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoiceRequestWithDerivedPayerIdBuilder_1payer_1note(JNIEnv *env, jclass clz, int64_t this_arg, jstring payer_note) {
71540         LDKInvoiceRequestWithDerivedPayerIdBuilder this_arg_conv;
71541         this_arg_conv.inner = untag_ptr(this_arg);
71542         this_arg_conv.is_owned = ptr_is_owned(this_arg);
71543         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
71544         // WARNING: we need a move here but no clone is available for LDKInvoiceRequestWithDerivedPayerIdBuilder
71545         
71546         LDKStr payer_note_conv = java_to_owned_str(env, payer_note);
71547         InvoiceRequestWithDerivedPayerIdBuilder_payer_note(this_arg_conv, payer_note_conv);
71548 }
71549
71550 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedInvoiceRequest_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
71551         LDKUnsignedInvoiceRequest this_obj_conv;
71552         this_obj_conv.inner = untag_ptr(this_obj);
71553         this_obj_conv.is_owned = ptr_is_owned(this_obj);
71554         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
71555         UnsignedInvoiceRequest_free(this_obj_conv);
71556 }
71557
71558 static inline uint64_t UnsignedInvoiceRequest_clone_ptr(LDKUnsignedInvoiceRequest *NONNULL_PTR arg) {
71559         LDKUnsignedInvoiceRequest ret_var = UnsignedInvoiceRequest_clone(arg);
71560         int64_t ret_ref = 0;
71561         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71562         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71563         return ret_ref;
71564 }
71565 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedInvoiceRequest_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
71566         LDKUnsignedInvoiceRequest arg_conv;
71567         arg_conv.inner = untag_ptr(arg);
71568         arg_conv.is_owned = ptr_is_owned(arg);
71569         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
71570         arg_conv.is_owned = false;
71571         int64_t ret_conv = UnsignedInvoiceRequest_clone_ptr(&arg_conv);
71572         return ret_conv;
71573 }
71574
71575 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedInvoiceRequest_1clone(JNIEnv *env, jclass clz, int64_t orig) {
71576         LDKUnsignedInvoiceRequest orig_conv;
71577         orig_conv.inner = untag_ptr(orig);
71578         orig_conv.is_owned = ptr_is_owned(orig);
71579         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
71580         orig_conv.is_owned = false;
71581         LDKUnsignedInvoiceRequest ret_var = UnsignedInvoiceRequest_clone(&orig_conv);
71582         int64_t ret_ref = 0;
71583         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71584         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71585         return ret_ref;
71586 }
71587
71588 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SignInvoiceRequestFn_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
71589         if (!ptr_is_owned(this_ptr)) return;
71590         void* this_ptr_ptr = untag_ptr(this_ptr);
71591         CHECK_ACCESS(this_ptr_ptr);
71592         LDKSignInvoiceRequestFn this_ptr_conv = *(LDKSignInvoiceRequestFn*)(this_ptr_ptr);
71593         FREE(untag_ptr(this_ptr));
71594         SignInvoiceRequestFn_free(this_ptr_conv);
71595 }
71596
71597 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedInvoiceRequest_1tagged_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
71598         LDKUnsignedInvoiceRequest this_arg_conv;
71599         this_arg_conv.inner = untag_ptr(this_arg);
71600         this_arg_conv.is_owned = ptr_is_owned(this_arg);
71601         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
71602         this_arg_conv.is_owned = false;
71603         LDKTaggedHash ret_var = UnsignedInvoiceRequest_tagged_hash(&this_arg_conv);
71604         int64_t ret_ref = 0;
71605         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71606         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71607         return ret_ref;
71608 }
71609
71610 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoiceRequest_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
71611         LDKInvoiceRequest this_obj_conv;
71612         this_obj_conv.inner = untag_ptr(this_obj);
71613         this_obj_conv.is_owned = ptr_is_owned(this_obj);
71614         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
71615         InvoiceRequest_free(this_obj_conv);
71616 }
71617
71618 static inline uint64_t InvoiceRequest_clone_ptr(LDKInvoiceRequest *NONNULL_PTR arg) {
71619         LDKInvoiceRequest ret_var = InvoiceRequest_clone(arg);
71620         int64_t ret_ref = 0;
71621         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71622         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71623         return ret_ref;
71624 }
71625 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceRequest_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
71626         LDKInvoiceRequest arg_conv;
71627         arg_conv.inner = untag_ptr(arg);
71628         arg_conv.is_owned = ptr_is_owned(arg);
71629         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
71630         arg_conv.is_owned = false;
71631         int64_t ret_conv = InvoiceRequest_clone_ptr(&arg_conv);
71632         return ret_conv;
71633 }
71634
71635 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceRequest_1clone(JNIEnv *env, jclass clz, int64_t orig) {
71636         LDKInvoiceRequest orig_conv;
71637         orig_conv.inner = untag_ptr(orig);
71638         orig_conv.is_owned = ptr_is_owned(orig);
71639         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
71640         orig_conv.is_owned = false;
71641         LDKInvoiceRequest ret_var = InvoiceRequest_clone(&orig_conv);
71642         int64_t ret_ref = 0;
71643         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71644         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71645         return ret_ref;
71646 }
71647
71648 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_VerifiedInvoiceRequest_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
71649         LDKVerifiedInvoiceRequest this_obj_conv;
71650         this_obj_conv.inner = untag_ptr(this_obj);
71651         this_obj_conv.is_owned = ptr_is_owned(this_obj);
71652         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
71653         VerifiedInvoiceRequest_free(this_obj_conv);
71654 }
71655
71656 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_VerifiedInvoiceRequest_1get_1offer_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
71657         LDKVerifiedInvoiceRequest this_ptr_conv;
71658         this_ptr_conv.inner = untag_ptr(this_ptr);
71659         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71660         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71661         this_ptr_conv.is_owned = false;
71662         LDKOfferId ret_var = VerifiedInvoiceRequest_get_offer_id(&this_ptr_conv);
71663         int64_t ret_ref = 0;
71664         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71665         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71666         return ret_ref;
71667 }
71668
71669 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_VerifiedInvoiceRequest_1set_1offer_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
71670         LDKVerifiedInvoiceRequest this_ptr_conv;
71671         this_ptr_conv.inner = untag_ptr(this_ptr);
71672         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71673         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71674         this_ptr_conv.is_owned = false;
71675         LDKOfferId val_conv;
71676         val_conv.inner = untag_ptr(val);
71677         val_conv.is_owned = ptr_is_owned(val);
71678         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
71679         val_conv = OfferId_clone(&val_conv);
71680         VerifiedInvoiceRequest_set_offer_id(&this_ptr_conv, val_conv);
71681 }
71682
71683 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_VerifiedInvoiceRequest_1get_1keys(JNIEnv *env, jclass clz, int64_t this_ptr) {
71684         LDKVerifiedInvoiceRequest this_ptr_conv;
71685         this_ptr_conv.inner = untag_ptr(this_ptr);
71686         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71687         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71688         this_ptr_conv.is_owned = false;
71689         LDKCOption_SecretKeyZ *ret_copy = MALLOC(sizeof(LDKCOption_SecretKeyZ), "LDKCOption_SecretKeyZ");
71690         *ret_copy = VerifiedInvoiceRequest_get_keys(&this_ptr_conv);
71691         int64_t ret_ref = tag_ptr(ret_copy, true);
71692         return ret_ref;
71693 }
71694
71695 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_VerifiedInvoiceRequest_1set_1keys(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
71696         LDKVerifiedInvoiceRequest this_ptr_conv;
71697         this_ptr_conv.inner = untag_ptr(this_ptr);
71698         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
71699         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
71700         this_ptr_conv.is_owned = false;
71701         void* val_ptr = untag_ptr(val);
71702         CHECK_ACCESS(val_ptr);
71703         LDKCOption_SecretKeyZ val_conv = *(LDKCOption_SecretKeyZ*)(val_ptr);
71704         val_conv = COption_SecretKeyZ_clone((LDKCOption_SecretKeyZ*)untag_ptr(val));
71705         VerifiedInvoiceRequest_set_keys(&this_ptr_conv, val_conv);
71706 }
71707
71708 static inline uint64_t VerifiedInvoiceRequest_clone_ptr(LDKVerifiedInvoiceRequest *NONNULL_PTR arg) {
71709         LDKVerifiedInvoiceRequest ret_var = VerifiedInvoiceRequest_clone(arg);
71710         int64_t ret_ref = 0;
71711         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71712         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71713         return ret_ref;
71714 }
71715 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_VerifiedInvoiceRequest_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
71716         LDKVerifiedInvoiceRequest arg_conv;
71717         arg_conv.inner = untag_ptr(arg);
71718         arg_conv.is_owned = ptr_is_owned(arg);
71719         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
71720         arg_conv.is_owned = false;
71721         int64_t ret_conv = VerifiedInvoiceRequest_clone_ptr(&arg_conv);
71722         return ret_conv;
71723 }
71724
71725 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_VerifiedInvoiceRequest_1clone(JNIEnv *env, jclass clz, int64_t orig) {
71726         LDKVerifiedInvoiceRequest orig_conv;
71727         orig_conv.inner = untag_ptr(orig);
71728         orig_conv.is_owned = ptr_is_owned(orig);
71729         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
71730         orig_conv.is_owned = false;
71731         LDKVerifiedInvoiceRequest ret_var = VerifiedInvoiceRequest_clone(&orig_conv);
71732         int64_t ret_ref = 0;
71733         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71734         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71735         return ret_ref;
71736 }
71737
71738 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_UnsignedInvoiceRequest_1chains(JNIEnv *env, jclass clz, int64_t this_arg) {
71739         LDKUnsignedInvoiceRequest this_arg_conv;
71740         this_arg_conv.inner = untag_ptr(this_arg);
71741         this_arg_conv.is_owned = ptr_is_owned(this_arg);
71742         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
71743         this_arg_conv.is_owned = false;
71744         LDKCVec_ThirtyTwoBytesZ ret_var = UnsignedInvoiceRequest_chains(&this_arg_conv);
71745         jobjectArray ret_arr = NULL;
71746         ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
71747         ;
71748         for (size_t i = 0; i < ret_var.datalen; i++) {
71749                 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, 32);
71750                 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, 32, ret_var.data[i].data);
71751                 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
71752         }
71753         
71754         FREE(ret_var.data);
71755         return ret_arr;
71756 }
71757
71758 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedInvoiceRequest_1metadata(JNIEnv *env, jclass clz, int64_t this_arg) {
71759         LDKUnsignedInvoiceRequest this_arg_conv;
71760         this_arg_conv.inner = untag_ptr(this_arg);
71761         this_arg_conv.is_owned = ptr_is_owned(this_arg);
71762         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
71763         this_arg_conv.is_owned = false;
71764         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
71765         *ret_copy = UnsignedInvoiceRequest_metadata(&this_arg_conv);
71766         int64_t ret_ref = tag_ptr(ret_copy, true);
71767         return ret_ref;
71768 }
71769
71770 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedInvoiceRequest_1amount(JNIEnv *env, jclass clz, int64_t this_arg) {
71771         LDKUnsignedInvoiceRequest this_arg_conv;
71772         this_arg_conv.inner = untag_ptr(this_arg);
71773         this_arg_conv.is_owned = ptr_is_owned(this_arg);
71774         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
71775         this_arg_conv.is_owned = false;
71776         LDKCOption_AmountZ *ret_copy = MALLOC(sizeof(LDKCOption_AmountZ), "LDKCOption_AmountZ");
71777         *ret_copy = UnsignedInvoiceRequest_amount(&this_arg_conv);
71778         int64_t ret_ref = tag_ptr(ret_copy, true);
71779         return ret_ref;
71780 }
71781
71782 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedInvoiceRequest_1description(JNIEnv *env, jclass clz, int64_t this_arg) {
71783         LDKUnsignedInvoiceRequest this_arg_conv;
71784         this_arg_conv.inner = untag_ptr(this_arg);
71785         this_arg_conv.is_owned = ptr_is_owned(this_arg);
71786         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
71787         this_arg_conv.is_owned = false;
71788         LDKPrintableString ret_var = UnsignedInvoiceRequest_description(&this_arg_conv);
71789         int64_t ret_ref = 0;
71790         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71791         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71792         return ret_ref;
71793 }
71794
71795 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedInvoiceRequest_1offer_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
71796         LDKUnsignedInvoiceRequest this_arg_conv;
71797         this_arg_conv.inner = untag_ptr(this_arg);
71798         this_arg_conv.is_owned = ptr_is_owned(this_arg);
71799         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
71800         this_arg_conv.is_owned = false;
71801         LDKOfferFeatures ret_var = UnsignedInvoiceRequest_offer_features(&this_arg_conv);
71802         int64_t ret_ref = 0;
71803         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71804         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71805         return ret_ref;
71806 }
71807
71808 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedInvoiceRequest_1absolute_1expiry(JNIEnv *env, jclass clz, int64_t this_arg) {
71809         LDKUnsignedInvoiceRequest this_arg_conv;
71810         this_arg_conv.inner = untag_ptr(this_arg);
71811         this_arg_conv.is_owned = ptr_is_owned(this_arg);
71812         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
71813         this_arg_conv.is_owned = false;
71814         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
71815         *ret_copy = UnsignedInvoiceRequest_absolute_expiry(&this_arg_conv);
71816         int64_t ret_ref = tag_ptr(ret_copy, true);
71817         return ret_ref;
71818 }
71819
71820 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedInvoiceRequest_1issuer(JNIEnv *env, jclass clz, int64_t this_arg) {
71821         LDKUnsignedInvoiceRequest this_arg_conv;
71822         this_arg_conv.inner = untag_ptr(this_arg);
71823         this_arg_conv.is_owned = ptr_is_owned(this_arg);
71824         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
71825         this_arg_conv.is_owned = false;
71826         LDKPrintableString ret_var = UnsignedInvoiceRequest_issuer(&this_arg_conv);
71827         int64_t ret_ref = 0;
71828         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71829         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71830         return ret_ref;
71831 }
71832
71833 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedInvoiceRequest_1paths(JNIEnv *env, jclass clz, int64_t this_arg) {
71834         LDKUnsignedInvoiceRequest this_arg_conv;
71835         this_arg_conv.inner = untag_ptr(this_arg);
71836         this_arg_conv.is_owned = ptr_is_owned(this_arg);
71837         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
71838         this_arg_conv.is_owned = false;
71839         LDKCVec_BlindedPathZ ret_var = UnsignedInvoiceRequest_paths(&this_arg_conv);
71840         int64_tArray ret_arr = NULL;
71841         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
71842         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
71843         for (size_t n = 0; n < ret_var.datalen; n++) {
71844                 LDKBlindedPath ret_conv_13_var = ret_var.data[n];
71845                 int64_t ret_conv_13_ref = 0;
71846                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_13_var);
71847                 ret_conv_13_ref = tag_ptr(ret_conv_13_var.inner, ret_conv_13_var.is_owned);
71848                 ret_arr_ptr[n] = ret_conv_13_ref;
71849         }
71850         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
71851         FREE(ret_var.data);
71852         return ret_arr;
71853 }
71854
71855 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedInvoiceRequest_1supported_1quantity(JNIEnv *env, jclass clz, int64_t this_arg) {
71856         LDKUnsignedInvoiceRequest this_arg_conv;
71857         this_arg_conv.inner = untag_ptr(this_arg);
71858         this_arg_conv.is_owned = ptr_is_owned(this_arg);
71859         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
71860         this_arg_conv.is_owned = false;
71861         LDKQuantity *ret_copy = MALLOC(sizeof(LDKQuantity), "LDKQuantity");
71862         *ret_copy = UnsignedInvoiceRequest_supported_quantity(&this_arg_conv);
71863         int64_t ret_ref = tag_ptr(ret_copy, true);
71864         return ret_ref;
71865 }
71866
71867 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedInvoiceRequest_1signing_1pubkey(JNIEnv *env, jclass clz, int64_t this_arg) {
71868         LDKUnsignedInvoiceRequest this_arg_conv;
71869         this_arg_conv.inner = untag_ptr(this_arg);
71870         this_arg_conv.is_owned = ptr_is_owned(this_arg);
71871         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
71872         this_arg_conv.is_owned = false;
71873         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
71874         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, UnsignedInvoiceRequest_signing_pubkey(&this_arg_conv).compressed_form);
71875         return ret_arr;
71876 }
71877
71878 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedInvoiceRequest_1payer_1metadata(JNIEnv *env, jclass clz, int64_t this_arg) {
71879         LDKUnsignedInvoiceRequest this_arg_conv;
71880         this_arg_conv.inner = untag_ptr(this_arg);
71881         this_arg_conv.is_owned = ptr_is_owned(this_arg);
71882         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
71883         this_arg_conv.is_owned = false;
71884         LDKu8slice ret_var = UnsignedInvoiceRequest_payer_metadata(&this_arg_conv);
71885         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
71886         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
71887         return ret_arr;
71888 }
71889
71890 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedInvoiceRequest_1chain(JNIEnv *env, jclass clz, int64_t this_arg) {
71891         LDKUnsignedInvoiceRequest this_arg_conv;
71892         this_arg_conv.inner = untag_ptr(this_arg);
71893         this_arg_conv.is_owned = ptr_is_owned(this_arg);
71894         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
71895         this_arg_conv.is_owned = false;
71896         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
71897         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, UnsignedInvoiceRequest_chain(&this_arg_conv).data);
71898         return ret_arr;
71899 }
71900
71901 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedInvoiceRequest_1amount_1msats(JNIEnv *env, jclass clz, int64_t this_arg) {
71902         LDKUnsignedInvoiceRequest this_arg_conv;
71903         this_arg_conv.inner = untag_ptr(this_arg);
71904         this_arg_conv.is_owned = ptr_is_owned(this_arg);
71905         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
71906         this_arg_conv.is_owned = false;
71907         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
71908         *ret_copy = UnsignedInvoiceRequest_amount_msats(&this_arg_conv);
71909         int64_t ret_ref = tag_ptr(ret_copy, true);
71910         return ret_ref;
71911 }
71912
71913 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedInvoiceRequest_1invoice_1request_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
71914         LDKUnsignedInvoiceRequest this_arg_conv;
71915         this_arg_conv.inner = untag_ptr(this_arg);
71916         this_arg_conv.is_owned = ptr_is_owned(this_arg);
71917         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
71918         this_arg_conv.is_owned = false;
71919         LDKInvoiceRequestFeatures ret_var = UnsignedInvoiceRequest_invoice_request_features(&this_arg_conv);
71920         int64_t ret_ref = 0;
71921         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71922         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71923         return ret_ref;
71924 }
71925
71926 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedInvoiceRequest_1quantity(JNIEnv *env, jclass clz, int64_t this_arg) {
71927         LDKUnsignedInvoiceRequest this_arg_conv;
71928         this_arg_conv.inner = untag_ptr(this_arg);
71929         this_arg_conv.is_owned = ptr_is_owned(this_arg);
71930         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
71931         this_arg_conv.is_owned = false;
71932         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
71933         *ret_copy = UnsignedInvoiceRequest_quantity(&this_arg_conv);
71934         int64_t ret_ref = tag_ptr(ret_copy, true);
71935         return ret_ref;
71936 }
71937
71938 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedInvoiceRequest_1payer_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
71939         LDKUnsignedInvoiceRequest this_arg_conv;
71940         this_arg_conv.inner = untag_ptr(this_arg);
71941         this_arg_conv.is_owned = ptr_is_owned(this_arg);
71942         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
71943         this_arg_conv.is_owned = false;
71944         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
71945         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, UnsignedInvoiceRequest_payer_id(&this_arg_conv).compressed_form);
71946         return ret_arr;
71947 }
71948
71949 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedInvoiceRequest_1payer_1note(JNIEnv *env, jclass clz, int64_t this_arg) {
71950         LDKUnsignedInvoiceRequest this_arg_conv;
71951         this_arg_conv.inner = untag_ptr(this_arg);
71952         this_arg_conv.is_owned = ptr_is_owned(this_arg);
71953         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
71954         this_arg_conv.is_owned = false;
71955         LDKPrintableString ret_var = UnsignedInvoiceRequest_payer_note(&this_arg_conv);
71956         int64_t ret_ref = 0;
71957         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
71958         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
71959         return ret_ref;
71960 }
71961
71962 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_InvoiceRequest_1chains(JNIEnv *env, jclass clz, int64_t this_arg) {
71963         LDKInvoiceRequest this_arg_conv;
71964         this_arg_conv.inner = untag_ptr(this_arg);
71965         this_arg_conv.is_owned = ptr_is_owned(this_arg);
71966         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
71967         this_arg_conv.is_owned = false;
71968         LDKCVec_ThirtyTwoBytesZ ret_var = InvoiceRequest_chains(&this_arg_conv);
71969         jobjectArray ret_arr = NULL;
71970         ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
71971         ;
71972         for (size_t i = 0; i < ret_var.datalen; i++) {
71973                 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, 32);
71974                 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, 32, ret_var.data[i].data);
71975                 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
71976         }
71977         
71978         FREE(ret_var.data);
71979         return ret_arr;
71980 }
71981
71982 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceRequest_1metadata(JNIEnv *env, jclass clz, int64_t this_arg) {
71983         LDKInvoiceRequest this_arg_conv;
71984         this_arg_conv.inner = untag_ptr(this_arg);
71985         this_arg_conv.is_owned = ptr_is_owned(this_arg);
71986         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
71987         this_arg_conv.is_owned = false;
71988         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
71989         *ret_copy = InvoiceRequest_metadata(&this_arg_conv);
71990         int64_t ret_ref = tag_ptr(ret_copy, true);
71991         return ret_ref;
71992 }
71993
71994 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceRequest_1amount(JNIEnv *env, jclass clz, int64_t this_arg) {
71995         LDKInvoiceRequest this_arg_conv;
71996         this_arg_conv.inner = untag_ptr(this_arg);
71997         this_arg_conv.is_owned = ptr_is_owned(this_arg);
71998         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
71999         this_arg_conv.is_owned = false;
72000         LDKCOption_AmountZ *ret_copy = MALLOC(sizeof(LDKCOption_AmountZ), "LDKCOption_AmountZ");
72001         *ret_copy = InvoiceRequest_amount(&this_arg_conv);
72002         int64_t ret_ref = tag_ptr(ret_copy, true);
72003         return ret_ref;
72004 }
72005
72006 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceRequest_1description(JNIEnv *env, jclass clz, int64_t this_arg) {
72007         LDKInvoiceRequest this_arg_conv;
72008         this_arg_conv.inner = untag_ptr(this_arg);
72009         this_arg_conv.is_owned = ptr_is_owned(this_arg);
72010         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
72011         this_arg_conv.is_owned = false;
72012         LDKPrintableString ret_var = InvoiceRequest_description(&this_arg_conv);
72013         int64_t ret_ref = 0;
72014         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
72015         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
72016         return ret_ref;
72017 }
72018
72019 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceRequest_1offer_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
72020         LDKInvoiceRequest this_arg_conv;
72021         this_arg_conv.inner = untag_ptr(this_arg);
72022         this_arg_conv.is_owned = ptr_is_owned(this_arg);
72023         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
72024         this_arg_conv.is_owned = false;
72025         LDKOfferFeatures ret_var = InvoiceRequest_offer_features(&this_arg_conv);
72026         int64_t ret_ref = 0;
72027         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
72028         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
72029         return ret_ref;
72030 }
72031
72032 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceRequest_1absolute_1expiry(JNIEnv *env, jclass clz, int64_t this_arg) {
72033         LDKInvoiceRequest this_arg_conv;
72034         this_arg_conv.inner = untag_ptr(this_arg);
72035         this_arg_conv.is_owned = ptr_is_owned(this_arg);
72036         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
72037         this_arg_conv.is_owned = false;
72038         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
72039         *ret_copy = InvoiceRequest_absolute_expiry(&this_arg_conv);
72040         int64_t ret_ref = tag_ptr(ret_copy, true);
72041         return ret_ref;
72042 }
72043
72044 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceRequest_1issuer(JNIEnv *env, jclass clz, int64_t this_arg) {
72045         LDKInvoiceRequest this_arg_conv;
72046         this_arg_conv.inner = untag_ptr(this_arg);
72047         this_arg_conv.is_owned = ptr_is_owned(this_arg);
72048         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
72049         this_arg_conv.is_owned = false;
72050         LDKPrintableString ret_var = InvoiceRequest_issuer(&this_arg_conv);
72051         int64_t ret_ref = 0;
72052         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
72053         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
72054         return ret_ref;
72055 }
72056
72057 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_InvoiceRequest_1paths(JNIEnv *env, jclass clz, int64_t this_arg) {
72058         LDKInvoiceRequest this_arg_conv;
72059         this_arg_conv.inner = untag_ptr(this_arg);
72060         this_arg_conv.is_owned = ptr_is_owned(this_arg);
72061         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
72062         this_arg_conv.is_owned = false;
72063         LDKCVec_BlindedPathZ ret_var = InvoiceRequest_paths(&this_arg_conv);
72064         int64_tArray ret_arr = NULL;
72065         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
72066         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
72067         for (size_t n = 0; n < ret_var.datalen; n++) {
72068                 LDKBlindedPath ret_conv_13_var = ret_var.data[n];
72069                 int64_t ret_conv_13_ref = 0;
72070                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_13_var);
72071                 ret_conv_13_ref = tag_ptr(ret_conv_13_var.inner, ret_conv_13_var.is_owned);
72072                 ret_arr_ptr[n] = ret_conv_13_ref;
72073         }
72074         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
72075         FREE(ret_var.data);
72076         return ret_arr;
72077 }
72078
72079 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceRequest_1supported_1quantity(JNIEnv *env, jclass clz, int64_t this_arg) {
72080         LDKInvoiceRequest this_arg_conv;
72081         this_arg_conv.inner = untag_ptr(this_arg);
72082         this_arg_conv.is_owned = ptr_is_owned(this_arg);
72083         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
72084         this_arg_conv.is_owned = false;
72085         LDKQuantity *ret_copy = MALLOC(sizeof(LDKQuantity), "LDKQuantity");
72086         *ret_copy = InvoiceRequest_supported_quantity(&this_arg_conv);
72087         int64_t ret_ref = tag_ptr(ret_copy, true);
72088         return ret_ref;
72089 }
72090
72091 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InvoiceRequest_1signing_1pubkey(JNIEnv *env, jclass clz, int64_t this_arg) {
72092         LDKInvoiceRequest this_arg_conv;
72093         this_arg_conv.inner = untag_ptr(this_arg);
72094         this_arg_conv.is_owned = ptr_is_owned(this_arg);
72095         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
72096         this_arg_conv.is_owned = false;
72097         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
72098         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, InvoiceRequest_signing_pubkey(&this_arg_conv).compressed_form);
72099         return ret_arr;
72100 }
72101
72102 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InvoiceRequest_1payer_1metadata(JNIEnv *env, jclass clz, int64_t this_arg) {
72103         LDKInvoiceRequest this_arg_conv;
72104         this_arg_conv.inner = untag_ptr(this_arg);
72105         this_arg_conv.is_owned = ptr_is_owned(this_arg);
72106         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
72107         this_arg_conv.is_owned = false;
72108         LDKu8slice ret_var = InvoiceRequest_payer_metadata(&this_arg_conv);
72109         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
72110         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
72111         return ret_arr;
72112 }
72113
72114 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InvoiceRequest_1chain(JNIEnv *env, jclass clz, int64_t this_arg) {
72115         LDKInvoiceRequest this_arg_conv;
72116         this_arg_conv.inner = untag_ptr(this_arg);
72117         this_arg_conv.is_owned = ptr_is_owned(this_arg);
72118         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
72119         this_arg_conv.is_owned = false;
72120         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
72121         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, InvoiceRequest_chain(&this_arg_conv).data);
72122         return ret_arr;
72123 }
72124
72125 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceRequest_1amount_1msats(JNIEnv *env, jclass clz, int64_t this_arg) {
72126         LDKInvoiceRequest this_arg_conv;
72127         this_arg_conv.inner = untag_ptr(this_arg);
72128         this_arg_conv.is_owned = ptr_is_owned(this_arg);
72129         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
72130         this_arg_conv.is_owned = false;
72131         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
72132         *ret_copy = InvoiceRequest_amount_msats(&this_arg_conv);
72133         int64_t ret_ref = tag_ptr(ret_copy, true);
72134         return ret_ref;
72135 }
72136
72137 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceRequest_1invoice_1request_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
72138         LDKInvoiceRequest this_arg_conv;
72139         this_arg_conv.inner = untag_ptr(this_arg);
72140         this_arg_conv.is_owned = ptr_is_owned(this_arg);
72141         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
72142         this_arg_conv.is_owned = false;
72143         LDKInvoiceRequestFeatures ret_var = InvoiceRequest_invoice_request_features(&this_arg_conv);
72144         int64_t ret_ref = 0;
72145         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
72146         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
72147         return ret_ref;
72148 }
72149
72150 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceRequest_1quantity(JNIEnv *env, jclass clz, int64_t this_arg) {
72151         LDKInvoiceRequest this_arg_conv;
72152         this_arg_conv.inner = untag_ptr(this_arg);
72153         this_arg_conv.is_owned = ptr_is_owned(this_arg);
72154         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
72155         this_arg_conv.is_owned = false;
72156         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
72157         *ret_copy = InvoiceRequest_quantity(&this_arg_conv);
72158         int64_t ret_ref = tag_ptr(ret_copy, true);
72159         return ret_ref;
72160 }
72161
72162 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InvoiceRequest_1payer_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
72163         LDKInvoiceRequest this_arg_conv;
72164         this_arg_conv.inner = untag_ptr(this_arg);
72165         this_arg_conv.is_owned = ptr_is_owned(this_arg);
72166         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
72167         this_arg_conv.is_owned = false;
72168         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
72169         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, InvoiceRequest_payer_id(&this_arg_conv).compressed_form);
72170         return ret_arr;
72171 }
72172
72173 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceRequest_1payer_1note(JNIEnv *env, jclass clz, int64_t this_arg) {
72174         LDKInvoiceRequest this_arg_conv;
72175         this_arg_conv.inner = untag_ptr(this_arg);
72176         this_arg_conv.is_owned = ptr_is_owned(this_arg);
72177         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
72178         this_arg_conv.is_owned = false;
72179         LDKPrintableString ret_var = InvoiceRequest_payer_note(&this_arg_conv);
72180         int64_t ret_ref = 0;
72181         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
72182         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
72183         return ret_ref;
72184 }
72185
72186 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceRequest_1respond_1with(JNIEnv *env, jclass clz, int64_t this_arg, int64_tArray payment_paths, int8_tArray payment_hash) {
72187         LDKInvoiceRequest this_arg_conv;
72188         this_arg_conv.inner = untag_ptr(this_arg);
72189         this_arg_conv.is_owned = ptr_is_owned(this_arg);
72190         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
72191         this_arg_conv.is_owned = false;
72192         LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ payment_paths_constr;
72193         payment_paths_constr.datalen = (*env)->GetArrayLength(env, payment_paths);
72194         if (payment_paths_constr.datalen > 0)
72195                 payment_paths_constr.data = MALLOC(payment_paths_constr.datalen * sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ Elements");
72196         else
72197                 payment_paths_constr.data = NULL;
72198         int64_t* payment_paths_vals = (*env)->GetLongArrayElements (env, payment_paths, NULL);
72199         for (size_t l = 0; l < payment_paths_constr.datalen; l++) {
72200                 int64_t payment_paths_conv_37 = payment_paths_vals[l];
72201                 void* payment_paths_conv_37_ptr = untag_ptr(payment_paths_conv_37);
72202                 CHECK_ACCESS(payment_paths_conv_37_ptr);
72203                 LDKC2Tuple_BlindedPayInfoBlindedPathZ payment_paths_conv_37_conv = *(LDKC2Tuple_BlindedPayInfoBlindedPathZ*)(payment_paths_conv_37_ptr);
72204                 payment_paths_conv_37_conv = C2Tuple_BlindedPayInfoBlindedPathZ_clone((LDKC2Tuple_BlindedPayInfoBlindedPathZ*)untag_ptr(payment_paths_conv_37));
72205                 payment_paths_constr.data[l] = payment_paths_conv_37_conv;
72206         }
72207         (*env)->ReleaseLongArrayElements(env, payment_paths, payment_paths_vals, 0);
72208         LDKThirtyTwoBytes payment_hash_ref;
72209         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
72210         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
72211         LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ), "LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ");
72212         *ret_conv = InvoiceRequest_respond_with(&this_arg_conv, payment_paths_constr, payment_hash_ref);
72213         return tag_ptr(ret_conv, true);
72214 }
72215
72216 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceRequest_1respond_1with_1no_1std(JNIEnv *env, jclass clz, int64_t this_arg, int64_tArray payment_paths, int8_tArray payment_hash, int64_t created_at) {
72217         LDKInvoiceRequest this_arg_conv;
72218         this_arg_conv.inner = untag_ptr(this_arg);
72219         this_arg_conv.is_owned = ptr_is_owned(this_arg);
72220         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
72221         this_arg_conv.is_owned = false;
72222         LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ payment_paths_constr;
72223         payment_paths_constr.datalen = (*env)->GetArrayLength(env, payment_paths);
72224         if (payment_paths_constr.datalen > 0)
72225                 payment_paths_constr.data = MALLOC(payment_paths_constr.datalen * sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ Elements");
72226         else
72227                 payment_paths_constr.data = NULL;
72228         int64_t* payment_paths_vals = (*env)->GetLongArrayElements (env, payment_paths, NULL);
72229         for (size_t l = 0; l < payment_paths_constr.datalen; l++) {
72230                 int64_t payment_paths_conv_37 = payment_paths_vals[l];
72231                 void* payment_paths_conv_37_ptr = untag_ptr(payment_paths_conv_37);
72232                 CHECK_ACCESS(payment_paths_conv_37_ptr);
72233                 LDKC2Tuple_BlindedPayInfoBlindedPathZ payment_paths_conv_37_conv = *(LDKC2Tuple_BlindedPayInfoBlindedPathZ*)(payment_paths_conv_37_ptr);
72234                 payment_paths_conv_37_conv = C2Tuple_BlindedPayInfoBlindedPathZ_clone((LDKC2Tuple_BlindedPayInfoBlindedPathZ*)untag_ptr(payment_paths_conv_37));
72235                 payment_paths_constr.data[l] = payment_paths_conv_37_conv;
72236         }
72237         (*env)->ReleaseLongArrayElements(env, payment_paths, payment_paths_vals, 0);
72238         LDKThirtyTwoBytes payment_hash_ref;
72239         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
72240         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
72241         LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ), "LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ");
72242         *ret_conv = InvoiceRequest_respond_with_no_std(&this_arg_conv, payment_paths_constr, payment_hash_ref, created_at);
72243         return tag_ptr(ret_conv, true);
72244 }
72245
72246 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceRequest_1verify(JNIEnv *env, jclass clz, int64_t this_arg, int64_t key) {
72247         LDKInvoiceRequest this_arg_conv;
72248         this_arg_conv.inner = untag_ptr(this_arg);
72249         this_arg_conv.is_owned = ptr_is_owned(this_arg);
72250         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
72251         this_arg_conv = InvoiceRequest_clone(&this_arg_conv);
72252         LDKExpandedKey key_conv;
72253         key_conv.inner = untag_ptr(key);
72254         key_conv.is_owned = ptr_is_owned(key);
72255         CHECK_INNER_FIELD_ACCESS_OR_NULL(key_conv);
72256         key_conv.is_owned = false;
72257         LDKCResult_VerifiedInvoiceRequestNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_VerifiedInvoiceRequestNoneZ), "LDKCResult_VerifiedInvoiceRequestNoneZ");
72258         *ret_conv = InvoiceRequest_verify(this_arg_conv, &key_conv);
72259         return tag_ptr(ret_conv, true);
72260 }
72261
72262 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InvoiceRequest_1signature(JNIEnv *env, jclass clz, int64_t this_arg) {
72263         LDKInvoiceRequest this_arg_conv;
72264         this_arg_conv.inner = untag_ptr(this_arg);
72265         this_arg_conv.is_owned = ptr_is_owned(this_arg);
72266         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
72267         this_arg_conv.is_owned = false;
72268         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
72269         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, InvoiceRequest_signature(&this_arg_conv).compact_form);
72270         return ret_arr;
72271 }
72272
72273 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_VerifiedInvoiceRequest_1chains(JNIEnv *env, jclass clz, int64_t this_arg) {
72274         LDKVerifiedInvoiceRequest this_arg_conv;
72275         this_arg_conv.inner = untag_ptr(this_arg);
72276         this_arg_conv.is_owned = ptr_is_owned(this_arg);
72277         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
72278         this_arg_conv.is_owned = false;
72279         LDKCVec_ThirtyTwoBytesZ ret_var = VerifiedInvoiceRequest_chains(&this_arg_conv);
72280         jobjectArray ret_arr = NULL;
72281         ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
72282         ;
72283         for (size_t i = 0; i < ret_var.datalen; i++) {
72284                 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, 32);
72285                 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, 32, ret_var.data[i].data);
72286                 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
72287         }
72288         
72289         FREE(ret_var.data);
72290         return ret_arr;
72291 }
72292
72293 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_VerifiedInvoiceRequest_1metadata(JNIEnv *env, jclass clz, int64_t this_arg) {
72294         LDKVerifiedInvoiceRequest this_arg_conv;
72295         this_arg_conv.inner = untag_ptr(this_arg);
72296         this_arg_conv.is_owned = ptr_is_owned(this_arg);
72297         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
72298         this_arg_conv.is_owned = false;
72299         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
72300         *ret_copy = VerifiedInvoiceRequest_metadata(&this_arg_conv);
72301         int64_t ret_ref = tag_ptr(ret_copy, true);
72302         return ret_ref;
72303 }
72304
72305 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_VerifiedInvoiceRequest_1amount(JNIEnv *env, jclass clz, int64_t this_arg) {
72306         LDKVerifiedInvoiceRequest this_arg_conv;
72307         this_arg_conv.inner = untag_ptr(this_arg);
72308         this_arg_conv.is_owned = ptr_is_owned(this_arg);
72309         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
72310         this_arg_conv.is_owned = false;
72311         LDKCOption_AmountZ *ret_copy = MALLOC(sizeof(LDKCOption_AmountZ), "LDKCOption_AmountZ");
72312         *ret_copy = VerifiedInvoiceRequest_amount(&this_arg_conv);
72313         int64_t ret_ref = tag_ptr(ret_copy, true);
72314         return ret_ref;
72315 }
72316
72317 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_VerifiedInvoiceRequest_1description(JNIEnv *env, jclass clz, int64_t this_arg) {
72318         LDKVerifiedInvoiceRequest this_arg_conv;
72319         this_arg_conv.inner = untag_ptr(this_arg);
72320         this_arg_conv.is_owned = ptr_is_owned(this_arg);
72321         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
72322         this_arg_conv.is_owned = false;
72323         LDKPrintableString ret_var = VerifiedInvoiceRequest_description(&this_arg_conv);
72324         int64_t ret_ref = 0;
72325         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
72326         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
72327         return ret_ref;
72328 }
72329
72330 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_VerifiedInvoiceRequest_1offer_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
72331         LDKVerifiedInvoiceRequest this_arg_conv;
72332         this_arg_conv.inner = untag_ptr(this_arg);
72333         this_arg_conv.is_owned = ptr_is_owned(this_arg);
72334         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
72335         this_arg_conv.is_owned = false;
72336         LDKOfferFeatures ret_var = VerifiedInvoiceRequest_offer_features(&this_arg_conv);
72337         int64_t ret_ref = 0;
72338         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
72339         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
72340         return ret_ref;
72341 }
72342
72343 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_VerifiedInvoiceRequest_1absolute_1expiry(JNIEnv *env, jclass clz, int64_t this_arg) {
72344         LDKVerifiedInvoiceRequest this_arg_conv;
72345         this_arg_conv.inner = untag_ptr(this_arg);
72346         this_arg_conv.is_owned = ptr_is_owned(this_arg);
72347         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
72348         this_arg_conv.is_owned = false;
72349         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
72350         *ret_copy = VerifiedInvoiceRequest_absolute_expiry(&this_arg_conv);
72351         int64_t ret_ref = tag_ptr(ret_copy, true);
72352         return ret_ref;
72353 }
72354
72355 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_VerifiedInvoiceRequest_1issuer(JNIEnv *env, jclass clz, int64_t this_arg) {
72356         LDKVerifiedInvoiceRequest this_arg_conv;
72357         this_arg_conv.inner = untag_ptr(this_arg);
72358         this_arg_conv.is_owned = ptr_is_owned(this_arg);
72359         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
72360         this_arg_conv.is_owned = false;
72361         LDKPrintableString ret_var = VerifiedInvoiceRequest_issuer(&this_arg_conv);
72362         int64_t ret_ref = 0;
72363         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
72364         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
72365         return ret_ref;
72366 }
72367
72368 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_VerifiedInvoiceRequest_1paths(JNIEnv *env, jclass clz, int64_t this_arg) {
72369         LDKVerifiedInvoiceRequest this_arg_conv;
72370         this_arg_conv.inner = untag_ptr(this_arg);
72371         this_arg_conv.is_owned = ptr_is_owned(this_arg);
72372         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
72373         this_arg_conv.is_owned = false;
72374         LDKCVec_BlindedPathZ ret_var = VerifiedInvoiceRequest_paths(&this_arg_conv);
72375         int64_tArray ret_arr = NULL;
72376         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
72377         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
72378         for (size_t n = 0; n < ret_var.datalen; n++) {
72379                 LDKBlindedPath ret_conv_13_var = ret_var.data[n];
72380                 int64_t ret_conv_13_ref = 0;
72381                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_13_var);
72382                 ret_conv_13_ref = tag_ptr(ret_conv_13_var.inner, ret_conv_13_var.is_owned);
72383                 ret_arr_ptr[n] = ret_conv_13_ref;
72384         }
72385         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
72386         FREE(ret_var.data);
72387         return ret_arr;
72388 }
72389
72390 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_VerifiedInvoiceRequest_1supported_1quantity(JNIEnv *env, jclass clz, int64_t this_arg) {
72391         LDKVerifiedInvoiceRequest this_arg_conv;
72392         this_arg_conv.inner = untag_ptr(this_arg);
72393         this_arg_conv.is_owned = ptr_is_owned(this_arg);
72394         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
72395         this_arg_conv.is_owned = false;
72396         LDKQuantity *ret_copy = MALLOC(sizeof(LDKQuantity), "LDKQuantity");
72397         *ret_copy = VerifiedInvoiceRequest_supported_quantity(&this_arg_conv);
72398         int64_t ret_ref = tag_ptr(ret_copy, true);
72399         return ret_ref;
72400 }
72401
72402 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_VerifiedInvoiceRequest_1signing_1pubkey(JNIEnv *env, jclass clz, int64_t this_arg) {
72403         LDKVerifiedInvoiceRequest this_arg_conv;
72404         this_arg_conv.inner = untag_ptr(this_arg);
72405         this_arg_conv.is_owned = ptr_is_owned(this_arg);
72406         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
72407         this_arg_conv.is_owned = false;
72408         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
72409         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, VerifiedInvoiceRequest_signing_pubkey(&this_arg_conv).compressed_form);
72410         return ret_arr;
72411 }
72412
72413 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_VerifiedInvoiceRequest_1payer_1metadata(JNIEnv *env, jclass clz, int64_t this_arg) {
72414         LDKVerifiedInvoiceRequest this_arg_conv;
72415         this_arg_conv.inner = untag_ptr(this_arg);
72416         this_arg_conv.is_owned = ptr_is_owned(this_arg);
72417         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
72418         this_arg_conv.is_owned = false;
72419         LDKu8slice ret_var = VerifiedInvoiceRequest_payer_metadata(&this_arg_conv);
72420         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
72421         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
72422         return ret_arr;
72423 }
72424
72425 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_VerifiedInvoiceRequest_1chain(JNIEnv *env, jclass clz, int64_t this_arg) {
72426         LDKVerifiedInvoiceRequest this_arg_conv;
72427         this_arg_conv.inner = untag_ptr(this_arg);
72428         this_arg_conv.is_owned = ptr_is_owned(this_arg);
72429         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
72430         this_arg_conv.is_owned = false;
72431         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
72432         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, VerifiedInvoiceRequest_chain(&this_arg_conv).data);
72433         return ret_arr;
72434 }
72435
72436 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_VerifiedInvoiceRequest_1amount_1msats(JNIEnv *env, jclass clz, int64_t this_arg) {
72437         LDKVerifiedInvoiceRequest this_arg_conv;
72438         this_arg_conv.inner = untag_ptr(this_arg);
72439         this_arg_conv.is_owned = ptr_is_owned(this_arg);
72440         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
72441         this_arg_conv.is_owned = false;
72442         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
72443         *ret_copy = VerifiedInvoiceRequest_amount_msats(&this_arg_conv);
72444         int64_t ret_ref = tag_ptr(ret_copy, true);
72445         return ret_ref;
72446 }
72447
72448 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_VerifiedInvoiceRequest_1invoice_1request_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
72449         LDKVerifiedInvoiceRequest this_arg_conv;
72450         this_arg_conv.inner = untag_ptr(this_arg);
72451         this_arg_conv.is_owned = ptr_is_owned(this_arg);
72452         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
72453         this_arg_conv.is_owned = false;
72454         LDKInvoiceRequestFeatures ret_var = VerifiedInvoiceRequest_invoice_request_features(&this_arg_conv);
72455         int64_t ret_ref = 0;
72456         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
72457         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
72458         return ret_ref;
72459 }
72460
72461 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_VerifiedInvoiceRequest_1quantity(JNIEnv *env, jclass clz, int64_t this_arg) {
72462         LDKVerifiedInvoiceRequest this_arg_conv;
72463         this_arg_conv.inner = untag_ptr(this_arg);
72464         this_arg_conv.is_owned = ptr_is_owned(this_arg);
72465         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
72466         this_arg_conv.is_owned = false;
72467         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
72468         *ret_copy = VerifiedInvoiceRequest_quantity(&this_arg_conv);
72469         int64_t ret_ref = tag_ptr(ret_copy, true);
72470         return ret_ref;
72471 }
72472
72473 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_VerifiedInvoiceRequest_1payer_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
72474         LDKVerifiedInvoiceRequest this_arg_conv;
72475         this_arg_conv.inner = untag_ptr(this_arg);
72476         this_arg_conv.is_owned = ptr_is_owned(this_arg);
72477         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
72478         this_arg_conv.is_owned = false;
72479         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
72480         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, VerifiedInvoiceRequest_payer_id(&this_arg_conv).compressed_form);
72481         return ret_arr;
72482 }
72483
72484 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_VerifiedInvoiceRequest_1payer_1note(JNIEnv *env, jclass clz, int64_t this_arg) {
72485         LDKVerifiedInvoiceRequest this_arg_conv;
72486         this_arg_conv.inner = untag_ptr(this_arg);
72487         this_arg_conv.is_owned = ptr_is_owned(this_arg);
72488         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
72489         this_arg_conv.is_owned = false;
72490         LDKPrintableString ret_var = VerifiedInvoiceRequest_payer_note(&this_arg_conv);
72491         int64_t ret_ref = 0;
72492         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
72493         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
72494         return ret_ref;
72495 }
72496
72497 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_VerifiedInvoiceRequest_1respond_1with(JNIEnv *env, jclass clz, int64_t this_arg, int64_tArray payment_paths, int8_tArray payment_hash) {
72498         LDKVerifiedInvoiceRequest this_arg_conv;
72499         this_arg_conv.inner = untag_ptr(this_arg);
72500         this_arg_conv.is_owned = ptr_is_owned(this_arg);
72501         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
72502         this_arg_conv.is_owned = false;
72503         LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ payment_paths_constr;
72504         payment_paths_constr.datalen = (*env)->GetArrayLength(env, payment_paths);
72505         if (payment_paths_constr.datalen > 0)
72506                 payment_paths_constr.data = MALLOC(payment_paths_constr.datalen * sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ Elements");
72507         else
72508                 payment_paths_constr.data = NULL;
72509         int64_t* payment_paths_vals = (*env)->GetLongArrayElements (env, payment_paths, NULL);
72510         for (size_t l = 0; l < payment_paths_constr.datalen; l++) {
72511                 int64_t payment_paths_conv_37 = payment_paths_vals[l];
72512                 void* payment_paths_conv_37_ptr = untag_ptr(payment_paths_conv_37);
72513                 CHECK_ACCESS(payment_paths_conv_37_ptr);
72514                 LDKC2Tuple_BlindedPayInfoBlindedPathZ payment_paths_conv_37_conv = *(LDKC2Tuple_BlindedPayInfoBlindedPathZ*)(payment_paths_conv_37_ptr);
72515                 payment_paths_conv_37_conv = C2Tuple_BlindedPayInfoBlindedPathZ_clone((LDKC2Tuple_BlindedPayInfoBlindedPathZ*)untag_ptr(payment_paths_conv_37));
72516                 payment_paths_constr.data[l] = payment_paths_conv_37_conv;
72517         }
72518         (*env)->ReleaseLongArrayElements(env, payment_paths, payment_paths_vals, 0);
72519         LDKThirtyTwoBytes payment_hash_ref;
72520         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
72521         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
72522         LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ), "LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ");
72523         *ret_conv = VerifiedInvoiceRequest_respond_with(&this_arg_conv, payment_paths_constr, payment_hash_ref);
72524         return tag_ptr(ret_conv, true);
72525 }
72526
72527 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_VerifiedInvoiceRequest_1respond_1with_1no_1std(JNIEnv *env, jclass clz, int64_t this_arg, int64_tArray payment_paths, int8_tArray payment_hash, int64_t created_at) {
72528         LDKVerifiedInvoiceRequest this_arg_conv;
72529         this_arg_conv.inner = untag_ptr(this_arg);
72530         this_arg_conv.is_owned = ptr_is_owned(this_arg);
72531         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
72532         this_arg_conv.is_owned = false;
72533         LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ payment_paths_constr;
72534         payment_paths_constr.datalen = (*env)->GetArrayLength(env, payment_paths);
72535         if (payment_paths_constr.datalen > 0)
72536                 payment_paths_constr.data = MALLOC(payment_paths_constr.datalen * sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ Elements");
72537         else
72538                 payment_paths_constr.data = NULL;
72539         int64_t* payment_paths_vals = (*env)->GetLongArrayElements (env, payment_paths, NULL);
72540         for (size_t l = 0; l < payment_paths_constr.datalen; l++) {
72541                 int64_t payment_paths_conv_37 = payment_paths_vals[l];
72542                 void* payment_paths_conv_37_ptr = untag_ptr(payment_paths_conv_37);
72543                 CHECK_ACCESS(payment_paths_conv_37_ptr);
72544                 LDKC2Tuple_BlindedPayInfoBlindedPathZ payment_paths_conv_37_conv = *(LDKC2Tuple_BlindedPayInfoBlindedPathZ*)(payment_paths_conv_37_ptr);
72545                 payment_paths_conv_37_conv = C2Tuple_BlindedPayInfoBlindedPathZ_clone((LDKC2Tuple_BlindedPayInfoBlindedPathZ*)untag_ptr(payment_paths_conv_37));
72546                 payment_paths_constr.data[l] = payment_paths_conv_37_conv;
72547         }
72548         (*env)->ReleaseLongArrayElements(env, payment_paths, payment_paths_vals, 0);
72549         LDKThirtyTwoBytes payment_hash_ref;
72550         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
72551         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
72552         LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ), "LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ");
72553         *ret_conv = VerifiedInvoiceRequest_respond_with_no_std(&this_arg_conv, payment_paths_constr, payment_hash_ref, created_at);
72554         return tag_ptr(ret_conv, true);
72555 }
72556
72557 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_VerifiedInvoiceRequest_1respond_1using_1derived_1keys(JNIEnv *env, jclass clz, int64_t this_arg, int64_tArray payment_paths, int8_tArray payment_hash) {
72558         LDKVerifiedInvoiceRequest this_arg_conv;
72559         this_arg_conv.inner = untag_ptr(this_arg);
72560         this_arg_conv.is_owned = ptr_is_owned(this_arg);
72561         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
72562         this_arg_conv.is_owned = false;
72563         LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ payment_paths_constr;
72564         payment_paths_constr.datalen = (*env)->GetArrayLength(env, payment_paths);
72565         if (payment_paths_constr.datalen > 0)
72566                 payment_paths_constr.data = MALLOC(payment_paths_constr.datalen * sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ Elements");
72567         else
72568                 payment_paths_constr.data = NULL;
72569         int64_t* payment_paths_vals = (*env)->GetLongArrayElements (env, payment_paths, NULL);
72570         for (size_t l = 0; l < payment_paths_constr.datalen; l++) {
72571                 int64_t payment_paths_conv_37 = payment_paths_vals[l];
72572                 void* payment_paths_conv_37_ptr = untag_ptr(payment_paths_conv_37);
72573                 CHECK_ACCESS(payment_paths_conv_37_ptr);
72574                 LDKC2Tuple_BlindedPayInfoBlindedPathZ payment_paths_conv_37_conv = *(LDKC2Tuple_BlindedPayInfoBlindedPathZ*)(payment_paths_conv_37_ptr);
72575                 payment_paths_conv_37_conv = C2Tuple_BlindedPayInfoBlindedPathZ_clone((LDKC2Tuple_BlindedPayInfoBlindedPathZ*)untag_ptr(payment_paths_conv_37));
72576                 payment_paths_constr.data[l] = payment_paths_conv_37_conv;
72577         }
72578         (*env)->ReleaseLongArrayElements(env, payment_paths, payment_paths_vals, 0);
72579         LDKThirtyTwoBytes payment_hash_ref;
72580         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
72581         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
72582         LDKCResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ), "LDKCResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ");
72583         *ret_conv = VerifiedInvoiceRequest_respond_using_derived_keys(&this_arg_conv, payment_paths_constr, payment_hash_ref);
72584         return tag_ptr(ret_conv, true);
72585 }
72586
72587 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_VerifiedInvoiceRequest_1respond_1using_1derived_1keys_1no_1std(JNIEnv *env, jclass clz, int64_t this_arg, int64_tArray payment_paths, int8_tArray payment_hash, int64_t created_at) {
72588         LDKVerifiedInvoiceRequest this_arg_conv;
72589         this_arg_conv.inner = untag_ptr(this_arg);
72590         this_arg_conv.is_owned = ptr_is_owned(this_arg);
72591         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
72592         this_arg_conv.is_owned = false;
72593         LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ payment_paths_constr;
72594         payment_paths_constr.datalen = (*env)->GetArrayLength(env, payment_paths);
72595         if (payment_paths_constr.datalen > 0)
72596                 payment_paths_constr.data = MALLOC(payment_paths_constr.datalen * sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ Elements");
72597         else
72598                 payment_paths_constr.data = NULL;
72599         int64_t* payment_paths_vals = (*env)->GetLongArrayElements (env, payment_paths, NULL);
72600         for (size_t l = 0; l < payment_paths_constr.datalen; l++) {
72601                 int64_t payment_paths_conv_37 = payment_paths_vals[l];
72602                 void* payment_paths_conv_37_ptr = untag_ptr(payment_paths_conv_37);
72603                 CHECK_ACCESS(payment_paths_conv_37_ptr);
72604                 LDKC2Tuple_BlindedPayInfoBlindedPathZ payment_paths_conv_37_conv = *(LDKC2Tuple_BlindedPayInfoBlindedPathZ*)(payment_paths_conv_37_ptr);
72605                 payment_paths_conv_37_conv = C2Tuple_BlindedPayInfoBlindedPathZ_clone((LDKC2Tuple_BlindedPayInfoBlindedPathZ*)untag_ptr(payment_paths_conv_37));
72606                 payment_paths_constr.data[l] = payment_paths_conv_37_conv;
72607         }
72608         (*env)->ReleaseLongArrayElements(env, payment_paths, payment_paths_vals, 0);
72609         LDKThirtyTwoBytes payment_hash_ref;
72610         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
72611         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
72612         LDKCResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ), "LDKCResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ");
72613         *ret_conv = VerifiedInvoiceRequest_respond_using_derived_keys_no_std(&this_arg_conv, payment_paths_constr, payment_hash_ref, created_at);
72614         return tag_ptr(ret_conv, true);
72615 }
72616
72617 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedInvoiceRequest_1write(JNIEnv *env, jclass clz, int64_t obj) {
72618         LDKUnsignedInvoiceRequest obj_conv;
72619         obj_conv.inner = untag_ptr(obj);
72620         obj_conv.is_owned = ptr_is_owned(obj);
72621         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
72622         obj_conv.is_owned = false;
72623         LDKCVec_u8Z ret_var = UnsignedInvoiceRequest_write(&obj_conv);
72624         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
72625         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
72626         CVec_u8Z_free(ret_var);
72627         return ret_arr;
72628 }
72629
72630 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InvoiceRequest_1write(JNIEnv *env, jclass clz, int64_t obj) {
72631         LDKInvoiceRequest obj_conv;
72632         obj_conv.inner = untag_ptr(obj);
72633         obj_conv.is_owned = ptr_is_owned(obj);
72634         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
72635         obj_conv.is_owned = false;
72636         LDKCVec_u8Z ret_var = InvoiceRequest_write(&obj_conv);
72637         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
72638         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
72639         CVec_u8Z_free(ret_var);
72640         return ret_arr;
72641 }
72642
72643 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoiceRequestFields_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
72644         LDKInvoiceRequestFields this_obj_conv;
72645         this_obj_conv.inner = untag_ptr(this_obj);
72646         this_obj_conv.is_owned = ptr_is_owned(this_obj);
72647         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
72648         InvoiceRequestFields_free(this_obj_conv);
72649 }
72650
72651 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InvoiceRequestFields_1get_1payer_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
72652         LDKInvoiceRequestFields 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         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
72658         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, InvoiceRequestFields_get_payer_id(&this_ptr_conv).compressed_form);
72659         return ret_arr;
72660 }
72661
72662 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoiceRequestFields_1set_1payer_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
72663         LDKInvoiceRequestFields this_ptr_conv;
72664         this_ptr_conv.inner = untag_ptr(this_ptr);
72665         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72666         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72667         this_ptr_conv.is_owned = false;
72668         LDKPublicKey val_ref;
72669         CHECK((*env)->GetArrayLength(env, val) == 33);
72670         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
72671         InvoiceRequestFields_set_payer_id(&this_ptr_conv, val_ref);
72672 }
72673
72674 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceRequestFields_1get_1quantity(JNIEnv *env, jclass clz, int64_t this_ptr) {
72675         LDKInvoiceRequestFields this_ptr_conv;
72676         this_ptr_conv.inner = untag_ptr(this_ptr);
72677         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72678         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72679         this_ptr_conv.is_owned = false;
72680         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
72681         *ret_copy = InvoiceRequestFields_get_quantity(&this_ptr_conv);
72682         int64_t ret_ref = tag_ptr(ret_copy, true);
72683         return ret_ref;
72684 }
72685
72686 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoiceRequestFields_1set_1quantity(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
72687         LDKInvoiceRequestFields this_ptr_conv;
72688         this_ptr_conv.inner = untag_ptr(this_ptr);
72689         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72690         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72691         this_ptr_conv.is_owned = false;
72692         void* val_ptr = untag_ptr(val);
72693         CHECK_ACCESS(val_ptr);
72694         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
72695         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
72696         InvoiceRequestFields_set_quantity(&this_ptr_conv, val_conv);
72697 }
72698
72699 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceRequestFields_1get_1payer_1note_1truncated(JNIEnv *env, jclass clz, int64_t this_ptr) {
72700         LDKInvoiceRequestFields this_ptr_conv;
72701         this_ptr_conv.inner = untag_ptr(this_ptr);
72702         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72703         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72704         this_ptr_conv.is_owned = false;
72705         LDKUntrustedString ret_var = InvoiceRequestFields_get_payer_note_truncated(&this_ptr_conv);
72706         int64_t ret_ref = 0;
72707         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
72708         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
72709         return ret_ref;
72710 }
72711
72712 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoiceRequestFields_1set_1payer_1note_1truncated(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
72713         LDKInvoiceRequestFields this_ptr_conv;
72714         this_ptr_conv.inner = untag_ptr(this_ptr);
72715         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
72716         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
72717         this_ptr_conv.is_owned = false;
72718         LDKUntrustedString val_conv;
72719         val_conv.inner = untag_ptr(val);
72720         val_conv.is_owned = ptr_is_owned(val);
72721         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
72722         val_conv = UntrustedString_clone(&val_conv);
72723         InvoiceRequestFields_set_payer_note_truncated(&this_ptr_conv, val_conv);
72724 }
72725
72726 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceRequestFields_1new(JNIEnv *env, jclass clz, int8_tArray payer_id_arg, int64_t quantity_arg, int64_t payer_note_truncated_arg) {
72727         LDKPublicKey payer_id_arg_ref;
72728         CHECK((*env)->GetArrayLength(env, payer_id_arg) == 33);
72729         (*env)->GetByteArrayRegion(env, payer_id_arg, 0, 33, payer_id_arg_ref.compressed_form);
72730         void* quantity_arg_ptr = untag_ptr(quantity_arg);
72731         CHECK_ACCESS(quantity_arg_ptr);
72732         LDKCOption_u64Z quantity_arg_conv = *(LDKCOption_u64Z*)(quantity_arg_ptr);
72733         quantity_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(quantity_arg));
72734         LDKUntrustedString payer_note_truncated_arg_conv;
72735         payer_note_truncated_arg_conv.inner = untag_ptr(payer_note_truncated_arg);
72736         payer_note_truncated_arg_conv.is_owned = ptr_is_owned(payer_note_truncated_arg);
72737         CHECK_INNER_FIELD_ACCESS_OR_NULL(payer_note_truncated_arg_conv);
72738         payer_note_truncated_arg_conv = UntrustedString_clone(&payer_note_truncated_arg_conv);
72739         LDKInvoiceRequestFields ret_var = InvoiceRequestFields_new(payer_id_arg_ref, quantity_arg_conv, payer_note_truncated_arg_conv);
72740         int64_t ret_ref = 0;
72741         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
72742         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
72743         return ret_ref;
72744 }
72745
72746 static inline uint64_t InvoiceRequestFields_clone_ptr(LDKInvoiceRequestFields *NONNULL_PTR arg) {
72747         LDKInvoiceRequestFields ret_var = InvoiceRequestFields_clone(arg);
72748         int64_t ret_ref = 0;
72749         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
72750         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
72751         return ret_ref;
72752 }
72753 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceRequestFields_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
72754         LDKInvoiceRequestFields arg_conv;
72755         arg_conv.inner = untag_ptr(arg);
72756         arg_conv.is_owned = ptr_is_owned(arg);
72757         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
72758         arg_conv.is_owned = false;
72759         int64_t ret_conv = InvoiceRequestFields_clone_ptr(&arg_conv);
72760         return ret_conv;
72761 }
72762
72763 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceRequestFields_1clone(JNIEnv *env, jclass clz, int64_t orig) {
72764         LDKInvoiceRequestFields orig_conv;
72765         orig_conv.inner = untag_ptr(orig);
72766         orig_conv.is_owned = ptr_is_owned(orig);
72767         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
72768         orig_conv.is_owned = false;
72769         LDKInvoiceRequestFields ret_var = InvoiceRequestFields_clone(&orig_conv);
72770         int64_t ret_ref = 0;
72771         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
72772         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
72773         return ret_ref;
72774 }
72775
72776 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InvoiceRequestFields_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
72777         LDKInvoiceRequestFields a_conv;
72778         a_conv.inner = untag_ptr(a);
72779         a_conv.is_owned = ptr_is_owned(a);
72780         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
72781         a_conv.is_owned = false;
72782         LDKInvoiceRequestFields b_conv;
72783         b_conv.inner = untag_ptr(b);
72784         b_conv.is_owned = ptr_is_owned(b);
72785         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
72786         b_conv.is_owned = false;
72787         jboolean ret_conv = InvoiceRequestFields_eq(&a_conv, &b_conv);
72788         return ret_conv;
72789 }
72790
72791 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InvoiceRequestFields_1write(JNIEnv *env, jclass clz, int64_t obj) {
72792         LDKInvoiceRequestFields obj_conv;
72793         obj_conv.inner = untag_ptr(obj);
72794         obj_conv.is_owned = ptr_is_owned(obj);
72795         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
72796         obj_conv.is_owned = false;
72797         LDKCVec_u8Z ret_var = InvoiceRequestFields_write(&obj_conv);
72798         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
72799         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
72800         CVec_u8Z_free(ret_var);
72801         return ret_arr;
72802 }
72803
72804 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceRequestFields_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
72805         LDKu8slice ser_ref;
72806         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
72807         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
72808         LDKCResult_InvoiceRequestFieldsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceRequestFieldsDecodeErrorZ), "LDKCResult_InvoiceRequestFieldsDecodeErrorZ");
72809         *ret_conv = InvoiceRequestFields_read(ser_ref);
72810         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
72811         return tag_ptr(ret_conv, true);
72812 }
72813
72814 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TaggedHash_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
72815         LDKTaggedHash this_obj_conv;
72816         this_obj_conv.inner = untag_ptr(this_obj);
72817         this_obj_conv.is_owned = ptr_is_owned(this_obj);
72818         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
72819         TaggedHash_free(this_obj_conv);
72820 }
72821
72822 static inline uint64_t TaggedHash_clone_ptr(LDKTaggedHash *NONNULL_PTR arg) {
72823         LDKTaggedHash ret_var = TaggedHash_clone(arg);
72824         int64_t ret_ref = 0;
72825         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
72826         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
72827         return ret_ref;
72828 }
72829 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TaggedHash_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
72830         LDKTaggedHash arg_conv;
72831         arg_conv.inner = untag_ptr(arg);
72832         arg_conv.is_owned = ptr_is_owned(arg);
72833         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
72834         arg_conv.is_owned = false;
72835         int64_t ret_conv = TaggedHash_clone_ptr(&arg_conv);
72836         return ret_conv;
72837 }
72838
72839 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TaggedHash_1clone(JNIEnv *env, jclass clz, int64_t orig) {
72840         LDKTaggedHash orig_conv;
72841         orig_conv.inner = untag_ptr(orig);
72842         orig_conv.is_owned = ptr_is_owned(orig);
72843         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
72844         orig_conv.is_owned = false;
72845         LDKTaggedHash ret_var = TaggedHash_clone(&orig_conv);
72846         int64_t ret_ref = 0;
72847         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
72848         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
72849         return ret_ref;
72850 }
72851
72852 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TaggedHash_1as_1digest(JNIEnv *env, jclass clz, int64_t this_arg) {
72853         LDKTaggedHash this_arg_conv;
72854         this_arg_conv.inner = untag_ptr(this_arg);
72855         this_arg_conv.is_owned = ptr_is_owned(this_arg);
72856         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
72857         this_arg_conv.is_owned = false;
72858         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
72859         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *TaggedHash_as_digest(&this_arg_conv));
72860         return ret_arr;
72861 }
72862
72863 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_TaggedHash_1tag(JNIEnv *env, jclass clz, int64_t this_arg) {
72864         LDKTaggedHash this_arg_conv;
72865         this_arg_conv.inner = untag_ptr(this_arg);
72866         this_arg_conv.is_owned = ptr_is_owned(this_arg);
72867         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
72868         this_arg_conv.is_owned = false;
72869         LDKStr ret_str = TaggedHash_tag(&this_arg_conv);
72870         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
72871         Str_free(ret_str);
72872         return ret_conv;
72873 }
72874
72875 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TaggedHash_1merkle_1root(JNIEnv *env, jclass clz, int64_t this_arg) {
72876         LDKTaggedHash this_arg_conv;
72877         this_arg_conv.inner = untag_ptr(this_arg);
72878         this_arg_conv.is_owned = ptr_is_owned(this_arg);
72879         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
72880         this_arg_conv.is_owned = false;
72881         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
72882         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, TaggedHash_merkle_root(&this_arg_conv).data);
72883         return ret_arr;
72884 }
72885
72886 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SignError_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
72887         if (!ptr_is_owned(this_ptr)) return;
72888         void* this_ptr_ptr = untag_ptr(this_ptr);
72889         CHECK_ACCESS(this_ptr_ptr);
72890         LDKSignError this_ptr_conv = *(LDKSignError*)(this_ptr_ptr);
72891         FREE(untag_ptr(this_ptr));
72892         SignError_free(this_ptr_conv);
72893 }
72894
72895 static inline uint64_t SignError_clone_ptr(LDKSignError *NONNULL_PTR arg) {
72896         LDKSignError *ret_copy = MALLOC(sizeof(LDKSignError), "LDKSignError");
72897         *ret_copy = SignError_clone(arg);
72898         int64_t ret_ref = tag_ptr(ret_copy, true);
72899         return ret_ref;
72900 }
72901 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
72902         LDKSignError* arg_conv = (LDKSignError*)untag_ptr(arg);
72903         int64_t ret_conv = SignError_clone_ptr(arg_conv);
72904         return ret_conv;
72905 }
72906
72907 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
72908         LDKSignError* orig_conv = (LDKSignError*)untag_ptr(orig);
72909         LDKSignError *ret_copy = MALLOC(sizeof(LDKSignError), "LDKSignError");
72910         *ret_copy = SignError_clone(orig_conv);
72911         int64_t ret_ref = tag_ptr(ret_copy, true);
72912         return ret_ref;
72913 }
72914
72915 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignError_1signing(JNIEnv *env, jclass clz) {
72916         LDKSignError *ret_copy = MALLOC(sizeof(LDKSignError), "LDKSignError");
72917         *ret_copy = SignError_signing();
72918         int64_t ret_ref = tag_ptr(ret_copy, true);
72919         return ret_ref;
72920 }
72921
72922 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignError_1verification(JNIEnv *env, jclass clz, jclass a) {
72923         LDKSecp256k1Error a_conv = LDKSecp256k1Error_from_java(env, a);
72924         LDKSignError *ret_copy = MALLOC(sizeof(LDKSignError), "LDKSignError");
72925         *ret_copy = SignError_verification(a_conv);
72926         int64_t ret_ref = tag_ptr(ret_copy, true);
72927         return ret_ref;
72928 }
72929
72930 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Bolt12ParseError_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
72931         LDKBolt12ParseError this_obj_conv;
72932         this_obj_conv.inner = untag_ptr(this_obj);
72933         this_obj_conv.is_owned = ptr_is_owned(this_obj);
72934         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
72935         Bolt12ParseError_free(this_obj_conv);
72936 }
72937
72938 static inline uint64_t Bolt12ParseError_clone_ptr(LDKBolt12ParseError *NONNULL_PTR arg) {
72939         LDKBolt12ParseError ret_var = Bolt12ParseError_clone(arg);
72940         int64_t ret_ref = 0;
72941         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
72942         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
72943         return ret_ref;
72944 }
72945 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12ParseError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
72946         LDKBolt12ParseError arg_conv;
72947         arg_conv.inner = untag_ptr(arg);
72948         arg_conv.is_owned = ptr_is_owned(arg);
72949         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
72950         arg_conv.is_owned = false;
72951         int64_t ret_conv = Bolt12ParseError_clone_ptr(&arg_conv);
72952         return ret_conv;
72953 }
72954
72955 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12ParseError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
72956         LDKBolt12ParseError orig_conv;
72957         orig_conv.inner = untag_ptr(orig);
72958         orig_conv.is_owned = ptr_is_owned(orig);
72959         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
72960         orig_conv.is_owned = false;
72961         LDKBolt12ParseError ret_var = Bolt12ParseError_clone(&orig_conv);
72962         int64_t ret_ref = 0;
72963         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
72964         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
72965         return ret_ref;
72966 }
72967
72968 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
72969         LDKBolt12SemanticError* orig_conv = (LDKBolt12SemanticError*)untag_ptr(orig);
72970         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_clone(orig_conv));
72971         return ret_conv;
72972 }
72973
72974 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1already_1expired(JNIEnv *env, jclass clz) {
72975         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_already_expired());
72976         return ret_conv;
72977 }
72978
72979 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1unsupported_1chain(JNIEnv *env, jclass clz) {
72980         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_unsupported_chain());
72981         return ret_conv;
72982 }
72983
72984 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1unexpected_1chain(JNIEnv *env, jclass clz) {
72985         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_unexpected_chain());
72986         return ret_conv;
72987 }
72988
72989 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1missing_1amount(JNIEnv *env, jclass clz) {
72990         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_missing_amount());
72991         return ret_conv;
72992 }
72993
72994 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1invalid_1amount(JNIEnv *env, jclass clz) {
72995         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_invalid_amount());
72996         return ret_conv;
72997 }
72998
72999 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1insufficient_1amount(JNIEnv *env, jclass clz) {
73000         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_insufficient_amount());
73001         return ret_conv;
73002 }
73003
73004 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1unexpected_1amount(JNIEnv *env, jclass clz) {
73005         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_unexpected_amount());
73006         return ret_conv;
73007 }
73008
73009 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1unsupported_1currency(JNIEnv *env, jclass clz) {
73010         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_unsupported_currency());
73011         return ret_conv;
73012 }
73013
73014 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1unknown_1required_1features(JNIEnv *env, jclass clz) {
73015         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_unknown_required_features());
73016         return ret_conv;
73017 }
73018
73019 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1unexpected_1features(JNIEnv *env, jclass clz) {
73020         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_unexpected_features());
73021         return ret_conv;
73022 }
73023
73024 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1missing_1description(JNIEnv *env, jclass clz) {
73025         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_missing_description());
73026         return ret_conv;
73027 }
73028
73029 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1missing_1signing_1pubkey(JNIEnv *env, jclass clz) {
73030         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_missing_signing_pubkey());
73031         return ret_conv;
73032 }
73033
73034 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1invalid_1signing_1pubkey(JNIEnv *env, jclass clz) {
73035         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_invalid_signing_pubkey());
73036         return ret_conv;
73037 }
73038
73039 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1unexpected_1signing_1pubkey(JNIEnv *env, jclass clz) {
73040         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_unexpected_signing_pubkey());
73041         return ret_conv;
73042 }
73043
73044 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1missing_1quantity(JNIEnv *env, jclass clz) {
73045         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_missing_quantity());
73046         return ret_conv;
73047 }
73048
73049 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1invalid_1quantity(JNIEnv *env, jclass clz) {
73050         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_invalid_quantity());
73051         return ret_conv;
73052 }
73053
73054 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1unexpected_1quantity(JNIEnv *env, jclass clz) {
73055         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_unexpected_quantity());
73056         return ret_conv;
73057 }
73058
73059 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1invalid_1metadata(JNIEnv *env, jclass clz) {
73060         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_invalid_metadata());
73061         return ret_conv;
73062 }
73063
73064 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1unexpected_1metadata(JNIEnv *env, jclass clz) {
73065         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_unexpected_metadata());
73066         return ret_conv;
73067 }
73068
73069 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1missing_1payer_1metadata(JNIEnv *env, jclass clz) {
73070         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_missing_payer_metadata());
73071         return ret_conv;
73072 }
73073
73074 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1missing_1payer_1id(JNIEnv *env, jclass clz) {
73075         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_missing_payer_id());
73076         return ret_conv;
73077 }
73078
73079 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1duplicate_1payment_1id(JNIEnv *env, jclass clz) {
73080         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_duplicate_payment_id());
73081         return ret_conv;
73082 }
73083
73084 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1missing_1paths(JNIEnv *env, jclass clz) {
73085         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_missing_paths());
73086         return ret_conv;
73087 }
73088
73089 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1unexpected_1paths(JNIEnv *env, jclass clz) {
73090         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_unexpected_paths());
73091         return ret_conv;
73092 }
73093
73094 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1invalid_1pay_1info(JNIEnv *env, jclass clz) {
73095         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_invalid_pay_info());
73096         return ret_conv;
73097 }
73098
73099 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1missing_1creation_1time(JNIEnv *env, jclass clz) {
73100         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_missing_creation_time());
73101         return ret_conv;
73102 }
73103
73104 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1missing_1payment_1hash(JNIEnv *env, jclass clz) {
73105         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_missing_payment_hash());
73106         return ret_conv;
73107 }
73108
73109 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1missing_1signature(JNIEnv *env, jclass clz) {
73110         jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_missing_signature());
73111         return ret_conv;
73112 }
73113
73114 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RefundMaybeWithDerivedMetadataBuilder_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
73115         LDKRefundMaybeWithDerivedMetadataBuilder this_obj_conv;
73116         this_obj_conv.inner = untag_ptr(this_obj);
73117         this_obj_conv.is_owned = ptr_is_owned(this_obj);
73118         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
73119         RefundMaybeWithDerivedMetadataBuilder_free(this_obj_conv);
73120 }
73121
73122 static inline uint64_t RefundMaybeWithDerivedMetadataBuilder_clone_ptr(LDKRefundMaybeWithDerivedMetadataBuilder *NONNULL_PTR arg) {
73123         LDKRefundMaybeWithDerivedMetadataBuilder ret_var = RefundMaybeWithDerivedMetadataBuilder_clone(arg);
73124         int64_t ret_ref = 0;
73125         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73126         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73127         return ret_ref;
73128 }
73129 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RefundMaybeWithDerivedMetadataBuilder_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
73130         LDKRefundMaybeWithDerivedMetadataBuilder arg_conv;
73131         arg_conv.inner = untag_ptr(arg);
73132         arg_conv.is_owned = ptr_is_owned(arg);
73133         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
73134         arg_conv.is_owned = false;
73135         int64_t ret_conv = RefundMaybeWithDerivedMetadataBuilder_clone_ptr(&arg_conv);
73136         return ret_conv;
73137 }
73138
73139 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RefundMaybeWithDerivedMetadataBuilder_1clone(JNIEnv *env, jclass clz, int64_t orig) {
73140         LDKRefundMaybeWithDerivedMetadataBuilder orig_conv;
73141         orig_conv.inner = untag_ptr(orig);
73142         orig_conv.is_owned = ptr_is_owned(orig);
73143         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
73144         orig_conv.is_owned = false;
73145         LDKRefundMaybeWithDerivedMetadataBuilder ret_var = RefundMaybeWithDerivedMetadataBuilder_clone(&orig_conv);
73146         int64_t ret_ref = 0;
73147         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73148         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73149         return ret_ref;
73150 }
73151
73152 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RefundMaybeWithDerivedMetadataBuilder_1new(JNIEnv *env, jclass clz, int8_tArray metadata, int8_tArray payer_id, int64_t amount_msats) {
73153         LDKCVec_u8Z metadata_ref;
73154         metadata_ref.datalen = (*env)->GetArrayLength(env, metadata);
73155         metadata_ref.data = MALLOC(metadata_ref.datalen, "LDKCVec_u8Z Bytes");
73156         (*env)->GetByteArrayRegion(env, metadata, 0, metadata_ref.datalen, metadata_ref.data);
73157         LDKPublicKey payer_id_ref;
73158         CHECK((*env)->GetArrayLength(env, payer_id) == 33);
73159         (*env)->GetByteArrayRegion(env, payer_id, 0, 33, payer_id_ref.compressed_form);
73160         LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ), "LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ");
73161         *ret_conv = RefundMaybeWithDerivedMetadataBuilder_new(metadata_ref, payer_id_ref, amount_msats);
73162         return tag_ptr(ret_conv, true);
73163 }
73164
73165 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RefundMaybeWithDerivedMetadataBuilder_1deriving_1payer_1id(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t expanded_key, int64_t entropy_source, int64_t amount_msats, int8_tArray payment_id) {
73166         LDKPublicKey node_id_ref;
73167         CHECK((*env)->GetArrayLength(env, node_id) == 33);
73168         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
73169         LDKExpandedKey expanded_key_conv;
73170         expanded_key_conv.inner = untag_ptr(expanded_key);
73171         expanded_key_conv.is_owned = ptr_is_owned(expanded_key);
73172         CHECK_INNER_FIELD_ACCESS_OR_NULL(expanded_key_conv);
73173         expanded_key_conv.is_owned = false;
73174         void* entropy_source_ptr = untag_ptr(entropy_source);
73175         CHECK_ACCESS(entropy_source_ptr);
73176         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
73177         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
73178                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
73179                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
73180         }
73181         LDKThirtyTwoBytes payment_id_ref;
73182         CHECK((*env)->GetArrayLength(env, payment_id) == 32);
73183         (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
73184         LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ), "LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ");
73185         *ret_conv = RefundMaybeWithDerivedMetadataBuilder_deriving_payer_id(node_id_ref, &expanded_key_conv, entropy_source_conv, amount_msats, payment_id_ref);
73186         return tag_ptr(ret_conv, true);
73187 }
73188
73189 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RefundMaybeWithDerivedMetadataBuilder_1description(JNIEnv *env, jclass clz, int64_t this_arg, jstring description) {
73190         LDKRefundMaybeWithDerivedMetadataBuilder this_arg_conv;
73191         this_arg_conv.inner = untag_ptr(this_arg);
73192         this_arg_conv.is_owned = ptr_is_owned(this_arg);
73193         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
73194         this_arg_conv = RefundMaybeWithDerivedMetadataBuilder_clone(&this_arg_conv);
73195         LDKStr description_conv = java_to_owned_str(env, description);
73196         RefundMaybeWithDerivedMetadataBuilder_description(this_arg_conv, description_conv);
73197 }
73198
73199 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RefundMaybeWithDerivedMetadataBuilder_1absolute_1expiry(JNIEnv *env, jclass clz, int64_t this_arg, int64_t absolute_expiry) {
73200         LDKRefundMaybeWithDerivedMetadataBuilder this_arg_conv;
73201         this_arg_conv.inner = untag_ptr(this_arg);
73202         this_arg_conv.is_owned = ptr_is_owned(this_arg);
73203         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
73204         this_arg_conv = RefundMaybeWithDerivedMetadataBuilder_clone(&this_arg_conv);
73205         RefundMaybeWithDerivedMetadataBuilder_absolute_expiry(this_arg_conv, absolute_expiry);
73206 }
73207
73208 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RefundMaybeWithDerivedMetadataBuilder_1issuer(JNIEnv *env, jclass clz, int64_t this_arg, jstring issuer) {
73209         LDKRefundMaybeWithDerivedMetadataBuilder this_arg_conv;
73210         this_arg_conv.inner = untag_ptr(this_arg);
73211         this_arg_conv.is_owned = ptr_is_owned(this_arg);
73212         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
73213         this_arg_conv = RefundMaybeWithDerivedMetadataBuilder_clone(&this_arg_conv);
73214         LDKStr issuer_conv = java_to_owned_str(env, issuer);
73215         RefundMaybeWithDerivedMetadataBuilder_issuer(this_arg_conv, issuer_conv);
73216 }
73217
73218 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RefundMaybeWithDerivedMetadataBuilder_1path(JNIEnv *env, jclass clz, int64_t this_arg, int64_t path) {
73219         LDKRefundMaybeWithDerivedMetadataBuilder this_arg_conv;
73220         this_arg_conv.inner = untag_ptr(this_arg);
73221         this_arg_conv.is_owned = ptr_is_owned(this_arg);
73222         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
73223         this_arg_conv = RefundMaybeWithDerivedMetadataBuilder_clone(&this_arg_conv);
73224         LDKBlindedPath path_conv;
73225         path_conv.inner = untag_ptr(path);
73226         path_conv.is_owned = ptr_is_owned(path);
73227         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
73228         path_conv = BlindedPath_clone(&path_conv);
73229         RefundMaybeWithDerivedMetadataBuilder_path(this_arg_conv, path_conv);
73230 }
73231
73232 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RefundMaybeWithDerivedMetadataBuilder_1chain(JNIEnv *env, jclass clz, int64_t this_arg, jclass network) {
73233         LDKRefundMaybeWithDerivedMetadataBuilder this_arg_conv;
73234         this_arg_conv.inner = untag_ptr(this_arg);
73235         this_arg_conv.is_owned = ptr_is_owned(this_arg);
73236         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
73237         this_arg_conv = RefundMaybeWithDerivedMetadataBuilder_clone(&this_arg_conv);
73238         LDKNetwork network_conv = LDKNetwork_from_java(env, network);
73239         RefundMaybeWithDerivedMetadataBuilder_chain(this_arg_conv, network_conv);
73240 }
73241
73242 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RefundMaybeWithDerivedMetadataBuilder_1quantity(JNIEnv *env, jclass clz, int64_t this_arg, int64_t quantity) {
73243         LDKRefundMaybeWithDerivedMetadataBuilder this_arg_conv;
73244         this_arg_conv.inner = untag_ptr(this_arg);
73245         this_arg_conv.is_owned = ptr_is_owned(this_arg);
73246         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
73247         this_arg_conv = RefundMaybeWithDerivedMetadataBuilder_clone(&this_arg_conv);
73248         RefundMaybeWithDerivedMetadataBuilder_quantity(this_arg_conv, quantity);
73249 }
73250
73251 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RefundMaybeWithDerivedMetadataBuilder_1payer_1note(JNIEnv *env, jclass clz, int64_t this_arg, jstring payer_note) {
73252         LDKRefundMaybeWithDerivedMetadataBuilder this_arg_conv;
73253         this_arg_conv.inner = untag_ptr(this_arg);
73254         this_arg_conv.is_owned = ptr_is_owned(this_arg);
73255         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
73256         this_arg_conv = RefundMaybeWithDerivedMetadataBuilder_clone(&this_arg_conv);
73257         LDKStr payer_note_conv = java_to_owned_str(env, payer_note);
73258         RefundMaybeWithDerivedMetadataBuilder_payer_note(this_arg_conv, payer_note_conv);
73259 }
73260
73261 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RefundMaybeWithDerivedMetadataBuilder_1build(JNIEnv *env, jclass clz, int64_t this_arg) {
73262         LDKRefundMaybeWithDerivedMetadataBuilder this_arg_conv;
73263         this_arg_conv.inner = untag_ptr(this_arg);
73264         this_arg_conv.is_owned = ptr_is_owned(this_arg);
73265         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
73266         this_arg_conv = RefundMaybeWithDerivedMetadataBuilder_clone(&this_arg_conv);
73267         LDKCResult_RefundBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RefundBolt12SemanticErrorZ), "LDKCResult_RefundBolt12SemanticErrorZ");
73268         *ret_conv = RefundMaybeWithDerivedMetadataBuilder_build(this_arg_conv);
73269         return tag_ptr(ret_conv, true);
73270 }
73271
73272 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Refund_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
73273         LDKRefund this_obj_conv;
73274         this_obj_conv.inner = untag_ptr(this_obj);
73275         this_obj_conv.is_owned = ptr_is_owned(this_obj);
73276         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
73277         Refund_free(this_obj_conv);
73278 }
73279
73280 static inline uint64_t Refund_clone_ptr(LDKRefund *NONNULL_PTR arg) {
73281         LDKRefund ret_var = Refund_clone(arg);
73282         int64_t ret_ref = 0;
73283         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73284         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73285         return ret_ref;
73286 }
73287 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Refund_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
73288         LDKRefund arg_conv;
73289         arg_conv.inner = untag_ptr(arg);
73290         arg_conv.is_owned = ptr_is_owned(arg);
73291         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
73292         arg_conv.is_owned = false;
73293         int64_t ret_conv = Refund_clone_ptr(&arg_conv);
73294         return ret_conv;
73295 }
73296
73297 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Refund_1clone(JNIEnv *env, jclass clz, int64_t orig) {
73298         LDKRefund orig_conv;
73299         orig_conv.inner = untag_ptr(orig);
73300         orig_conv.is_owned = ptr_is_owned(orig);
73301         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
73302         orig_conv.is_owned = false;
73303         LDKRefund ret_var = Refund_clone(&orig_conv);
73304         int64_t ret_ref = 0;
73305         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73306         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73307         return ret_ref;
73308 }
73309
73310 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Refund_1description(JNIEnv *env, jclass clz, int64_t this_arg) {
73311         LDKRefund this_arg_conv;
73312         this_arg_conv.inner = untag_ptr(this_arg);
73313         this_arg_conv.is_owned = ptr_is_owned(this_arg);
73314         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
73315         this_arg_conv.is_owned = false;
73316         LDKPrintableString ret_var = Refund_description(&this_arg_conv);
73317         int64_t ret_ref = 0;
73318         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73319         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73320         return ret_ref;
73321 }
73322
73323 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Refund_1absolute_1expiry(JNIEnv *env, jclass clz, int64_t this_arg) {
73324         LDKRefund this_arg_conv;
73325         this_arg_conv.inner = untag_ptr(this_arg);
73326         this_arg_conv.is_owned = ptr_is_owned(this_arg);
73327         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
73328         this_arg_conv.is_owned = false;
73329         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
73330         *ret_copy = Refund_absolute_expiry(&this_arg_conv);
73331         int64_t ret_ref = tag_ptr(ret_copy, true);
73332         return ret_ref;
73333 }
73334
73335 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Refund_1is_1expired(JNIEnv *env, jclass clz, int64_t this_arg) {
73336         LDKRefund this_arg_conv;
73337         this_arg_conv.inner = untag_ptr(this_arg);
73338         this_arg_conv.is_owned = ptr_is_owned(this_arg);
73339         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
73340         this_arg_conv.is_owned = false;
73341         jboolean ret_conv = Refund_is_expired(&this_arg_conv);
73342         return ret_conv;
73343 }
73344
73345 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) {
73346         LDKRefund this_arg_conv;
73347         this_arg_conv.inner = untag_ptr(this_arg);
73348         this_arg_conv.is_owned = ptr_is_owned(this_arg);
73349         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
73350         this_arg_conv.is_owned = false;
73351         jboolean ret_conv = Refund_is_expired_no_std(&this_arg_conv, duration_since_epoch);
73352         return ret_conv;
73353 }
73354
73355 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Refund_1issuer(JNIEnv *env, jclass clz, int64_t this_arg) {
73356         LDKRefund this_arg_conv;
73357         this_arg_conv.inner = untag_ptr(this_arg);
73358         this_arg_conv.is_owned = ptr_is_owned(this_arg);
73359         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
73360         this_arg_conv.is_owned = false;
73361         LDKPrintableString ret_var = Refund_issuer(&this_arg_conv);
73362         int64_t ret_ref = 0;
73363         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73364         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73365         return ret_ref;
73366 }
73367
73368 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_Refund_1paths(JNIEnv *env, jclass clz, int64_t this_arg) {
73369         LDKRefund this_arg_conv;
73370         this_arg_conv.inner = untag_ptr(this_arg);
73371         this_arg_conv.is_owned = ptr_is_owned(this_arg);
73372         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
73373         this_arg_conv.is_owned = false;
73374         LDKCVec_BlindedPathZ ret_var = Refund_paths(&this_arg_conv);
73375         int64_tArray ret_arr = NULL;
73376         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
73377         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
73378         for (size_t n = 0; n < ret_var.datalen; n++) {
73379                 LDKBlindedPath ret_conv_13_var = ret_var.data[n];
73380                 int64_t ret_conv_13_ref = 0;
73381                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_13_var);
73382                 ret_conv_13_ref = tag_ptr(ret_conv_13_var.inner, ret_conv_13_var.is_owned);
73383                 ret_arr_ptr[n] = ret_conv_13_ref;
73384         }
73385         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
73386         FREE(ret_var.data);
73387         return ret_arr;
73388 }
73389
73390 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Refund_1payer_1metadata(JNIEnv *env, jclass clz, int64_t this_arg) {
73391         LDKRefund this_arg_conv;
73392         this_arg_conv.inner = untag_ptr(this_arg);
73393         this_arg_conv.is_owned = ptr_is_owned(this_arg);
73394         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
73395         this_arg_conv.is_owned = false;
73396         LDKu8slice ret_var = Refund_payer_metadata(&this_arg_conv);
73397         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
73398         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
73399         return ret_arr;
73400 }
73401
73402 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Refund_1chain(JNIEnv *env, jclass clz, int64_t this_arg) {
73403         LDKRefund this_arg_conv;
73404         this_arg_conv.inner = untag_ptr(this_arg);
73405         this_arg_conv.is_owned = ptr_is_owned(this_arg);
73406         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
73407         this_arg_conv.is_owned = false;
73408         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
73409         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, Refund_chain(&this_arg_conv).data);
73410         return ret_arr;
73411 }
73412
73413 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Refund_1amount_1msats(JNIEnv *env, jclass clz, int64_t this_arg) {
73414         LDKRefund this_arg_conv;
73415         this_arg_conv.inner = untag_ptr(this_arg);
73416         this_arg_conv.is_owned = ptr_is_owned(this_arg);
73417         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
73418         this_arg_conv.is_owned = false;
73419         int64_t ret_conv = Refund_amount_msats(&this_arg_conv);
73420         return ret_conv;
73421 }
73422
73423 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Refund_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
73424         LDKRefund this_arg_conv;
73425         this_arg_conv.inner = untag_ptr(this_arg);
73426         this_arg_conv.is_owned = ptr_is_owned(this_arg);
73427         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
73428         this_arg_conv.is_owned = false;
73429         LDKInvoiceRequestFeatures ret_var = Refund_features(&this_arg_conv);
73430         int64_t ret_ref = 0;
73431         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73432         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73433         return ret_ref;
73434 }
73435
73436 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Refund_1quantity(JNIEnv *env, jclass clz, int64_t this_arg) {
73437         LDKRefund this_arg_conv;
73438         this_arg_conv.inner = untag_ptr(this_arg);
73439         this_arg_conv.is_owned = ptr_is_owned(this_arg);
73440         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
73441         this_arg_conv.is_owned = false;
73442         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
73443         *ret_copy = Refund_quantity(&this_arg_conv);
73444         int64_t ret_ref = tag_ptr(ret_copy, true);
73445         return ret_ref;
73446 }
73447
73448 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Refund_1payer_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
73449         LDKRefund this_arg_conv;
73450         this_arg_conv.inner = untag_ptr(this_arg);
73451         this_arg_conv.is_owned = ptr_is_owned(this_arg);
73452         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
73453         this_arg_conv.is_owned = false;
73454         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
73455         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, Refund_payer_id(&this_arg_conv).compressed_form);
73456         return ret_arr;
73457 }
73458
73459 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Refund_1payer_1note(JNIEnv *env, jclass clz, int64_t this_arg) {
73460         LDKRefund this_arg_conv;
73461         this_arg_conv.inner = untag_ptr(this_arg);
73462         this_arg_conv.is_owned = ptr_is_owned(this_arg);
73463         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
73464         this_arg_conv.is_owned = false;
73465         LDKPrintableString ret_var = Refund_payer_note(&this_arg_conv);
73466         int64_t ret_ref = 0;
73467         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73468         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73469         return ret_ref;
73470 }
73471
73472 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Refund_1hash(JNIEnv *env, jclass clz, int64_t o) {
73473         LDKRefund o_conv;
73474         o_conv.inner = untag_ptr(o);
73475         o_conv.is_owned = ptr_is_owned(o);
73476         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
73477         o_conv.is_owned = false;
73478         int64_t ret_conv = Refund_hash(&o_conv);
73479         return ret_conv;
73480 }
73481
73482 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Refund_1write(JNIEnv *env, jclass clz, int64_t obj) {
73483         LDKRefund obj_conv;
73484         obj_conv.inner = untag_ptr(obj);
73485         obj_conv.is_owned = ptr_is_owned(obj);
73486         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
73487         obj_conv.is_owned = false;
73488         LDKCVec_u8Z ret_var = Refund_write(&obj_conv);
73489         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
73490         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
73491         CVec_u8Z_free(ret_var);
73492         return ret_arr;
73493 }
73494
73495 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Refund_1from_1str(JNIEnv *env, jclass clz, jstring s) {
73496         LDKStr s_conv = java_to_owned_str(env, s);
73497         LDKCResult_RefundBolt12ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RefundBolt12ParseErrorZ), "LDKCResult_RefundBolt12ParseErrorZ");
73498         *ret_conv = Refund_from_str(s_conv);
73499         return tag_ptr(ret_conv, true);
73500 }
73501
73502 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_UtxoLookupError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
73503         LDKUtxoLookupError* orig_conv = (LDKUtxoLookupError*)untag_ptr(orig);
73504         jclass ret_conv = LDKUtxoLookupError_to_java(env, UtxoLookupError_clone(orig_conv));
73505         return ret_conv;
73506 }
73507
73508 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_UtxoLookupError_1unknown_1chain(JNIEnv *env, jclass clz) {
73509         jclass ret_conv = LDKUtxoLookupError_to_java(env, UtxoLookupError_unknown_chain());
73510         return ret_conv;
73511 }
73512
73513 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_UtxoLookupError_1unknown_1tx(JNIEnv *env, jclass clz) {
73514         jclass ret_conv = LDKUtxoLookupError_to_java(env, UtxoLookupError_unknown_tx());
73515         return ret_conv;
73516 }
73517
73518 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UtxoResult_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
73519         if (!ptr_is_owned(this_ptr)) return;
73520         void* this_ptr_ptr = untag_ptr(this_ptr);
73521         CHECK_ACCESS(this_ptr_ptr);
73522         LDKUtxoResult this_ptr_conv = *(LDKUtxoResult*)(this_ptr_ptr);
73523         FREE(untag_ptr(this_ptr));
73524         UtxoResult_free(this_ptr_conv);
73525 }
73526
73527 static inline uint64_t UtxoResult_clone_ptr(LDKUtxoResult *NONNULL_PTR arg) {
73528         LDKUtxoResult *ret_copy = MALLOC(sizeof(LDKUtxoResult), "LDKUtxoResult");
73529         *ret_copy = UtxoResult_clone(arg);
73530         int64_t ret_ref = tag_ptr(ret_copy, true);
73531         return ret_ref;
73532 }
73533 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UtxoResult_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
73534         LDKUtxoResult* arg_conv = (LDKUtxoResult*)untag_ptr(arg);
73535         int64_t ret_conv = UtxoResult_clone_ptr(arg_conv);
73536         return ret_conv;
73537 }
73538
73539 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UtxoResult_1clone(JNIEnv *env, jclass clz, int64_t orig) {
73540         LDKUtxoResult* orig_conv = (LDKUtxoResult*)untag_ptr(orig);
73541         LDKUtxoResult *ret_copy = MALLOC(sizeof(LDKUtxoResult), "LDKUtxoResult");
73542         *ret_copy = UtxoResult_clone(orig_conv);
73543         int64_t ret_ref = tag_ptr(ret_copy, true);
73544         return ret_ref;
73545 }
73546
73547 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UtxoResult_1sync(JNIEnv *env, jclass clz, int64_t a) {
73548         void* a_ptr = untag_ptr(a);
73549         CHECK_ACCESS(a_ptr);
73550         LDKCResult_TxOutUtxoLookupErrorZ a_conv = *(LDKCResult_TxOutUtxoLookupErrorZ*)(a_ptr);
73551         a_conv = CResult_TxOutUtxoLookupErrorZ_clone((LDKCResult_TxOutUtxoLookupErrorZ*)untag_ptr(a));
73552         LDKUtxoResult *ret_copy = MALLOC(sizeof(LDKUtxoResult), "LDKUtxoResult");
73553         *ret_copy = UtxoResult_sync(a_conv);
73554         int64_t ret_ref = tag_ptr(ret_copy, true);
73555         return ret_ref;
73556 }
73557
73558 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UtxoResult_1async(JNIEnv *env, jclass clz, int64_t a) {
73559         LDKUtxoFuture a_conv;
73560         a_conv.inner = untag_ptr(a);
73561         a_conv.is_owned = ptr_is_owned(a);
73562         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
73563         a_conv = UtxoFuture_clone(&a_conv);
73564         LDKUtxoResult *ret_copy = MALLOC(sizeof(LDKUtxoResult), "LDKUtxoResult");
73565         *ret_copy = UtxoResult_async(a_conv);
73566         int64_t ret_ref = tag_ptr(ret_copy, true);
73567         return ret_ref;
73568 }
73569
73570 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UtxoLookup_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
73571         if (!ptr_is_owned(this_ptr)) return;
73572         void* this_ptr_ptr = untag_ptr(this_ptr);
73573         CHECK_ACCESS(this_ptr_ptr);
73574         LDKUtxoLookup this_ptr_conv = *(LDKUtxoLookup*)(this_ptr_ptr);
73575         FREE(untag_ptr(this_ptr));
73576         UtxoLookup_free(this_ptr_conv);
73577 }
73578
73579 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UtxoFuture_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
73580         LDKUtxoFuture this_obj_conv;
73581         this_obj_conv.inner = untag_ptr(this_obj);
73582         this_obj_conv.is_owned = ptr_is_owned(this_obj);
73583         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
73584         UtxoFuture_free(this_obj_conv);
73585 }
73586
73587 static inline uint64_t UtxoFuture_clone_ptr(LDKUtxoFuture *NONNULL_PTR arg) {
73588         LDKUtxoFuture ret_var = UtxoFuture_clone(arg);
73589         int64_t ret_ref = 0;
73590         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73591         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73592         return ret_ref;
73593 }
73594 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UtxoFuture_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
73595         LDKUtxoFuture arg_conv;
73596         arg_conv.inner = untag_ptr(arg);
73597         arg_conv.is_owned = ptr_is_owned(arg);
73598         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
73599         arg_conv.is_owned = false;
73600         int64_t ret_conv = UtxoFuture_clone_ptr(&arg_conv);
73601         return ret_conv;
73602 }
73603
73604 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UtxoFuture_1clone(JNIEnv *env, jclass clz, int64_t orig) {
73605         LDKUtxoFuture orig_conv;
73606         orig_conv.inner = untag_ptr(orig);
73607         orig_conv.is_owned = ptr_is_owned(orig);
73608         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
73609         orig_conv.is_owned = false;
73610         LDKUtxoFuture ret_var = UtxoFuture_clone(&orig_conv);
73611         int64_t ret_ref = 0;
73612         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73613         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73614         return ret_ref;
73615 }
73616
73617 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UtxoFuture_1new(JNIEnv *env, jclass clz) {
73618         LDKUtxoFuture ret_var = UtxoFuture_new();
73619         int64_t ret_ref = 0;
73620         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73621         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73622         return ret_ref;
73623 }
73624
73625 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) {
73626         LDKUtxoFuture this_arg_conv;
73627         this_arg_conv.inner = untag_ptr(this_arg);
73628         this_arg_conv.is_owned = ptr_is_owned(this_arg);
73629         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
73630         this_arg_conv.is_owned = false;
73631         LDKNetworkGraph graph_conv;
73632         graph_conv.inner = untag_ptr(graph);
73633         graph_conv.is_owned = ptr_is_owned(graph);
73634         CHECK_INNER_FIELD_ACCESS_OR_NULL(graph_conv);
73635         graph_conv.is_owned = false;
73636         void* result_ptr = untag_ptr(result);
73637         CHECK_ACCESS(result_ptr);
73638         LDKCResult_TxOutUtxoLookupErrorZ result_conv = *(LDKCResult_TxOutUtxoLookupErrorZ*)(result_ptr);
73639         UtxoFuture_resolve_without_forwarding(&this_arg_conv, &graph_conv, result_conv);
73640 }
73641
73642 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) {
73643         LDKUtxoFuture this_arg_conv;
73644         this_arg_conv.inner = untag_ptr(this_arg);
73645         this_arg_conv.is_owned = ptr_is_owned(this_arg);
73646         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
73647         this_arg_conv.is_owned = false;
73648         LDKNetworkGraph graph_conv;
73649         graph_conv.inner = untag_ptr(graph);
73650         graph_conv.is_owned = ptr_is_owned(graph);
73651         CHECK_INNER_FIELD_ACCESS_OR_NULL(graph_conv);
73652         graph_conv.is_owned = false;
73653         LDKP2PGossipSync gossip_conv;
73654         gossip_conv.inner = untag_ptr(gossip);
73655         gossip_conv.is_owned = ptr_is_owned(gossip);
73656         CHECK_INNER_FIELD_ACCESS_OR_NULL(gossip_conv);
73657         gossip_conv.is_owned = false;
73658         void* result_ptr = untag_ptr(result);
73659         CHECK_ACCESS(result_ptr);
73660         LDKCResult_TxOutUtxoLookupErrorZ result_conv = *(LDKCResult_TxOutUtxoLookupErrorZ*)(result_ptr);
73661         UtxoFuture_resolve(&this_arg_conv, &graph_conv, &gossip_conv, result_conv);
73662 }
73663
73664 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeId_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
73665         LDKNodeId this_obj_conv;
73666         this_obj_conv.inner = untag_ptr(this_obj);
73667         this_obj_conv.is_owned = ptr_is_owned(this_obj);
73668         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
73669         NodeId_free(this_obj_conv);
73670 }
73671
73672 static inline uint64_t NodeId_clone_ptr(LDKNodeId *NONNULL_PTR arg) {
73673         LDKNodeId ret_var = NodeId_clone(arg);
73674         int64_t ret_ref = 0;
73675         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73676         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73677         return ret_ref;
73678 }
73679 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeId_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
73680         LDKNodeId arg_conv;
73681         arg_conv.inner = untag_ptr(arg);
73682         arg_conv.is_owned = ptr_is_owned(arg);
73683         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
73684         arg_conv.is_owned = false;
73685         int64_t ret_conv = NodeId_clone_ptr(&arg_conv);
73686         return ret_conv;
73687 }
73688
73689 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeId_1clone(JNIEnv *env, jclass clz, int64_t orig) {
73690         LDKNodeId orig_conv;
73691         orig_conv.inner = untag_ptr(orig);
73692         orig_conv.is_owned = ptr_is_owned(orig);
73693         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
73694         orig_conv.is_owned = false;
73695         LDKNodeId ret_var = NodeId_clone(&orig_conv);
73696         int64_t ret_ref = 0;
73697         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73698         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73699         return ret_ref;
73700 }
73701
73702 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeId_1from_1pubkey(JNIEnv *env, jclass clz, int8_tArray pubkey) {
73703         LDKPublicKey pubkey_ref;
73704         CHECK((*env)->GetArrayLength(env, pubkey) == 33);
73705         (*env)->GetByteArrayRegion(env, pubkey, 0, 33, pubkey_ref.compressed_form);
73706         LDKNodeId ret_var = NodeId_from_pubkey(pubkey_ref);
73707         int64_t ret_ref = 0;
73708         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73709         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73710         return ret_ref;
73711 }
73712
73713 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeId_1from_1slice(JNIEnv *env, jclass clz, int8_tArray bytes) {
73714         LDKu8slice bytes_ref;
73715         bytes_ref.datalen = (*env)->GetArrayLength(env, bytes);
73716         bytes_ref.data = (*env)->GetByteArrayElements (env, bytes, NULL);
73717         LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
73718         *ret_conv = NodeId_from_slice(bytes_ref);
73719         (*env)->ReleaseByteArrayElements(env, bytes, (int8_t*)bytes_ref.data, 0);
73720         return tag_ptr(ret_conv, true);
73721 }
73722
73723 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeId_1as_1slice(JNIEnv *env, jclass clz, int64_t this_arg) {
73724         LDKNodeId this_arg_conv;
73725         this_arg_conv.inner = untag_ptr(this_arg);
73726         this_arg_conv.is_owned = ptr_is_owned(this_arg);
73727         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
73728         this_arg_conv.is_owned = false;
73729         LDKu8slice ret_var = NodeId_as_slice(&this_arg_conv);
73730         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
73731         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
73732         return ret_arr;
73733 }
73734
73735 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeId_1as_1array(JNIEnv *env, jclass clz, int64_t this_arg) {
73736         LDKNodeId this_arg_conv;
73737         this_arg_conv.inner = untag_ptr(this_arg);
73738         this_arg_conv.is_owned = ptr_is_owned(this_arg);
73739         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
73740         this_arg_conv.is_owned = false;
73741         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
73742         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, *NodeId_as_array(&this_arg_conv));
73743         return ret_arr;
73744 }
73745
73746 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeId_1as_1pubkey(JNIEnv *env, jclass clz, int64_t this_arg) {
73747         LDKNodeId this_arg_conv;
73748         this_arg_conv.inner = untag_ptr(this_arg);
73749         this_arg_conv.is_owned = ptr_is_owned(this_arg);
73750         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
73751         this_arg_conv.is_owned = false;
73752         LDKCResult_PublicKeySecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeySecp256k1ErrorZ), "LDKCResult_PublicKeySecp256k1ErrorZ");
73753         *ret_conv = NodeId_as_pubkey(&this_arg_conv);
73754         return tag_ptr(ret_conv, true);
73755 }
73756
73757 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeId_1hash(JNIEnv *env, jclass clz, int64_t o) {
73758         LDKNodeId o_conv;
73759         o_conv.inner = untag_ptr(o);
73760         o_conv.is_owned = ptr_is_owned(o);
73761         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
73762         o_conv.is_owned = false;
73763         int64_t ret_conv = NodeId_hash(&o_conv);
73764         return ret_conv;
73765 }
73766
73767 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeId_1write(JNIEnv *env, jclass clz, int64_t obj) {
73768         LDKNodeId obj_conv;
73769         obj_conv.inner = untag_ptr(obj);
73770         obj_conv.is_owned = ptr_is_owned(obj);
73771         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
73772         obj_conv.is_owned = false;
73773         LDKCVec_u8Z ret_var = NodeId_write(&obj_conv);
73774         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
73775         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
73776         CVec_u8Z_free(ret_var);
73777         return ret_arr;
73778 }
73779
73780 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeId_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
73781         LDKu8slice ser_ref;
73782         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
73783         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
73784         LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ");
73785         *ret_conv = NodeId_read(ser_ref);
73786         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
73787         return tag_ptr(ret_conv, true);
73788 }
73789
73790 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
73791         LDKNetworkGraph this_obj_conv;
73792         this_obj_conv.inner = untag_ptr(this_obj);
73793         this_obj_conv.is_owned = ptr_is_owned(this_obj);
73794         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
73795         NetworkGraph_free(this_obj_conv);
73796 }
73797
73798 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReadOnlyNetworkGraph_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
73799         LDKReadOnlyNetworkGraph this_obj_conv;
73800         this_obj_conv.inner = untag_ptr(this_obj);
73801         this_obj_conv.is_owned = ptr_is_owned(this_obj);
73802         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
73803         ReadOnlyNetworkGraph_free(this_obj_conv);
73804 }
73805
73806 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
73807         if (!ptr_is_owned(this_ptr)) return;
73808         void* this_ptr_ptr = untag_ptr(this_ptr);
73809         CHECK_ACCESS(this_ptr_ptr);
73810         LDKNetworkUpdate this_ptr_conv = *(LDKNetworkUpdate*)(this_ptr_ptr);
73811         FREE(untag_ptr(this_ptr));
73812         NetworkUpdate_free(this_ptr_conv);
73813 }
73814
73815 static inline uint64_t NetworkUpdate_clone_ptr(LDKNetworkUpdate *NONNULL_PTR arg) {
73816         LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
73817         *ret_copy = NetworkUpdate_clone(arg);
73818         int64_t ret_ref = tag_ptr(ret_copy, true);
73819         return ret_ref;
73820 }
73821 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
73822         LDKNetworkUpdate* arg_conv = (LDKNetworkUpdate*)untag_ptr(arg);
73823         int64_t ret_conv = NetworkUpdate_clone_ptr(arg_conv);
73824         return ret_conv;
73825 }
73826
73827 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
73828         LDKNetworkUpdate* orig_conv = (LDKNetworkUpdate*)untag_ptr(orig);
73829         LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
73830         *ret_copy = NetworkUpdate_clone(orig_conv);
73831         int64_t ret_ref = tag_ptr(ret_copy, true);
73832         return ret_ref;
73833 }
73834
73835 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1channel_1update_1message(JNIEnv *env, jclass clz, int64_t msg) {
73836         LDKChannelUpdate msg_conv;
73837         msg_conv.inner = untag_ptr(msg);
73838         msg_conv.is_owned = ptr_is_owned(msg);
73839         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
73840         msg_conv = ChannelUpdate_clone(&msg_conv);
73841         LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
73842         *ret_copy = NetworkUpdate_channel_update_message(msg_conv);
73843         int64_t ret_ref = tag_ptr(ret_copy, true);
73844         return ret_ref;
73845 }
73846
73847 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1channel_1failure(JNIEnv *env, jclass clz, int64_t short_channel_id, jboolean is_permanent) {
73848         LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
73849         *ret_copy = NetworkUpdate_channel_failure(short_channel_id, is_permanent);
73850         int64_t ret_ref = tag_ptr(ret_copy, true);
73851         return ret_ref;
73852 }
73853
73854 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1node_1failure(JNIEnv *env, jclass clz, int8_tArray node_id, jboolean is_permanent) {
73855         LDKPublicKey node_id_ref;
73856         CHECK((*env)->GetArrayLength(env, node_id) == 33);
73857         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
73858         LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
73859         *ret_copy = NetworkUpdate_node_failure(node_id_ref, is_permanent);
73860         int64_t ret_ref = tag_ptr(ret_copy, true);
73861         return ret_ref;
73862 }
73863
73864 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
73865         LDKNetworkUpdate* a_conv = (LDKNetworkUpdate*)untag_ptr(a);
73866         LDKNetworkUpdate* b_conv = (LDKNetworkUpdate*)untag_ptr(b);
73867         jboolean ret_conv = NetworkUpdate_eq(a_conv, b_conv);
73868         return ret_conv;
73869 }
73870
73871 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1write(JNIEnv *env, jclass clz, int64_t obj) {
73872         LDKNetworkUpdate* obj_conv = (LDKNetworkUpdate*)untag_ptr(obj);
73873         LDKCVec_u8Z ret_var = NetworkUpdate_write(obj_conv);
73874         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
73875         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
73876         CVec_u8Z_free(ret_var);
73877         return ret_arr;
73878 }
73879
73880 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
73881         LDKu8slice ser_ref;
73882         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
73883         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
73884         LDKCResult_COption_NetworkUpdateZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ), "LDKCResult_COption_NetworkUpdateZDecodeErrorZ");
73885         *ret_conv = NetworkUpdate_read(ser_ref);
73886         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
73887         return tag_ptr(ret_conv, true);
73888 }
73889
73890 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_P2PGossipSync_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
73891         LDKP2PGossipSync this_obj_conv;
73892         this_obj_conv.inner = untag_ptr(this_obj);
73893         this_obj_conv.is_owned = ptr_is_owned(this_obj);
73894         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
73895         P2PGossipSync_free(this_obj_conv);
73896 }
73897
73898 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) {
73899         LDKNetworkGraph network_graph_conv;
73900         network_graph_conv.inner = untag_ptr(network_graph);
73901         network_graph_conv.is_owned = ptr_is_owned(network_graph);
73902         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
73903         network_graph_conv.is_owned = false;
73904         void* utxo_lookup_ptr = untag_ptr(utxo_lookup);
73905         CHECK_ACCESS(utxo_lookup_ptr);
73906         LDKCOption_UtxoLookupZ utxo_lookup_conv = *(LDKCOption_UtxoLookupZ*)(utxo_lookup_ptr);
73907         // WARNING: we may need a move here but no clone is available for LDKCOption_UtxoLookupZ
73908         if (utxo_lookup_conv.tag == LDKCOption_UtxoLookupZ_Some) {
73909                 // Manually implement clone for Java trait instances
73910                 if (utxo_lookup_conv.some.free == LDKUtxoLookup_JCalls_free) {
73911                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
73912                         LDKUtxoLookup_JCalls_cloned(&utxo_lookup_conv.some);
73913                 }
73914         }
73915         void* logger_ptr = untag_ptr(logger);
73916         CHECK_ACCESS(logger_ptr);
73917         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
73918         if (logger_conv.free == LDKLogger_JCalls_free) {
73919                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
73920                 LDKLogger_JCalls_cloned(&logger_conv);
73921         }
73922         LDKP2PGossipSync ret_var = P2PGossipSync_new(&network_graph_conv, utxo_lookup_conv, logger_conv);
73923         int64_t ret_ref = 0;
73924         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
73925         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
73926         return ret_ref;
73927 }
73928
73929 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_P2PGossipSync_1add_1utxo_1lookup(JNIEnv *env, jclass clz, int64_t this_arg, int64_t utxo_lookup) {
73930         LDKP2PGossipSync this_arg_conv;
73931         this_arg_conv.inner = untag_ptr(this_arg);
73932         this_arg_conv.is_owned = ptr_is_owned(this_arg);
73933         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
73934         this_arg_conv.is_owned = false;
73935         void* utxo_lookup_ptr = untag_ptr(utxo_lookup);
73936         CHECK_ACCESS(utxo_lookup_ptr);
73937         LDKCOption_UtxoLookupZ utxo_lookup_conv = *(LDKCOption_UtxoLookupZ*)(utxo_lookup_ptr);
73938         // WARNING: we may need a move here but no clone is available for LDKCOption_UtxoLookupZ
73939         if (utxo_lookup_conv.tag == LDKCOption_UtxoLookupZ_Some) {
73940                 // Manually implement clone for Java trait instances
73941                 if (utxo_lookup_conv.some.free == LDKUtxoLookup_JCalls_free) {
73942                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
73943                         LDKUtxoLookup_JCalls_cloned(&utxo_lookup_conv.some);
73944                 }
73945         }
73946         P2PGossipSync_add_utxo_lookup(&this_arg_conv, utxo_lookup_conv);
73947 }
73948
73949 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1handle_1network_1update(JNIEnv *env, jclass clz, int64_t this_arg, int64_t network_update) {
73950         LDKNetworkGraph this_arg_conv;
73951         this_arg_conv.inner = untag_ptr(this_arg);
73952         this_arg_conv.is_owned = ptr_is_owned(this_arg);
73953         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
73954         this_arg_conv.is_owned = false;
73955         LDKNetworkUpdate* network_update_conv = (LDKNetworkUpdate*)untag_ptr(network_update);
73956         NetworkGraph_handle_network_update(&this_arg_conv, network_update_conv);
73957 }
73958
73959 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
73960         LDKNetworkGraph this_arg_conv;
73961         this_arg_conv.inner = untag_ptr(this_arg);
73962         this_arg_conv.is_owned = ptr_is_owned(this_arg);
73963         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
73964         this_arg_conv.is_owned = false;
73965         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
73966         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, NetworkGraph_get_chain_hash(&this_arg_conv).data);
73967         return ret_arr;
73968 }
73969
73970 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_verify_1node_1announcement(JNIEnv *env, jclass clz, int64_t msg) {
73971         LDKNodeAnnouncement msg_conv;
73972         msg_conv.inner = untag_ptr(msg);
73973         msg_conv.is_owned = ptr_is_owned(msg);
73974         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
73975         msg_conv.is_owned = false;
73976         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
73977         *ret_conv = verify_node_announcement(&msg_conv);
73978         return tag_ptr(ret_conv, true);
73979 }
73980
73981 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_verify_1channel_1announcement(JNIEnv *env, jclass clz, int64_t msg) {
73982         LDKChannelAnnouncement msg_conv;
73983         msg_conv.inner = untag_ptr(msg);
73984         msg_conv.is_owned = ptr_is_owned(msg);
73985         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
73986         msg_conv.is_owned = false;
73987         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
73988         *ret_conv = verify_channel_announcement(&msg_conv);
73989         return tag_ptr(ret_conv, true);
73990 }
73991
73992 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_P2PGossipSync_1as_1RoutingMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
73993         LDKP2PGossipSync this_arg_conv;
73994         this_arg_conv.inner = untag_ptr(this_arg);
73995         this_arg_conv.is_owned = ptr_is_owned(this_arg);
73996         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
73997         this_arg_conv.is_owned = false;
73998         LDKRoutingMessageHandler* ret_ret = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
73999         *ret_ret = P2PGossipSync_as_RoutingMessageHandler(&this_arg_conv);
74000         return tag_ptr(ret_ret, true);
74001 }
74002
74003 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_P2PGossipSync_1as_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
74004         LDKP2PGossipSync this_arg_conv;
74005         this_arg_conv.inner = untag_ptr(this_arg);
74006         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74007         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74008         this_arg_conv.is_owned = false;
74009         LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
74010         *ret_ret = P2PGossipSync_as_MessageSendEventsProvider(&this_arg_conv);
74011         return tag_ptr(ret_ret, true);
74012 }
74013
74014 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
74015         LDKChannelUpdateInfo this_obj_conv;
74016         this_obj_conv.inner = untag_ptr(this_obj);
74017         this_obj_conv.is_owned = ptr_is_owned(this_obj);
74018         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
74019         ChannelUpdateInfo_free(this_obj_conv);
74020 }
74021
74022 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1get_1last_1update(JNIEnv *env, jclass clz, int64_t this_ptr) {
74023         LDKChannelUpdateInfo this_ptr_conv;
74024         this_ptr_conv.inner = untag_ptr(this_ptr);
74025         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74026         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74027         this_ptr_conv.is_owned = false;
74028         int32_t ret_conv = ChannelUpdateInfo_get_last_update(&this_ptr_conv);
74029         return ret_conv;
74030 }
74031
74032 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1set_1last_1update(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
74033         LDKChannelUpdateInfo this_ptr_conv;
74034         this_ptr_conv.inner = untag_ptr(this_ptr);
74035         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74036         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74037         this_ptr_conv.is_owned = false;
74038         ChannelUpdateInfo_set_last_update(&this_ptr_conv, val);
74039 }
74040
74041 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1get_1enabled(JNIEnv *env, jclass clz, int64_t this_ptr) {
74042         LDKChannelUpdateInfo this_ptr_conv;
74043         this_ptr_conv.inner = untag_ptr(this_ptr);
74044         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74045         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74046         this_ptr_conv.is_owned = false;
74047         jboolean ret_conv = ChannelUpdateInfo_get_enabled(&this_ptr_conv);
74048         return ret_conv;
74049 }
74050
74051 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1set_1enabled(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
74052         LDKChannelUpdateInfo 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         ChannelUpdateInfo_set_enabled(&this_ptr_conv, val);
74058 }
74059
74060 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
74061         LDKChannelUpdateInfo this_ptr_conv;
74062         this_ptr_conv.inner = untag_ptr(this_ptr);
74063         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74064         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74065         this_ptr_conv.is_owned = false;
74066         int16_t ret_conv = ChannelUpdateInfo_get_cltv_expiry_delta(&this_ptr_conv);
74067         return ret_conv;
74068 }
74069
74070 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
74071         LDKChannelUpdateInfo this_ptr_conv;
74072         this_ptr_conv.inner = untag_ptr(this_ptr);
74073         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74074         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74075         this_ptr_conv.is_owned = false;
74076         ChannelUpdateInfo_set_cltv_expiry_delta(&this_ptr_conv, val);
74077 }
74078
74079 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
74080         LDKChannelUpdateInfo this_ptr_conv;
74081         this_ptr_conv.inner = untag_ptr(this_ptr);
74082         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74083         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74084         this_ptr_conv.is_owned = false;
74085         int64_t ret_conv = ChannelUpdateInfo_get_htlc_minimum_msat(&this_ptr_conv);
74086         return ret_conv;
74087 }
74088
74089 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
74090         LDKChannelUpdateInfo this_ptr_conv;
74091         this_ptr_conv.inner = untag_ptr(this_ptr);
74092         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74093         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74094         this_ptr_conv.is_owned = false;
74095         ChannelUpdateInfo_set_htlc_minimum_msat(&this_ptr_conv, val);
74096 }
74097
74098 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1get_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
74099         LDKChannelUpdateInfo this_ptr_conv;
74100         this_ptr_conv.inner = untag_ptr(this_ptr);
74101         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74102         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74103         this_ptr_conv.is_owned = false;
74104         int64_t ret_conv = ChannelUpdateInfo_get_htlc_maximum_msat(&this_ptr_conv);
74105         return ret_conv;
74106 }
74107
74108 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1set_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
74109         LDKChannelUpdateInfo this_ptr_conv;
74110         this_ptr_conv.inner = untag_ptr(this_ptr);
74111         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74112         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74113         this_ptr_conv.is_owned = false;
74114         ChannelUpdateInfo_set_htlc_maximum_msat(&this_ptr_conv, val);
74115 }
74116
74117 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1get_1fees(JNIEnv *env, jclass clz, int64_t this_ptr) {
74118         LDKChannelUpdateInfo this_ptr_conv;
74119         this_ptr_conv.inner = untag_ptr(this_ptr);
74120         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74121         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74122         this_ptr_conv.is_owned = false;
74123         LDKRoutingFees ret_var = ChannelUpdateInfo_get_fees(&this_ptr_conv);
74124         int64_t ret_ref = 0;
74125         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74126         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74127         return ret_ref;
74128 }
74129
74130 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1set_1fees(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
74131         LDKChannelUpdateInfo this_ptr_conv;
74132         this_ptr_conv.inner = untag_ptr(this_ptr);
74133         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74134         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74135         this_ptr_conv.is_owned = false;
74136         LDKRoutingFees val_conv;
74137         val_conv.inner = untag_ptr(val);
74138         val_conv.is_owned = ptr_is_owned(val);
74139         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
74140         val_conv = RoutingFees_clone(&val_conv);
74141         ChannelUpdateInfo_set_fees(&this_ptr_conv, val_conv);
74142 }
74143
74144 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1get_1last_1update_1message(JNIEnv *env, jclass clz, int64_t this_ptr) {
74145         LDKChannelUpdateInfo this_ptr_conv;
74146         this_ptr_conv.inner = untag_ptr(this_ptr);
74147         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74148         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74149         this_ptr_conv.is_owned = false;
74150         LDKChannelUpdate ret_var = ChannelUpdateInfo_get_last_update_message(&this_ptr_conv);
74151         int64_t ret_ref = 0;
74152         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74153         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74154         return ret_ref;
74155 }
74156
74157 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1set_1last_1update_1message(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
74158         LDKChannelUpdateInfo this_ptr_conv;
74159         this_ptr_conv.inner = untag_ptr(this_ptr);
74160         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74161         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74162         this_ptr_conv.is_owned = false;
74163         LDKChannelUpdate val_conv;
74164         val_conv.inner = untag_ptr(val);
74165         val_conv.is_owned = ptr_is_owned(val);
74166         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
74167         val_conv = ChannelUpdate_clone(&val_conv);
74168         ChannelUpdateInfo_set_last_update_message(&this_ptr_conv, val_conv);
74169 }
74170
74171 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) {
74172         LDKRoutingFees fees_arg_conv;
74173         fees_arg_conv.inner = untag_ptr(fees_arg);
74174         fees_arg_conv.is_owned = ptr_is_owned(fees_arg);
74175         CHECK_INNER_FIELD_ACCESS_OR_NULL(fees_arg_conv);
74176         fees_arg_conv = RoutingFees_clone(&fees_arg_conv);
74177         LDKChannelUpdate last_update_message_arg_conv;
74178         last_update_message_arg_conv.inner = untag_ptr(last_update_message_arg);
74179         last_update_message_arg_conv.is_owned = ptr_is_owned(last_update_message_arg);
74180         CHECK_INNER_FIELD_ACCESS_OR_NULL(last_update_message_arg_conv);
74181         last_update_message_arg_conv = ChannelUpdate_clone(&last_update_message_arg_conv);
74182         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);
74183         int64_t ret_ref = 0;
74184         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74185         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74186         return ret_ref;
74187 }
74188
74189 static inline uint64_t ChannelUpdateInfo_clone_ptr(LDKChannelUpdateInfo *NONNULL_PTR arg) {
74190         LDKChannelUpdateInfo ret_var = ChannelUpdateInfo_clone(arg);
74191         int64_t ret_ref = 0;
74192         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74193         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74194         return ret_ref;
74195 }
74196 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
74197         LDKChannelUpdateInfo arg_conv;
74198         arg_conv.inner = untag_ptr(arg);
74199         arg_conv.is_owned = ptr_is_owned(arg);
74200         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
74201         arg_conv.is_owned = false;
74202         int64_t ret_conv = ChannelUpdateInfo_clone_ptr(&arg_conv);
74203         return ret_conv;
74204 }
74205
74206 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
74207         LDKChannelUpdateInfo orig_conv;
74208         orig_conv.inner = untag_ptr(orig);
74209         orig_conv.is_owned = ptr_is_owned(orig);
74210         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
74211         orig_conv.is_owned = false;
74212         LDKChannelUpdateInfo ret_var = ChannelUpdateInfo_clone(&orig_conv);
74213         int64_t ret_ref = 0;
74214         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74215         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74216         return ret_ref;
74217 }
74218
74219 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
74220         LDKChannelUpdateInfo a_conv;
74221         a_conv.inner = untag_ptr(a);
74222         a_conv.is_owned = ptr_is_owned(a);
74223         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
74224         a_conv.is_owned = false;
74225         LDKChannelUpdateInfo b_conv;
74226         b_conv.inner = untag_ptr(b);
74227         b_conv.is_owned = ptr_is_owned(b);
74228         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
74229         b_conv.is_owned = false;
74230         jboolean ret_conv = ChannelUpdateInfo_eq(&a_conv, &b_conv);
74231         return ret_conv;
74232 }
74233
74234 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1write(JNIEnv *env, jclass clz, int64_t obj) {
74235         LDKChannelUpdateInfo obj_conv;
74236         obj_conv.inner = untag_ptr(obj);
74237         obj_conv.is_owned = ptr_is_owned(obj);
74238         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
74239         obj_conv.is_owned = false;
74240         LDKCVec_u8Z ret_var = ChannelUpdateInfo_write(&obj_conv);
74241         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
74242         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
74243         CVec_u8Z_free(ret_var);
74244         return ret_arr;
74245 }
74246
74247 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdateInfo_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
74248         LDKu8slice ser_ref;
74249         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
74250         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
74251         LDKCResult_ChannelUpdateInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ), "LDKCResult_ChannelUpdateInfoDecodeErrorZ");
74252         *ret_conv = ChannelUpdateInfo_read(ser_ref);
74253         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
74254         return tag_ptr(ret_conv, true);
74255 }
74256
74257 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
74258         LDKChannelInfo this_obj_conv;
74259         this_obj_conv.inner = untag_ptr(this_obj);
74260         this_obj_conv.is_owned = ptr_is_owned(this_obj);
74261         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
74262         ChannelInfo_free(this_obj_conv);
74263 }
74264
74265 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
74266         LDKChannelInfo this_ptr_conv;
74267         this_ptr_conv.inner = untag_ptr(this_ptr);
74268         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74269         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74270         this_ptr_conv.is_owned = false;
74271         LDKChannelFeatures ret_var = ChannelInfo_get_features(&this_ptr_conv);
74272         int64_t ret_ref = 0;
74273         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74274         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74275         return ret_ref;
74276 }
74277
74278 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
74279         LDKChannelInfo this_ptr_conv;
74280         this_ptr_conv.inner = untag_ptr(this_ptr);
74281         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74282         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74283         this_ptr_conv.is_owned = false;
74284         LDKChannelFeatures val_conv;
74285         val_conv.inner = untag_ptr(val);
74286         val_conv.is_owned = ptr_is_owned(val);
74287         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
74288         val_conv = ChannelFeatures_clone(&val_conv);
74289         ChannelInfo_set_features(&this_ptr_conv, val_conv);
74290 }
74291
74292 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1node_1one(JNIEnv *env, jclass clz, int64_t this_ptr) {
74293         LDKChannelInfo this_ptr_conv;
74294         this_ptr_conv.inner = untag_ptr(this_ptr);
74295         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74296         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74297         this_ptr_conv.is_owned = false;
74298         LDKNodeId ret_var = ChannelInfo_get_node_one(&this_ptr_conv);
74299         int64_t ret_ref = 0;
74300         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74301         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74302         return ret_ref;
74303 }
74304
74305 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1node_1one(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
74306         LDKChannelInfo this_ptr_conv;
74307         this_ptr_conv.inner = untag_ptr(this_ptr);
74308         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74309         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74310         this_ptr_conv.is_owned = false;
74311         LDKNodeId val_conv;
74312         val_conv.inner = untag_ptr(val);
74313         val_conv.is_owned = ptr_is_owned(val);
74314         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
74315         val_conv = NodeId_clone(&val_conv);
74316         ChannelInfo_set_node_one(&this_ptr_conv, val_conv);
74317 }
74318
74319 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1one_1to_1two(JNIEnv *env, jclass clz, int64_t this_ptr) {
74320         LDKChannelInfo this_ptr_conv;
74321         this_ptr_conv.inner = untag_ptr(this_ptr);
74322         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74323         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74324         this_ptr_conv.is_owned = false;
74325         LDKChannelUpdateInfo ret_var = ChannelInfo_get_one_to_two(&this_ptr_conv);
74326         int64_t ret_ref = 0;
74327         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74328         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74329         return ret_ref;
74330 }
74331
74332 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1one_1to_1two(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
74333         LDKChannelInfo this_ptr_conv;
74334         this_ptr_conv.inner = untag_ptr(this_ptr);
74335         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74336         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74337         this_ptr_conv.is_owned = false;
74338         LDKChannelUpdateInfo val_conv;
74339         val_conv.inner = untag_ptr(val);
74340         val_conv.is_owned = ptr_is_owned(val);
74341         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
74342         val_conv = ChannelUpdateInfo_clone(&val_conv);
74343         ChannelInfo_set_one_to_two(&this_ptr_conv, val_conv);
74344 }
74345
74346 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1node_1two(JNIEnv *env, jclass clz, int64_t this_ptr) {
74347         LDKChannelInfo this_ptr_conv;
74348         this_ptr_conv.inner = untag_ptr(this_ptr);
74349         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74350         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74351         this_ptr_conv.is_owned = false;
74352         LDKNodeId ret_var = ChannelInfo_get_node_two(&this_ptr_conv);
74353         int64_t ret_ref = 0;
74354         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74355         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74356         return ret_ref;
74357 }
74358
74359 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1node_1two(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
74360         LDKChannelInfo this_ptr_conv;
74361         this_ptr_conv.inner = untag_ptr(this_ptr);
74362         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74363         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74364         this_ptr_conv.is_owned = false;
74365         LDKNodeId val_conv;
74366         val_conv.inner = untag_ptr(val);
74367         val_conv.is_owned = ptr_is_owned(val);
74368         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
74369         val_conv = NodeId_clone(&val_conv);
74370         ChannelInfo_set_node_two(&this_ptr_conv, val_conv);
74371 }
74372
74373 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1two_1to_1one(JNIEnv *env, jclass clz, int64_t this_ptr) {
74374         LDKChannelInfo this_ptr_conv;
74375         this_ptr_conv.inner = untag_ptr(this_ptr);
74376         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74377         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74378         this_ptr_conv.is_owned = false;
74379         LDKChannelUpdateInfo ret_var = ChannelInfo_get_two_to_one(&this_ptr_conv);
74380         int64_t ret_ref = 0;
74381         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74382         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74383         return ret_ref;
74384 }
74385
74386 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1two_1to_1one(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
74387         LDKChannelInfo this_ptr_conv;
74388         this_ptr_conv.inner = untag_ptr(this_ptr);
74389         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74390         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74391         this_ptr_conv.is_owned = false;
74392         LDKChannelUpdateInfo val_conv;
74393         val_conv.inner = untag_ptr(val);
74394         val_conv.is_owned = ptr_is_owned(val);
74395         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
74396         val_conv = ChannelUpdateInfo_clone(&val_conv);
74397         ChannelInfo_set_two_to_one(&this_ptr_conv, val_conv);
74398 }
74399
74400 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1capacity_1sats(JNIEnv *env, jclass clz, int64_t this_ptr) {
74401         LDKChannelInfo this_ptr_conv;
74402         this_ptr_conv.inner = untag_ptr(this_ptr);
74403         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74404         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74405         this_ptr_conv.is_owned = false;
74406         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
74407         *ret_copy = ChannelInfo_get_capacity_sats(&this_ptr_conv);
74408         int64_t ret_ref = tag_ptr(ret_copy, true);
74409         return ret_ref;
74410 }
74411
74412 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1capacity_1sats(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
74413         LDKChannelInfo this_ptr_conv;
74414         this_ptr_conv.inner = untag_ptr(this_ptr);
74415         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74416         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74417         this_ptr_conv.is_owned = false;
74418         void* val_ptr = untag_ptr(val);
74419         CHECK_ACCESS(val_ptr);
74420         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
74421         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
74422         ChannelInfo_set_capacity_sats(&this_ptr_conv, val_conv);
74423 }
74424
74425 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1announcement_1message(JNIEnv *env, jclass clz, int64_t this_ptr) {
74426         LDKChannelInfo this_ptr_conv;
74427         this_ptr_conv.inner = untag_ptr(this_ptr);
74428         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74429         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74430         this_ptr_conv.is_owned = false;
74431         LDKChannelAnnouncement ret_var = ChannelInfo_get_announcement_message(&this_ptr_conv);
74432         int64_t ret_ref = 0;
74433         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74434         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74435         return ret_ref;
74436 }
74437
74438 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1announcement_1message(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
74439         LDKChannelInfo this_ptr_conv;
74440         this_ptr_conv.inner = untag_ptr(this_ptr);
74441         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74442         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74443         this_ptr_conv.is_owned = false;
74444         LDKChannelAnnouncement val_conv;
74445         val_conv.inner = untag_ptr(val);
74446         val_conv.is_owned = ptr_is_owned(val);
74447         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
74448         val_conv = ChannelAnnouncement_clone(&val_conv);
74449         ChannelInfo_set_announcement_message(&this_ptr_conv, val_conv);
74450 }
74451
74452 static inline uint64_t ChannelInfo_clone_ptr(LDKChannelInfo *NONNULL_PTR arg) {
74453         LDKChannelInfo ret_var = ChannelInfo_clone(arg);
74454         int64_t ret_ref = 0;
74455         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74456         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74457         return ret_ref;
74458 }
74459 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
74460         LDKChannelInfo arg_conv;
74461         arg_conv.inner = untag_ptr(arg);
74462         arg_conv.is_owned = ptr_is_owned(arg);
74463         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
74464         arg_conv.is_owned = false;
74465         int64_t ret_conv = ChannelInfo_clone_ptr(&arg_conv);
74466         return ret_conv;
74467 }
74468
74469 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
74470         LDKChannelInfo orig_conv;
74471         orig_conv.inner = untag_ptr(orig);
74472         orig_conv.is_owned = ptr_is_owned(orig);
74473         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
74474         orig_conv.is_owned = false;
74475         LDKChannelInfo ret_var = ChannelInfo_clone(&orig_conv);
74476         int64_t ret_ref = 0;
74477         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74478         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74479         return ret_ref;
74480 }
74481
74482 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
74483         LDKChannelInfo a_conv;
74484         a_conv.inner = untag_ptr(a);
74485         a_conv.is_owned = ptr_is_owned(a);
74486         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
74487         a_conv.is_owned = false;
74488         LDKChannelInfo b_conv;
74489         b_conv.inner = untag_ptr(b);
74490         b_conv.is_owned = ptr_is_owned(b);
74491         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
74492         b_conv.is_owned = false;
74493         jboolean ret_conv = ChannelInfo_eq(&a_conv, &b_conv);
74494         return ret_conv;
74495 }
74496
74497 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) {
74498         LDKChannelInfo this_arg_conv;
74499         this_arg_conv.inner = untag_ptr(this_arg);
74500         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74501         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74502         this_arg_conv.is_owned = false;
74503         LDKChannelUpdateInfo ret_var = ChannelInfo_get_directional_info(&this_arg_conv, channel_flags);
74504         int64_t ret_ref = 0;
74505         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74506         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74507         return ret_ref;
74508 }
74509
74510 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1write(JNIEnv *env, jclass clz, int64_t obj) {
74511         LDKChannelInfo obj_conv;
74512         obj_conv.inner = untag_ptr(obj);
74513         obj_conv.is_owned = ptr_is_owned(obj);
74514         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
74515         obj_conv.is_owned = false;
74516         LDKCVec_u8Z ret_var = ChannelInfo_write(&obj_conv);
74517         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
74518         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
74519         CVec_u8Z_free(ret_var);
74520         return ret_arr;
74521 }
74522
74523 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
74524         LDKu8slice ser_ref;
74525         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
74526         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
74527         LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
74528         *ret_conv = ChannelInfo_read(ser_ref);
74529         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
74530         return tag_ptr(ret_conv, true);
74531 }
74532
74533 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectedChannelInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
74534         LDKDirectedChannelInfo this_obj_conv;
74535         this_obj_conv.inner = untag_ptr(this_obj);
74536         this_obj_conv.is_owned = ptr_is_owned(this_obj);
74537         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
74538         DirectedChannelInfo_free(this_obj_conv);
74539 }
74540
74541 static inline uint64_t DirectedChannelInfo_clone_ptr(LDKDirectedChannelInfo *NONNULL_PTR arg) {
74542         LDKDirectedChannelInfo ret_var = DirectedChannelInfo_clone(arg);
74543         int64_t ret_ref = 0;
74544         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74545         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74546         return ret_ref;
74547 }
74548 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelInfo_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
74549         LDKDirectedChannelInfo arg_conv;
74550         arg_conv.inner = untag_ptr(arg);
74551         arg_conv.is_owned = ptr_is_owned(arg);
74552         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
74553         arg_conv.is_owned = false;
74554         int64_t ret_conv = DirectedChannelInfo_clone_ptr(&arg_conv);
74555         return ret_conv;
74556 }
74557
74558 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
74559         LDKDirectedChannelInfo orig_conv;
74560         orig_conv.inner = untag_ptr(orig);
74561         orig_conv.is_owned = ptr_is_owned(orig);
74562         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
74563         orig_conv.is_owned = false;
74564         LDKDirectedChannelInfo ret_var = DirectedChannelInfo_clone(&orig_conv);
74565         int64_t ret_ref = 0;
74566         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74567         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74568         return ret_ref;
74569 }
74570
74571 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelInfo_1channel(JNIEnv *env, jclass clz, int64_t this_arg) {
74572         LDKDirectedChannelInfo this_arg_conv;
74573         this_arg_conv.inner = untag_ptr(this_arg);
74574         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74575         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74576         this_arg_conv.is_owned = false;
74577         LDKChannelInfo ret_var = DirectedChannelInfo_channel(&this_arg_conv);
74578         int64_t ret_ref = 0;
74579         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74580         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74581         return ret_ref;
74582 }
74583
74584 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelInfo_1effective_1capacity(JNIEnv *env, jclass clz, int64_t this_arg) {
74585         LDKDirectedChannelInfo this_arg_conv;
74586         this_arg_conv.inner = untag_ptr(this_arg);
74587         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74588         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74589         this_arg_conv.is_owned = false;
74590         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
74591         *ret_copy = DirectedChannelInfo_effective_capacity(&this_arg_conv);
74592         int64_t ret_ref = tag_ptr(ret_copy, true);
74593         return ret_ref;
74594 }
74595
74596 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelInfo_1source(JNIEnv *env, jclass clz, int64_t this_arg) {
74597         LDKDirectedChannelInfo this_arg_conv;
74598         this_arg_conv.inner = untag_ptr(this_arg);
74599         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74600         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74601         this_arg_conv.is_owned = false;
74602         LDKNodeId ret_var = DirectedChannelInfo_source(&this_arg_conv);
74603         int64_t ret_ref = 0;
74604         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74605         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74606         return ret_ref;
74607 }
74608
74609 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelInfo_1target(JNIEnv *env, jclass clz, int64_t this_arg) {
74610         LDKDirectedChannelInfo this_arg_conv;
74611         this_arg_conv.inner = untag_ptr(this_arg);
74612         this_arg_conv.is_owned = ptr_is_owned(this_arg);
74613         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
74614         this_arg_conv.is_owned = false;
74615         LDKNodeId ret_var = DirectedChannelInfo_target(&this_arg_conv);
74616         int64_t ret_ref = 0;
74617         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74618         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74619         return ret_ref;
74620 }
74621
74622 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EffectiveCapacity_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
74623         if (!ptr_is_owned(this_ptr)) return;
74624         void* this_ptr_ptr = untag_ptr(this_ptr);
74625         CHECK_ACCESS(this_ptr_ptr);
74626         LDKEffectiveCapacity this_ptr_conv = *(LDKEffectiveCapacity*)(this_ptr_ptr);
74627         FREE(untag_ptr(this_ptr));
74628         EffectiveCapacity_free(this_ptr_conv);
74629 }
74630
74631 static inline uint64_t EffectiveCapacity_clone_ptr(LDKEffectiveCapacity *NONNULL_PTR arg) {
74632         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
74633         *ret_copy = EffectiveCapacity_clone(arg);
74634         int64_t ret_ref = tag_ptr(ret_copy, true);
74635         return ret_ref;
74636 }
74637 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EffectiveCapacity_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
74638         LDKEffectiveCapacity* arg_conv = (LDKEffectiveCapacity*)untag_ptr(arg);
74639         int64_t ret_conv = EffectiveCapacity_clone_ptr(arg_conv);
74640         return ret_conv;
74641 }
74642
74643 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EffectiveCapacity_1clone(JNIEnv *env, jclass clz, int64_t orig) {
74644         LDKEffectiveCapacity* orig_conv = (LDKEffectiveCapacity*)untag_ptr(orig);
74645         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
74646         *ret_copy = EffectiveCapacity_clone(orig_conv);
74647         int64_t ret_ref = tag_ptr(ret_copy, true);
74648         return ret_ref;
74649 }
74650
74651 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EffectiveCapacity_1exact_1liquidity(JNIEnv *env, jclass clz, int64_t liquidity_msat) {
74652         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
74653         *ret_copy = EffectiveCapacity_exact_liquidity(liquidity_msat);
74654         int64_t ret_ref = tag_ptr(ret_copy, true);
74655         return ret_ref;
74656 }
74657
74658 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EffectiveCapacity_1advertised_1max_1htlc(JNIEnv *env, jclass clz, int64_t amount_msat) {
74659         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
74660         *ret_copy = EffectiveCapacity_advertised_max_htlc(amount_msat);
74661         int64_t ret_ref = tag_ptr(ret_copy, true);
74662         return ret_ref;
74663 }
74664
74665 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EffectiveCapacity_1total(JNIEnv *env, jclass clz, int64_t capacity_msat, int64_t htlc_maximum_msat) {
74666         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
74667         *ret_copy = EffectiveCapacity_total(capacity_msat, htlc_maximum_msat);
74668         int64_t ret_ref = tag_ptr(ret_copy, true);
74669         return ret_ref;
74670 }
74671
74672 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EffectiveCapacity_1infinite(JNIEnv *env, jclass clz) {
74673         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
74674         *ret_copy = EffectiveCapacity_infinite();
74675         int64_t ret_ref = tag_ptr(ret_copy, true);
74676         return ret_ref;
74677 }
74678
74679 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EffectiveCapacity_1hint_1max_1htlc(JNIEnv *env, jclass clz, int64_t amount_msat) {
74680         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
74681         *ret_copy = EffectiveCapacity_hint_max_htlc(amount_msat);
74682         int64_t ret_ref = tag_ptr(ret_copy, true);
74683         return ret_ref;
74684 }
74685
74686 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EffectiveCapacity_1unknown(JNIEnv *env, jclass clz) {
74687         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
74688         *ret_copy = EffectiveCapacity_unknown();
74689         int64_t ret_ref = tag_ptr(ret_copy, true);
74690         return ret_ref;
74691 }
74692
74693 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EffectiveCapacity_1as_1msat(JNIEnv *env, jclass clz, int64_t this_arg) {
74694         LDKEffectiveCapacity* this_arg_conv = (LDKEffectiveCapacity*)untag_ptr(this_arg);
74695         int64_t ret_conv = EffectiveCapacity_as_msat(this_arg_conv);
74696         return ret_conv;
74697 }
74698
74699 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingFees_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
74700         LDKRoutingFees 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         RoutingFees_free(this_obj_conv);
74705 }
74706
74707 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1get_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
74708         LDKRoutingFees this_ptr_conv;
74709         this_ptr_conv.inner = untag_ptr(this_ptr);
74710         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74711         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74712         this_ptr_conv.is_owned = false;
74713         int32_t ret_conv = RoutingFees_get_base_msat(&this_ptr_conv);
74714         return ret_conv;
74715 }
74716
74717 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingFees_1set_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
74718         LDKRoutingFees this_ptr_conv;
74719         this_ptr_conv.inner = untag_ptr(this_ptr);
74720         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74721         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74722         this_ptr_conv.is_owned = false;
74723         RoutingFees_set_base_msat(&this_ptr_conv, val);
74724 }
74725
74726 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1get_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr) {
74727         LDKRoutingFees this_ptr_conv;
74728         this_ptr_conv.inner = untag_ptr(this_ptr);
74729         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74730         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74731         this_ptr_conv.is_owned = false;
74732         int32_t ret_conv = RoutingFees_get_proportional_millionths(&this_ptr_conv);
74733         return ret_conv;
74734 }
74735
74736 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingFees_1set_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
74737         LDKRoutingFees this_ptr_conv;
74738         this_ptr_conv.inner = untag_ptr(this_ptr);
74739         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74740         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74741         this_ptr_conv.is_owned = false;
74742         RoutingFees_set_proportional_millionths(&this_ptr_conv, val);
74743 }
74744
74745 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) {
74746         LDKRoutingFees ret_var = RoutingFees_new(base_msat_arg, proportional_millionths_arg);
74747         int64_t ret_ref = 0;
74748         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74749         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74750         return ret_ref;
74751 }
74752
74753 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RoutingFees_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
74754         LDKRoutingFees a_conv;
74755         a_conv.inner = untag_ptr(a);
74756         a_conv.is_owned = ptr_is_owned(a);
74757         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
74758         a_conv.is_owned = false;
74759         LDKRoutingFees b_conv;
74760         b_conv.inner = untag_ptr(b);
74761         b_conv.is_owned = ptr_is_owned(b);
74762         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
74763         b_conv.is_owned = false;
74764         jboolean ret_conv = RoutingFees_eq(&a_conv, &b_conv);
74765         return ret_conv;
74766 }
74767
74768 static inline uint64_t RoutingFees_clone_ptr(LDKRoutingFees *NONNULL_PTR arg) {
74769         LDKRoutingFees ret_var = RoutingFees_clone(arg);
74770         int64_t ret_ref = 0;
74771         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74772         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74773         return ret_ref;
74774 }
74775 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
74776         LDKRoutingFees arg_conv;
74777         arg_conv.inner = untag_ptr(arg);
74778         arg_conv.is_owned = ptr_is_owned(arg);
74779         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
74780         arg_conv.is_owned = false;
74781         int64_t ret_conv = RoutingFees_clone_ptr(&arg_conv);
74782         return ret_conv;
74783 }
74784
74785 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1clone(JNIEnv *env, jclass clz, int64_t orig) {
74786         LDKRoutingFees orig_conv;
74787         orig_conv.inner = untag_ptr(orig);
74788         orig_conv.is_owned = ptr_is_owned(orig);
74789         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
74790         orig_conv.is_owned = false;
74791         LDKRoutingFees ret_var = RoutingFees_clone(&orig_conv);
74792         int64_t ret_ref = 0;
74793         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74794         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74795         return ret_ref;
74796 }
74797
74798 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1hash(JNIEnv *env, jclass clz, int64_t o) {
74799         LDKRoutingFees o_conv;
74800         o_conv.inner = untag_ptr(o);
74801         o_conv.is_owned = ptr_is_owned(o);
74802         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
74803         o_conv.is_owned = false;
74804         int64_t ret_conv = RoutingFees_hash(&o_conv);
74805         return ret_conv;
74806 }
74807
74808 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RoutingFees_1write(JNIEnv *env, jclass clz, int64_t obj) {
74809         LDKRoutingFees obj_conv;
74810         obj_conv.inner = untag_ptr(obj);
74811         obj_conv.is_owned = ptr_is_owned(obj);
74812         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
74813         obj_conv.is_owned = false;
74814         LDKCVec_u8Z ret_var = RoutingFees_write(&obj_conv);
74815         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
74816         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
74817         CVec_u8Z_free(ret_var);
74818         return ret_arr;
74819 }
74820
74821 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
74822         LDKu8slice ser_ref;
74823         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
74824         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
74825         LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
74826         *ret_conv = RoutingFees_read(ser_ref);
74827         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
74828         return tag_ptr(ret_conv, true);
74829 }
74830
74831 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
74832         LDKNodeAnnouncementInfo this_obj_conv;
74833         this_obj_conv.inner = untag_ptr(this_obj);
74834         this_obj_conv.is_owned = ptr_is_owned(this_obj);
74835         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
74836         NodeAnnouncementInfo_free(this_obj_conv);
74837 }
74838
74839 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
74840         LDKNodeAnnouncementInfo this_ptr_conv;
74841         this_ptr_conv.inner = untag_ptr(this_ptr);
74842         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74843         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74844         this_ptr_conv.is_owned = false;
74845         LDKNodeFeatures ret_var = NodeAnnouncementInfo_get_features(&this_ptr_conv);
74846         int64_t ret_ref = 0;
74847         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74848         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74849         return ret_ref;
74850 }
74851
74852 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
74853         LDKNodeAnnouncementInfo this_ptr_conv;
74854         this_ptr_conv.inner = untag_ptr(this_ptr);
74855         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74856         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74857         this_ptr_conv.is_owned = false;
74858         LDKNodeFeatures val_conv;
74859         val_conv.inner = untag_ptr(val);
74860         val_conv.is_owned = ptr_is_owned(val);
74861         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
74862         val_conv = NodeFeatures_clone(&val_conv);
74863         NodeAnnouncementInfo_set_features(&this_ptr_conv, val_conv);
74864 }
74865
74866 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1last_1update(JNIEnv *env, jclass clz, int64_t this_ptr) {
74867         LDKNodeAnnouncementInfo this_ptr_conv;
74868         this_ptr_conv.inner = untag_ptr(this_ptr);
74869         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74870         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74871         this_ptr_conv.is_owned = false;
74872         int32_t ret_conv = NodeAnnouncementInfo_get_last_update(&this_ptr_conv);
74873         return ret_conv;
74874 }
74875
74876 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1last_1update(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
74877         LDKNodeAnnouncementInfo this_ptr_conv;
74878         this_ptr_conv.inner = untag_ptr(this_ptr);
74879         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74880         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74881         this_ptr_conv.is_owned = false;
74882         NodeAnnouncementInfo_set_last_update(&this_ptr_conv, val);
74883 }
74884
74885 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1rgb(JNIEnv *env, jclass clz, int64_t this_ptr) {
74886         LDKNodeAnnouncementInfo this_ptr_conv;
74887         this_ptr_conv.inner = untag_ptr(this_ptr);
74888         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74889         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74890         this_ptr_conv.is_owned = false;
74891         int8_tArray ret_arr = (*env)->NewByteArray(env, 3);
74892         (*env)->SetByteArrayRegion(env, ret_arr, 0, 3, *NodeAnnouncementInfo_get_rgb(&this_ptr_conv));
74893         return ret_arr;
74894 }
74895
74896 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1rgb(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
74897         LDKNodeAnnouncementInfo this_ptr_conv;
74898         this_ptr_conv.inner = untag_ptr(this_ptr);
74899         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74900         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74901         this_ptr_conv.is_owned = false;
74902         LDKThreeBytes val_ref;
74903         CHECK((*env)->GetArrayLength(env, val) == 3);
74904         (*env)->GetByteArrayRegion(env, val, 0, 3, val_ref.data);
74905         NodeAnnouncementInfo_set_rgb(&this_ptr_conv, val_ref);
74906 }
74907
74908 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1alias(JNIEnv *env, jclass clz, int64_t this_ptr) {
74909         LDKNodeAnnouncementInfo this_ptr_conv;
74910         this_ptr_conv.inner = untag_ptr(this_ptr);
74911         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74912         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74913         this_ptr_conv.is_owned = false;
74914         LDKNodeAlias ret_var = NodeAnnouncementInfo_get_alias(&this_ptr_conv);
74915         int64_t ret_ref = 0;
74916         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74917         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74918         return ret_ref;
74919 }
74920
74921 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1alias(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
74922         LDKNodeAnnouncementInfo this_ptr_conv;
74923         this_ptr_conv.inner = untag_ptr(this_ptr);
74924         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74925         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74926         this_ptr_conv.is_owned = false;
74927         LDKNodeAlias val_conv;
74928         val_conv.inner = untag_ptr(val);
74929         val_conv.is_owned = ptr_is_owned(val);
74930         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
74931         val_conv = NodeAlias_clone(&val_conv);
74932         NodeAnnouncementInfo_set_alias(&this_ptr_conv, val_conv);
74933 }
74934
74935 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1announcement_1message(JNIEnv *env, jclass clz, int64_t this_ptr) {
74936         LDKNodeAnnouncementInfo this_ptr_conv;
74937         this_ptr_conv.inner = untag_ptr(this_ptr);
74938         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74939         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74940         this_ptr_conv.is_owned = false;
74941         LDKNodeAnnouncement ret_var = NodeAnnouncementInfo_get_announcement_message(&this_ptr_conv);
74942         int64_t ret_ref = 0;
74943         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74944         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74945         return ret_ref;
74946 }
74947
74948 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1announcement_1message(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
74949         LDKNodeAnnouncementInfo this_ptr_conv;
74950         this_ptr_conv.inner = untag_ptr(this_ptr);
74951         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
74952         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
74953         this_ptr_conv.is_owned = false;
74954         LDKNodeAnnouncement val_conv;
74955         val_conv.inner = untag_ptr(val);
74956         val_conv.is_owned = ptr_is_owned(val);
74957         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
74958         val_conv = NodeAnnouncement_clone(&val_conv);
74959         NodeAnnouncementInfo_set_announcement_message(&this_ptr_conv, val_conv);
74960 }
74961
74962 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) {
74963         LDKNodeFeatures features_arg_conv;
74964         features_arg_conv.inner = untag_ptr(features_arg);
74965         features_arg_conv.is_owned = ptr_is_owned(features_arg);
74966         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
74967         features_arg_conv = NodeFeatures_clone(&features_arg_conv);
74968         LDKThreeBytes rgb_arg_ref;
74969         CHECK((*env)->GetArrayLength(env, rgb_arg) == 3);
74970         (*env)->GetByteArrayRegion(env, rgb_arg, 0, 3, rgb_arg_ref.data);
74971         LDKNodeAlias alias_arg_conv;
74972         alias_arg_conv.inner = untag_ptr(alias_arg);
74973         alias_arg_conv.is_owned = ptr_is_owned(alias_arg);
74974         CHECK_INNER_FIELD_ACCESS_OR_NULL(alias_arg_conv);
74975         alias_arg_conv = NodeAlias_clone(&alias_arg_conv);
74976         LDKNodeAnnouncement announcement_message_arg_conv;
74977         announcement_message_arg_conv.inner = untag_ptr(announcement_message_arg);
74978         announcement_message_arg_conv.is_owned = ptr_is_owned(announcement_message_arg);
74979         CHECK_INNER_FIELD_ACCESS_OR_NULL(announcement_message_arg_conv);
74980         announcement_message_arg_conv = NodeAnnouncement_clone(&announcement_message_arg_conv);
74981         LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_new(features_arg_conv, last_update_arg, rgb_arg_ref, alias_arg_conv, announcement_message_arg_conv);
74982         int64_t ret_ref = 0;
74983         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74984         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74985         return ret_ref;
74986 }
74987
74988 static inline uint64_t NodeAnnouncementInfo_clone_ptr(LDKNodeAnnouncementInfo *NONNULL_PTR arg) {
74989         LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_clone(arg);
74990         int64_t ret_ref = 0;
74991         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
74992         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
74993         return ret_ref;
74994 }
74995 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
74996         LDKNodeAnnouncementInfo arg_conv;
74997         arg_conv.inner = untag_ptr(arg);
74998         arg_conv.is_owned = ptr_is_owned(arg);
74999         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
75000         arg_conv.is_owned = false;
75001         int64_t ret_conv = NodeAnnouncementInfo_clone_ptr(&arg_conv);
75002         return ret_conv;
75003 }
75004
75005 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
75006         LDKNodeAnnouncementInfo orig_conv;
75007         orig_conv.inner = untag_ptr(orig);
75008         orig_conv.is_owned = ptr_is_owned(orig);
75009         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
75010         orig_conv.is_owned = false;
75011         LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_clone(&orig_conv);
75012         int64_t ret_ref = 0;
75013         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
75014         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
75015         return ret_ref;
75016 }
75017
75018 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
75019         LDKNodeAnnouncementInfo a_conv;
75020         a_conv.inner = untag_ptr(a);
75021         a_conv.is_owned = ptr_is_owned(a);
75022         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
75023         a_conv.is_owned = false;
75024         LDKNodeAnnouncementInfo b_conv;
75025         b_conv.inner = untag_ptr(b);
75026         b_conv.is_owned = ptr_is_owned(b);
75027         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
75028         b_conv.is_owned = false;
75029         jboolean ret_conv = NodeAnnouncementInfo_eq(&a_conv, &b_conv);
75030         return ret_conv;
75031 }
75032
75033 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1addresses(JNIEnv *env, jclass clz, int64_t this_arg) {
75034         LDKNodeAnnouncementInfo this_arg_conv;
75035         this_arg_conv.inner = untag_ptr(this_arg);
75036         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75037         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75038         this_arg_conv.is_owned = false;
75039         LDKCVec_SocketAddressZ ret_var = NodeAnnouncementInfo_addresses(&this_arg_conv);
75040         int64_tArray ret_arr = NULL;
75041         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
75042         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
75043         for (size_t p = 0; p < ret_var.datalen; p++) {
75044                 LDKSocketAddress *ret_conv_15_copy = MALLOC(sizeof(LDKSocketAddress), "LDKSocketAddress");
75045                 *ret_conv_15_copy = ret_var.data[p];
75046                 int64_t ret_conv_15_ref = tag_ptr(ret_conv_15_copy, true);
75047                 ret_arr_ptr[p] = ret_conv_15_ref;
75048         }
75049         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
75050         FREE(ret_var.data);
75051         return ret_arr;
75052 }
75053
75054 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1write(JNIEnv *env, jclass clz, int64_t obj) {
75055         LDKNodeAnnouncementInfo obj_conv;
75056         obj_conv.inner = untag_ptr(obj);
75057         obj_conv.is_owned = ptr_is_owned(obj);
75058         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
75059         obj_conv.is_owned = false;
75060         LDKCVec_u8Z ret_var = NodeAnnouncementInfo_write(&obj_conv);
75061         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
75062         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
75063         CVec_u8Z_free(ret_var);
75064         return ret_arr;
75065 }
75066
75067 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
75068         LDKu8slice ser_ref;
75069         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
75070         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
75071         LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
75072         *ret_conv = NodeAnnouncementInfo_read(ser_ref);
75073         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
75074         return tag_ptr(ret_conv, true);
75075 }
75076
75077 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAlias_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
75078         LDKNodeAlias this_obj_conv;
75079         this_obj_conv.inner = untag_ptr(this_obj);
75080         this_obj_conv.is_owned = ptr_is_owned(this_obj);
75081         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
75082         NodeAlias_free(this_obj_conv);
75083 }
75084
75085 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAlias_1get_1a(JNIEnv *env, jclass clz, int64_t this_ptr) {
75086         LDKNodeAlias this_ptr_conv;
75087         this_ptr_conv.inner = untag_ptr(this_ptr);
75088         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
75089         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
75090         this_ptr_conv.is_owned = false;
75091         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
75092         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *NodeAlias_get_a(&this_ptr_conv));
75093         return ret_arr;
75094 }
75095
75096 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAlias_1set_1a(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
75097         LDKNodeAlias this_ptr_conv;
75098         this_ptr_conv.inner = untag_ptr(this_ptr);
75099         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
75100         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
75101         this_ptr_conv.is_owned = false;
75102         LDKThirtyTwoBytes val_ref;
75103         CHECK((*env)->GetArrayLength(env, val) == 32);
75104         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
75105         NodeAlias_set_a(&this_ptr_conv, val_ref);
75106 }
75107
75108 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAlias_1new(JNIEnv *env, jclass clz, int8_tArray a_arg) {
75109         LDKThirtyTwoBytes a_arg_ref;
75110         CHECK((*env)->GetArrayLength(env, a_arg) == 32);
75111         (*env)->GetByteArrayRegion(env, a_arg, 0, 32, a_arg_ref.data);
75112         LDKNodeAlias ret_var = NodeAlias_new(a_arg_ref);
75113         int64_t ret_ref = 0;
75114         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
75115         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
75116         return ret_ref;
75117 }
75118
75119 static inline uint64_t NodeAlias_clone_ptr(LDKNodeAlias *NONNULL_PTR arg) {
75120         LDKNodeAlias ret_var = NodeAlias_clone(arg);
75121         int64_t ret_ref = 0;
75122         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
75123         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
75124         return ret_ref;
75125 }
75126 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAlias_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
75127         LDKNodeAlias arg_conv;
75128         arg_conv.inner = untag_ptr(arg);
75129         arg_conv.is_owned = ptr_is_owned(arg);
75130         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
75131         arg_conv.is_owned = false;
75132         int64_t ret_conv = NodeAlias_clone_ptr(&arg_conv);
75133         return ret_conv;
75134 }
75135
75136 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAlias_1clone(JNIEnv *env, jclass clz, int64_t orig) {
75137         LDKNodeAlias orig_conv;
75138         orig_conv.inner = untag_ptr(orig);
75139         orig_conv.is_owned = ptr_is_owned(orig);
75140         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
75141         orig_conv.is_owned = false;
75142         LDKNodeAlias ret_var = NodeAlias_clone(&orig_conv);
75143         int64_t ret_ref = 0;
75144         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
75145         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
75146         return ret_ref;
75147 }
75148
75149 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAlias_1hash(JNIEnv *env, jclass clz, int64_t o) {
75150         LDKNodeAlias o_conv;
75151         o_conv.inner = untag_ptr(o);
75152         o_conv.is_owned = ptr_is_owned(o);
75153         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
75154         o_conv.is_owned = false;
75155         int64_t ret_conv = NodeAlias_hash(&o_conv);
75156         return ret_conv;
75157 }
75158
75159 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeAlias_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
75160         LDKNodeAlias a_conv;
75161         a_conv.inner = untag_ptr(a);
75162         a_conv.is_owned = ptr_is_owned(a);
75163         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
75164         a_conv.is_owned = false;
75165         LDKNodeAlias b_conv;
75166         b_conv.inner = untag_ptr(b);
75167         b_conv.is_owned = ptr_is_owned(b);
75168         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
75169         b_conv.is_owned = false;
75170         jboolean ret_conv = NodeAlias_eq(&a_conv, &b_conv);
75171         return ret_conv;
75172 }
75173
75174 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAlias_1write(JNIEnv *env, jclass clz, int64_t obj) {
75175         LDKNodeAlias obj_conv;
75176         obj_conv.inner = untag_ptr(obj);
75177         obj_conv.is_owned = ptr_is_owned(obj);
75178         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
75179         obj_conv.is_owned = false;
75180         LDKCVec_u8Z ret_var = NodeAlias_write(&obj_conv);
75181         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
75182         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
75183         CVec_u8Z_free(ret_var);
75184         return ret_arr;
75185 }
75186
75187 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAlias_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
75188         LDKu8slice ser_ref;
75189         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
75190         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
75191         LDKCResult_NodeAliasDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAliasDecodeErrorZ), "LDKCResult_NodeAliasDecodeErrorZ");
75192         *ret_conv = NodeAlias_read(ser_ref);
75193         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
75194         return tag_ptr(ret_conv, true);
75195 }
75196
75197 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
75198         LDKNodeInfo this_obj_conv;
75199         this_obj_conv.inner = untag_ptr(this_obj);
75200         this_obj_conv.is_owned = ptr_is_owned(this_obj);
75201         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
75202         NodeInfo_free(this_obj_conv);
75203 }
75204
75205 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_NodeInfo_1get_1channels(JNIEnv *env, jclass clz, int64_t this_ptr) {
75206         LDKNodeInfo this_ptr_conv;
75207         this_ptr_conv.inner = untag_ptr(this_ptr);
75208         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
75209         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
75210         this_ptr_conv.is_owned = false;
75211         LDKCVec_u64Z ret_var = NodeInfo_get_channels(&this_ptr_conv);
75212         int64_tArray ret_arr = NULL;
75213         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
75214         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
75215         for (size_t g = 0; g < ret_var.datalen; g++) {
75216                 int64_t ret_conv_6_conv = ret_var.data[g];
75217                 ret_arr_ptr[g] = ret_conv_6_conv;
75218         }
75219         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
75220         FREE(ret_var.data);
75221         return ret_arr;
75222 }
75223
75224 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1set_1channels(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
75225         LDKNodeInfo this_ptr_conv;
75226         this_ptr_conv.inner = untag_ptr(this_ptr);
75227         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
75228         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
75229         this_ptr_conv.is_owned = false;
75230         LDKCVec_u64Z val_constr;
75231         val_constr.datalen = (*env)->GetArrayLength(env, val);
75232         if (val_constr.datalen > 0)
75233                 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
75234         else
75235                 val_constr.data = NULL;
75236         int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
75237         for (size_t g = 0; g < val_constr.datalen; g++) {
75238                 int64_t val_conv_6 = val_vals[g];
75239                 val_constr.data[g] = val_conv_6;
75240         }
75241         (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
75242         NodeInfo_set_channels(&this_ptr_conv, val_constr);
75243 }
75244
75245 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeInfo_1get_1announcement_1info(JNIEnv *env, jclass clz, int64_t this_ptr) {
75246         LDKNodeInfo this_ptr_conv;
75247         this_ptr_conv.inner = untag_ptr(this_ptr);
75248         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
75249         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
75250         this_ptr_conv.is_owned = false;
75251         LDKNodeAnnouncementInfo ret_var = NodeInfo_get_announcement_info(&this_ptr_conv);
75252         int64_t ret_ref = 0;
75253         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
75254         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
75255         return ret_ref;
75256 }
75257
75258 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1set_1announcement_1info(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
75259         LDKNodeInfo this_ptr_conv;
75260         this_ptr_conv.inner = untag_ptr(this_ptr);
75261         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
75262         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
75263         this_ptr_conv.is_owned = false;
75264         LDKNodeAnnouncementInfo val_conv;
75265         val_conv.inner = untag_ptr(val);
75266         val_conv.is_owned = ptr_is_owned(val);
75267         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
75268         val_conv = NodeAnnouncementInfo_clone(&val_conv);
75269         NodeInfo_set_announcement_info(&this_ptr_conv, val_conv);
75270 }
75271
75272 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeInfo_1new(JNIEnv *env, jclass clz, int64_tArray channels_arg, int64_t announcement_info_arg) {
75273         LDKCVec_u64Z channels_arg_constr;
75274         channels_arg_constr.datalen = (*env)->GetArrayLength(env, channels_arg);
75275         if (channels_arg_constr.datalen > 0)
75276                 channels_arg_constr.data = MALLOC(channels_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
75277         else
75278                 channels_arg_constr.data = NULL;
75279         int64_t* channels_arg_vals = (*env)->GetLongArrayElements (env, channels_arg, NULL);
75280         for (size_t g = 0; g < channels_arg_constr.datalen; g++) {
75281                 int64_t channels_arg_conv_6 = channels_arg_vals[g];
75282                 channels_arg_constr.data[g] = channels_arg_conv_6;
75283         }
75284         (*env)->ReleaseLongArrayElements(env, channels_arg, channels_arg_vals, 0);
75285         LDKNodeAnnouncementInfo announcement_info_arg_conv;
75286         announcement_info_arg_conv.inner = untag_ptr(announcement_info_arg);
75287         announcement_info_arg_conv.is_owned = ptr_is_owned(announcement_info_arg);
75288         CHECK_INNER_FIELD_ACCESS_OR_NULL(announcement_info_arg_conv);
75289         announcement_info_arg_conv = NodeAnnouncementInfo_clone(&announcement_info_arg_conv);
75290         LDKNodeInfo ret_var = NodeInfo_new(channels_arg_constr, announcement_info_arg_conv);
75291         int64_t ret_ref = 0;
75292         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
75293         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
75294         return ret_ref;
75295 }
75296
75297 static inline uint64_t NodeInfo_clone_ptr(LDKNodeInfo *NONNULL_PTR arg) {
75298         LDKNodeInfo ret_var = NodeInfo_clone(arg);
75299         int64_t ret_ref = 0;
75300         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
75301         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
75302         return ret_ref;
75303 }
75304 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeInfo_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
75305         LDKNodeInfo arg_conv;
75306         arg_conv.inner = untag_ptr(arg);
75307         arg_conv.is_owned = ptr_is_owned(arg);
75308         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
75309         arg_conv.is_owned = false;
75310         int64_t ret_conv = NodeInfo_clone_ptr(&arg_conv);
75311         return ret_conv;
75312 }
75313
75314 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
75315         LDKNodeInfo orig_conv;
75316         orig_conv.inner = untag_ptr(orig);
75317         orig_conv.is_owned = ptr_is_owned(orig);
75318         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
75319         orig_conv.is_owned = false;
75320         LDKNodeInfo ret_var = NodeInfo_clone(&orig_conv);
75321         int64_t ret_ref = 0;
75322         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
75323         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
75324         return ret_ref;
75325 }
75326
75327 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeInfo_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
75328         LDKNodeInfo a_conv;
75329         a_conv.inner = untag_ptr(a);
75330         a_conv.is_owned = ptr_is_owned(a);
75331         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
75332         a_conv.is_owned = false;
75333         LDKNodeInfo b_conv;
75334         b_conv.inner = untag_ptr(b);
75335         b_conv.is_owned = ptr_is_owned(b);
75336         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
75337         b_conv.is_owned = false;
75338         jboolean ret_conv = NodeInfo_eq(&a_conv, &b_conv);
75339         return ret_conv;
75340 }
75341
75342 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeInfo_1is_1tor_1only(JNIEnv *env, jclass clz, int64_t this_arg) {
75343         LDKNodeInfo this_arg_conv;
75344         this_arg_conv.inner = untag_ptr(this_arg);
75345         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75346         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75347         this_arg_conv.is_owned = false;
75348         jboolean ret_conv = NodeInfo_is_tor_only(&this_arg_conv);
75349         return ret_conv;
75350 }
75351
75352 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeInfo_1write(JNIEnv *env, jclass clz, int64_t obj) {
75353         LDKNodeInfo obj_conv;
75354         obj_conv.inner = untag_ptr(obj);
75355         obj_conv.is_owned = ptr_is_owned(obj);
75356         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
75357         obj_conv.is_owned = false;
75358         LDKCVec_u8Z ret_var = NodeInfo_write(&obj_conv);
75359         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
75360         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
75361         CVec_u8Z_free(ret_var);
75362         return ret_arr;
75363 }
75364
75365 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeInfo_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
75366         LDKu8slice ser_ref;
75367         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
75368         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
75369         LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
75370         *ret_conv = NodeInfo_read(ser_ref);
75371         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
75372         return tag_ptr(ret_conv, true);
75373 }
75374
75375 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1write(JNIEnv *env, jclass clz, int64_t obj) {
75376         LDKNetworkGraph obj_conv;
75377         obj_conv.inner = untag_ptr(obj);
75378         obj_conv.is_owned = ptr_is_owned(obj);
75379         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
75380         obj_conv.is_owned = false;
75381         LDKCVec_u8Z ret_var = NetworkGraph_write(&obj_conv);
75382         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
75383         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
75384         CVec_u8Z_free(ret_var);
75385         return ret_arr;
75386 }
75387
75388 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1read(JNIEnv *env, jclass clz, int8_tArray ser, int64_t arg) {
75389         LDKu8slice ser_ref;
75390         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
75391         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
75392         void* arg_ptr = untag_ptr(arg);
75393         CHECK_ACCESS(arg_ptr);
75394         LDKLogger arg_conv = *(LDKLogger*)(arg_ptr);
75395         if (arg_conv.free == LDKLogger_JCalls_free) {
75396                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
75397                 LDKLogger_JCalls_cloned(&arg_conv);
75398         }
75399         LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
75400         *ret_conv = NetworkGraph_read(ser_ref, arg_conv);
75401         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
75402         return tag_ptr(ret_conv, true);
75403 }
75404
75405 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1new(JNIEnv *env, jclass clz, jclass network, int64_t logger) {
75406         LDKNetwork network_conv = LDKNetwork_from_java(env, network);
75407         void* logger_ptr = untag_ptr(logger);
75408         CHECK_ACCESS(logger_ptr);
75409         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
75410         if (logger_conv.free == LDKLogger_JCalls_free) {
75411                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
75412                 LDKLogger_JCalls_cloned(&logger_conv);
75413         }
75414         LDKNetworkGraph ret_var = NetworkGraph_new(network_conv, logger_conv);
75415         int64_t ret_ref = 0;
75416         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
75417         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
75418         return ret_ref;
75419 }
75420
75421 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1read_1only(JNIEnv *env, jclass clz, int64_t this_arg) {
75422         LDKNetworkGraph this_arg_conv;
75423         this_arg_conv.inner = untag_ptr(this_arg);
75424         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75425         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75426         this_arg_conv.is_owned = false;
75427         LDKReadOnlyNetworkGraph ret_var = NetworkGraph_read_only(&this_arg_conv);
75428         int64_t ret_ref = 0;
75429         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
75430         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
75431         return ret_ref;
75432 }
75433
75434 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1get_1last_1rapid_1gossip_1sync_1timestamp(JNIEnv *env, jclass clz, int64_t this_arg) {
75435         LDKNetworkGraph this_arg_conv;
75436         this_arg_conv.inner = untag_ptr(this_arg);
75437         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75438         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75439         this_arg_conv.is_owned = false;
75440         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
75441         *ret_copy = NetworkGraph_get_last_rapid_gossip_sync_timestamp(&this_arg_conv);
75442         int64_t ret_ref = tag_ptr(ret_copy, true);
75443         return ret_ref;
75444 }
75445
75446 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) {
75447         LDKNetworkGraph this_arg_conv;
75448         this_arg_conv.inner = untag_ptr(this_arg);
75449         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75450         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75451         this_arg_conv.is_owned = false;
75452         NetworkGraph_set_last_rapid_gossip_sync_timestamp(&this_arg_conv, last_rapid_gossip_sync_timestamp);
75453 }
75454
75455 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) {
75456         LDKNetworkGraph this_arg_conv;
75457         this_arg_conv.inner = untag_ptr(this_arg);
75458         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75459         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75460         this_arg_conv.is_owned = false;
75461         LDKNodeAnnouncement msg_conv;
75462         msg_conv.inner = untag_ptr(msg);
75463         msg_conv.is_owned = ptr_is_owned(msg);
75464         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
75465         msg_conv.is_owned = false;
75466         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
75467         *ret_conv = NetworkGraph_update_node_from_announcement(&this_arg_conv, &msg_conv);
75468         return tag_ptr(ret_conv, true);
75469 }
75470
75471 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) {
75472         LDKNetworkGraph this_arg_conv;
75473         this_arg_conv.inner = untag_ptr(this_arg);
75474         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75475         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75476         this_arg_conv.is_owned = false;
75477         LDKUnsignedNodeAnnouncement msg_conv;
75478         msg_conv.inner = untag_ptr(msg);
75479         msg_conv.is_owned = ptr_is_owned(msg);
75480         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
75481         msg_conv.is_owned = false;
75482         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
75483         *ret_conv = NetworkGraph_update_node_from_unsigned_announcement(&this_arg_conv, &msg_conv);
75484         return tag_ptr(ret_conv, true);
75485 }
75486
75487 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) {
75488         LDKNetworkGraph this_arg_conv;
75489         this_arg_conv.inner = untag_ptr(this_arg);
75490         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75491         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75492         this_arg_conv.is_owned = false;
75493         LDKChannelAnnouncement msg_conv;
75494         msg_conv.inner = untag_ptr(msg);
75495         msg_conv.is_owned = ptr_is_owned(msg);
75496         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
75497         msg_conv.is_owned = false;
75498         void* utxo_lookup_ptr = untag_ptr(utxo_lookup);
75499         CHECK_ACCESS(utxo_lookup_ptr);
75500         LDKCOption_UtxoLookupZ utxo_lookup_conv = *(LDKCOption_UtxoLookupZ*)(utxo_lookup_ptr);
75501         // WARNING: we may need a move here but no clone is available for LDKCOption_UtxoLookupZ
75502         if (utxo_lookup_conv.tag == LDKCOption_UtxoLookupZ_Some) {
75503                 // Manually implement clone for Java trait instances
75504                 if (utxo_lookup_conv.some.free == LDKUtxoLookup_JCalls_free) {
75505                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
75506                         LDKUtxoLookup_JCalls_cloned(&utxo_lookup_conv.some);
75507                 }
75508         }
75509         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
75510         *ret_conv = NetworkGraph_update_channel_from_announcement(&this_arg_conv, &msg_conv, utxo_lookup_conv);
75511         return tag_ptr(ret_conv, true);
75512 }
75513
75514 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) {
75515         LDKNetworkGraph this_arg_conv;
75516         this_arg_conv.inner = untag_ptr(this_arg);
75517         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75518         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75519         this_arg_conv.is_owned = false;
75520         LDKChannelAnnouncement msg_conv;
75521         msg_conv.inner = untag_ptr(msg);
75522         msg_conv.is_owned = ptr_is_owned(msg);
75523         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
75524         msg_conv.is_owned = false;
75525         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
75526         *ret_conv = NetworkGraph_update_channel_from_announcement_no_lookup(&this_arg_conv, &msg_conv);
75527         return tag_ptr(ret_conv, true);
75528 }
75529
75530 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) {
75531         LDKNetworkGraph this_arg_conv;
75532         this_arg_conv.inner = untag_ptr(this_arg);
75533         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75534         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75535         this_arg_conv.is_owned = false;
75536         LDKUnsignedChannelAnnouncement msg_conv;
75537         msg_conv.inner = untag_ptr(msg);
75538         msg_conv.is_owned = ptr_is_owned(msg);
75539         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
75540         msg_conv.is_owned = false;
75541         void* utxo_lookup_ptr = untag_ptr(utxo_lookup);
75542         CHECK_ACCESS(utxo_lookup_ptr);
75543         LDKCOption_UtxoLookupZ utxo_lookup_conv = *(LDKCOption_UtxoLookupZ*)(utxo_lookup_ptr);
75544         // WARNING: we may need a move here but no clone is available for LDKCOption_UtxoLookupZ
75545         if (utxo_lookup_conv.tag == LDKCOption_UtxoLookupZ_Some) {
75546                 // Manually implement clone for Java trait instances
75547                 if (utxo_lookup_conv.some.free == LDKUtxoLookup_JCalls_free) {
75548                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
75549                         LDKUtxoLookup_JCalls_cloned(&utxo_lookup_conv.some);
75550                 }
75551         }
75552         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
75553         *ret_conv = NetworkGraph_update_channel_from_unsigned_announcement(&this_arg_conv, &msg_conv, utxo_lookup_conv);
75554         return tag_ptr(ret_conv, true);
75555 }
75556
75557 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) {
75558         LDKNetworkGraph this_arg_conv;
75559         this_arg_conv.inner = untag_ptr(this_arg);
75560         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75561         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75562         this_arg_conv.is_owned = false;
75563         LDKChannelFeatures features_conv;
75564         features_conv.inner = untag_ptr(features);
75565         features_conv.is_owned = ptr_is_owned(features);
75566         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_conv);
75567         features_conv = ChannelFeatures_clone(&features_conv);
75568         LDKPublicKey node_id_1_ref;
75569         CHECK((*env)->GetArrayLength(env, node_id_1) == 33);
75570         (*env)->GetByteArrayRegion(env, node_id_1, 0, 33, node_id_1_ref.compressed_form);
75571         LDKPublicKey node_id_2_ref;
75572         CHECK((*env)->GetArrayLength(env, node_id_2) == 33);
75573         (*env)->GetByteArrayRegion(env, node_id_2, 0, 33, node_id_2_ref.compressed_form);
75574         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
75575         *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);
75576         return tag_ptr(ret_conv, true);
75577 }
75578
75579 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) {
75580         LDKNetworkGraph this_arg_conv;
75581         this_arg_conv.inner = untag_ptr(this_arg);
75582         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75583         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75584         this_arg_conv.is_owned = false;
75585         NetworkGraph_channel_failed_permanent(&this_arg_conv, short_channel_id);
75586 }
75587
75588 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1node_1failed_1permanent(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray node_id) {
75589         LDKNetworkGraph this_arg_conv;
75590         this_arg_conv.inner = untag_ptr(this_arg);
75591         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75592         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75593         this_arg_conv.is_owned = false;
75594         LDKPublicKey node_id_ref;
75595         CHECK((*env)->GetArrayLength(env, node_id) == 33);
75596         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
75597         NetworkGraph_node_failed_permanent(&this_arg_conv, node_id_ref);
75598 }
75599
75600 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1remove_1stale_1channels_1and_1tracking(JNIEnv *env, jclass clz, int64_t this_arg) {
75601         LDKNetworkGraph this_arg_conv;
75602         this_arg_conv.inner = untag_ptr(this_arg);
75603         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75604         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75605         this_arg_conv.is_owned = false;
75606         NetworkGraph_remove_stale_channels_and_tracking(&this_arg_conv);
75607 }
75608
75609 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) {
75610         LDKNetworkGraph this_arg_conv;
75611         this_arg_conv.inner = untag_ptr(this_arg);
75612         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75613         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75614         this_arg_conv.is_owned = false;
75615         NetworkGraph_remove_stale_channels_and_tracking_with_time(&this_arg_conv, current_time_unix);
75616 }
75617
75618 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1update_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
75619         LDKNetworkGraph this_arg_conv;
75620         this_arg_conv.inner = untag_ptr(this_arg);
75621         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75622         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75623         this_arg_conv.is_owned = false;
75624         LDKChannelUpdate msg_conv;
75625         msg_conv.inner = untag_ptr(msg);
75626         msg_conv.is_owned = ptr_is_owned(msg);
75627         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
75628         msg_conv.is_owned = false;
75629         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
75630         *ret_conv = NetworkGraph_update_channel(&this_arg_conv, &msg_conv);
75631         return tag_ptr(ret_conv, true);
75632 }
75633
75634 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1update_1channel_1unsigned(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
75635         LDKNetworkGraph this_arg_conv;
75636         this_arg_conv.inner = untag_ptr(this_arg);
75637         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75638         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75639         this_arg_conv.is_owned = false;
75640         LDKUnsignedChannelUpdate msg_conv;
75641         msg_conv.inner = untag_ptr(msg);
75642         msg_conv.is_owned = ptr_is_owned(msg);
75643         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
75644         msg_conv.is_owned = false;
75645         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
75646         *ret_conv = NetworkGraph_update_channel_unsigned(&this_arg_conv, &msg_conv);
75647         return tag_ptr(ret_conv, true);
75648 }
75649
75650 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1verify_1channel_1update(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
75651         LDKNetworkGraph this_arg_conv;
75652         this_arg_conv.inner = untag_ptr(this_arg);
75653         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75654         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75655         this_arg_conv.is_owned = false;
75656         LDKChannelUpdate msg_conv;
75657         msg_conv.inner = untag_ptr(msg);
75658         msg_conv.is_owned = ptr_is_owned(msg);
75659         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
75660         msg_conv.is_owned = false;
75661         LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
75662         *ret_conv = NetworkGraph_verify_channel_update(&this_arg_conv, &msg_conv);
75663         return tag_ptr(ret_conv, true);
75664 }
75665
75666 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReadOnlyNetworkGraph_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int64_t short_channel_id) {
75667         LDKReadOnlyNetworkGraph this_arg_conv;
75668         this_arg_conv.inner = untag_ptr(this_arg);
75669         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75670         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75671         this_arg_conv.is_owned = false;
75672         LDKChannelInfo ret_var = ReadOnlyNetworkGraph_channel(&this_arg_conv, short_channel_id);
75673         int64_t ret_ref = 0;
75674         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
75675         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
75676         return ret_ref;
75677 }
75678
75679 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ReadOnlyNetworkGraph_1list_1channels(JNIEnv *env, jclass clz, int64_t this_arg) {
75680         LDKReadOnlyNetworkGraph this_arg_conv;
75681         this_arg_conv.inner = untag_ptr(this_arg);
75682         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75683         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75684         this_arg_conv.is_owned = false;
75685         LDKCVec_u64Z ret_var = ReadOnlyNetworkGraph_list_channels(&this_arg_conv);
75686         int64_tArray ret_arr = NULL;
75687         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
75688         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
75689         for (size_t g = 0; g < ret_var.datalen; g++) {
75690                 int64_t ret_conv_6_conv = ret_var.data[g];
75691                 ret_arr_ptr[g] = ret_conv_6_conv;
75692         }
75693         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
75694         FREE(ret_var.data);
75695         return ret_arr;
75696 }
75697
75698 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReadOnlyNetworkGraph_1node(JNIEnv *env, jclass clz, int64_t this_arg, int64_t node_id) {
75699         LDKReadOnlyNetworkGraph this_arg_conv;
75700         this_arg_conv.inner = untag_ptr(this_arg);
75701         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75702         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75703         this_arg_conv.is_owned = false;
75704         LDKNodeId node_id_conv;
75705         node_id_conv.inner = untag_ptr(node_id);
75706         node_id_conv.is_owned = ptr_is_owned(node_id);
75707         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_conv);
75708         node_id_conv.is_owned = false;
75709         LDKNodeInfo ret_var = ReadOnlyNetworkGraph_node(&this_arg_conv, &node_id_conv);
75710         int64_t ret_ref = 0;
75711         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
75712         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
75713         return ret_ref;
75714 }
75715
75716 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ReadOnlyNetworkGraph_1list_1nodes(JNIEnv *env, jclass clz, int64_t this_arg) {
75717         LDKReadOnlyNetworkGraph this_arg_conv;
75718         this_arg_conv.inner = untag_ptr(this_arg);
75719         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75720         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75721         this_arg_conv.is_owned = false;
75722         LDKCVec_NodeIdZ ret_var = ReadOnlyNetworkGraph_list_nodes(&this_arg_conv);
75723         int64_tArray ret_arr = NULL;
75724         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
75725         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
75726         for (size_t i = 0; i < ret_var.datalen; i++) {
75727                 LDKNodeId ret_conv_8_var = ret_var.data[i];
75728                 int64_t ret_conv_8_ref = 0;
75729                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_8_var);
75730                 ret_conv_8_ref = tag_ptr(ret_conv_8_var.inner, ret_conv_8_var.is_owned);
75731                 ret_arr_ptr[i] = ret_conv_8_ref;
75732         }
75733         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
75734         FREE(ret_var.data);
75735         return ret_arr;
75736 }
75737
75738 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReadOnlyNetworkGraph_1get_1addresses(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray pubkey) {
75739         LDKReadOnlyNetworkGraph this_arg_conv;
75740         this_arg_conv.inner = untag_ptr(this_arg);
75741         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75742         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75743         this_arg_conv.is_owned = false;
75744         LDKPublicKey pubkey_ref;
75745         CHECK((*env)->GetArrayLength(env, pubkey) == 33);
75746         (*env)->GetByteArrayRegion(env, pubkey, 0, 33, pubkey_ref.compressed_form);
75747         LDKCOption_CVec_SocketAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_SocketAddressZZ), "LDKCOption_CVec_SocketAddressZZ");
75748         *ret_copy = ReadOnlyNetworkGraph_get_addresses(&this_arg_conv, pubkey_ref);
75749         int64_t ret_ref = tag_ptr(ret_copy, true);
75750         return ret_ref;
75751 }
75752
75753 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DefaultRouter_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
75754         LDKDefaultRouter this_obj_conv;
75755         this_obj_conv.inner = untag_ptr(this_obj);
75756         this_obj_conv.is_owned = ptr_is_owned(this_obj);
75757         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
75758         DefaultRouter_free(this_obj_conv);
75759 }
75760
75761 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) {
75762         LDKNetworkGraph network_graph_conv;
75763         network_graph_conv.inner = untag_ptr(network_graph);
75764         network_graph_conv.is_owned = ptr_is_owned(network_graph);
75765         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
75766         network_graph_conv.is_owned = false;
75767         void* logger_ptr = untag_ptr(logger);
75768         CHECK_ACCESS(logger_ptr);
75769         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
75770         if (logger_conv.free == LDKLogger_JCalls_free) {
75771                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
75772                 LDKLogger_JCalls_cloned(&logger_conv);
75773         }
75774         void* entropy_source_ptr = untag_ptr(entropy_source);
75775         CHECK_ACCESS(entropy_source_ptr);
75776         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
75777         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
75778                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
75779                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
75780         }
75781         void* scorer_ptr = untag_ptr(scorer);
75782         CHECK_ACCESS(scorer_ptr);
75783         LDKLockableScore scorer_conv = *(LDKLockableScore*)(scorer_ptr);
75784         if (scorer_conv.free == LDKLockableScore_JCalls_free) {
75785                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
75786                 LDKLockableScore_JCalls_cloned(&scorer_conv);
75787         }
75788         LDKProbabilisticScoringFeeParameters score_params_conv;
75789         score_params_conv.inner = untag_ptr(score_params);
75790         score_params_conv.is_owned = ptr_is_owned(score_params);
75791         CHECK_INNER_FIELD_ACCESS_OR_NULL(score_params_conv);
75792         score_params_conv = ProbabilisticScoringFeeParameters_clone(&score_params_conv);
75793         LDKDefaultRouter ret_var = DefaultRouter_new(&network_graph_conv, logger_conv, entropy_source_conv, scorer_conv, score_params_conv);
75794         int64_t ret_ref = 0;
75795         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
75796         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
75797         return ret_ref;
75798 }
75799
75800 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DefaultRouter_1as_1Router(JNIEnv *env, jclass clz, int64_t this_arg) {
75801         LDKDefaultRouter this_arg_conv;
75802         this_arg_conv.inner = untag_ptr(this_arg);
75803         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75804         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75805         this_arg_conv.is_owned = false;
75806         LDKRouter* ret_ret = MALLOC(sizeof(LDKRouter), "LDKRouter");
75807         *ret_ret = DefaultRouter_as_Router(&this_arg_conv);
75808         return tag_ptr(ret_ret, true);
75809 }
75810
75811 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DefaultRouter_1as_1MessageRouter(JNIEnv *env, jclass clz, int64_t this_arg) {
75812         LDKDefaultRouter this_arg_conv;
75813         this_arg_conv.inner = untag_ptr(this_arg);
75814         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75815         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75816         this_arg_conv.is_owned = false;
75817         LDKMessageRouter* ret_ret = MALLOC(sizeof(LDKMessageRouter), "LDKMessageRouter");
75818         *ret_ret = DefaultRouter_as_MessageRouter(&this_arg_conv);
75819         return tag_ptr(ret_ret, true);
75820 }
75821
75822 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Router_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
75823         if (!ptr_is_owned(this_ptr)) return;
75824         void* this_ptr_ptr = untag_ptr(this_ptr);
75825         CHECK_ACCESS(this_ptr_ptr);
75826         LDKRouter this_ptr_conv = *(LDKRouter*)(this_ptr_ptr);
75827         FREE(untag_ptr(this_ptr));
75828         Router_free(this_ptr_conv);
75829 }
75830
75831 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ScorerAccountingForInFlightHtlcs_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
75832         LDKScorerAccountingForInFlightHtlcs this_obj_conv;
75833         this_obj_conv.inner = untag_ptr(this_obj);
75834         this_obj_conv.is_owned = ptr_is_owned(this_obj);
75835         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
75836         ScorerAccountingForInFlightHtlcs_free(this_obj_conv);
75837 }
75838
75839 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ScorerAccountingForInFlightHtlcs_1new(JNIEnv *env, jclass clz, int64_t scorer, int64_t inflight_htlcs) {
75840         void* scorer_ptr = untag_ptr(scorer);
75841         CHECK_ACCESS(scorer_ptr);
75842         LDKScoreLookUp scorer_conv = *(LDKScoreLookUp*)(scorer_ptr);
75843         if (scorer_conv.free == LDKScoreLookUp_JCalls_free) {
75844                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
75845                 LDKScoreLookUp_JCalls_cloned(&scorer_conv);
75846         }
75847         LDKInFlightHtlcs inflight_htlcs_conv;
75848         inflight_htlcs_conv.inner = untag_ptr(inflight_htlcs);
75849         inflight_htlcs_conv.is_owned = ptr_is_owned(inflight_htlcs);
75850         CHECK_INNER_FIELD_ACCESS_OR_NULL(inflight_htlcs_conv);
75851         inflight_htlcs_conv.is_owned = false;
75852         LDKScorerAccountingForInFlightHtlcs ret_var = ScorerAccountingForInFlightHtlcs_new(scorer_conv, &inflight_htlcs_conv);
75853         int64_t ret_ref = 0;
75854         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
75855         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
75856         return ret_ref;
75857 }
75858
75859 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ScorerAccountingForInFlightHtlcs_1as_1ScoreLookUp(JNIEnv *env, jclass clz, int64_t this_arg) {
75860         LDKScorerAccountingForInFlightHtlcs this_arg_conv;
75861         this_arg_conv.inner = untag_ptr(this_arg);
75862         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75863         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75864         this_arg_conv.is_owned = false;
75865         LDKScoreLookUp* ret_ret = MALLOC(sizeof(LDKScoreLookUp), "LDKScoreLookUp");
75866         *ret_ret = ScorerAccountingForInFlightHtlcs_as_ScoreLookUp(&this_arg_conv);
75867         return tag_ptr(ret_ret, true);
75868 }
75869
75870 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InFlightHtlcs_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
75871         LDKInFlightHtlcs this_obj_conv;
75872         this_obj_conv.inner = untag_ptr(this_obj);
75873         this_obj_conv.is_owned = ptr_is_owned(this_obj);
75874         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
75875         InFlightHtlcs_free(this_obj_conv);
75876 }
75877
75878 static inline uint64_t InFlightHtlcs_clone_ptr(LDKInFlightHtlcs *NONNULL_PTR arg) {
75879         LDKInFlightHtlcs ret_var = InFlightHtlcs_clone(arg);
75880         int64_t ret_ref = 0;
75881         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
75882         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
75883         return ret_ref;
75884 }
75885 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InFlightHtlcs_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
75886         LDKInFlightHtlcs arg_conv;
75887         arg_conv.inner = untag_ptr(arg);
75888         arg_conv.is_owned = ptr_is_owned(arg);
75889         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
75890         arg_conv.is_owned = false;
75891         int64_t ret_conv = InFlightHtlcs_clone_ptr(&arg_conv);
75892         return ret_conv;
75893 }
75894
75895 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InFlightHtlcs_1clone(JNIEnv *env, jclass clz, int64_t orig) {
75896         LDKInFlightHtlcs orig_conv;
75897         orig_conv.inner = untag_ptr(orig);
75898         orig_conv.is_owned = ptr_is_owned(orig);
75899         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
75900         orig_conv.is_owned = false;
75901         LDKInFlightHtlcs ret_var = InFlightHtlcs_clone(&orig_conv);
75902         int64_t ret_ref = 0;
75903         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
75904         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
75905         return ret_ref;
75906 }
75907
75908 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InFlightHtlcs_1new(JNIEnv *env, jclass clz) {
75909         LDKInFlightHtlcs ret_var = InFlightHtlcs_new();
75910         int64_t ret_ref = 0;
75911         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
75912         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
75913         return ret_ref;
75914 }
75915
75916 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) {
75917         LDKInFlightHtlcs this_arg_conv;
75918         this_arg_conv.inner = untag_ptr(this_arg);
75919         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75920         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75921         this_arg_conv.is_owned = false;
75922         LDKPath path_conv;
75923         path_conv.inner = untag_ptr(path);
75924         path_conv.is_owned = ptr_is_owned(path);
75925         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
75926         path_conv.is_owned = false;
75927         LDKPublicKey payer_node_id_ref;
75928         CHECK((*env)->GetArrayLength(env, payer_node_id) == 33);
75929         (*env)->GetByteArrayRegion(env, payer_node_id, 0, 33, payer_node_id_ref.compressed_form);
75930         InFlightHtlcs_process_path(&this_arg_conv, &path_conv, payer_node_id_ref);
75931 }
75932
75933 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) {
75934         LDKInFlightHtlcs this_arg_conv;
75935         this_arg_conv.inner = untag_ptr(this_arg);
75936         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75937         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75938         this_arg_conv.is_owned = false;
75939         LDKNodeId source_conv;
75940         source_conv.inner = untag_ptr(source);
75941         source_conv.is_owned = ptr_is_owned(source);
75942         CHECK_INNER_FIELD_ACCESS_OR_NULL(source_conv);
75943         source_conv.is_owned = false;
75944         LDKNodeId target_conv;
75945         target_conv.inner = untag_ptr(target);
75946         target_conv.is_owned = ptr_is_owned(target);
75947         CHECK_INNER_FIELD_ACCESS_OR_NULL(target_conv);
75948         target_conv.is_owned = false;
75949         InFlightHtlcs_add_inflight_htlc(&this_arg_conv, &source_conv, &target_conv, channel_scid, used_msat);
75950 }
75951
75952 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) {
75953         LDKInFlightHtlcs this_arg_conv;
75954         this_arg_conv.inner = untag_ptr(this_arg);
75955         this_arg_conv.is_owned = ptr_is_owned(this_arg);
75956         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
75957         this_arg_conv.is_owned = false;
75958         LDKNodeId source_conv;
75959         source_conv.inner = untag_ptr(source);
75960         source_conv.is_owned = ptr_is_owned(source);
75961         CHECK_INNER_FIELD_ACCESS_OR_NULL(source_conv);
75962         source_conv.is_owned = false;
75963         LDKNodeId target_conv;
75964         target_conv.inner = untag_ptr(target);
75965         target_conv.is_owned = ptr_is_owned(target);
75966         CHECK_INNER_FIELD_ACCESS_OR_NULL(target_conv);
75967         target_conv.is_owned = false;
75968         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
75969         *ret_copy = InFlightHtlcs_used_liquidity_msat(&this_arg_conv, &source_conv, &target_conv, channel_scid);
75970         int64_t ret_ref = tag_ptr(ret_copy, true);
75971         return ret_ref;
75972 }
75973
75974 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InFlightHtlcs_1write(JNIEnv *env, jclass clz, int64_t obj) {
75975         LDKInFlightHtlcs obj_conv;
75976         obj_conv.inner = untag_ptr(obj);
75977         obj_conv.is_owned = ptr_is_owned(obj);
75978         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
75979         obj_conv.is_owned = false;
75980         LDKCVec_u8Z ret_var = InFlightHtlcs_write(&obj_conv);
75981         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
75982         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
75983         CVec_u8Z_free(ret_var);
75984         return ret_arr;
75985 }
75986
75987 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InFlightHtlcs_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
75988         LDKu8slice ser_ref;
75989         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
75990         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
75991         LDKCResult_InFlightHtlcsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InFlightHtlcsDecodeErrorZ), "LDKCResult_InFlightHtlcsDecodeErrorZ");
75992         *ret_conv = InFlightHtlcs_read(ser_ref);
75993         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
75994         return tag_ptr(ret_conv, true);
75995 }
75996
75997 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
75998         LDKRouteHop this_obj_conv;
75999         this_obj_conv.inner = untag_ptr(this_obj);
76000         this_obj_conv.is_owned = ptr_is_owned(this_obj);
76001         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
76002         RouteHop_free(this_obj_conv);
76003 }
76004
76005 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
76006         LDKRouteHop this_ptr_conv;
76007         this_ptr_conv.inner = untag_ptr(this_ptr);
76008         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
76009         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
76010         this_ptr_conv.is_owned = false;
76011         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
76012         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, RouteHop_get_pubkey(&this_ptr_conv).compressed_form);
76013         return ret_arr;
76014 }
76015
76016 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
76017         LDKRouteHop this_ptr_conv;
76018         this_ptr_conv.inner = untag_ptr(this_ptr);
76019         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
76020         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
76021         this_ptr_conv.is_owned = false;
76022         LDKPublicKey val_ref;
76023         CHECK((*env)->GetArrayLength(env, val) == 33);
76024         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
76025         RouteHop_set_pubkey(&this_ptr_conv, val_ref);
76026 }
76027
76028 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1node_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
76029         LDKRouteHop this_ptr_conv;
76030         this_ptr_conv.inner = untag_ptr(this_ptr);
76031         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
76032         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
76033         this_ptr_conv.is_owned = false;
76034         LDKNodeFeatures ret_var = RouteHop_get_node_features(&this_ptr_conv);
76035         int64_t ret_ref = 0;
76036         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
76037         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
76038         return ret_ref;
76039 }
76040
76041 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1node_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
76042         LDKRouteHop this_ptr_conv;
76043         this_ptr_conv.inner = untag_ptr(this_ptr);
76044         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
76045         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
76046         this_ptr_conv.is_owned = false;
76047         LDKNodeFeatures val_conv;
76048         val_conv.inner = untag_ptr(val);
76049         val_conv.is_owned = ptr_is_owned(val);
76050         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
76051         val_conv = NodeFeatures_clone(&val_conv);
76052         RouteHop_set_node_features(&this_ptr_conv, val_conv);
76053 }
76054
76055 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
76056         LDKRouteHop this_ptr_conv;
76057         this_ptr_conv.inner = untag_ptr(this_ptr);
76058         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
76059         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
76060         this_ptr_conv.is_owned = false;
76061         int64_t ret_conv = RouteHop_get_short_channel_id(&this_ptr_conv);
76062         return ret_conv;
76063 }
76064
76065 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
76066         LDKRouteHop this_ptr_conv;
76067         this_ptr_conv.inner = untag_ptr(this_ptr);
76068         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
76069         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
76070         this_ptr_conv.is_owned = false;
76071         RouteHop_set_short_channel_id(&this_ptr_conv, val);
76072 }
76073
76074 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1channel_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
76075         LDKRouteHop this_ptr_conv;
76076         this_ptr_conv.inner = untag_ptr(this_ptr);
76077         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
76078         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
76079         this_ptr_conv.is_owned = false;
76080         LDKChannelFeatures ret_var = RouteHop_get_channel_features(&this_ptr_conv);
76081         int64_t ret_ref = 0;
76082         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
76083         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
76084         return ret_ref;
76085 }
76086
76087 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1channel_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
76088         LDKRouteHop this_ptr_conv;
76089         this_ptr_conv.inner = untag_ptr(this_ptr);
76090         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
76091         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
76092         this_ptr_conv.is_owned = false;
76093         LDKChannelFeatures val_conv;
76094         val_conv.inner = untag_ptr(val);
76095         val_conv.is_owned = ptr_is_owned(val);
76096         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
76097         val_conv = ChannelFeatures_clone(&val_conv);
76098         RouteHop_set_channel_features(&this_ptr_conv, val_conv);
76099 }
76100
76101 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1fee_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
76102         LDKRouteHop this_ptr_conv;
76103         this_ptr_conv.inner = untag_ptr(this_ptr);
76104         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
76105         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
76106         this_ptr_conv.is_owned = false;
76107         int64_t ret_conv = RouteHop_get_fee_msat(&this_ptr_conv);
76108         return ret_conv;
76109 }
76110
76111 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1fee_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
76112         LDKRouteHop this_ptr_conv;
76113         this_ptr_conv.inner = untag_ptr(this_ptr);
76114         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
76115         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
76116         this_ptr_conv.is_owned = false;
76117         RouteHop_set_fee_msat(&this_ptr_conv, val);
76118 }
76119
76120 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
76121         LDKRouteHop this_ptr_conv;
76122         this_ptr_conv.inner = untag_ptr(this_ptr);
76123         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
76124         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
76125         this_ptr_conv.is_owned = false;
76126         int32_t ret_conv = RouteHop_get_cltv_expiry_delta(&this_ptr_conv);
76127         return ret_conv;
76128 }
76129
76130 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
76131         LDKRouteHop this_ptr_conv;
76132         this_ptr_conv.inner = untag_ptr(this_ptr);
76133         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
76134         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
76135         this_ptr_conv.is_owned = false;
76136         RouteHop_set_cltv_expiry_delta(&this_ptr_conv, val);
76137 }
76138
76139 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1maybe_1announced_1channel(JNIEnv *env, jclass clz, int64_t this_ptr) {
76140         LDKRouteHop this_ptr_conv;
76141         this_ptr_conv.inner = untag_ptr(this_ptr);
76142         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
76143         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
76144         this_ptr_conv.is_owned = false;
76145         jboolean ret_conv = RouteHop_get_maybe_announced_channel(&this_ptr_conv);
76146         return ret_conv;
76147 }
76148
76149 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1maybe_1announced_1channel(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
76150         LDKRouteHop this_ptr_conv;
76151         this_ptr_conv.inner = untag_ptr(this_ptr);
76152         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
76153         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
76154         this_ptr_conv.is_owned = false;
76155         RouteHop_set_maybe_announced_channel(&this_ptr_conv, val);
76156 }
76157
76158 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) {
76159         LDKPublicKey pubkey_arg_ref;
76160         CHECK((*env)->GetArrayLength(env, pubkey_arg) == 33);
76161         (*env)->GetByteArrayRegion(env, pubkey_arg, 0, 33, pubkey_arg_ref.compressed_form);
76162         LDKNodeFeatures node_features_arg_conv;
76163         node_features_arg_conv.inner = untag_ptr(node_features_arg);
76164         node_features_arg_conv.is_owned = ptr_is_owned(node_features_arg);
76165         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_features_arg_conv);
76166         node_features_arg_conv = NodeFeatures_clone(&node_features_arg_conv);
76167         LDKChannelFeatures channel_features_arg_conv;
76168         channel_features_arg_conv.inner = untag_ptr(channel_features_arg);
76169         channel_features_arg_conv.is_owned = ptr_is_owned(channel_features_arg);
76170         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_features_arg_conv);
76171         channel_features_arg_conv = ChannelFeatures_clone(&channel_features_arg_conv);
76172         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);
76173         int64_t ret_ref = 0;
76174         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
76175         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
76176         return ret_ref;
76177 }
76178
76179 static inline uint64_t RouteHop_clone_ptr(LDKRouteHop *NONNULL_PTR arg) {
76180         LDKRouteHop ret_var = RouteHop_clone(arg);
76181         int64_t ret_ref = 0;
76182         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
76183         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
76184         return ret_ref;
76185 }
76186 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
76187         LDKRouteHop arg_conv;
76188         arg_conv.inner = untag_ptr(arg);
76189         arg_conv.is_owned = ptr_is_owned(arg);
76190         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
76191         arg_conv.is_owned = false;
76192         int64_t ret_conv = RouteHop_clone_ptr(&arg_conv);
76193         return ret_conv;
76194 }
76195
76196 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1clone(JNIEnv *env, jclass clz, int64_t orig) {
76197         LDKRouteHop orig_conv;
76198         orig_conv.inner = untag_ptr(orig);
76199         orig_conv.is_owned = ptr_is_owned(orig);
76200         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
76201         orig_conv.is_owned = false;
76202         LDKRouteHop ret_var = RouteHop_clone(&orig_conv);
76203         int64_t ret_ref = 0;
76204         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
76205         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
76206         return ret_ref;
76207 }
76208
76209 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1hash(JNIEnv *env, jclass clz, int64_t o) {
76210         LDKRouteHop o_conv;
76211         o_conv.inner = untag_ptr(o);
76212         o_conv.is_owned = ptr_is_owned(o);
76213         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
76214         o_conv.is_owned = false;
76215         int64_t ret_conv = RouteHop_hash(&o_conv);
76216         return ret_conv;
76217 }
76218
76219 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RouteHop_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
76220         LDKRouteHop a_conv;
76221         a_conv.inner = untag_ptr(a);
76222         a_conv.is_owned = ptr_is_owned(a);
76223         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
76224         a_conv.is_owned = false;
76225         LDKRouteHop b_conv;
76226         b_conv.inner = untag_ptr(b);
76227         b_conv.is_owned = ptr_is_owned(b);
76228         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
76229         b_conv.is_owned = false;
76230         jboolean ret_conv = RouteHop_eq(&a_conv, &b_conv);
76231         return ret_conv;
76232 }
76233
76234 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RouteHop_1write(JNIEnv *env, jclass clz, int64_t obj) {
76235         LDKRouteHop obj_conv;
76236         obj_conv.inner = untag_ptr(obj);
76237         obj_conv.is_owned = ptr_is_owned(obj);
76238         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
76239         obj_conv.is_owned = false;
76240         LDKCVec_u8Z ret_var = RouteHop_write(&obj_conv);
76241         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
76242         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
76243         CVec_u8Z_free(ret_var);
76244         return ret_arr;
76245 }
76246
76247 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
76248         LDKu8slice ser_ref;
76249         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
76250         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
76251         LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
76252         *ret_conv = RouteHop_read(ser_ref);
76253         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
76254         return tag_ptr(ret_conv, true);
76255 }
76256
76257 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BlindedTail_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
76258         LDKBlindedTail this_obj_conv;
76259         this_obj_conv.inner = untag_ptr(this_obj);
76260         this_obj_conv.is_owned = ptr_is_owned(this_obj);
76261         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
76262         BlindedTail_free(this_obj_conv);
76263 }
76264
76265 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_BlindedTail_1get_1hops(JNIEnv *env, jclass clz, int64_t this_ptr) {
76266         LDKBlindedTail this_ptr_conv;
76267         this_ptr_conv.inner = untag_ptr(this_ptr);
76268         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
76269         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
76270         this_ptr_conv.is_owned = false;
76271         LDKCVec_BlindedHopZ ret_var = BlindedTail_get_hops(&this_ptr_conv);
76272         int64_tArray ret_arr = NULL;
76273         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
76274         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
76275         for (size_t m = 0; m < ret_var.datalen; m++) {
76276                 LDKBlindedHop ret_conv_12_var = ret_var.data[m];
76277                 int64_t ret_conv_12_ref = 0;
76278                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_12_var);
76279                 ret_conv_12_ref = tag_ptr(ret_conv_12_var.inner, ret_conv_12_var.is_owned);
76280                 ret_arr_ptr[m] = ret_conv_12_ref;
76281         }
76282         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
76283         FREE(ret_var.data);
76284         return ret_arr;
76285 }
76286
76287 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BlindedTail_1set_1hops(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
76288         LDKBlindedTail this_ptr_conv;
76289         this_ptr_conv.inner = untag_ptr(this_ptr);
76290         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
76291         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
76292         this_ptr_conv.is_owned = false;
76293         LDKCVec_BlindedHopZ val_constr;
76294         val_constr.datalen = (*env)->GetArrayLength(env, val);
76295         if (val_constr.datalen > 0)
76296                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKBlindedHop), "LDKCVec_BlindedHopZ Elements");
76297         else
76298                 val_constr.data = NULL;
76299         int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
76300         for (size_t m = 0; m < val_constr.datalen; m++) {
76301                 int64_t val_conv_12 = val_vals[m];
76302                 LDKBlindedHop val_conv_12_conv;
76303                 val_conv_12_conv.inner = untag_ptr(val_conv_12);
76304                 val_conv_12_conv.is_owned = ptr_is_owned(val_conv_12);
76305                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_12_conv);
76306                 val_conv_12_conv = BlindedHop_clone(&val_conv_12_conv);
76307                 val_constr.data[m] = val_conv_12_conv;
76308         }
76309         (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
76310         BlindedTail_set_hops(&this_ptr_conv, val_constr);
76311 }
76312
76313 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BlindedTail_1get_1blinding_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
76314         LDKBlindedTail this_ptr_conv;
76315         this_ptr_conv.inner = untag_ptr(this_ptr);
76316         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
76317         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
76318         this_ptr_conv.is_owned = false;
76319         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
76320         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, BlindedTail_get_blinding_point(&this_ptr_conv).compressed_form);
76321         return ret_arr;
76322 }
76323
76324 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BlindedTail_1set_1blinding_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
76325         LDKBlindedTail this_ptr_conv;
76326         this_ptr_conv.inner = untag_ptr(this_ptr);
76327         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
76328         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
76329         this_ptr_conv.is_owned = false;
76330         LDKPublicKey val_ref;
76331         CHECK((*env)->GetArrayLength(env, val) == 33);
76332         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
76333         BlindedTail_set_blinding_point(&this_ptr_conv, val_ref);
76334 }
76335
76336 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_BlindedTail_1get_1excess_1final_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
76337         LDKBlindedTail this_ptr_conv;
76338         this_ptr_conv.inner = untag_ptr(this_ptr);
76339         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
76340         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
76341         this_ptr_conv.is_owned = false;
76342         int32_t ret_conv = BlindedTail_get_excess_final_cltv_expiry_delta(&this_ptr_conv);
76343         return ret_conv;
76344 }
76345
76346 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) {
76347         LDKBlindedTail this_ptr_conv;
76348         this_ptr_conv.inner = untag_ptr(this_ptr);
76349         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
76350         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
76351         this_ptr_conv.is_owned = false;
76352         BlindedTail_set_excess_final_cltv_expiry_delta(&this_ptr_conv, val);
76353 }
76354
76355 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedTail_1get_1final_1value_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
76356         LDKBlindedTail this_ptr_conv;
76357         this_ptr_conv.inner = untag_ptr(this_ptr);
76358         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
76359         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
76360         this_ptr_conv.is_owned = false;
76361         int64_t ret_conv = BlindedTail_get_final_value_msat(&this_ptr_conv);
76362         return ret_conv;
76363 }
76364
76365 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BlindedTail_1set_1final_1value_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
76366         LDKBlindedTail this_ptr_conv;
76367         this_ptr_conv.inner = untag_ptr(this_ptr);
76368         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
76369         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
76370         this_ptr_conv.is_owned = false;
76371         BlindedTail_set_final_value_msat(&this_ptr_conv, val);
76372 }
76373
76374 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) {
76375         LDKCVec_BlindedHopZ hops_arg_constr;
76376         hops_arg_constr.datalen = (*env)->GetArrayLength(env, hops_arg);
76377         if (hops_arg_constr.datalen > 0)
76378                 hops_arg_constr.data = MALLOC(hops_arg_constr.datalen * sizeof(LDKBlindedHop), "LDKCVec_BlindedHopZ Elements");
76379         else
76380                 hops_arg_constr.data = NULL;
76381         int64_t* hops_arg_vals = (*env)->GetLongArrayElements (env, hops_arg, NULL);
76382         for (size_t m = 0; m < hops_arg_constr.datalen; m++) {
76383                 int64_t hops_arg_conv_12 = hops_arg_vals[m];
76384                 LDKBlindedHop hops_arg_conv_12_conv;
76385                 hops_arg_conv_12_conv.inner = untag_ptr(hops_arg_conv_12);
76386                 hops_arg_conv_12_conv.is_owned = ptr_is_owned(hops_arg_conv_12);
76387                 CHECK_INNER_FIELD_ACCESS_OR_NULL(hops_arg_conv_12_conv);
76388                 hops_arg_conv_12_conv = BlindedHop_clone(&hops_arg_conv_12_conv);
76389                 hops_arg_constr.data[m] = hops_arg_conv_12_conv;
76390         }
76391         (*env)->ReleaseLongArrayElements(env, hops_arg, hops_arg_vals, 0);
76392         LDKPublicKey blinding_point_arg_ref;
76393         CHECK((*env)->GetArrayLength(env, blinding_point_arg) == 33);
76394         (*env)->GetByteArrayRegion(env, blinding_point_arg, 0, 33, blinding_point_arg_ref.compressed_form);
76395         LDKBlindedTail ret_var = BlindedTail_new(hops_arg_constr, blinding_point_arg_ref, excess_final_cltv_expiry_delta_arg, final_value_msat_arg);
76396         int64_t ret_ref = 0;
76397         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
76398         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
76399         return ret_ref;
76400 }
76401
76402 static inline uint64_t BlindedTail_clone_ptr(LDKBlindedTail *NONNULL_PTR arg) {
76403         LDKBlindedTail ret_var = BlindedTail_clone(arg);
76404         int64_t ret_ref = 0;
76405         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
76406         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
76407         return ret_ref;
76408 }
76409 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedTail_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
76410         LDKBlindedTail arg_conv;
76411         arg_conv.inner = untag_ptr(arg);
76412         arg_conv.is_owned = ptr_is_owned(arg);
76413         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
76414         arg_conv.is_owned = false;
76415         int64_t ret_conv = BlindedTail_clone_ptr(&arg_conv);
76416         return ret_conv;
76417 }
76418
76419 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedTail_1clone(JNIEnv *env, jclass clz, int64_t orig) {
76420         LDKBlindedTail orig_conv;
76421         orig_conv.inner = untag_ptr(orig);
76422         orig_conv.is_owned = ptr_is_owned(orig);
76423         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
76424         orig_conv.is_owned = false;
76425         LDKBlindedTail ret_var = BlindedTail_clone(&orig_conv);
76426         int64_t ret_ref = 0;
76427         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
76428         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
76429         return ret_ref;
76430 }
76431
76432 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedTail_1hash(JNIEnv *env, jclass clz, int64_t o) {
76433         LDKBlindedTail o_conv;
76434         o_conv.inner = untag_ptr(o);
76435         o_conv.is_owned = ptr_is_owned(o);
76436         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
76437         o_conv.is_owned = false;
76438         int64_t ret_conv = BlindedTail_hash(&o_conv);
76439         return ret_conv;
76440 }
76441
76442 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_BlindedTail_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
76443         LDKBlindedTail a_conv;
76444         a_conv.inner = untag_ptr(a);
76445         a_conv.is_owned = ptr_is_owned(a);
76446         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
76447         a_conv.is_owned = false;
76448         LDKBlindedTail b_conv;
76449         b_conv.inner = untag_ptr(b);
76450         b_conv.is_owned = ptr_is_owned(b);
76451         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
76452         b_conv.is_owned = false;
76453         jboolean ret_conv = BlindedTail_eq(&a_conv, &b_conv);
76454         return ret_conv;
76455 }
76456
76457 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BlindedTail_1write(JNIEnv *env, jclass clz, int64_t obj) {
76458         LDKBlindedTail obj_conv;
76459         obj_conv.inner = untag_ptr(obj);
76460         obj_conv.is_owned = ptr_is_owned(obj);
76461         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
76462         obj_conv.is_owned = false;
76463         LDKCVec_u8Z ret_var = BlindedTail_write(&obj_conv);
76464         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
76465         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
76466         CVec_u8Z_free(ret_var);
76467         return ret_arr;
76468 }
76469
76470 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedTail_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
76471         LDKu8slice ser_ref;
76472         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
76473         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
76474         LDKCResult_BlindedTailDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedTailDecodeErrorZ), "LDKCResult_BlindedTailDecodeErrorZ");
76475         *ret_conv = BlindedTail_read(ser_ref);
76476         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
76477         return tag_ptr(ret_conv, true);
76478 }
76479
76480 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Path_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
76481         LDKPath this_obj_conv;
76482         this_obj_conv.inner = untag_ptr(this_obj);
76483         this_obj_conv.is_owned = ptr_is_owned(this_obj);
76484         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
76485         Path_free(this_obj_conv);
76486 }
76487
76488 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_Path_1get_1hops(JNIEnv *env, jclass clz, int64_t this_ptr) {
76489         LDKPath this_ptr_conv;
76490         this_ptr_conv.inner = untag_ptr(this_ptr);
76491         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
76492         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
76493         this_ptr_conv.is_owned = false;
76494         LDKCVec_RouteHopZ ret_var = Path_get_hops(&this_ptr_conv);
76495         int64_tArray ret_arr = NULL;
76496         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
76497         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
76498         for (size_t k = 0; k < ret_var.datalen; k++) {
76499                 LDKRouteHop ret_conv_10_var = ret_var.data[k];
76500                 int64_t ret_conv_10_ref = 0;
76501                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_10_var);
76502                 ret_conv_10_ref = tag_ptr(ret_conv_10_var.inner, ret_conv_10_var.is_owned);
76503                 ret_arr_ptr[k] = ret_conv_10_ref;
76504         }
76505         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
76506         FREE(ret_var.data);
76507         return ret_arr;
76508 }
76509
76510 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Path_1set_1hops(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
76511         LDKPath this_ptr_conv;
76512         this_ptr_conv.inner = untag_ptr(this_ptr);
76513         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
76514         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
76515         this_ptr_conv.is_owned = false;
76516         LDKCVec_RouteHopZ val_constr;
76517         val_constr.datalen = (*env)->GetArrayLength(env, val);
76518         if (val_constr.datalen > 0)
76519                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
76520         else
76521                 val_constr.data = NULL;
76522         int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
76523         for (size_t k = 0; k < val_constr.datalen; k++) {
76524                 int64_t val_conv_10 = val_vals[k];
76525                 LDKRouteHop val_conv_10_conv;
76526                 val_conv_10_conv.inner = untag_ptr(val_conv_10);
76527                 val_conv_10_conv.is_owned = ptr_is_owned(val_conv_10);
76528                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_10_conv);
76529                 val_conv_10_conv = RouteHop_clone(&val_conv_10_conv);
76530                 val_constr.data[k] = val_conv_10_conv;
76531         }
76532         (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
76533         Path_set_hops(&this_ptr_conv, val_constr);
76534 }
76535
76536 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Path_1get_1blinded_1tail(JNIEnv *env, jclass clz, int64_t this_ptr) {
76537         LDKPath this_ptr_conv;
76538         this_ptr_conv.inner = untag_ptr(this_ptr);
76539         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
76540         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
76541         this_ptr_conv.is_owned = false;
76542         LDKBlindedTail ret_var = Path_get_blinded_tail(&this_ptr_conv);
76543         int64_t ret_ref = 0;
76544         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
76545         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
76546         return ret_ref;
76547 }
76548
76549 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Path_1set_1blinded_1tail(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
76550         LDKPath this_ptr_conv;
76551         this_ptr_conv.inner = untag_ptr(this_ptr);
76552         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
76553         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
76554         this_ptr_conv.is_owned = false;
76555         LDKBlindedTail val_conv;
76556         val_conv.inner = untag_ptr(val);
76557         val_conv.is_owned = ptr_is_owned(val);
76558         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
76559         val_conv = BlindedTail_clone(&val_conv);
76560         Path_set_blinded_tail(&this_ptr_conv, val_conv);
76561 }
76562
76563 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Path_1new(JNIEnv *env, jclass clz, int64_tArray hops_arg, int64_t blinded_tail_arg) {
76564         LDKCVec_RouteHopZ hops_arg_constr;
76565         hops_arg_constr.datalen = (*env)->GetArrayLength(env, hops_arg);
76566         if (hops_arg_constr.datalen > 0)
76567                 hops_arg_constr.data = MALLOC(hops_arg_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
76568         else
76569                 hops_arg_constr.data = NULL;
76570         int64_t* hops_arg_vals = (*env)->GetLongArrayElements (env, hops_arg, NULL);
76571         for (size_t k = 0; k < hops_arg_constr.datalen; k++) {
76572                 int64_t hops_arg_conv_10 = hops_arg_vals[k];
76573                 LDKRouteHop hops_arg_conv_10_conv;
76574                 hops_arg_conv_10_conv.inner = untag_ptr(hops_arg_conv_10);
76575                 hops_arg_conv_10_conv.is_owned = ptr_is_owned(hops_arg_conv_10);
76576                 CHECK_INNER_FIELD_ACCESS_OR_NULL(hops_arg_conv_10_conv);
76577                 hops_arg_conv_10_conv = RouteHop_clone(&hops_arg_conv_10_conv);
76578                 hops_arg_constr.data[k] = hops_arg_conv_10_conv;
76579         }
76580         (*env)->ReleaseLongArrayElements(env, hops_arg, hops_arg_vals, 0);
76581         LDKBlindedTail blinded_tail_arg_conv;
76582         blinded_tail_arg_conv.inner = untag_ptr(blinded_tail_arg);
76583         blinded_tail_arg_conv.is_owned = ptr_is_owned(blinded_tail_arg);
76584         CHECK_INNER_FIELD_ACCESS_OR_NULL(blinded_tail_arg_conv);
76585         blinded_tail_arg_conv = BlindedTail_clone(&blinded_tail_arg_conv);
76586         LDKPath ret_var = Path_new(hops_arg_constr, blinded_tail_arg_conv);
76587         int64_t ret_ref = 0;
76588         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
76589         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
76590         return ret_ref;
76591 }
76592
76593 static inline uint64_t Path_clone_ptr(LDKPath *NONNULL_PTR arg) {
76594         LDKPath ret_var = Path_clone(arg);
76595         int64_t ret_ref = 0;
76596         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
76597         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
76598         return ret_ref;
76599 }
76600 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Path_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
76601         LDKPath arg_conv;
76602         arg_conv.inner = untag_ptr(arg);
76603         arg_conv.is_owned = ptr_is_owned(arg);
76604         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
76605         arg_conv.is_owned = false;
76606         int64_t ret_conv = Path_clone_ptr(&arg_conv);
76607         return ret_conv;
76608 }
76609
76610 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Path_1clone(JNIEnv *env, jclass clz, int64_t orig) {
76611         LDKPath orig_conv;
76612         orig_conv.inner = untag_ptr(orig);
76613         orig_conv.is_owned = ptr_is_owned(orig);
76614         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
76615         orig_conv.is_owned = false;
76616         LDKPath ret_var = Path_clone(&orig_conv);
76617         int64_t ret_ref = 0;
76618         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
76619         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
76620         return ret_ref;
76621 }
76622
76623 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Path_1hash(JNIEnv *env, jclass clz, int64_t o) {
76624         LDKPath o_conv;
76625         o_conv.inner = untag_ptr(o);
76626         o_conv.is_owned = ptr_is_owned(o);
76627         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
76628         o_conv.is_owned = false;
76629         int64_t ret_conv = Path_hash(&o_conv);
76630         return ret_conv;
76631 }
76632
76633 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Path_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
76634         LDKPath a_conv;
76635         a_conv.inner = untag_ptr(a);
76636         a_conv.is_owned = ptr_is_owned(a);
76637         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
76638         a_conv.is_owned = false;
76639         LDKPath b_conv;
76640         b_conv.inner = untag_ptr(b);
76641         b_conv.is_owned = ptr_is_owned(b);
76642         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
76643         b_conv.is_owned = false;
76644         jboolean ret_conv = Path_eq(&a_conv, &b_conv);
76645         return ret_conv;
76646 }
76647
76648 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Path_1fee_1msat(JNIEnv *env, jclass clz, int64_t this_arg) {
76649         LDKPath this_arg_conv;
76650         this_arg_conv.inner = untag_ptr(this_arg);
76651         this_arg_conv.is_owned = ptr_is_owned(this_arg);
76652         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
76653         this_arg_conv.is_owned = false;
76654         int64_t ret_conv = Path_fee_msat(&this_arg_conv);
76655         return ret_conv;
76656 }
76657
76658 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Path_1final_1value_1msat(JNIEnv *env, jclass clz, int64_t this_arg) {
76659         LDKPath this_arg_conv;
76660         this_arg_conv.inner = untag_ptr(this_arg);
76661         this_arg_conv.is_owned = ptr_is_owned(this_arg);
76662         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
76663         this_arg_conv.is_owned = false;
76664         int64_t ret_conv = Path_final_value_msat(&this_arg_conv);
76665         return ret_conv;
76666 }
76667
76668 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Path_1final_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_arg) {
76669         LDKPath this_arg_conv;
76670         this_arg_conv.inner = untag_ptr(this_arg);
76671         this_arg_conv.is_owned = ptr_is_owned(this_arg);
76672         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
76673         this_arg_conv.is_owned = false;
76674         LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
76675         *ret_copy = Path_final_cltv_expiry_delta(&this_arg_conv);
76676         int64_t ret_ref = tag_ptr(ret_copy, true);
76677         return ret_ref;
76678 }
76679
76680 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Route_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
76681         LDKRoute this_obj_conv;
76682         this_obj_conv.inner = untag_ptr(this_obj);
76683         this_obj_conv.is_owned = ptr_is_owned(this_obj);
76684         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
76685         Route_free(this_obj_conv);
76686 }
76687
76688 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_Route_1get_1paths(JNIEnv *env, jclass clz, int64_t this_ptr) {
76689         LDKRoute this_ptr_conv;
76690         this_ptr_conv.inner = untag_ptr(this_ptr);
76691         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
76692         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
76693         this_ptr_conv.is_owned = false;
76694         LDKCVec_PathZ ret_var = Route_get_paths(&this_ptr_conv);
76695         int64_tArray ret_arr = NULL;
76696         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
76697         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
76698         for (size_t g = 0; g < ret_var.datalen; g++) {
76699                 LDKPath ret_conv_6_var = ret_var.data[g];
76700                 int64_t ret_conv_6_ref = 0;
76701                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_6_var);
76702                 ret_conv_6_ref = tag_ptr(ret_conv_6_var.inner, ret_conv_6_var.is_owned);
76703                 ret_arr_ptr[g] = ret_conv_6_ref;
76704         }
76705         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
76706         FREE(ret_var.data);
76707         return ret_arr;
76708 }
76709
76710 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Route_1set_1paths(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
76711         LDKRoute this_ptr_conv;
76712         this_ptr_conv.inner = untag_ptr(this_ptr);
76713         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
76714         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
76715         this_ptr_conv.is_owned = false;
76716         LDKCVec_PathZ val_constr;
76717         val_constr.datalen = (*env)->GetArrayLength(env, val);
76718         if (val_constr.datalen > 0)
76719                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKPath), "LDKCVec_PathZ Elements");
76720         else
76721                 val_constr.data = NULL;
76722         int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
76723         for (size_t g = 0; g < val_constr.datalen; g++) {
76724                 int64_t val_conv_6 = val_vals[g];
76725                 LDKPath val_conv_6_conv;
76726                 val_conv_6_conv.inner = untag_ptr(val_conv_6);
76727                 val_conv_6_conv.is_owned = ptr_is_owned(val_conv_6);
76728                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_6_conv);
76729                 val_conv_6_conv = Path_clone(&val_conv_6_conv);
76730                 val_constr.data[g] = val_conv_6_conv;
76731         }
76732         (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
76733         Route_set_paths(&this_ptr_conv, val_constr);
76734 }
76735
76736 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1get_1route_1params(JNIEnv *env, jclass clz, int64_t this_ptr) {
76737         LDKRoute this_ptr_conv;
76738         this_ptr_conv.inner = untag_ptr(this_ptr);
76739         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
76740         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
76741         this_ptr_conv.is_owned = false;
76742         LDKRouteParameters ret_var = Route_get_route_params(&this_ptr_conv);
76743         int64_t ret_ref = 0;
76744         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
76745         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
76746         return ret_ref;
76747 }
76748
76749 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Route_1set_1route_1params(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
76750         LDKRoute this_ptr_conv;
76751         this_ptr_conv.inner = untag_ptr(this_ptr);
76752         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
76753         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
76754         this_ptr_conv.is_owned = false;
76755         LDKRouteParameters val_conv;
76756         val_conv.inner = untag_ptr(val);
76757         val_conv.is_owned = ptr_is_owned(val);
76758         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
76759         val_conv = RouteParameters_clone(&val_conv);
76760         Route_set_route_params(&this_ptr_conv, val_conv);
76761 }
76762
76763 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1new(JNIEnv *env, jclass clz, int64_tArray paths_arg, int64_t route_params_arg) {
76764         LDKCVec_PathZ paths_arg_constr;
76765         paths_arg_constr.datalen = (*env)->GetArrayLength(env, paths_arg);
76766         if (paths_arg_constr.datalen > 0)
76767                 paths_arg_constr.data = MALLOC(paths_arg_constr.datalen * sizeof(LDKPath), "LDKCVec_PathZ Elements");
76768         else
76769                 paths_arg_constr.data = NULL;
76770         int64_t* paths_arg_vals = (*env)->GetLongArrayElements (env, paths_arg, NULL);
76771         for (size_t g = 0; g < paths_arg_constr.datalen; g++) {
76772                 int64_t paths_arg_conv_6 = paths_arg_vals[g];
76773                 LDKPath paths_arg_conv_6_conv;
76774                 paths_arg_conv_6_conv.inner = untag_ptr(paths_arg_conv_6);
76775                 paths_arg_conv_6_conv.is_owned = ptr_is_owned(paths_arg_conv_6);
76776                 CHECK_INNER_FIELD_ACCESS_OR_NULL(paths_arg_conv_6_conv);
76777                 paths_arg_conv_6_conv = Path_clone(&paths_arg_conv_6_conv);
76778                 paths_arg_constr.data[g] = paths_arg_conv_6_conv;
76779         }
76780         (*env)->ReleaseLongArrayElements(env, paths_arg, paths_arg_vals, 0);
76781         LDKRouteParameters route_params_arg_conv;
76782         route_params_arg_conv.inner = untag_ptr(route_params_arg);
76783         route_params_arg_conv.is_owned = ptr_is_owned(route_params_arg);
76784         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_arg_conv);
76785         route_params_arg_conv = RouteParameters_clone(&route_params_arg_conv);
76786         LDKRoute ret_var = Route_new(paths_arg_constr, route_params_arg_conv);
76787         int64_t ret_ref = 0;
76788         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
76789         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
76790         return ret_ref;
76791 }
76792
76793 static inline uint64_t Route_clone_ptr(LDKRoute *NONNULL_PTR arg) {
76794         LDKRoute ret_var = Route_clone(arg);
76795         int64_t ret_ref = 0;
76796         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
76797         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
76798         return ret_ref;
76799 }
76800 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
76801         LDKRoute arg_conv;
76802         arg_conv.inner = untag_ptr(arg);
76803         arg_conv.is_owned = ptr_is_owned(arg);
76804         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
76805         arg_conv.is_owned = false;
76806         int64_t ret_conv = Route_clone_ptr(&arg_conv);
76807         return ret_conv;
76808 }
76809
76810 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1clone(JNIEnv *env, jclass clz, int64_t orig) {
76811         LDKRoute orig_conv;
76812         orig_conv.inner = untag_ptr(orig);
76813         orig_conv.is_owned = ptr_is_owned(orig);
76814         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
76815         orig_conv.is_owned = false;
76816         LDKRoute ret_var = Route_clone(&orig_conv);
76817         int64_t ret_ref = 0;
76818         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
76819         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
76820         return ret_ref;
76821 }
76822
76823 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1hash(JNIEnv *env, jclass clz, int64_t o) {
76824         LDKRoute o_conv;
76825         o_conv.inner = untag_ptr(o);
76826         o_conv.is_owned = ptr_is_owned(o);
76827         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
76828         o_conv.is_owned = false;
76829         int64_t ret_conv = Route_hash(&o_conv);
76830         return ret_conv;
76831 }
76832
76833 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Route_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
76834         LDKRoute a_conv;
76835         a_conv.inner = untag_ptr(a);
76836         a_conv.is_owned = ptr_is_owned(a);
76837         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
76838         a_conv.is_owned = false;
76839         LDKRoute b_conv;
76840         b_conv.inner = untag_ptr(b);
76841         b_conv.is_owned = ptr_is_owned(b);
76842         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
76843         b_conv.is_owned = false;
76844         jboolean ret_conv = Route_eq(&a_conv, &b_conv);
76845         return ret_conv;
76846 }
76847
76848 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1get_1total_1fees(JNIEnv *env, jclass clz, int64_t this_arg) {
76849         LDKRoute this_arg_conv;
76850         this_arg_conv.inner = untag_ptr(this_arg);
76851         this_arg_conv.is_owned = ptr_is_owned(this_arg);
76852         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
76853         this_arg_conv.is_owned = false;
76854         int64_t ret_conv = Route_get_total_fees(&this_arg_conv);
76855         return ret_conv;
76856 }
76857
76858 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1get_1total_1amount(JNIEnv *env, jclass clz, int64_t this_arg) {
76859         LDKRoute this_arg_conv;
76860         this_arg_conv.inner = untag_ptr(this_arg);
76861         this_arg_conv.is_owned = ptr_is_owned(this_arg);
76862         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
76863         this_arg_conv.is_owned = false;
76864         int64_t ret_conv = Route_get_total_amount(&this_arg_conv);
76865         return ret_conv;
76866 }
76867
76868 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Route_1write(JNIEnv *env, jclass clz, int64_t obj) {
76869         LDKRoute obj_conv;
76870         obj_conv.inner = untag_ptr(obj);
76871         obj_conv.is_owned = ptr_is_owned(obj);
76872         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
76873         obj_conv.is_owned = false;
76874         LDKCVec_u8Z ret_var = Route_write(&obj_conv);
76875         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
76876         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
76877         CVec_u8Z_free(ret_var);
76878         return ret_arr;
76879 }
76880
76881 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
76882         LDKu8slice ser_ref;
76883         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
76884         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
76885         LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
76886         *ret_conv = Route_read(ser_ref);
76887         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
76888         return tag_ptr(ret_conv, true);
76889 }
76890
76891 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
76892         LDKRouteParameters this_obj_conv;
76893         this_obj_conv.inner = untag_ptr(this_obj);
76894         this_obj_conv.is_owned = ptr_is_owned(this_obj);
76895         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
76896         RouteParameters_free(this_obj_conv);
76897 }
76898
76899 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteParameters_1get_1payment_1params(JNIEnv *env, jclass clz, int64_t this_ptr) {
76900         LDKRouteParameters this_ptr_conv;
76901         this_ptr_conv.inner = untag_ptr(this_ptr);
76902         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
76903         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
76904         this_ptr_conv.is_owned = false;
76905         LDKPaymentParameters ret_var = RouteParameters_get_payment_params(&this_ptr_conv);
76906         int64_t ret_ref = 0;
76907         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
76908         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
76909         return ret_ref;
76910 }
76911
76912 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteParameters_1set_1payment_1params(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
76913         LDKRouteParameters this_ptr_conv;
76914         this_ptr_conv.inner = untag_ptr(this_ptr);
76915         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
76916         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
76917         this_ptr_conv.is_owned = false;
76918         LDKPaymentParameters val_conv;
76919         val_conv.inner = untag_ptr(val);
76920         val_conv.is_owned = ptr_is_owned(val);
76921         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
76922         val_conv = PaymentParameters_clone(&val_conv);
76923         RouteParameters_set_payment_params(&this_ptr_conv, val_conv);
76924 }
76925
76926 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteParameters_1get_1final_1value_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
76927         LDKRouteParameters this_ptr_conv;
76928         this_ptr_conv.inner = untag_ptr(this_ptr);
76929         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
76930         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
76931         this_ptr_conv.is_owned = false;
76932         int64_t ret_conv = RouteParameters_get_final_value_msat(&this_ptr_conv);
76933         return ret_conv;
76934 }
76935
76936 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteParameters_1set_1final_1value_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
76937         LDKRouteParameters this_ptr_conv;
76938         this_ptr_conv.inner = untag_ptr(this_ptr);
76939         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
76940         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
76941         this_ptr_conv.is_owned = false;
76942         RouteParameters_set_final_value_msat(&this_ptr_conv, val);
76943 }
76944
76945 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteParameters_1get_1max_1total_1routing_1fee_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
76946         LDKRouteParameters this_ptr_conv;
76947         this_ptr_conv.inner = untag_ptr(this_ptr);
76948         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
76949         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
76950         this_ptr_conv.is_owned = false;
76951         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
76952         *ret_copy = RouteParameters_get_max_total_routing_fee_msat(&this_ptr_conv);
76953         int64_t ret_ref = tag_ptr(ret_copy, true);
76954         return ret_ref;
76955 }
76956
76957 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) {
76958         LDKRouteParameters 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         void* val_ptr = untag_ptr(val);
76964         CHECK_ACCESS(val_ptr);
76965         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
76966         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
76967         RouteParameters_set_max_total_routing_fee_msat(&this_ptr_conv, val_conv);
76968 }
76969
76970 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) {
76971         LDKPaymentParameters payment_params_arg_conv;
76972         payment_params_arg_conv.inner = untag_ptr(payment_params_arg);
76973         payment_params_arg_conv.is_owned = ptr_is_owned(payment_params_arg);
76974         CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_params_arg_conv);
76975         payment_params_arg_conv = PaymentParameters_clone(&payment_params_arg_conv);
76976         void* max_total_routing_fee_msat_arg_ptr = untag_ptr(max_total_routing_fee_msat_arg);
76977         CHECK_ACCESS(max_total_routing_fee_msat_arg_ptr);
76978         LDKCOption_u64Z max_total_routing_fee_msat_arg_conv = *(LDKCOption_u64Z*)(max_total_routing_fee_msat_arg_ptr);
76979         max_total_routing_fee_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(max_total_routing_fee_msat_arg));
76980         LDKRouteParameters ret_var = RouteParameters_new(payment_params_arg_conv, final_value_msat_arg, max_total_routing_fee_msat_arg_conv);
76981         int64_t ret_ref = 0;
76982         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
76983         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
76984         return ret_ref;
76985 }
76986
76987 static inline uint64_t RouteParameters_clone_ptr(LDKRouteParameters *NONNULL_PTR arg) {
76988         LDKRouteParameters ret_var = RouteParameters_clone(arg);
76989         int64_t ret_ref = 0;
76990         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
76991         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
76992         return ret_ref;
76993 }
76994 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteParameters_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
76995         LDKRouteParameters arg_conv;
76996         arg_conv.inner = untag_ptr(arg);
76997         arg_conv.is_owned = ptr_is_owned(arg);
76998         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
76999         arg_conv.is_owned = false;
77000         int64_t ret_conv = RouteParameters_clone_ptr(&arg_conv);
77001         return ret_conv;
77002 }
77003
77004 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteParameters_1clone(JNIEnv *env, jclass clz, int64_t orig) {
77005         LDKRouteParameters orig_conv;
77006         orig_conv.inner = untag_ptr(orig);
77007         orig_conv.is_owned = ptr_is_owned(orig);
77008         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
77009         orig_conv.is_owned = false;
77010         LDKRouteParameters ret_var = RouteParameters_clone(&orig_conv);
77011         int64_t ret_ref = 0;
77012         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
77013         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
77014         return ret_ref;
77015 }
77016
77017 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteParameters_1hash(JNIEnv *env, jclass clz, int64_t o) {
77018         LDKRouteParameters o_conv;
77019         o_conv.inner = untag_ptr(o);
77020         o_conv.is_owned = ptr_is_owned(o);
77021         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
77022         o_conv.is_owned = false;
77023         int64_t ret_conv = RouteParameters_hash(&o_conv);
77024         return ret_conv;
77025 }
77026
77027 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RouteParameters_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
77028         LDKRouteParameters a_conv;
77029         a_conv.inner = untag_ptr(a);
77030         a_conv.is_owned = ptr_is_owned(a);
77031         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
77032         a_conv.is_owned = false;
77033         LDKRouteParameters b_conv;
77034         b_conv.inner = untag_ptr(b);
77035         b_conv.is_owned = ptr_is_owned(b);
77036         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
77037         b_conv.is_owned = false;
77038         jboolean ret_conv = RouteParameters_eq(&a_conv, &b_conv);
77039         return ret_conv;
77040 }
77041
77042 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) {
77043         LDKPaymentParameters payment_params_conv;
77044         payment_params_conv.inner = untag_ptr(payment_params);
77045         payment_params_conv.is_owned = ptr_is_owned(payment_params);
77046         CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_params_conv);
77047         payment_params_conv = PaymentParameters_clone(&payment_params_conv);
77048         LDKRouteParameters ret_var = RouteParameters_from_payment_params_and_value(payment_params_conv, final_value_msat);
77049         int64_t ret_ref = 0;
77050         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
77051         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
77052         return ret_ref;
77053 }
77054
77055 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RouteParameters_1write(JNIEnv *env, jclass clz, int64_t obj) {
77056         LDKRouteParameters obj_conv;
77057         obj_conv.inner = untag_ptr(obj);
77058         obj_conv.is_owned = ptr_is_owned(obj);
77059         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
77060         obj_conv.is_owned = false;
77061         LDKCVec_u8Z ret_var = RouteParameters_write(&obj_conv);
77062         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
77063         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
77064         CVec_u8Z_free(ret_var);
77065         return ret_arr;
77066 }
77067
77068 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteParameters_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
77069         LDKu8slice ser_ref;
77070         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
77071         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
77072         LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
77073         *ret_conv = RouteParameters_read(ser_ref);
77074         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
77075         return tag_ptr(ret_conv, true);
77076 }
77077
77078 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
77079         LDKPaymentParameters this_obj_conv;
77080         this_obj_conv.inner = untag_ptr(this_obj);
77081         this_obj_conv.is_owned = ptr_is_owned(this_obj);
77082         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
77083         PaymentParameters_free(this_obj_conv);
77084 }
77085
77086 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1get_1payee(JNIEnv *env, jclass clz, int64_t this_ptr) {
77087         LDKPaymentParameters this_ptr_conv;
77088         this_ptr_conv.inner = untag_ptr(this_ptr);
77089         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
77090         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
77091         this_ptr_conv.is_owned = false;
77092         LDKPayee *ret_copy = MALLOC(sizeof(LDKPayee), "LDKPayee");
77093         *ret_copy = PaymentParameters_get_payee(&this_ptr_conv);
77094         int64_t ret_ref = tag_ptr(ret_copy, true);
77095         return ret_ref;
77096 }
77097
77098 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1set_1payee(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
77099         LDKPaymentParameters this_ptr_conv;
77100         this_ptr_conv.inner = untag_ptr(this_ptr);
77101         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
77102         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
77103         this_ptr_conv.is_owned = false;
77104         void* val_ptr = untag_ptr(val);
77105         CHECK_ACCESS(val_ptr);
77106         LDKPayee val_conv = *(LDKPayee*)(val_ptr);
77107         val_conv = Payee_clone((LDKPayee*)untag_ptr(val));
77108         PaymentParameters_set_payee(&this_ptr_conv, val_conv);
77109 }
77110
77111 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1get_1expiry_1time(JNIEnv *env, jclass clz, int64_t this_ptr) {
77112         LDKPaymentParameters this_ptr_conv;
77113         this_ptr_conv.inner = untag_ptr(this_ptr);
77114         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
77115         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
77116         this_ptr_conv.is_owned = false;
77117         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
77118         *ret_copy = PaymentParameters_get_expiry_time(&this_ptr_conv);
77119         int64_t ret_ref = tag_ptr(ret_copy, true);
77120         return ret_ref;
77121 }
77122
77123 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1set_1expiry_1time(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
77124         LDKPaymentParameters this_ptr_conv;
77125         this_ptr_conv.inner = untag_ptr(this_ptr);
77126         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
77127         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
77128         this_ptr_conv.is_owned = false;
77129         void* val_ptr = untag_ptr(val);
77130         CHECK_ACCESS(val_ptr);
77131         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
77132         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
77133         PaymentParameters_set_expiry_time(&this_ptr_conv, val_conv);
77134 }
77135
77136 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1get_1max_1total_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
77137         LDKPaymentParameters this_ptr_conv;
77138         this_ptr_conv.inner = untag_ptr(this_ptr);
77139         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
77140         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
77141         this_ptr_conv.is_owned = false;
77142         int32_t ret_conv = PaymentParameters_get_max_total_cltv_expiry_delta(&this_ptr_conv);
77143         return ret_conv;
77144 }
77145
77146 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) {
77147         LDKPaymentParameters this_ptr_conv;
77148         this_ptr_conv.inner = untag_ptr(this_ptr);
77149         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
77150         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
77151         this_ptr_conv.is_owned = false;
77152         PaymentParameters_set_max_total_cltv_expiry_delta(&this_ptr_conv, val);
77153 }
77154
77155 JNIEXPORT int8_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1get_1max_1path_1count(JNIEnv *env, jclass clz, int64_t this_ptr) {
77156         LDKPaymentParameters this_ptr_conv;
77157         this_ptr_conv.inner = untag_ptr(this_ptr);
77158         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
77159         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
77160         this_ptr_conv.is_owned = false;
77161         int8_t ret_conv = PaymentParameters_get_max_path_count(&this_ptr_conv);
77162         return ret_conv;
77163 }
77164
77165 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1set_1max_1path_1count(JNIEnv *env, jclass clz, int64_t this_ptr, int8_t val) {
77166         LDKPaymentParameters this_ptr_conv;
77167         this_ptr_conv.inner = untag_ptr(this_ptr);
77168         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
77169         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
77170         this_ptr_conv.is_owned = false;
77171         PaymentParameters_set_max_path_count(&this_ptr_conv, val);
77172 }
77173
77174 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) {
77175         LDKPaymentParameters this_ptr_conv;
77176         this_ptr_conv.inner = untag_ptr(this_ptr);
77177         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
77178         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
77179         this_ptr_conv.is_owned = false;
77180         int8_t ret_conv = PaymentParameters_get_max_channel_saturation_power_of_half(&this_ptr_conv);
77181         return ret_conv;
77182 }
77183
77184 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) {
77185         LDKPaymentParameters this_ptr_conv;
77186         this_ptr_conv.inner = untag_ptr(this_ptr);
77187         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
77188         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
77189         this_ptr_conv.is_owned = false;
77190         PaymentParameters_set_max_channel_saturation_power_of_half(&this_ptr_conv, val);
77191 }
77192
77193 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1get_1previously_1failed_1channels(JNIEnv *env, jclass clz, int64_t this_ptr) {
77194         LDKPaymentParameters this_ptr_conv;
77195         this_ptr_conv.inner = untag_ptr(this_ptr);
77196         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
77197         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
77198         this_ptr_conv.is_owned = false;
77199         LDKCVec_u64Z ret_var = PaymentParameters_get_previously_failed_channels(&this_ptr_conv);
77200         int64_tArray ret_arr = NULL;
77201         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
77202         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
77203         for (size_t g = 0; g < ret_var.datalen; g++) {
77204                 int64_t ret_conv_6_conv = ret_var.data[g];
77205                 ret_arr_ptr[g] = ret_conv_6_conv;
77206         }
77207         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
77208         FREE(ret_var.data);
77209         return ret_arr;
77210 }
77211
77212 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1set_1previously_1failed_1channels(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
77213         LDKPaymentParameters this_ptr_conv;
77214         this_ptr_conv.inner = untag_ptr(this_ptr);
77215         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
77216         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
77217         this_ptr_conv.is_owned = false;
77218         LDKCVec_u64Z val_constr;
77219         val_constr.datalen = (*env)->GetArrayLength(env, val);
77220         if (val_constr.datalen > 0)
77221                 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
77222         else
77223                 val_constr.data = NULL;
77224         int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
77225         for (size_t g = 0; g < val_constr.datalen; g++) {
77226                 int64_t val_conv_6 = val_vals[g];
77227                 val_constr.data[g] = val_conv_6;
77228         }
77229         (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
77230         PaymentParameters_set_previously_failed_channels(&this_ptr_conv, val_constr);
77231 }
77232
77233 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1get_1previously_1failed_1blinded_1path_1idxs(JNIEnv *env, jclass clz, int64_t this_ptr) {
77234         LDKPaymentParameters this_ptr_conv;
77235         this_ptr_conv.inner = untag_ptr(this_ptr);
77236         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
77237         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
77238         this_ptr_conv.is_owned = false;
77239         LDKCVec_u64Z ret_var = PaymentParameters_get_previously_failed_blinded_path_idxs(&this_ptr_conv);
77240         int64_tArray ret_arr = NULL;
77241         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
77242         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
77243         for (size_t g = 0; g < ret_var.datalen; g++) {
77244                 int64_t ret_conv_6_conv = ret_var.data[g];
77245                 ret_arr_ptr[g] = ret_conv_6_conv;
77246         }
77247         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
77248         FREE(ret_var.data);
77249         return ret_arr;
77250 }
77251
77252 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) {
77253         LDKPaymentParameters this_ptr_conv;
77254         this_ptr_conv.inner = untag_ptr(this_ptr);
77255         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
77256         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
77257         this_ptr_conv.is_owned = false;
77258         LDKCVec_u64Z val_constr;
77259         val_constr.datalen = (*env)->GetArrayLength(env, val);
77260         if (val_constr.datalen > 0)
77261                 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
77262         else
77263                 val_constr.data = NULL;
77264         int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
77265         for (size_t g = 0; g < val_constr.datalen; g++) {
77266                 int64_t val_conv_6 = val_vals[g];
77267                 val_constr.data[g] = val_conv_6;
77268         }
77269         (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
77270         PaymentParameters_set_previously_failed_blinded_path_idxs(&this_ptr_conv, val_constr);
77271 }
77272
77273 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) {
77274         void* payee_arg_ptr = untag_ptr(payee_arg);
77275         CHECK_ACCESS(payee_arg_ptr);
77276         LDKPayee payee_arg_conv = *(LDKPayee*)(payee_arg_ptr);
77277         payee_arg_conv = Payee_clone((LDKPayee*)untag_ptr(payee_arg));
77278         void* expiry_time_arg_ptr = untag_ptr(expiry_time_arg);
77279         CHECK_ACCESS(expiry_time_arg_ptr);
77280         LDKCOption_u64Z expiry_time_arg_conv = *(LDKCOption_u64Z*)(expiry_time_arg_ptr);
77281         expiry_time_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(expiry_time_arg));
77282         LDKCVec_u64Z previously_failed_channels_arg_constr;
77283         previously_failed_channels_arg_constr.datalen = (*env)->GetArrayLength(env, previously_failed_channels_arg);
77284         if (previously_failed_channels_arg_constr.datalen > 0)
77285                 previously_failed_channels_arg_constr.data = MALLOC(previously_failed_channels_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
77286         else
77287                 previously_failed_channels_arg_constr.data = NULL;
77288         int64_t* previously_failed_channels_arg_vals = (*env)->GetLongArrayElements (env, previously_failed_channels_arg, NULL);
77289         for (size_t g = 0; g < previously_failed_channels_arg_constr.datalen; g++) {
77290                 int64_t previously_failed_channels_arg_conv_6 = previously_failed_channels_arg_vals[g];
77291                 previously_failed_channels_arg_constr.data[g] = previously_failed_channels_arg_conv_6;
77292         }
77293         (*env)->ReleaseLongArrayElements(env, previously_failed_channels_arg, previously_failed_channels_arg_vals, 0);
77294         LDKCVec_u64Z previously_failed_blinded_path_idxs_arg_constr;
77295         previously_failed_blinded_path_idxs_arg_constr.datalen = (*env)->GetArrayLength(env, previously_failed_blinded_path_idxs_arg);
77296         if (previously_failed_blinded_path_idxs_arg_constr.datalen > 0)
77297                 previously_failed_blinded_path_idxs_arg_constr.data = MALLOC(previously_failed_blinded_path_idxs_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
77298         else
77299                 previously_failed_blinded_path_idxs_arg_constr.data = NULL;
77300         int64_t* previously_failed_blinded_path_idxs_arg_vals = (*env)->GetLongArrayElements (env, previously_failed_blinded_path_idxs_arg, NULL);
77301         for (size_t g = 0; g < previously_failed_blinded_path_idxs_arg_constr.datalen; g++) {
77302                 int64_t previously_failed_blinded_path_idxs_arg_conv_6 = previously_failed_blinded_path_idxs_arg_vals[g];
77303                 previously_failed_blinded_path_idxs_arg_constr.data[g] = previously_failed_blinded_path_idxs_arg_conv_6;
77304         }
77305         (*env)->ReleaseLongArrayElements(env, previously_failed_blinded_path_idxs_arg, previously_failed_blinded_path_idxs_arg_vals, 0);
77306         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);
77307         int64_t ret_ref = 0;
77308         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
77309         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
77310         return ret_ref;
77311 }
77312
77313 static inline uint64_t PaymentParameters_clone_ptr(LDKPaymentParameters *NONNULL_PTR arg) {
77314         LDKPaymentParameters ret_var = PaymentParameters_clone(arg);
77315         int64_t ret_ref = 0;
77316         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
77317         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
77318         return ret_ref;
77319 }
77320 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
77321         LDKPaymentParameters arg_conv;
77322         arg_conv.inner = untag_ptr(arg);
77323         arg_conv.is_owned = ptr_is_owned(arg);
77324         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
77325         arg_conv.is_owned = false;
77326         int64_t ret_conv = PaymentParameters_clone_ptr(&arg_conv);
77327         return ret_conv;
77328 }
77329
77330 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1clone(JNIEnv *env, jclass clz, int64_t orig) {
77331         LDKPaymentParameters orig_conv;
77332         orig_conv.inner = untag_ptr(orig);
77333         orig_conv.is_owned = ptr_is_owned(orig);
77334         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
77335         orig_conv.is_owned = false;
77336         LDKPaymentParameters ret_var = PaymentParameters_clone(&orig_conv);
77337         int64_t ret_ref = 0;
77338         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
77339         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
77340         return ret_ref;
77341 }
77342
77343 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1hash(JNIEnv *env, jclass clz, int64_t o) {
77344         LDKPaymentParameters o_conv;
77345         o_conv.inner = untag_ptr(o);
77346         o_conv.is_owned = ptr_is_owned(o);
77347         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
77348         o_conv.is_owned = false;
77349         int64_t ret_conv = PaymentParameters_hash(&o_conv);
77350         return ret_conv;
77351 }
77352
77353 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
77354         LDKPaymentParameters a_conv;
77355         a_conv.inner = untag_ptr(a);
77356         a_conv.is_owned = ptr_is_owned(a);
77357         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
77358         a_conv.is_owned = false;
77359         LDKPaymentParameters b_conv;
77360         b_conv.inner = untag_ptr(b);
77361         b_conv.is_owned = ptr_is_owned(b);
77362         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
77363         b_conv.is_owned = false;
77364         jboolean ret_conv = PaymentParameters_eq(&a_conv, &b_conv);
77365         return ret_conv;
77366 }
77367
77368 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1write(JNIEnv *env, jclass clz, int64_t obj) {
77369         LDKPaymentParameters obj_conv;
77370         obj_conv.inner = untag_ptr(obj);
77371         obj_conv.is_owned = ptr_is_owned(obj);
77372         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
77373         obj_conv.is_owned = false;
77374         LDKCVec_u8Z ret_var = PaymentParameters_write(&obj_conv);
77375         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
77376         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
77377         CVec_u8Z_free(ret_var);
77378         return ret_arr;
77379 }
77380
77381 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1read(JNIEnv *env, jclass clz, int8_tArray ser, int32_t arg) {
77382         LDKu8slice ser_ref;
77383         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
77384         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
77385         LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
77386         *ret_conv = PaymentParameters_read(ser_ref, arg);
77387         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
77388         return tag_ptr(ret_conv, true);
77389 }
77390
77391 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) {
77392         LDKPublicKey payee_pubkey_ref;
77393         CHECK((*env)->GetArrayLength(env, payee_pubkey) == 33);
77394         (*env)->GetByteArrayRegion(env, payee_pubkey, 0, 33, payee_pubkey_ref.compressed_form);
77395         LDKPaymentParameters ret_var = PaymentParameters_from_node_id(payee_pubkey_ref, final_cltv_expiry_delta);
77396         int64_t ret_ref = 0;
77397         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
77398         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
77399         return ret_ref;
77400 }
77401
77402 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) {
77403         LDKPublicKey payee_pubkey_ref;
77404         CHECK((*env)->GetArrayLength(env, payee_pubkey) == 33);
77405         (*env)->GetByteArrayRegion(env, payee_pubkey, 0, 33, payee_pubkey_ref.compressed_form);
77406         LDKPaymentParameters ret_var = PaymentParameters_for_keysend(payee_pubkey_ref, final_cltv_expiry_delta, allow_mpp);
77407         int64_t ret_ref = 0;
77408         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
77409         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
77410         return ret_ref;
77411 }
77412
77413 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1from_1bolt12_1invoice(JNIEnv *env, jclass clz, int64_t invoice) {
77414         LDKBolt12Invoice invoice_conv;
77415         invoice_conv.inner = untag_ptr(invoice);
77416         invoice_conv.is_owned = ptr_is_owned(invoice);
77417         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_conv);
77418         invoice_conv.is_owned = false;
77419         LDKPaymentParameters ret_var = PaymentParameters_from_bolt12_invoice(&invoice_conv);
77420         int64_t ret_ref = 0;
77421         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
77422         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
77423         return ret_ref;
77424 }
77425
77426 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentParameters_1blinded(JNIEnv *env, jclass clz, int64_tArray blinded_route_hints) {
77427         LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ blinded_route_hints_constr;
77428         blinded_route_hints_constr.datalen = (*env)->GetArrayLength(env, blinded_route_hints);
77429         if (blinded_route_hints_constr.datalen > 0)
77430                 blinded_route_hints_constr.data = MALLOC(blinded_route_hints_constr.datalen * sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ Elements");
77431         else
77432                 blinded_route_hints_constr.data = NULL;
77433         int64_t* blinded_route_hints_vals = (*env)->GetLongArrayElements (env, blinded_route_hints, NULL);
77434         for (size_t l = 0; l < blinded_route_hints_constr.datalen; l++) {
77435                 int64_t blinded_route_hints_conv_37 = blinded_route_hints_vals[l];
77436                 void* blinded_route_hints_conv_37_ptr = untag_ptr(blinded_route_hints_conv_37);
77437                 CHECK_ACCESS(blinded_route_hints_conv_37_ptr);
77438                 LDKC2Tuple_BlindedPayInfoBlindedPathZ blinded_route_hints_conv_37_conv = *(LDKC2Tuple_BlindedPayInfoBlindedPathZ*)(blinded_route_hints_conv_37_ptr);
77439                 blinded_route_hints_conv_37_conv = C2Tuple_BlindedPayInfoBlindedPathZ_clone((LDKC2Tuple_BlindedPayInfoBlindedPathZ*)untag_ptr(blinded_route_hints_conv_37));
77440                 blinded_route_hints_constr.data[l] = blinded_route_hints_conv_37_conv;
77441         }
77442         (*env)->ReleaseLongArrayElements(env, blinded_route_hints, blinded_route_hints_vals, 0);
77443         LDKPaymentParameters ret_var = PaymentParameters_blinded(blinded_route_hints_constr);
77444         int64_t ret_ref = 0;
77445         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
77446         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
77447         return ret_ref;
77448 }
77449
77450 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Payee_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
77451         if (!ptr_is_owned(this_ptr)) return;
77452         void* this_ptr_ptr = untag_ptr(this_ptr);
77453         CHECK_ACCESS(this_ptr_ptr);
77454         LDKPayee this_ptr_conv = *(LDKPayee*)(this_ptr_ptr);
77455         FREE(untag_ptr(this_ptr));
77456         Payee_free(this_ptr_conv);
77457 }
77458
77459 static inline uint64_t Payee_clone_ptr(LDKPayee *NONNULL_PTR arg) {
77460         LDKPayee *ret_copy = MALLOC(sizeof(LDKPayee), "LDKPayee");
77461         *ret_copy = Payee_clone(arg);
77462         int64_t ret_ref = tag_ptr(ret_copy, true);
77463         return ret_ref;
77464 }
77465 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Payee_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
77466         LDKPayee* arg_conv = (LDKPayee*)untag_ptr(arg);
77467         int64_t ret_conv = Payee_clone_ptr(arg_conv);
77468         return ret_conv;
77469 }
77470
77471 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Payee_1clone(JNIEnv *env, jclass clz, int64_t orig) {
77472         LDKPayee* orig_conv = (LDKPayee*)untag_ptr(orig);
77473         LDKPayee *ret_copy = MALLOC(sizeof(LDKPayee), "LDKPayee");
77474         *ret_copy = Payee_clone(orig_conv);
77475         int64_t ret_ref = tag_ptr(ret_copy, true);
77476         return ret_ref;
77477 }
77478
77479 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Payee_1blinded(JNIEnv *env, jclass clz, int64_tArray route_hints, int64_t features) {
77480         LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ route_hints_constr;
77481         route_hints_constr.datalen = (*env)->GetArrayLength(env, route_hints);
77482         if (route_hints_constr.datalen > 0)
77483                 route_hints_constr.data = MALLOC(route_hints_constr.datalen * sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ Elements");
77484         else
77485                 route_hints_constr.data = NULL;
77486         int64_t* route_hints_vals = (*env)->GetLongArrayElements (env, route_hints, NULL);
77487         for (size_t l = 0; l < route_hints_constr.datalen; l++) {
77488                 int64_t route_hints_conv_37 = route_hints_vals[l];
77489                 void* route_hints_conv_37_ptr = untag_ptr(route_hints_conv_37);
77490                 CHECK_ACCESS(route_hints_conv_37_ptr);
77491                 LDKC2Tuple_BlindedPayInfoBlindedPathZ route_hints_conv_37_conv = *(LDKC2Tuple_BlindedPayInfoBlindedPathZ*)(route_hints_conv_37_ptr);
77492                 route_hints_conv_37_conv = C2Tuple_BlindedPayInfoBlindedPathZ_clone((LDKC2Tuple_BlindedPayInfoBlindedPathZ*)untag_ptr(route_hints_conv_37));
77493                 route_hints_constr.data[l] = route_hints_conv_37_conv;
77494         }
77495         (*env)->ReleaseLongArrayElements(env, route_hints, route_hints_vals, 0);
77496         LDKBolt12InvoiceFeatures features_conv;
77497         features_conv.inner = untag_ptr(features);
77498         features_conv.is_owned = ptr_is_owned(features);
77499         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_conv);
77500         features_conv = Bolt12InvoiceFeatures_clone(&features_conv);
77501         LDKPayee *ret_copy = MALLOC(sizeof(LDKPayee), "LDKPayee");
77502         *ret_copy = Payee_blinded(route_hints_constr, features_conv);
77503         int64_t ret_ref = tag_ptr(ret_copy, true);
77504         return ret_ref;
77505 }
77506
77507 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) {
77508         LDKPublicKey node_id_ref;
77509         CHECK((*env)->GetArrayLength(env, node_id) == 33);
77510         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
77511         LDKCVec_RouteHintZ route_hints_constr;
77512         route_hints_constr.datalen = (*env)->GetArrayLength(env, route_hints);
77513         if (route_hints_constr.datalen > 0)
77514                 route_hints_constr.data = MALLOC(route_hints_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
77515         else
77516                 route_hints_constr.data = NULL;
77517         int64_t* route_hints_vals = (*env)->GetLongArrayElements (env, route_hints, NULL);
77518         for (size_t l = 0; l < route_hints_constr.datalen; l++) {
77519                 int64_t route_hints_conv_11 = route_hints_vals[l];
77520                 LDKRouteHint route_hints_conv_11_conv;
77521                 route_hints_conv_11_conv.inner = untag_ptr(route_hints_conv_11);
77522                 route_hints_conv_11_conv.is_owned = ptr_is_owned(route_hints_conv_11);
77523                 CHECK_INNER_FIELD_ACCESS_OR_NULL(route_hints_conv_11_conv);
77524                 route_hints_conv_11_conv = RouteHint_clone(&route_hints_conv_11_conv);
77525                 route_hints_constr.data[l] = route_hints_conv_11_conv;
77526         }
77527         (*env)->ReleaseLongArrayElements(env, route_hints, route_hints_vals, 0);
77528         LDKBolt11InvoiceFeatures features_conv;
77529         features_conv.inner = untag_ptr(features);
77530         features_conv.is_owned = ptr_is_owned(features);
77531         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_conv);
77532         features_conv = Bolt11InvoiceFeatures_clone(&features_conv);
77533         LDKPayee *ret_copy = MALLOC(sizeof(LDKPayee), "LDKPayee");
77534         *ret_copy = Payee_clear(node_id_ref, route_hints_constr, features_conv, final_cltv_expiry_delta);
77535         int64_t ret_ref = tag_ptr(ret_copy, true);
77536         return ret_ref;
77537 }
77538
77539 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Payee_1hash(JNIEnv *env, jclass clz, int64_t o) {
77540         LDKPayee* o_conv = (LDKPayee*)untag_ptr(o);
77541         int64_t ret_conv = Payee_hash(o_conv);
77542         return ret_conv;
77543 }
77544
77545 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Payee_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
77546         LDKPayee* a_conv = (LDKPayee*)untag_ptr(a);
77547         LDKPayee* b_conv = (LDKPayee*)untag_ptr(b);
77548         jboolean ret_conv = Payee_eq(a_conv, b_conv);
77549         return ret_conv;
77550 }
77551
77552 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
77553         LDKRouteHint this_obj_conv;
77554         this_obj_conv.inner = untag_ptr(this_obj);
77555         this_obj_conv.is_owned = ptr_is_owned(this_obj);
77556         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
77557         RouteHint_free(this_obj_conv);
77558 }
77559
77560 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_RouteHint_1get_1a(JNIEnv *env, jclass clz, int64_t this_ptr) {
77561         LDKRouteHint this_ptr_conv;
77562         this_ptr_conv.inner = untag_ptr(this_ptr);
77563         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
77564         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
77565         this_ptr_conv.is_owned = false;
77566         LDKCVec_RouteHintHopZ ret_var = RouteHint_get_a(&this_ptr_conv);
77567         int64_tArray ret_arr = NULL;
77568         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
77569         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
77570         for (size_t o = 0; o < ret_var.datalen; o++) {
77571                 LDKRouteHintHop ret_conv_14_var = ret_var.data[o];
77572                 int64_t ret_conv_14_ref = 0;
77573                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_14_var);
77574                 ret_conv_14_ref = tag_ptr(ret_conv_14_var.inner, ret_conv_14_var.is_owned);
77575                 ret_arr_ptr[o] = ret_conv_14_ref;
77576         }
77577         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
77578         FREE(ret_var.data);
77579         return ret_arr;
77580 }
77581
77582 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1set_1a(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
77583         LDKRouteHint this_ptr_conv;
77584         this_ptr_conv.inner = untag_ptr(this_ptr);
77585         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
77586         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
77587         this_ptr_conv.is_owned = false;
77588         LDKCVec_RouteHintHopZ val_constr;
77589         val_constr.datalen = (*env)->GetArrayLength(env, val);
77590         if (val_constr.datalen > 0)
77591                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKRouteHintHop), "LDKCVec_RouteHintHopZ Elements");
77592         else
77593                 val_constr.data = NULL;
77594         int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
77595         for (size_t o = 0; o < val_constr.datalen; o++) {
77596                 int64_t val_conv_14 = val_vals[o];
77597                 LDKRouteHintHop val_conv_14_conv;
77598                 val_conv_14_conv.inner = untag_ptr(val_conv_14);
77599                 val_conv_14_conv.is_owned = ptr_is_owned(val_conv_14);
77600                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_14_conv);
77601                 val_conv_14_conv = RouteHintHop_clone(&val_conv_14_conv);
77602                 val_constr.data[o] = val_conv_14_conv;
77603         }
77604         (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
77605         RouteHint_set_a(&this_ptr_conv, val_constr);
77606 }
77607
77608 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHint_1new(JNIEnv *env, jclass clz, int64_tArray a_arg) {
77609         LDKCVec_RouteHintHopZ a_arg_constr;
77610         a_arg_constr.datalen = (*env)->GetArrayLength(env, a_arg);
77611         if (a_arg_constr.datalen > 0)
77612                 a_arg_constr.data = MALLOC(a_arg_constr.datalen * sizeof(LDKRouteHintHop), "LDKCVec_RouteHintHopZ Elements");
77613         else
77614                 a_arg_constr.data = NULL;
77615         int64_t* a_arg_vals = (*env)->GetLongArrayElements (env, a_arg, NULL);
77616         for (size_t o = 0; o < a_arg_constr.datalen; o++) {
77617                 int64_t a_arg_conv_14 = a_arg_vals[o];
77618                 LDKRouteHintHop a_arg_conv_14_conv;
77619                 a_arg_conv_14_conv.inner = untag_ptr(a_arg_conv_14);
77620                 a_arg_conv_14_conv.is_owned = ptr_is_owned(a_arg_conv_14);
77621                 CHECK_INNER_FIELD_ACCESS_OR_NULL(a_arg_conv_14_conv);
77622                 a_arg_conv_14_conv = RouteHintHop_clone(&a_arg_conv_14_conv);
77623                 a_arg_constr.data[o] = a_arg_conv_14_conv;
77624         }
77625         (*env)->ReleaseLongArrayElements(env, a_arg, a_arg_vals, 0);
77626         LDKRouteHint ret_var = RouteHint_new(a_arg_constr);
77627         int64_t ret_ref = 0;
77628         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
77629         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
77630         return ret_ref;
77631 }
77632
77633 static inline uint64_t RouteHint_clone_ptr(LDKRouteHint *NONNULL_PTR arg) {
77634         LDKRouteHint ret_var = RouteHint_clone(arg);
77635         int64_t ret_ref = 0;
77636         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
77637         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
77638         return ret_ref;
77639 }
77640 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHint_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
77641         LDKRouteHint arg_conv;
77642         arg_conv.inner = untag_ptr(arg);
77643         arg_conv.is_owned = ptr_is_owned(arg);
77644         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
77645         arg_conv.is_owned = false;
77646         int64_t ret_conv = RouteHint_clone_ptr(&arg_conv);
77647         return ret_conv;
77648 }
77649
77650 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHint_1clone(JNIEnv *env, jclass clz, int64_t orig) {
77651         LDKRouteHint orig_conv;
77652         orig_conv.inner = untag_ptr(orig);
77653         orig_conv.is_owned = ptr_is_owned(orig);
77654         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
77655         orig_conv.is_owned = false;
77656         LDKRouteHint ret_var = RouteHint_clone(&orig_conv);
77657         int64_t ret_ref = 0;
77658         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
77659         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
77660         return ret_ref;
77661 }
77662
77663 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHint_1hash(JNIEnv *env, jclass clz, int64_t o) {
77664         LDKRouteHint o_conv;
77665         o_conv.inner = untag_ptr(o);
77666         o_conv.is_owned = ptr_is_owned(o);
77667         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
77668         o_conv.is_owned = false;
77669         int64_t ret_conv = RouteHint_hash(&o_conv);
77670         return ret_conv;
77671 }
77672
77673 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RouteHint_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
77674         LDKRouteHint a_conv;
77675         a_conv.inner = untag_ptr(a);
77676         a_conv.is_owned = ptr_is_owned(a);
77677         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
77678         a_conv.is_owned = false;
77679         LDKRouteHint b_conv;
77680         b_conv.inner = untag_ptr(b);
77681         b_conv.is_owned = ptr_is_owned(b);
77682         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
77683         b_conv.is_owned = false;
77684         jboolean ret_conv = RouteHint_eq(&a_conv, &b_conv);
77685         return ret_conv;
77686 }
77687
77688 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RouteHint_1write(JNIEnv *env, jclass clz, int64_t obj) {
77689         LDKRouteHint obj_conv;
77690         obj_conv.inner = untag_ptr(obj);
77691         obj_conv.is_owned = ptr_is_owned(obj);
77692         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
77693         obj_conv.is_owned = false;
77694         LDKCVec_u8Z ret_var = RouteHint_write(&obj_conv);
77695         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
77696         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
77697         CVec_u8Z_free(ret_var);
77698         return ret_arr;
77699 }
77700
77701 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHint_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
77702         LDKu8slice ser_ref;
77703         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
77704         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
77705         LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
77706         *ret_conv = RouteHint_read(ser_ref);
77707         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
77708         return tag_ptr(ret_conv, true);
77709 }
77710
77711 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
77712         LDKRouteHintHop this_obj_conv;
77713         this_obj_conv.inner = untag_ptr(this_obj);
77714         this_obj_conv.is_owned = ptr_is_owned(this_obj);
77715         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
77716         RouteHintHop_free(this_obj_conv);
77717 }
77718
77719 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1src_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
77720         LDKRouteHintHop this_ptr_conv;
77721         this_ptr_conv.inner = untag_ptr(this_ptr);
77722         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
77723         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
77724         this_ptr_conv.is_owned = false;
77725         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
77726         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, RouteHintHop_get_src_node_id(&this_ptr_conv).compressed_form);
77727         return ret_arr;
77728 }
77729
77730 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1src_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
77731         LDKRouteHintHop this_ptr_conv;
77732         this_ptr_conv.inner = untag_ptr(this_ptr);
77733         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
77734         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
77735         this_ptr_conv.is_owned = false;
77736         LDKPublicKey val_ref;
77737         CHECK((*env)->GetArrayLength(env, val) == 33);
77738         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
77739         RouteHintHop_set_src_node_id(&this_ptr_conv, val_ref);
77740 }
77741
77742 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
77743         LDKRouteHintHop this_ptr_conv;
77744         this_ptr_conv.inner = untag_ptr(this_ptr);
77745         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
77746         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
77747         this_ptr_conv.is_owned = false;
77748         int64_t ret_conv = RouteHintHop_get_short_channel_id(&this_ptr_conv);
77749         return ret_conv;
77750 }
77751
77752 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
77753         LDKRouteHintHop this_ptr_conv;
77754         this_ptr_conv.inner = untag_ptr(this_ptr);
77755         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
77756         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
77757         this_ptr_conv.is_owned = false;
77758         RouteHintHop_set_short_channel_id(&this_ptr_conv, val);
77759 }
77760
77761 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1fees(JNIEnv *env, jclass clz, int64_t this_ptr) {
77762         LDKRouteHintHop this_ptr_conv;
77763         this_ptr_conv.inner = untag_ptr(this_ptr);
77764         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
77765         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
77766         this_ptr_conv.is_owned = false;
77767         LDKRoutingFees ret_var = RouteHintHop_get_fees(&this_ptr_conv);
77768         int64_t ret_ref = 0;
77769         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
77770         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
77771         return ret_ref;
77772 }
77773
77774 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1fees(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
77775         LDKRouteHintHop this_ptr_conv;
77776         this_ptr_conv.inner = untag_ptr(this_ptr);
77777         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
77778         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
77779         this_ptr_conv.is_owned = false;
77780         LDKRoutingFees val_conv;
77781         val_conv.inner = untag_ptr(val);
77782         val_conv.is_owned = ptr_is_owned(val);
77783         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
77784         val_conv = RoutingFees_clone(&val_conv);
77785         RouteHintHop_set_fees(&this_ptr_conv, val_conv);
77786 }
77787
77788 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
77789         LDKRouteHintHop this_ptr_conv;
77790         this_ptr_conv.inner = untag_ptr(this_ptr);
77791         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
77792         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
77793         this_ptr_conv.is_owned = false;
77794         int16_t ret_conv = RouteHintHop_get_cltv_expiry_delta(&this_ptr_conv);
77795         return ret_conv;
77796 }
77797
77798 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
77799         LDKRouteHintHop this_ptr_conv;
77800         this_ptr_conv.inner = untag_ptr(this_ptr);
77801         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
77802         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
77803         this_ptr_conv.is_owned = false;
77804         RouteHintHop_set_cltv_expiry_delta(&this_ptr_conv, val);
77805 }
77806
77807 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
77808         LDKRouteHintHop this_ptr_conv;
77809         this_ptr_conv.inner = untag_ptr(this_ptr);
77810         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
77811         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
77812         this_ptr_conv.is_owned = false;
77813         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
77814         *ret_copy = RouteHintHop_get_htlc_minimum_msat(&this_ptr_conv);
77815         int64_t ret_ref = tag_ptr(ret_copy, true);
77816         return ret_ref;
77817 }
77818
77819 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
77820         LDKRouteHintHop this_ptr_conv;
77821         this_ptr_conv.inner = untag_ptr(this_ptr);
77822         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
77823         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
77824         this_ptr_conv.is_owned = false;
77825         void* val_ptr = untag_ptr(val);
77826         CHECK_ACCESS(val_ptr);
77827         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
77828         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
77829         RouteHintHop_set_htlc_minimum_msat(&this_ptr_conv, val_conv);
77830 }
77831
77832 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
77833         LDKRouteHintHop this_ptr_conv;
77834         this_ptr_conv.inner = untag_ptr(this_ptr);
77835         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
77836         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
77837         this_ptr_conv.is_owned = false;
77838         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
77839         *ret_copy = RouteHintHop_get_htlc_maximum_msat(&this_ptr_conv);
77840         int64_t ret_ref = tag_ptr(ret_copy, true);
77841         return ret_ref;
77842 }
77843
77844 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
77845         LDKRouteHintHop this_ptr_conv;
77846         this_ptr_conv.inner = untag_ptr(this_ptr);
77847         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
77848         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
77849         this_ptr_conv.is_owned = false;
77850         void* val_ptr = untag_ptr(val);
77851         CHECK_ACCESS(val_ptr);
77852         LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
77853         val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
77854         RouteHintHop_set_htlc_maximum_msat(&this_ptr_conv, val_conv);
77855 }
77856
77857 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) {
77858         LDKPublicKey src_node_id_arg_ref;
77859         CHECK((*env)->GetArrayLength(env, src_node_id_arg) == 33);
77860         (*env)->GetByteArrayRegion(env, src_node_id_arg, 0, 33, src_node_id_arg_ref.compressed_form);
77861         LDKRoutingFees fees_arg_conv;
77862         fees_arg_conv.inner = untag_ptr(fees_arg);
77863         fees_arg_conv.is_owned = ptr_is_owned(fees_arg);
77864         CHECK_INNER_FIELD_ACCESS_OR_NULL(fees_arg_conv);
77865         fees_arg_conv = RoutingFees_clone(&fees_arg_conv);
77866         void* htlc_minimum_msat_arg_ptr = untag_ptr(htlc_minimum_msat_arg);
77867         CHECK_ACCESS(htlc_minimum_msat_arg_ptr);
77868         LDKCOption_u64Z htlc_minimum_msat_arg_conv = *(LDKCOption_u64Z*)(htlc_minimum_msat_arg_ptr);
77869         htlc_minimum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(htlc_minimum_msat_arg));
77870         void* htlc_maximum_msat_arg_ptr = untag_ptr(htlc_maximum_msat_arg);
77871         CHECK_ACCESS(htlc_maximum_msat_arg_ptr);
77872         LDKCOption_u64Z htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(htlc_maximum_msat_arg_ptr);
77873         htlc_maximum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(htlc_maximum_msat_arg));
77874         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);
77875         int64_t ret_ref = 0;
77876         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
77877         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
77878         return ret_ref;
77879 }
77880
77881 static inline uint64_t RouteHintHop_clone_ptr(LDKRouteHintHop *NONNULL_PTR arg) {
77882         LDKRouteHintHop ret_var = RouteHintHop_clone(arg);
77883         int64_t ret_ref = 0;
77884         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
77885         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
77886         return ret_ref;
77887 }
77888 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
77889         LDKRouteHintHop arg_conv;
77890         arg_conv.inner = untag_ptr(arg);
77891         arg_conv.is_owned = ptr_is_owned(arg);
77892         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
77893         arg_conv.is_owned = false;
77894         int64_t ret_conv = RouteHintHop_clone_ptr(&arg_conv);
77895         return ret_conv;
77896 }
77897
77898 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1clone(JNIEnv *env, jclass clz, int64_t orig) {
77899         LDKRouteHintHop orig_conv;
77900         orig_conv.inner = untag_ptr(orig);
77901         orig_conv.is_owned = ptr_is_owned(orig);
77902         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
77903         orig_conv.is_owned = false;
77904         LDKRouteHintHop ret_var = RouteHintHop_clone(&orig_conv);
77905         int64_t ret_ref = 0;
77906         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
77907         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
77908         return ret_ref;
77909 }
77910
77911 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1hash(JNIEnv *env, jclass clz, int64_t o) {
77912         LDKRouteHintHop o_conv;
77913         o_conv.inner = untag_ptr(o);
77914         o_conv.is_owned = ptr_is_owned(o);
77915         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
77916         o_conv.is_owned = false;
77917         int64_t ret_conv = RouteHintHop_hash(&o_conv);
77918         return ret_conv;
77919 }
77920
77921 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
77922         LDKRouteHintHop a_conv;
77923         a_conv.inner = untag_ptr(a);
77924         a_conv.is_owned = ptr_is_owned(a);
77925         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
77926         a_conv.is_owned = false;
77927         LDKRouteHintHop b_conv;
77928         b_conv.inner = untag_ptr(b);
77929         b_conv.is_owned = ptr_is_owned(b);
77930         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
77931         b_conv.is_owned = false;
77932         jboolean ret_conv = RouteHintHop_eq(&a_conv, &b_conv);
77933         return ret_conv;
77934 }
77935
77936 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1write(JNIEnv *env, jclass clz, int64_t obj) {
77937         LDKRouteHintHop obj_conv;
77938         obj_conv.inner = untag_ptr(obj);
77939         obj_conv.is_owned = ptr_is_owned(obj);
77940         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
77941         obj_conv.is_owned = false;
77942         LDKCVec_u8Z ret_var = RouteHintHop_write(&obj_conv);
77943         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
77944         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
77945         CVec_u8Z_free(ret_var);
77946         return ret_arr;
77947 }
77948
77949 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
77950         LDKu8slice ser_ref;
77951         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
77952         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
77953         LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
77954         *ret_conv = RouteHintHop_read(ser_ref);
77955         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
77956         return tag_ptr(ret_conv, true);
77957 }
77958
77959 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FirstHopCandidate_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
77960         LDKFirstHopCandidate this_obj_conv;
77961         this_obj_conv.inner = untag_ptr(this_obj);
77962         this_obj_conv.is_owned = ptr_is_owned(this_obj);
77963         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
77964         FirstHopCandidate_free(this_obj_conv);
77965 }
77966
77967 static inline uint64_t FirstHopCandidate_clone_ptr(LDKFirstHopCandidate *NONNULL_PTR arg) {
77968         LDKFirstHopCandidate ret_var = FirstHopCandidate_clone(arg);
77969         int64_t ret_ref = 0;
77970         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
77971         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
77972         return ret_ref;
77973 }
77974 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FirstHopCandidate_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
77975         LDKFirstHopCandidate arg_conv;
77976         arg_conv.inner = untag_ptr(arg);
77977         arg_conv.is_owned = ptr_is_owned(arg);
77978         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
77979         arg_conv.is_owned = false;
77980         int64_t ret_conv = FirstHopCandidate_clone_ptr(&arg_conv);
77981         return ret_conv;
77982 }
77983
77984 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FirstHopCandidate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
77985         LDKFirstHopCandidate orig_conv;
77986         orig_conv.inner = untag_ptr(orig);
77987         orig_conv.is_owned = ptr_is_owned(orig);
77988         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
77989         orig_conv.is_owned = false;
77990         LDKFirstHopCandidate ret_var = FirstHopCandidate_clone(&orig_conv);
77991         int64_t ret_ref = 0;
77992         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
77993         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
77994         return ret_ref;
77995 }
77996
77997 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PublicHopCandidate_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
77998         LDKPublicHopCandidate this_obj_conv;
77999         this_obj_conv.inner = untag_ptr(this_obj);
78000         this_obj_conv.is_owned = ptr_is_owned(this_obj);
78001         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
78002         PublicHopCandidate_free(this_obj_conv);
78003 }
78004
78005 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PublicHopCandidate_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
78006         LDKPublicHopCandidate this_ptr_conv;
78007         this_ptr_conv.inner = untag_ptr(this_ptr);
78008         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
78009         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
78010         this_ptr_conv.is_owned = false;
78011         int64_t ret_conv = PublicHopCandidate_get_short_channel_id(&this_ptr_conv);
78012         return ret_conv;
78013 }
78014
78015 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PublicHopCandidate_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
78016         LDKPublicHopCandidate this_ptr_conv;
78017         this_ptr_conv.inner = untag_ptr(this_ptr);
78018         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
78019         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
78020         this_ptr_conv.is_owned = false;
78021         PublicHopCandidate_set_short_channel_id(&this_ptr_conv, val);
78022 }
78023
78024 static inline uint64_t PublicHopCandidate_clone_ptr(LDKPublicHopCandidate *NONNULL_PTR arg) {
78025         LDKPublicHopCandidate ret_var = PublicHopCandidate_clone(arg);
78026         int64_t ret_ref = 0;
78027         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
78028         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
78029         return ret_ref;
78030 }
78031 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PublicHopCandidate_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
78032         LDKPublicHopCandidate arg_conv;
78033         arg_conv.inner = untag_ptr(arg);
78034         arg_conv.is_owned = ptr_is_owned(arg);
78035         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
78036         arg_conv.is_owned = false;
78037         int64_t ret_conv = PublicHopCandidate_clone_ptr(&arg_conv);
78038         return ret_conv;
78039 }
78040
78041 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PublicHopCandidate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
78042         LDKPublicHopCandidate orig_conv;
78043         orig_conv.inner = untag_ptr(orig);
78044         orig_conv.is_owned = ptr_is_owned(orig);
78045         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
78046         orig_conv.is_owned = false;
78047         LDKPublicHopCandidate ret_var = PublicHopCandidate_clone(&orig_conv);
78048         int64_t ret_ref = 0;
78049         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
78050         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
78051         return ret_ref;
78052 }
78053
78054 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PrivateHopCandidate_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
78055         LDKPrivateHopCandidate this_obj_conv;
78056         this_obj_conv.inner = untag_ptr(this_obj);
78057         this_obj_conv.is_owned = ptr_is_owned(this_obj);
78058         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
78059         PrivateHopCandidate_free(this_obj_conv);
78060 }
78061
78062 static inline uint64_t PrivateHopCandidate_clone_ptr(LDKPrivateHopCandidate *NONNULL_PTR arg) {
78063         LDKPrivateHopCandidate ret_var = PrivateHopCandidate_clone(arg);
78064         int64_t ret_ref = 0;
78065         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
78066         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
78067         return ret_ref;
78068 }
78069 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PrivateHopCandidate_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
78070         LDKPrivateHopCandidate arg_conv;
78071         arg_conv.inner = untag_ptr(arg);
78072         arg_conv.is_owned = ptr_is_owned(arg);
78073         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
78074         arg_conv.is_owned = false;
78075         int64_t ret_conv = PrivateHopCandidate_clone_ptr(&arg_conv);
78076         return ret_conv;
78077 }
78078
78079 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PrivateHopCandidate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
78080         LDKPrivateHopCandidate orig_conv;
78081         orig_conv.inner = untag_ptr(orig);
78082         orig_conv.is_owned = ptr_is_owned(orig);
78083         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
78084         orig_conv.is_owned = false;
78085         LDKPrivateHopCandidate ret_var = PrivateHopCandidate_clone(&orig_conv);
78086         int64_t ret_ref = 0;
78087         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
78088         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
78089         return ret_ref;
78090 }
78091
78092 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BlindedPathCandidate_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
78093         LDKBlindedPathCandidate this_obj_conv;
78094         this_obj_conv.inner = untag_ptr(this_obj);
78095         this_obj_conv.is_owned = ptr_is_owned(this_obj);
78096         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
78097         BlindedPathCandidate_free(this_obj_conv);
78098 }
78099
78100 static inline uint64_t BlindedPathCandidate_clone_ptr(LDKBlindedPathCandidate *NONNULL_PTR arg) {
78101         LDKBlindedPathCandidate ret_var = BlindedPathCandidate_clone(arg);
78102         int64_t ret_ref = 0;
78103         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
78104         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
78105         return ret_ref;
78106 }
78107 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedPathCandidate_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
78108         LDKBlindedPathCandidate arg_conv;
78109         arg_conv.inner = untag_ptr(arg);
78110         arg_conv.is_owned = ptr_is_owned(arg);
78111         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
78112         arg_conv.is_owned = false;
78113         int64_t ret_conv = BlindedPathCandidate_clone_ptr(&arg_conv);
78114         return ret_conv;
78115 }
78116
78117 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedPathCandidate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
78118         LDKBlindedPathCandidate orig_conv;
78119         orig_conv.inner = untag_ptr(orig);
78120         orig_conv.is_owned = ptr_is_owned(orig);
78121         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
78122         orig_conv.is_owned = false;
78123         LDKBlindedPathCandidate ret_var = BlindedPathCandidate_clone(&orig_conv);
78124         int64_t ret_ref = 0;
78125         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
78126         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
78127         return ret_ref;
78128 }
78129
78130 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OneHopBlindedPathCandidate_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
78131         LDKOneHopBlindedPathCandidate this_obj_conv;
78132         this_obj_conv.inner = untag_ptr(this_obj);
78133         this_obj_conv.is_owned = ptr_is_owned(this_obj);
78134         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
78135         OneHopBlindedPathCandidate_free(this_obj_conv);
78136 }
78137
78138 static inline uint64_t OneHopBlindedPathCandidate_clone_ptr(LDKOneHopBlindedPathCandidate *NONNULL_PTR arg) {
78139         LDKOneHopBlindedPathCandidate ret_var = OneHopBlindedPathCandidate_clone(arg);
78140         int64_t ret_ref = 0;
78141         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
78142         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
78143         return ret_ref;
78144 }
78145 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OneHopBlindedPathCandidate_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
78146         LDKOneHopBlindedPathCandidate arg_conv;
78147         arg_conv.inner = untag_ptr(arg);
78148         arg_conv.is_owned = ptr_is_owned(arg);
78149         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
78150         arg_conv.is_owned = false;
78151         int64_t ret_conv = OneHopBlindedPathCandidate_clone_ptr(&arg_conv);
78152         return ret_conv;
78153 }
78154
78155 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OneHopBlindedPathCandidate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
78156         LDKOneHopBlindedPathCandidate orig_conv;
78157         orig_conv.inner = untag_ptr(orig);
78158         orig_conv.is_owned = ptr_is_owned(orig);
78159         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
78160         orig_conv.is_owned = false;
78161         LDKOneHopBlindedPathCandidate ret_var = OneHopBlindedPathCandidate_clone(&orig_conv);
78162         int64_t ret_ref = 0;
78163         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
78164         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
78165         return ret_ref;
78166 }
78167
78168 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CandidateRouteHop_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
78169         if (!ptr_is_owned(this_ptr)) return;
78170         void* this_ptr_ptr = untag_ptr(this_ptr);
78171         CHECK_ACCESS(this_ptr_ptr);
78172         LDKCandidateRouteHop this_ptr_conv = *(LDKCandidateRouteHop*)(this_ptr_ptr);
78173         FREE(untag_ptr(this_ptr));
78174         CandidateRouteHop_free(this_ptr_conv);
78175 }
78176
78177 static inline uint64_t CandidateRouteHop_clone_ptr(LDKCandidateRouteHop *NONNULL_PTR arg) {
78178         LDKCandidateRouteHop *ret_copy = MALLOC(sizeof(LDKCandidateRouteHop), "LDKCandidateRouteHop");
78179         *ret_copy = CandidateRouteHop_clone(arg);
78180         int64_t ret_ref = tag_ptr(ret_copy, true);
78181         return ret_ref;
78182 }
78183 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CandidateRouteHop_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
78184         LDKCandidateRouteHop* arg_conv = (LDKCandidateRouteHop*)untag_ptr(arg);
78185         int64_t ret_conv = CandidateRouteHop_clone_ptr(arg_conv);
78186         return ret_conv;
78187 }
78188
78189 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CandidateRouteHop_1clone(JNIEnv *env, jclass clz, int64_t orig) {
78190         LDKCandidateRouteHop* orig_conv = (LDKCandidateRouteHop*)untag_ptr(orig);
78191         LDKCandidateRouteHop *ret_copy = MALLOC(sizeof(LDKCandidateRouteHop), "LDKCandidateRouteHop");
78192         *ret_copy = CandidateRouteHop_clone(orig_conv);
78193         int64_t ret_ref = tag_ptr(ret_copy, true);
78194         return ret_ref;
78195 }
78196
78197 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CandidateRouteHop_1first_1hop(JNIEnv *env, jclass clz, int64_t a) {
78198         LDKFirstHopCandidate a_conv;
78199         a_conv.inner = untag_ptr(a);
78200         a_conv.is_owned = ptr_is_owned(a);
78201         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
78202         a_conv = FirstHopCandidate_clone(&a_conv);
78203         LDKCandidateRouteHop *ret_copy = MALLOC(sizeof(LDKCandidateRouteHop), "LDKCandidateRouteHop");
78204         *ret_copy = CandidateRouteHop_first_hop(a_conv);
78205         int64_t ret_ref = tag_ptr(ret_copy, true);
78206         return ret_ref;
78207 }
78208
78209 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CandidateRouteHop_1public_1hop(JNIEnv *env, jclass clz, int64_t a) {
78210         LDKPublicHopCandidate a_conv;
78211         a_conv.inner = untag_ptr(a);
78212         a_conv.is_owned = ptr_is_owned(a);
78213         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
78214         a_conv = PublicHopCandidate_clone(&a_conv);
78215         LDKCandidateRouteHop *ret_copy = MALLOC(sizeof(LDKCandidateRouteHop), "LDKCandidateRouteHop");
78216         *ret_copy = CandidateRouteHop_public_hop(a_conv);
78217         int64_t ret_ref = tag_ptr(ret_copy, true);
78218         return ret_ref;
78219 }
78220
78221 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CandidateRouteHop_1private_1hop(JNIEnv *env, jclass clz, int64_t a) {
78222         LDKPrivateHopCandidate a_conv;
78223         a_conv.inner = untag_ptr(a);
78224         a_conv.is_owned = ptr_is_owned(a);
78225         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
78226         a_conv = PrivateHopCandidate_clone(&a_conv);
78227         LDKCandidateRouteHop *ret_copy = MALLOC(sizeof(LDKCandidateRouteHop), "LDKCandidateRouteHop");
78228         *ret_copy = CandidateRouteHop_private_hop(a_conv);
78229         int64_t ret_ref = tag_ptr(ret_copy, true);
78230         return ret_ref;
78231 }
78232
78233 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CandidateRouteHop_1blinded(JNIEnv *env, jclass clz, int64_t a) {
78234         LDKBlindedPathCandidate a_conv;
78235         a_conv.inner = untag_ptr(a);
78236         a_conv.is_owned = ptr_is_owned(a);
78237         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
78238         a_conv = BlindedPathCandidate_clone(&a_conv);
78239         LDKCandidateRouteHop *ret_copy = MALLOC(sizeof(LDKCandidateRouteHop), "LDKCandidateRouteHop");
78240         *ret_copy = CandidateRouteHop_blinded(a_conv);
78241         int64_t ret_ref = tag_ptr(ret_copy, true);
78242         return ret_ref;
78243 }
78244
78245 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CandidateRouteHop_1one_1hop_1blinded(JNIEnv *env, jclass clz, int64_t a) {
78246         LDKOneHopBlindedPathCandidate a_conv;
78247         a_conv.inner = untag_ptr(a);
78248         a_conv.is_owned = ptr_is_owned(a);
78249         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
78250         a_conv = OneHopBlindedPathCandidate_clone(&a_conv);
78251         LDKCandidateRouteHop *ret_copy = MALLOC(sizeof(LDKCandidateRouteHop), "LDKCandidateRouteHop");
78252         *ret_copy = CandidateRouteHop_one_hop_blinded(a_conv);
78253         int64_t ret_ref = tag_ptr(ret_copy, true);
78254         return ret_ref;
78255 }
78256
78257 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CandidateRouteHop_1globally_1unique_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
78258         LDKCandidateRouteHop* this_arg_conv = (LDKCandidateRouteHop*)untag_ptr(this_arg);
78259         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
78260         *ret_copy = CandidateRouteHop_globally_unique_short_channel_id(this_arg_conv);
78261         int64_t ret_ref = tag_ptr(ret_copy, true);
78262         return ret_ref;
78263 }
78264
78265 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_CandidateRouteHop_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_arg) {
78266         LDKCandidateRouteHop* this_arg_conv = (LDKCandidateRouteHop*)untag_ptr(this_arg);
78267         int32_t ret_conv = CandidateRouteHop_cltv_expiry_delta(this_arg_conv);
78268         return ret_conv;
78269 }
78270
78271 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CandidateRouteHop_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_arg) {
78272         LDKCandidateRouteHop* this_arg_conv = (LDKCandidateRouteHop*)untag_ptr(this_arg);
78273         int64_t ret_conv = CandidateRouteHop_htlc_minimum_msat(this_arg_conv);
78274         return ret_conv;
78275 }
78276
78277 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CandidateRouteHop_1fees(JNIEnv *env, jclass clz, int64_t this_arg) {
78278         LDKCandidateRouteHop* this_arg_conv = (LDKCandidateRouteHop*)untag_ptr(this_arg);
78279         LDKRoutingFees ret_var = CandidateRouteHop_fees(this_arg_conv);
78280         int64_t ret_ref = 0;
78281         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
78282         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
78283         return ret_ref;
78284 }
78285
78286 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CandidateRouteHop_1source(JNIEnv *env, jclass clz, int64_t this_arg) {
78287         LDKCandidateRouteHop* this_arg_conv = (LDKCandidateRouteHop*)untag_ptr(this_arg);
78288         LDKNodeId ret_var = CandidateRouteHop_source(this_arg_conv);
78289         int64_t ret_ref = 0;
78290         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
78291         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
78292         return ret_ref;
78293 }
78294
78295 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CandidateRouteHop_1target(JNIEnv *env, jclass clz, int64_t this_arg) {
78296         LDKCandidateRouteHop* this_arg_conv = (LDKCandidateRouteHop*)untag_ptr(this_arg);
78297         LDKNodeId ret_var = CandidateRouteHop_target(this_arg_conv);
78298         int64_t ret_ref = 0;
78299         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
78300         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
78301         return ret_ref;
78302 }
78303
78304 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) {
78305         LDKPublicKey our_node_pubkey_ref;
78306         CHECK((*env)->GetArrayLength(env, our_node_pubkey) == 33);
78307         (*env)->GetByteArrayRegion(env, our_node_pubkey, 0, 33, our_node_pubkey_ref.compressed_form);
78308         LDKRouteParameters route_params_conv;
78309         route_params_conv.inner = untag_ptr(route_params);
78310         route_params_conv.is_owned = ptr_is_owned(route_params);
78311         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
78312         route_params_conv.is_owned = false;
78313         LDKNetworkGraph network_graph_conv;
78314         network_graph_conv.inner = untag_ptr(network_graph);
78315         network_graph_conv.is_owned = ptr_is_owned(network_graph);
78316         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
78317         network_graph_conv.is_owned = false;
78318         LDKCVec_ChannelDetailsZ first_hops_constr;
78319         LDKCVec_ChannelDetailsZ *first_hops_ptr = NULL;
78320         if (first_hops != NULL) {
78321                 first_hops_constr.datalen = (*env)->GetArrayLength(env, first_hops);
78322                 if (first_hops_constr.datalen > 0)
78323                         first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
78324                 else
78325                         first_hops_constr.data = NULL;
78326                 int64_t* first_hops_vals = (*env)->GetLongArrayElements (env, first_hops, NULL);
78327                 for (size_t q = 0; q < first_hops_constr.datalen; q++) {
78328                         int64_t first_hops_conv_16 = first_hops_vals[q];
78329                         LDKChannelDetails first_hops_conv_16_conv;
78330                         first_hops_conv_16_conv.inner = untag_ptr(first_hops_conv_16);
78331                         first_hops_conv_16_conv.is_owned = ptr_is_owned(first_hops_conv_16);
78332                         CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_conv);
78333                         first_hops_conv_16_conv.is_owned = false;
78334                         first_hops_constr.data[q] = first_hops_conv_16_conv;
78335                 }
78336                 (*env)->ReleaseLongArrayElements(env, first_hops, first_hops_vals, 0);
78337                 first_hops_ptr = &first_hops_constr;
78338         }
78339         void* logger_ptr = untag_ptr(logger);
78340         CHECK_ACCESS(logger_ptr);
78341         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
78342         if (logger_conv.free == LDKLogger_JCalls_free) {
78343                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
78344                 LDKLogger_JCalls_cloned(&logger_conv);
78345         }
78346         void* scorer_ptr = untag_ptr(scorer);
78347         if (ptr_is_owned(scorer)) { CHECK_ACCESS(scorer_ptr); }
78348         LDKScoreLookUp* scorer_conv = (LDKScoreLookUp*)scorer_ptr;
78349         LDKProbabilisticScoringFeeParameters score_params_conv;
78350         score_params_conv.inner = untag_ptr(score_params);
78351         score_params_conv.is_owned = ptr_is_owned(score_params);
78352         CHECK_INNER_FIELD_ACCESS_OR_NULL(score_params_conv);
78353         score_params_conv.is_owned = false;
78354         uint8_t random_seed_bytes_arr[32];
78355         CHECK((*env)->GetArrayLength(env, random_seed_bytes) == 32);
78356         (*env)->GetByteArrayRegion(env, random_seed_bytes, 0, 32, random_seed_bytes_arr);
78357         uint8_t (*random_seed_bytes_ref)[32] = &random_seed_bytes_arr;
78358         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
78359         *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);
78360         if (first_hops_ptr != NULL) { FREE(first_hops_constr.data); }
78361         return tag_ptr(ret_conv, true);
78362 }
78363
78364 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) {
78365         LDKPublicKey our_node_pubkey_ref;
78366         CHECK((*env)->GetArrayLength(env, our_node_pubkey) == 33);
78367         (*env)->GetByteArrayRegion(env, our_node_pubkey, 0, 33, our_node_pubkey_ref.compressed_form);
78368         LDKCVec_PublicKeyZ hops_constr;
78369         hops_constr.datalen = (*env)->GetArrayLength(env, hops);
78370         if (hops_constr.datalen > 0)
78371                 hops_constr.data = MALLOC(hops_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
78372         else
78373                 hops_constr.data = NULL;
78374         for (size_t i = 0; i < hops_constr.datalen; i++) {
78375                 int8_tArray hops_conv_8 = (*env)->GetObjectArrayElement(env, hops, i);
78376                 LDKPublicKey hops_conv_8_ref;
78377                 CHECK((*env)->GetArrayLength(env, hops_conv_8) == 33);
78378                 (*env)->GetByteArrayRegion(env, hops_conv_8, 0, 33, hops_conv_8_ref.compressed_form);
78379                 hops_constr.data[i] = hops_conv_8_ref;
78380         }
78381         LDKRouteParameters route_params_conv;
78382         route_params_conv.inner = untag_ptr(route_params);
78383         route_params_conv.is_owned = ptr_is_owned(route_params);
78384         CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
78385         route_params_conv.is_owned = false;
78386         LDKNetworkGraph network_graph_conv;
78387         network_graph_conv.inner = untag_ptr(network_graph);
78388         network_graph_conv.is_owned = ptr_is_owned(network_graph);
78389         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
78390         network_graph_conv.is_owned = false;
78391         void* logger_ptr = untag_ptr(logger);
78392         CHECK_ACCESS(logger_ptr);
78393         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
78394         if (logger_conv.free == LDKLogger_JCalls_free) {
78395                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
78396                 LDKLogger_JCalls_cloned(&logger_conv);
78397         }
78398         uint8_t random_seed_bytes_arr[32];
78399         CHECK((*env)->GetArrayLength(env, random_seed_bytes) == 32);
78400         (*env)->GetByteArrayRegion(env, random_seed_bytes, 0, 32, random_seed_bytes_arr);
78401         uint8_t (*random_seed_bytes_ref)[32] = &random_seed_bytes_arr;
78402         LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
78403         *ret_conv = build_route_from_hops(our_node_pubkey_ref, hops_constr, &route_params_conv, &network_graph_conv, logger_conv, random_seed_bytes_ref);
78404         return tag_ptr(ret_conv, true);
78405 }
78406
78407 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ScoreLookUp_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
78408         if (!ptr_is_owned(this_ptr)) return;
78409         void* this_ptr_ptr = untag_ptr(this_ptr);
78410         CHECK_ACCESS(this_ptr_ptr);
78411         LDKScoreLookUp this_ptr_conv = *(LDKScoreLookUp*)(this_ptr_ptr);
78412         FREE(untag_ptr(this_ptr));
78413         ScoreLookUp_free(this_ptr_conv);
78414 }
78415
78416 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ScoreUpdate_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
78417         if (!ptr_is_owned(this_ptr)) return;
78418         void* this_ptr_ptr = untag_ptr(this_ptr);
78419         CHECK_ACCESS(this_ptr_ptr);
78420         LDKScoreUpdate this_ptr_conv = *(LDKScoreUpdate*)(this_ptr_ptr);
78421         FREE(untag_ptr(this_ptr));
78422         ScoreUpdate_free(this_ptr_conv);
78423 }
78424
78425 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Score_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
78426         if (!ptr_is_owned(this_ptr)) return;
78427         void* this_ptr_ptr = untag_ptr(this_ptr);
78428         CHECK_ACCESS(this_ptr_ptr);
78429         LDKScore this_ptr_conv = *(LDKScore*)(this_ptr_ptr);
78430         FREE(untag_ptr(this_ptr));
78431         Score_free(this_ptr_conv);
78432 }
78433
78434 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LockableScore_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
78435         if (!ptr_is_owned(this_ptr)) return;
78436         void* this_ptr_ptr = untag_ptr(this_ptr);
78437         CHECK_ACCESS(this_ptr_ptr);
78438         LDKLockableScore this_ptr_conv = *(LDKLockableScore*)(this_ptr_ptr);
78439         FREE(untag_ptr(this_ptr));
78440         LockableScore_free(this_ptr_conv);
78441 }
78442
78443 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WriteableScore_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
78444         if (!ptr_is_owned(this_ptr)) return;
78445         void* this_ptr_ptr = untag_ptr(this_ptr);
78446         CHECK_ACCESS(this_ptr_ptr);
78447         LDKWriteableScore this_ptr_conv = *(LDKWriteableScore*)(this_ptr_ptr);
78448         FREE(untag_ptr(this_ptr));
78449         WriteableScore_free(this_ptr_conv);
78450 }
78451
78452 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MultiThreadedLockableScore_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
78453         LDKMultiThreadedLockableScore this_obj_conv;
78454         this_obj_conv.inner = untag_ptr(this_obj);
78455         this_obj_conv.is_owned = ptr_is_owned(this_obj);
78456         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
78457         MultiThreadedLockableScore_free(this_obj_conv);
78458 }
78459
78460 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MultiThreadedLockableScore_1as_1LockableScore(JNIEnv *env, jclass clz, int64_t this_arg) {
78461         LDKMultiThreadedLockableScore this_arg_conv;
78462         this_arg_conv.inner = untag_ptr(this_arg);
78463         this_arg_conv.is_owned = ptr_is_owned(this_arg);
78464         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
78465         this_arg_conv.is_owned = false;
78466         LDKLockableScore* ret_ret = MALLOC(sizeof(LDKLockableScore), "LDKLockableScore");
78467         *ret_ret = MultiThreadedLockableScore_as_LockableScore(&this_arg_conv);
78468         return tag_ptr(ret_ret, true);
78469 }
78470
78471 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_MultiThreadedLockableScore_1write(JNIEnv *env, jclass clz, int64_t obj) {
78472         LDKMultiThreadedLockableScore obj_conv;
78473         obj_conv.inner = untag_ptr(obj);
78474         obj_conv.is_owned = ptr_is_owned(obj);
78475         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
78476         obj_conv.is_owned = false;
78477         LDKCVec_u8Z ret_var = MultiThreadedLockableScore_write(&obj_conv);
78478         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
78479         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
78480         CVec_u8Z_free(ret_var);
78481         return ret_arr;
78482 }
78483
78484 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MultiThreadedLockableScore_1as_1WriteableScore(JNIEnv *env, jclass clz, int64_t this_arg) {
78485         LDKMultiThreadedLockableScore this_arg_conv;
78486         this_arg_conv.inner = untag_ptr(this_arg);
78487         this_arg_conv.is_owned = ptr_is_owned(this_arg);
78488         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
78489         this_arg_conv.is_owned = false;
78490         LDKWriteableScore* ret_ret = MALLOC(sizeof(LDKWriteableScore), "LDKWriteableScore");
78491         *ret_ret = MultiThreadedLockableScore_as_WriteableScore(&this_arg_conv);
78492         return tag_ptr(ret_ret, true);
78493 }
78494
78495 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MultiThreadedLockableScore_1new(JNIEnv *env, jclass clz, int64_t score) {
78496         void* score_ptr = untag_ptr(score);
78497         CHECK_ACCESS(score_ptr);
78498         LDKScore score_conv = *(LDKScore*)(score_ptr);
78499         if (score_conv.free == LDKScore_JCalls_free) {
78500                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
78501                 LDKScore_JCalls_cloned(&score_conv);
78502         }
78503         LDKMultiThreadedLockableScore ret_var = MultiThreadedLockableScore_new(score_conv);
78504         int64_t ret_ref = 0;
78505         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
78506         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
78507         return ret_ref;
78508 }
78509
78510 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MultiThreadedScoreLockRead_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
78511         LDKMultiThreadedScoreLockRead this_obj_conv;
78512         this_obj_conv.inner = untag_ptr(this_obj);
78513         this_obj_conv.is_owned = ptr_is_owned(this_obj);
78514         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
78515         MultiThreadedScoreLockRead_free(this_obj_conv);
78516 }
78517
78518 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MultiThreadedScoreLockWrite_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
78519         LDKMultiThreadedScoreLockWrite this_obj_conv;
78520         this_obj_conv.inner = untag_ptr(this_obj);
78521         this_obj_conv.is_owned = ptr_is_owned(this_obj);
78522         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
78523         MultiThreadedScoreLockWrite_free(this_obj_conv);
78524 }
78525
78526 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MultiThreadedScoreLockRead_1as_1ScoreLookUp(JNIEnv *env, jclass clz, int64_t this_arg) {
78527         LDKMultiThreadedScoreLockRead this_arg_conv;
78528         this_arg_conv.inner = untag_ptr(this_arg);
78529         this_arg_conv.is_owned = ptr_is_owned(this_arg);
78530         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
78531         this_arg_conv.is_owned = false;
78532         LDKScoreLookUp* ret_ret = MALLOC(sizeof(LDKScoreLookUp), "LDKScoreLookUp");
78533         *ret_ret = MultiThreadedScoreLockRead_as_ScoreLookUp(&this_arg_conv);
78534         return tag_ptr(ret_ret, true);
78535 }
78536
78537 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_MultiThreadedScoreLockWrite_1write(JNIEnv *env, jclass clz, int64_t obj) {
78538         LDKMultiThreadedScoreLockWrite obj_conv;
78539         obj_conv.inner = untag_ptr(obj);
78540         obj_conv.is_owned = ptr_is_owned(obj);
78541         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
78542         obj_conv.is_owned = false;
78543         LDKCVec_u8Z ret_var = MultiThreadedScoreLockWrite_write(&obj_conv);
78544         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
78545         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
78546         CVec_u8Z_free(ret_var);
78547         return ret_arr;
78548 }
78549
78550 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MultiThreadedScoreLockWrite_1as_1ScoreUpdate(JNIEnv *env, jclass clz, int64_t this_arg) {
78551         LDKMultiThreadedScoreLockWrite this_arg_conv;
78552         this_arg_conv.inner = untag_ptr(this_arg);
78553         this_arg_conv.is_owned = ptr_is_owned(this_arg);
78554         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
78555         this_arg_conv.is_owned = false;
78556         LDKScoreUpdate* ret_ret = MALLOC(sizeof(LDKScoreUpdate), "LDKScoreUpdate");
78557         *ret_ret = MultiThreadedScoreLockWrite_as_ScoreUpdate(&this_arg_conv);
78558         return tag_ptr(ret_ret, true);
78559 }
78560
78561 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUsage_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
78562         LDKChannelUsage this_obj_conv;
78563         this_obj_conv.inner = untag_ptr(this_obj);
78564         this_obj_conv.is_owned = ptr_is_owned(this_obj);
78565         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
78566         ChannelUsage_free(this_obj_conv);
78567 }
78568
78569 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUsage_1get_1amount_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
78570         LDKChannelUsage this_ptr_conv;
78571         this_ptr_conv.inner = untag_ptr(this_ptr);
78572         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
78573         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
78574         this_ptr_conv.is_owned = false;
78575         int64_t ret_conv = ChannelUsage_get_amount_msat(&this_ptr_conv);
78576         return ret_conv;
78577 }
78578
78579 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUsage_1set_1amount_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
78580         LDKChannelUsage this_ptr_conv;
78581         this_ptr_conv.inner = untag_ptr(this_ptr);
78582         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
78583         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
78584         this_ptr_conv.is_owned = false;
78585         ChannelUsage_set_amount_msat(&this_ptr_conv, val);
78586 }
78587
78588 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUsage_1get_1inflight_1htlc_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
78589         LDKChannelUsage this_ptr_conv;
78590         this_ptr_conv.inner = untag_ptr(this_ptr);
78591         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
78592         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
78593         this_ptr_conv.is_owned = false;
78594         int64_t ret_conv = ChannelUsage_get_inflight_htlc_msat(&this_ptr_conv);
78595         return ret_conv;
78596 }
78597
78598 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUsage_1set_1inflight_1htlc_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
78599         LDKChannelUsage this_ptr_conv;
78600         this_ptr_conv.inner = untag_ptr(this_ptr);
78601         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
78602         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
78603         this_ptr_conv.is_owned = false;
78604         ChannelUsage_set_inflight_htlc_msat(&this_ptr_conv, val);
78605 }
78606
78607 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUsage_1get_1effective_1capacity(JNIEnv *env, jclass clz, int64_t this_ptr) {
78608         LDKChannelUsage this_ptr_conv;
78609         this_ptr_conv.inner = untag_ptr(this_ptr);
78610         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
78611         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
78612         this_ptr_conv.is_owned = false;
78613         LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
78614         *ret_copy = ChannelUsage_get_effective_capacity(&this_ptr_conv);
78615         int64_t ret_ref = tag_ptr(ret_copy, true);
78616         return ret_ref;
78617 }
78618
78619 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUsage_1set_1effective_1capacity(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
78620         LDKChannelUsage this_ptr_conv;
78621         this_ptr_conv.inner = untag_ptr(this_ptr);
78622         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
78623         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
78624         this_ptr_conv.is_owned = false;
78625         void* val_ptr = untag_ptr(val);
78626         CHECK_ACCESS(val_ptr);
78627         LDKEffectiveCapacity val_conv = *(LDKEffectiveCapacity*)(val_ptr);
78628         val_conv = EffectiveCapacity_clone((LDKEffectiveCapacity*)untag_ptr(val));
78629         ChannelUsage_set_effective_capacity(&this_ptr_conv, val_conv);
78630 }
78631
78632 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) {
78633         void* effective_capacity_arg_ptr = untag_ptr(effective_capacity_arg);
78634         CHECK_ACCESS(effective_capacity_arg_ptr);
78635         LDKEffectiveCapacity effective_capacity_arg_conv = *(LDKEffectiveCapacity*)(effective_capacity_arg_ptr);
78636         effective_capacity_arg_conv = EffectiveCapacity_clone((LDKEffectiveCapacity*)untag_ptr(effective_capacity_arg));
78637         LDKChannelUsage ret_var = ChannelUsage_new(amount_msat_arg, inflight_htlc_msat_arg, effective_capacity_arg_conv);
78638         int64_t ret_ref = 0;
78639         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
78640         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
78641         return ret_ref;
78642 }
78643
78644 static inline uint64_t ChannelUsage_clone_ptr(LDKChannelUsage *NONNULL_PTR arg) {
78645         LDKChannelUsage ret_var = ChannelUsage_clone(arg);
78646         int64_t ret_ref = 0;
78647         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
78648         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
78649         return ret_ref;
78650 }
78651 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUsage_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
78652         LDKChannelUsage arg_conv;
78653         arg_conv.inner = untag_ptr(arg);
78654         arg_conv.is_owned = ptr_is_owned(arg);
78655         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
78656         arg_conv.is_owned = false;
78657         int64_t ret_conv = ChannelUsage_clone_ptr(&arg_conv);
78658         return ret_conv;
78659 }
78660
78661 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUsage_1clone(JNIEnv *env, jclass clz, int64_t orig) {
78662         LDKChannelUsage orig_conv;
78663         orig_conv.inner = untag_ptr(orig);
78664         orig_conv.is_owned = ptr_is_owned(orig);
78665         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
78666         orig_conv.is_owned = false;
78667         LDKChannelUsage ret_var = ChannelUsage_clone(&orig_conv);
78668         int64_t ret_ref = 0;
78669         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
78670         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
78671         return ret_ref;
78672 }
78673
78674 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FixedPenaltyScorer_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
78675         LDKFixedPenaltyScorer this_obj_conv;
78676         this_obj_conv.inner = untag_ptr(this_obj);
78677         this_obj_conv.is_owned = ptr_is_owned(this_obj);
78678         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
78679         FixedPenaltyScorer_free(this_obj_conv);
78680 }
78681
78682 static inline uint64_t FixedPenaltyScorer_clone_ptr(LDKFixedPenaltyScorer *NONNULL_PTR arg) {
78683         LDKFixedPenaltyScorer ret_var = FixedPenaltyScorer_clone(arg);
78684         int64_t ret_ref = 0;
78685         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
78686         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
78687         return ret_ref;
78688 }
78689 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FixedPenaltyScorer_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
78690         LDKFixedPenaltyScorer arg_conv;
78691         arg_conv.inner = untag_ptr(arg);
78692         arg_conv.is_owned = ptr_is_owned(arg);
78693         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
78694         arg_conv.is_owned = false;
78695         int64_t ret_conv = FixedPenaltyScorer_clone_ptr(&arg_conv);
78696         return ret_conv;
78697 }
78698
78699 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FixedPenaltyScorer_1clone(JNIEnv *env, jclass clz, int64_t orig) {
78700         LDKFixedPenaltyScorer orig_conv;
78701         orig_conv.inner = untag_ptr(orig);
78702         orig_conv.is_owned = ptr_is_owned(orig);
78703         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
78704         orig_conv.is_owned = false;
78705         LDKFixedPenaltyScorer ret_var = FixedPenaltyScorer_clone(&orig_conv);
78706         int64_t ret_ref = 0;
78707         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
78708         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
78709         return ret_ref;
78710 }
78711
78712 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FixedPenaltyScorer_1with_1penalty(JNIEnv *env, jclass clz, int64_t penalty_msat) {
78713         LDKFixedPenaltyScorer ret_var = FixedPenaltyScorer_with_penalty(penalty_msat);
78714         int64_t ret_ref = 0;
78715         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
78716         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
78717         return ret_ref;
78718 }
78719
78720 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FixedPenaltyScorer_1as_1ScoreLookUp(JNIEnv *env, jclass clz, int64_t this_arg) {
78721         LDKFixedPenaltyScorer this_arg_conv;
78722         this_arg_conv.inner = untag_ptr(this_arg);
78723         this_arg_conv.is_owned = ptr_is_owned(this_arg);
78724         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
78725         this_arg_conv.is_owned = false;
78726         LDKScoreLookUp* ret_ret = MALLOC(sizeof(LDKScoreLookUp), "LDKScoreLookUp");
78727         *ret_ret = FixedPenaltyScorer_as_ScoreLookUp(&this_arg_conv);
78728         return tag_ptr(ret_ret, true);
78729 }
78730
78731 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FixedPenaltyScorer_1as_1ScoreUpdate(JNIEnv *env, jclass clz, int64_t this_arg) {
78732         LDKFixedPenaltyScorer this_arg_conv;
78733         this_arg_conv.inner = untag_ptr(this_arg);
78734         this_arg_conv.is_owned = ptr_is_owned(this_arg);
78735         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
78736         this_arg_conv.is_owned = false;
78737         LDKScoreUpdate* ret_ret = MALLOC(sizeof(LDKScoreUpdate), "LDKScoreUpdate");
78738         *ret_ret = FixedPenaltyScorer_as_ScoreUpdate(&this_arg_conv);
78739         return tag_ptr(ret_ret, true);
78740 }
78741
78742 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FixedPenaltyScorer_1write(JNIEnv *env, jclass clz, int64_t obj) {
78743         LDKFixedPenaltyScorer obj_conv;
78744         obj_conv.inner = untag_ptr(obj);
78745         obj_conv.is_owned = ptr_is_owned(obj);
78746         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
78747         obj_conv.is_owned = false;
78748         LDKCVec_u8Z ret_var = FixedPenaltyScorer_write(&obj_conv);
78749         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
78750         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
78751         CVec_u8Z_free(ret_var);
78752         return ret_arr;
78753 }
78754
78755 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FixedPenaltyScorer_1read(JNIEnv *env, jclass clz, int8_tArray ser, int64_t arg) {
78756         LDKu8slice ser_ref;
78757         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
78758         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
78759         LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
78760         *ret_conv = FixedPenaltyScorer_read(ser_ref, arg);
78761         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
78762         return tag_ptr(ret_conv, true);
78763 }
78764
78765 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScorer_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
78766         LDKProbabilisticScorer this_obj_conv;
78767         this_obj_conv.inner = untag_ptr(this_obj);
78768         this_obj_conv.is_owned = ptr_is_owned(this_obj);
78769         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
78770         ProbabilisticScorer_free(this_obj_conv);
78771 }
78772
78773 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringFeeParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
78774         LDKProbabilisticScoringFeeParameters this_obj_conv;
78775         this_obj_conv.inner = untag_ptr(this_obj);
78776         this_obj_conv.is_owned = ptr_is_owned(this_obj);
78777         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
78778         ProbabilisticScoringFeeParameters_free(this_obj_conv);
78779 }
78780
78781 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringFeeParameters_1get_1base_1penalty_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
78782         LDKProbabilisticScoringFeeParameters this_ptr_conv;
78783         this_ptr_conv.inner = untag_ptr(this_ptr);
78784         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
78785         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
78786         this_ptr_conv.is_owned = false;
78787         int64_t ret_conv = ProbabilisticScoringFeeParameters_get_base_penalty_msat(&this_ptr_conv);
78788         return ret_conv;
78789 }
78790
78791 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringFeeParameters_1set_1base_1penalty_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
78792         LDKProbabilisticScoringFeeParameters this_ptr_conv;
78793         this_ptr_conv.inner = untag_ptr(this_ptr);
78794         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
78795         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
78796         this_ptr_conv.is_owned = false;
78797         ProbabilisticScoringFeeParameters_set_base_penalty_msat(&this_ptr_conv, val);
78798 }
78799
78800 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringFeeParameters_1get_1base_1penalty_1amount_1multiplier_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
78801         LDKProbabilisticScoringFeeParameters this_ptr_conv;
78802         this_ptr_conv.inner = untag_ptr(this_ptr);
78803         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
78804         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
78805         this_ptr_conv.is_owned = false;
78806         int64_t ret_conv = ProbabilisticScoringFeeParameters_get_base_penalty_amount_multiplier_msat(&this_ptr_conv);
78807         return ret_conv;
78808 }
78809
78810 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) {
78811         LDKProbabilisticScoringFeeParameters this_ptr_conv;
78812         this_ptr_conv.inner = untag_ptr(this_ptr);
78813         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
78814         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
78815         this_ptr_conv.is_owned = false;
78816         ProbabilisticScoringFeeParameters_set_base_penalty_amount_multiplier_msat(&this_ptr_conv, val);
78817 }
78818
78819 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringFeeParameters_1get_1liquidity_1penalty_1multiplier_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
78820         LDKProbabilisticScoringFeeParameters this_ptr_conv;
78821         this_ptr_conv.inner = untag_ptr(this_ptr);
78822         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
78823         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
78824         this_ptr_conv.is_owned = false;
78825         int64_t ret_conv = ProbabilisticScoringFeeParameters_get_liquidity_penalty_multiplier_msat(&this_ptr_conv);
78826         return ret_conv;
78827 }
78828
78829 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) {
78830         LDKProbabilisticScoringFeeParameters this_ptr_conv;
78831         this_ptr_conv.inner = untag_ptr(this_ptr);
78832         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
78833         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
78834         this_ptr_conv.is_owned = false;
78835         ProbabilisticScoringFeeParameters_set_liquidity_penalty_multiplier_msat(&this_ptr_conv, val);
78836 }
78837
78838 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringFeeParameters_1get_1liquidity_1penalty_1amount_1multiplier_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
78839         LDKProbabilisticScoringFeeParameters this_ptr_conv;
78840         this_ptr_conv.inner = untag_ptr(this_ptr);
78841         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
78842         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
78843         this_ptr_conv.is_owned = false;
78844         int64_t ret_conv = ProbabilisticScoringFeeParameters_get_liquidity_penalty_amount_multiplier_msat(&this_ptr_conv);
78845         return ret_conv;
78846 }
78847
78848 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) {
78849         LDKProbabilisticScoringFeeParameters this_ptr_conv;
78850         this_ptr_conv.inner = untag_ptr(this_ptr);
78851         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
78852         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
78853         this_ptr_conv.is_owned = false;
78854         ProbabilisticScoringFeeParameters_set_liquidity_penalty_amount_multiplier_msat(&this_ptr_conv, val);
78855 }
78856
78857 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringFeeParameters_1get_1historical_1liquidity_1penalty_1multiplier_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
78858         LDKProbabilisticScoringFeeParameters this_ptr_conv;
78859         this_ptr_conv.inner = untag_ptr(this_ptr);
78860         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
78861         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
78862         this_ptr_conv.is_owned = false;
78863         int64_t ret_conv = ProbabilisticScoringFeeParameters_get_historical_liquidity_penalty_multiplier_msat(&this_ptr_conv);
78864         return ret_conv;
78865 }
78866
78867 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) {
78868         LDKProbabilisticScoringFeeParameters this_ptr_conv;
78869         this_ptr_conv.inner = untag_ptr(this_ptr);
78870         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
78871         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
78872         this_ptr_conv.is_owned = false;
78873         ProbabilisticScoringFeeParameters_set_historical_liquidity_penalty_multiplier_msat(&this_ptr_conv, val);
78874 }
78875
78876 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) {
78877         LDKProbabilisticScoringFeeParameters this_ptr_conv;
78878         this_ptr_conv.inner = untag_ptr(this_ptr);
78879         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
78880         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
78881         this_ptr_conv.is_owned = false;
78882         int64_t ret_conv = ProbabilisticScoringFeeParameters_get_historical_liquidity_penalty_amount_multiplier_msat(&this_ptr_conv);
78883         return ret_conv;
78884 }
78885
78886 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) {
78887         LDKProbabilisticScoringFeeParameters this_ptr_conv;
78888         this_ptr_conv.inner = untag_ptr(this_ptr);
78889         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
78890         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
78891         this_ptr_conv.is_owned = false;
78892         ProbabilisticScoringFeeParameters_set_historical_liquidity_penalty_amount_multiplier_msat(&this_ptr_conv, val);
78893 }
78894
78895 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringFeeParameters_1get_1anti_1probing_1penalty_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
78896         LDKProbabilisticScoringFeeParameters this_ptr_conv;
78897         this_ptr_conv.inner = untag_ptr(this_ptr);
78898         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
78899         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
78900         this_ptr_conv.is_owned = false;
78901         int64_t ret_conv = ProbabilisticScoringFeeParameters_get_anti_probing_penalty_msat(&this_ptr_conv);
78902         return ret_conv;
78903 }
78904
78905 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) {
78906         LDKProbabilisticScoringFeeParameters this_ptr_conv;
78907         this_ptr_conv.inner = untag_ptr(this_ptr);
78908         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
78909         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
78910         this_ptr_conv.is_owned = false;
78911         ProbabilisticScoringFeeParameters_set_anti_probing_penalty_msat(&this_ptr_conv, val);
78912 }
78913
78914 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringFeeParameters_1get_1considered_1impossible_1penalty_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
78915         LDKProbabilisticScoringFeeParameters this_ptr_conv;
78916         this_ptr_conv.inner = untag_ptr(this_ptr);
78917         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
78918         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
78919         this_ptr_conv.is_owned = false;
78920         int64_t ret_conv = ProbabilisticScoringFeeParameters_get_considered_impossible_penalty_msat(&this_ptr_conv);
78921         return ret_conv;
78922 }
78923
78924 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) {
78925         LDKProbabilisticScoringFeeParameters this_ptr_conv;
78926         this_ptr_conv.inner = untag_ptr(this_ptr);
78927         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
78928         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
78929         this_ptr_conv.is_owned = false;
78930         ProbabilisticScoringFeeParameters_set_considered_impossible_penalty_msat(&this_ptr_conv, val);
78931 }
78932
78933 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringFeeParameters_1get_1linear_1success_1probability(JNIEnv *env, jclass clz, int64_t this_ptr) {
78934         LDKProbabilisticScoringFeeParameters this_ptr_conv;
78935         this_ptr_conv.inner = untag_ptr(this_ptr);
78936         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
78937         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
78938         this_ptr_conv.is_owned = false;
78939         jboolean ret_conv = ProbabilisticScoringFeeParameters_get_linear_success_probability(&this_ptr_conv);
78940         return ret_conv;
78941 }
78942
78943 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringFeeParameters_1set_1linear_1success_1probability(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
78944         LDKProbabilisticScoringFeeParameters this_ptr_conv;
78945         this_ptr_conv.inner = untag_ptr(this_ptr);
78946         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
78947         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
78948         this_ptr_conv.is_owned = false;
78949         ProbabilisticScoringFeeParameters_set_linear_success_probability(&this_ptr_conv, val);
78950 }
78951
78952 static inline uint64_t ProbabilisticScoringFeeParameters_clone_ptr(LDKProbabilisticScoringFeeParameters *NONNULL_PTR arg) {
78953         LDKProbabilisticScoringFeeParameters ret_var = ProbabilisticScoringFeeParameters_clone(arg);
78954         int64_t ret_ref = 0;
78955         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
78956         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
78957         return ret_ref;
78958 }
78959 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringFeeParameters_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
78960         LDKProbabilisticScoringFeeParameters arg_conv;
78961         arg_conv.inner = untag_ptr(arg);
78962         arg_conv.is_owned = ptr_is_owned(arg);
78963         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
78964         arg_conv.is_owned = false;
78965         int64_t ret_conv = ProbabilisticScoringFeeParameters_clone_ptr(&arg_conv);
78966         return ret_conv;
78967 }
78968
78969 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringFeeParameters_1clone(JNIEnv *env, jclass clz, int64_t orig) {
78970         LDKProbabilisticScoringFeeParameters orig_conv;
78971         orig_conv.inner = untag_ptr(orig);
78972         orig_conv.is_owned = ptr_is_owned(orig);
78973         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
78974         orig_conv.is_owned = false;
78975         LDKProbabilisticScoringFeeParameters ret_var = ProbabilisticScoringFeeParameters_clone(&orig_conv);
78976         int64_t ret_ref = 0;
78977         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
78978         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
78979         return ret_ref;
78980 }
78981
78982 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringFeeParameters_1default(JNIEnv *env, jclass clz) {
78983         LDKProbabilisticScoringFeeParameters ret_var = ProbabilisticScoringFeeParameters_default();
78984         int64_t ret_ref = 0;
78985         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
78986         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
78987         return ret_ref;
78988 }
78989
78990 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringFeeParameters_1add_1banned(JNIEnv *env, jclass clz, int64_t this_arg, int64_t node_id) {
78991         LDKProbabilisticScoringFeeParameters this_arg_conv;
78992         this_arg_conv.inner = untag_ptr(this_arg);
78993         this_arg_conv.is_owned = ptr_is_owned(this_arg);
78994         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
78995         this_arg_conv.is_owned = false;
78996         LDKNodeId node_id_conv;
78997         node_id_conv.inner = untag_ptr(node_id);
78998         node_id_conv.is_owned = ptr_is_owned(node_id);
78999         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_conv);
79000         node_id_conv.is_owned = false;
79001         ProbabilisticScoringFeeParameters_add_banned(&this_arg_conv, &node_id_conv);
79002 }
79003
79004 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) {
79005         LDKProbabilisticScoringFeeParameters this_arg_conv;
79006         this_arg_conv.inner = untag_ptr(this_arg);
79007         this_arg_conv.is_owned = ptr_is_owned(this_arg);
79008         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
79009         this_arg_conv.is_owned = false;
79010         LDKCVec_NodeIdZ node_ids_constr;
79011         node_ids_constr.datalen = (*env)->GetArrayLength(env, node_ids);
79012         if (node_ids_constr.datalen > 0)
79013                 node_ids_constr.data = MALLOC(node_ids_constr.datalen * sizeof(LDKNodeId), "LDKCVec_NodeIdZ Elements");
79014         else
79015                 node_ids_constr.data = NULL;
79016         int64_t* node_ids_vals = (*env)->GetLongArrayElements (env, node_ids, NULL);
79017         for (size_t i = 0; i < node_ids_constr.datalen; i++) {
79018                 int64_t node_ids_conv_8 = node_ids_vals[i];
79019                 LDKNodeId node_ids_conv_8_conv;
79020                 node_ids_conv_8_conv.inner = untag_ptr(node_ids_conv_8);
79021                 node_ids_conv_8_conv.is_owned = ptr_is_owned(node_ids_conv_8);
79022                 CHECK_INNER_FIELD_ACCESS_OR_NULL(node_ids_conv_8_conv);
79023                 node_ids_conv_8_conv = NodeId_clone(&node_ids_conv_8_conv);
79024                 node_ids_constr.data[i] = node_ids_conv_8_conv;
79025         }
79026         (*env)->ReleaseLongArrayElements(env, node_ids, node_ids_vals, 0);
79027         ProbabilisticScoringFeeParameters_add_banned_from_list(&this_arg_conv, node_ids_constr);
79028 }
79029
79030 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringFeeParameters_1remove_1banned(JNIEnv *env, jclass clz, int64_t this_arg, int64_t node_id) {
79031         LDKProbabilisticScoringFeeParameters this_arg_conv;
79032         this_arg_conv.inner = untag_ptr(this_arg);
79033         this_arg_conv.is_owned = ptr_is_owned(this_arg);
79034         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
79035         this_arg_conv.is_owned = false;
79036         LDKNodeId node_id_conv;
79037         node_id_conv.inner = untag_ptr(node_id);
79038         node_id_conv.is_owned = ptr_is_owned(node_id);
79039         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_conv);
79040         node_id_conv.is_owned = false;
79041         ProbabilisticScoringFeeParameters_remove_banned(&this_arg_conv, &node_id_conv);
79042 }
79043
79044 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) {
79045         LDKProbabilisticScoringFeeParameters this_arg_conv;
79046         this_arg_conv.inner = untag_ptr(this_arg);
79047         this_arg_conv.is_owned = ptr_is_owned(this_arg);
79048         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
79049         this_arg_conv.is_owned = false;
79050         LDKNodeId node_id_conv;
79051         node_id_conv.inner = untag_ptr(node_id);
79052         node_id_conv.is_owned = ptr_is_owned(node_id);
79053         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_conv);
79054         node_id_conv.is_owned = false;
79055         ProbabilisticScoringFeeParameters_set_manual_penalty(&this_arg_conv, &node_id_conv, penalty);
79056 }
79057
79058 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringFeeParameters_1remove_1manual_1penalty(JNIEnv *env, jclass clz, int64_t this_arg, int64_t node_id) {
79059         LDKProbabilisticScoringFeeParameters this_arg_conv;
79060         this_arg_conv.inner = untag_ptr(this_arg);
79061         this_arg_conv.is_owned = ptr_is_owned(this_arg);
79062         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
79063         this_arg_conv.is_owned = false;
79064         LDKNodeId node_id_conv;
79065         node_id_conv.inner = untag_ptr(node_id);
79066         node_id_conv.is_owned = ptr_is_owned(node_id);
79067         CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_conv);
79068         node_id_conv.is_owned = false;
79069         ProbabilisticScoringFeeParameters_remove_manual_penalty(&this_arg_conv, &node_id_conv);
79070 }
79071
79072 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringFeeParameters_1clear_1manual_1penalties(JNIEnv *env, jclass clz, int64_t this_arg) {
79073         LDKProbabilisticScoringFeeParameters 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         ProbabilisticScoringFeeParameters_clear_manual_penalties(&this_arg_conv);
79079 }
79080
79081 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringDecayParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
79082         LDKProbabilisticScoringDecayParameters this_obj_conv;
79083         this_obj_conv.inner = untag_ptr(this_obj);
79084         this_obj_conv.is_owned = ptr_is_owned(this_obj);
79085         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
79086         ProbabilisticScoringDecayParameters_free(this_obj_conv);
79087 }
79088
79089 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringDecayParameters_1get_1historical_1no_1updates_1half_1life(JNIEnv *env, jclass clz, int64_t this_ptr) {
79090         LDKProbabilisticScoringDecayParameters this_ptr_conv;
79091         this_ptr_conv.inner = untag_ptr(this_ptr);
79092         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
79093         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
79094         this_ptr_conv.is_owned = false;
79095         int64_t ret_conv = ProbabilisticScoringDecayParameters_get_historical_no_updates_half_life(&this_ptr_conv);
79096         return ret_conv;
79097 }
79098
79099 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) {
79100         LDKProbabilisticScoringDecayParameters this_ptr_conv;
79101         this_ptr_conv.inner = untag_ptr(this_ptr);
79102         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
79103         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
79104         this_ptr_conv.is_owned = false;
79105         ProbabilisticScoringDecayParameters_set_historical_no_updates_half_life(&this_ptr_conv, val);
79106 }
79107
79108 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringDecayParameters_1get_1liquidity_1offset_1half_1life(JNIEnv *env, jclass clz, int64_t this_ptr) {
79109         LDKProbabilisticScoringDecayParameters this_ptr_conv;
79110         this_ptr_conv.inner = untag_ptr(this_ptr);
79111         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
79112         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
79113         this_ptr_conv.is_owned = false;
79114         int64_t ret_conv = ProbabilisticScoringDecayParameters_get_liquidity_offset_half_life(&this_ptr_conv);
79115         return ret_conv;
79116 }
79117
79118 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) {
79119         LDKProbabilisticScoringDecayParameters this_ptr_conv;
79120         this_ptr_conv.inner = untag_ptr(this_ptr);
79121         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
79122         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
79123         this_ptr_conv.is_owned = false;
79124         ProbabilisticScoringDecayParameters_set_liquidity_offset_half_life(&this_ptr_conv, val);
79125 }
79126
79127 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) {
79128         LDKProbabilisticScoringDecayParameters ret_var = ProbabilisticScoringDecayParameters_new(historical_no_updates_half_life_arg, liquidity_offset_half_life_arg);
79129         int64_t ret_ref = 0;
79130         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
79131         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
79132         return ret_ref;
79133 }
79134
79135 static inline uint64_t ProbabilisticScoringDecayParameters_clone_ptr(LDKProbabilisticScoringDecayParameters *NONNULL_PTR arg) {
79136         LDKProbabilisticScoringDecayParameters ret_var = ProbabilisticScoringDecayParameters_clone(arg);
79137         int64_t ret_ref = 0;
79138         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
79139         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
79140         return ret_ref;
79141 }
79142 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringDecayParameters_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
79143         LDKProbabilisticScoringDecayParameters arg_conv;
79144         arg_conv.inner = untag_ptr(arg);
79145         arg_conv.is_owned = ptr_is_owned(arg);
79146         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
79147         arg_conv.is_owned = false;
79148         int64_t ret_conv = ProbabilisticScoringDecayParameters_clone_ptr(&arg_conv);
79149         return ret_conv;
79150 }
79151
79152 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringDecayParameters_1clone(JNIEnv *env, jclass clz, int64_t orig) {
79153         LDKProbabilisticScoringDecayParameters orig_conv;
79154         orig_conv.inner = untag_ptr(orig);
79155         orig_conv.is_owned = ptr_is_owned(orig);
79156         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
79157         orig_conv.is_owned = false;
79158         LDKProbabilisticScoringDecayParameters ret_var = ProbabilisticScoringDecayParameters_clone(&orig_conv);
79159         int64_t ret_ref = 0;
79160         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
79161         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
79162         return ret_ref;
79163 }
79164
79165 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringDecayParameters_1default(JNIEnv *env, jclass clz) {
79166         LDKProbabilisticScoringDecayParameters ret_var = ProbabilisticScoringDecayParameters_default();
79167         int64_t ret_ref = 0;
79168         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
79169         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
79170         return ret_ref;
79171 }
79172
79173 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) {
79174         LDKProbabilisticScoringDecayParameters decay_params_conv;
79175         decay_params_conv.inner = untag_ptr(decay_params);
79176         decay_params_conv.is_owned = ptr_is_owned(decay_params);
79177         CHECK_INNER_FIELD_ACCESS_OR_NULL(decay_params_conv);
79178         decay_params_conv = ProbabilisticScoringDecayParameters_clone(&decay_params_conv);
79179         LDKNetworkGraph network_graph_conv;
79180         network_graph_conv.inner = untag_ptr(network_graph);
79181         network_graph_conv.is_owned = ptr_is_owned(network_graph);
79182         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
79183         network_graph_conv.is_owned = false;
79184         void* logger_ptr = untag_ptr(logger);
79185         CHECK_ACCESS(logger_ptr);
79186         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
79187         if (logger_conv.free == LDKLogger_JCalls_free) {
79188                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
79189                 LDKLogger_JCalls_cloned(&logger_conv);
79190         }
79191         LDKProbabilisticScorer ret_var = ProbabilisticScorer_new(decay_params_conv, &network_graph_conv, logger_conv);
79192         int64_t ret_ref = 0;
79193         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
79194         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
79195         return ret_ref;
79196 }
79197
79198 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScorer_1debug_1log_1liquidity_1stats(JNIEnv *env, jclass clz, int64_t this_arg) {
79199         LDKProbabilisticScorer this_arg_conv;
79200         this_arg_conv.inner = untag_ptr(this_arg);
79201         this_arg_conv.is_owned = ptr_is_owned(this_arg);
79202         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
79203         this_arg_conv.is_owned = false;
79204         ProbabilisticScorer_debug_log_liquidity_stats(&this_arg_conv);
79205 }
79206
79207 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) {
79208         LDKProbabilisticScorer this_arg_conv;
79209         this_arg_conv.inner = untag_ptr(this_arg);
79210         this_arg_conv.is_owned = ptr_is_owned(this_arg);
79211         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
79212         this_arg_conv.is_owned = false;
79213         LDKNodeId target_conv;
79214         target_conv.inner = untag_ptr(target);
79215         target_conv.is_owned = ptr_is_owned(target);
79216         CHECK_INNER_FIELD_ACCESS_OR_NULL(target_conv);
79217         target_conv.is_owned = false;
79218         LDKCOption_C2Tuple_u64u64ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u64ZZ), "LDKCOption_C2Tuple_u64u64ZZ");
79219         *ret_copy = ProbabilisticScorer_estimated_channel_liquidity_range(&this_arg_conv, scid, &target_conv);
79220         int64_t ret_ref = tag_ptr(ret_copy, true);
79221         return ret_ref;
79222 }
79223
79224 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) {
79225         LDKProbabilisticScorer this_arg_conv;
79226         this_arg_conv.inner = untag_ptr(this_arg);
79227         this_arg_conv.is_owned = ptr_is_owned(this_arg);
79228         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
79229         this_arg_conv.is_owned = false;
79230         LDKNodeId target_conv;
79231         target_conv.inner = untag_ptr(target);
79232         target_conv.is_owned = ptr_is_owned(target);
79233         CHECK_INNER_FIELD_ACCESS_OR_NULL(target_conv);
79234         target_conv.is_owned = false;
79235         LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ), "LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ");
79236         *ret_copy = ProbabilisticScorer_historical_estimated_channel_liquidity_probabilities(&this_arg_conv, scid, &target_conv);
79237         int64_t ret_ref = tag_ptr(ret_copy, true);
79238         return ret_ref;
79239 }
79240
79241 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) {
79242         LDKProbabilisticScorer this_arg_conv;
79243         this_arg_conv.inner = untag_ptr(this_arg);
79244         this_arg_conv.is_owned = ptr_is_owned(this_arg);
79245         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
79246         this_arg_conv.is_owned = false;
79247         LDKNodeId target_conv;
79248         target_conv.inner = untag_ptr(target);
79249         target_conv.is_owned = ptr_is_owned(target);
79250         CHECK_INNER_FIELD_ACCESS_OR_NULL(target_conv);
79251         target_conv.is_owned = false;
79252         LDKProbabilisticScoringFeeParameters params_conv;
79253         params_conv.inner = untag_ptr(params);
79254         params_conv.is_owned = ptr_is_owned(params);
79255         CHECK_INNER_FIELD_ACCESS_OR_NULL(params_conv);
79256         params_conv.is_owned = false;
79257         LDKCOption_f64Z *ret_copy = MALLOC(sizeof(LDKCOption_f64Z), "LDKCOption_f64Z");
79258         *ret_copy = ProbabilisticScorer_historical_estimated_payment_success_probability(&this_arg_conv, scid, &target_conv, amount_msat, &params_conv);
79259         int64_t ret_ref = tag_ptr(ret_copy, true);
79260         return ret_ref;
79261 }
79262
79263 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScorer_1as_1ScoreLookUp(JNIEnv *env, jclass clz, int64_t this_arg) {
79264         LDKProbabilisticScorer this_arg_conv;
79265         this_arg_conv.inner = untag_ptr(this_arg);
79266         this_arg_conv.is_owned = ptr_is_owned(this_arg);
79267         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
79268         this_arg_conv.is_owned = false;
79269         LDKScoreLookUp* ret_ret = MALLOC(sizeof(LDKScoreLookUp), "LDKScoreLookUp");
79270         *ret_ret = ProbabilisticScorer_as_ScoreLookUp(&this_arg_conv);
79271         return tag_ptr(ret_ret, true);
79272 }
79273
79274 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScorer_1as_1ScoreUpdate(JNIEnv *env, jclass clz, int64_t this_arg) {
79275         LDKProbabilisticScorer this_arg_conv;
79276         this_arg_conv.inner = untag_ptr(this_arg);
79277         this_arg_conv.is_owned = ptr_is_owned(this_arg);
79278         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
79279         this_arg_conv.is_owned = false;
79280         LDKScoreUpdate* ret_ret = MALLOC(sizeof(LDKScoreUpdate), "LDKScoreUpdate");
79281         *ret_ret = ProbabilisticScorer_as_ScoreUpdate(&this_arg_conv);
79282         return tag_ptr(ret_ret, true);
79283 }
79284
79285 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScorer_1as_1Score(JNIEnv *env, jclass clz, int64_t this_arg) {
79286         LDKProbabilisticScorer this_arg_conv;
79287         this_arg_conv.inner = untag_ptr(this_arg);
79288         this_arg_conv.is_owned = ptr_is_owned(this_arg);
79289         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
79290         this_arg_conv.is_owned = false;
79291         LDKScore* ret_ret = MALLOC(sizeof(LDKScore), "LDKScore");
79292         *ret_ret = ProbabilisticScorer_as_Score(&this_arg_conv);
79293         return tag_ptr(ret_ret, true);
79294 }
79295
79296 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ProbabilisticScorer_1write(JNIEnv *env, jclass clz, int64_t obj) {
79297         LDKProbabilisticScorer obj_conv;
79298         obj_conv.inner = untag_ptr(obj);
79299         obj_conv.is_owned = ptr_is_owned(obj);
79300         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
79301         obj_conv.is_owned = false;
79302         LDKCVec_u8Z ret_var = ProbabilisticScorer_write(&obj_conv);
79303         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
79304         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
79305         CVec_u8Z_free(ret_var);
79306         return ret_arr;
79307 }
79308
79309 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) {
79310         LDKu8slice ser_ref;
79311         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
79312         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
79313         LDKProbabilisticScoringDecayParameters arg_a_conv;
79314         arg_a_conv.inner = untag_ptr(arg_a);
79315         arg_a_conv.is_owned = ptr_is_owned(arg_a);
79316         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_a_conv);
79317         arg_a_conv = ProbabilisticScoringDecayParameters_clone(&arg_a_conv);
79318         LDKNetworkGraph arg_b_conv;
79319         arg_b_conv.inner = untag_ptr(arg_b);
79320         arg_b_conv.is_owned = ptr_is_owned(arg_b);
79321         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_b_conv);
79322         arg_b_conv.is_owned = false;
79323         void* arg_c_ptr = untag_ptr(arg_c);
79324         CHECK_ACCESS(arg_c_ptr);
79325         LDKLogger arg_c_conv = *(LDKLogger*)(arg_c_ptr);
79326         if (arg_c_conv.free == LDKLogger_JCalls_free) {
79327                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
79328                 LDKLogger_JCalls_cloned(&arg_c_conv);
79329         }
79330         LDKCResult_ProbabilisticScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ProbabilisticScorerDecodeErrorZ), "LDKCResult_ProbabilisticScorerDecodeErrorZ");
79331         *ret_conv = ProbabilisticScorer_read(ser_ref, arg_a_conv, &arg_b_conv, arg_c_conv);
79332         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
79333         return tag_ptr(ret_conv, true);
79334 }
79335
79336 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
79337         LDKDelayedPaymentOutputDescriptor this_obj_conv;
79338         this_obj_conv.inner = untag_ptr(this_obj);
79339         this_obj_conv.is_owned = ptr_is_owned(this_obj);
79340         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
79341         DelayedPaymentOutputDescriptor_free(this_obj_conv);
79342 }
79343
79344 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
79345         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
79346         this_ptr_conv.inner = untag_ptr(this_ptr);
79347         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
79348         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
79349         this_ptr_conv.is_owned = false;
79350         LDKOutPoint ret_var = DelayedPaymentOutputDescriptor_get_outpoint(&this_ptr_conv);
79351         int64_t ret_ref = 0;
79352         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
79353         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
79354         return ret_ref;
79355 }
79356
79357 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
79358         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
79359         this_ptr_conv.inner = untag_ptr(this_ptr);
79360         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
79361         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
79362         this_ptr_conv.is_owned = false;
79363         LDKOutPoint val_conv;
79364         val_conv.inner = untag_ptr(val);
79365         val_conv.is_owned = ptr_is_owned(val);
79366         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
79367         val_conv = OutPoint_clone(&val_conv);
79368         DelayedPaymentOutputDescriptor_set_outpoint(&this_ptr_conv, val_conv);
79369 }
79370
79371 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
79372         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
79373         this_ptr_conv.inner = untag_ptr(this_ptr);
79374         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
79375         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
79376         this_ptr_conv.is_owned = false;
79377         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
79378         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, DelayedPaymentOutputDescriptor_get_per_commitment_point(&this_ptr_conv).compressed_form);
79379         return ret_arr;
79380 }
79381
79382 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
79383         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
79384         this_ptr_conv.inner = untag_ptr(this_ptr);
79385         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
79386         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
79387         this_ptr_conv.is_owned = false;
79388         LDKPublicKey val_ref;
79389         CHECK((*env)->GetArrayLength(env, val) == 33);
79390         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
79391         DelayedPaymentOutputDescriptor_set_per_commitment_point(&this_ptr_conv, val_ref);
79392 }
79393
79394 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
79395         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
79396         this_ptr_conv.inner = untag_ptr(this_ptr);
79397         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
79398         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
79399         this_ptr_conv.is_owned = false;
79400         int16_t ret_conv = DelayedPaymentOutputDescriptor_get_to_self_delay(&this_ptr_conv);
79401         return ret_conv;
79402 }
79403
79404 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
79405         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
79406         this_ptr_conv.inner = untag_ptr(this_ptr);
79407         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
79408         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
79409         this_ptr_conv.is_owned = false;
79410         DelayedPaymentOutputDescriptor_set_to_self_delay(&this_ptr_conv, val);
79411 }
79412
79413 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1output(JNIEnv *env, jclass clz, int64_t this_ptr) {
79414         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
79415         this_ptr_conv.inner = untag_ptr(this_ptr);
79416         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
79417         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
79418         this_ptr_conv.is_owned = false;
79419         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
79420         *ret_ref = DelayedPaymentOutputDescriptor_get_output(&this_ptr_conv);
79421         return tag_ptr(ret_ref, true);
79422 }
79423
79424 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1output(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
79425         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
79426         this_ptr_conv.inner = untag_ptr(this_ptr);
79427         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
79428         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
79429         this_ptr_conv.is_owned = false;
79430         void* val_ptr = untag_ptr(val);
79431         CHECK_ACCESS(val_ptr);
79432         LDKTxOut val_conv = *(LDKTxOut*)(val_ptr);
79433         val_conv = TxOut_clone((LDKTxOut*)untag_ptr(val));
79434         DelayedPaymentOutputDescriptor_set_output(&this_ptr_conv, val_conv);
79435 }
79436
79437 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1revocation_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
79438         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
79439         this_ptr_conv.inner = untag_ptr(this_ptr);
79440         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
79441         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
79442         this_ptr_conv.is_owned = false;
79443         LDKRevocationKey ret_var = DelayedPaymentOutputDescriptor_get_revocation_pubkey(&this_ptr_conv);
79444         int64_t ret_ref = 0;
79445         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
79446         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
79447         return ret_ref;
79448 }
79449
79450 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1revocation_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
79451         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
79452         this_ptr_conv.inner = untag_ptr(this_ptr);
79453         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
79454         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
79455         this_ptr_conv.is_owned = false;
79456         LDKRevocationKey val_conv;
79457         val_conv.inner = untag_ptr(val);
79458         val_conv.is_owned = ptr_is_owned(val);
79459         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
79460         val_conv = RevocationKey_clone(&val_conv);
79461         DelayedPaymentOutputDescriptor_set_revocation_pubkey(&this_ptr_conv, val_conv);
79462 }
79463
79464 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1channel_1keys_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
79465         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
79466         this_ptr_conv.inner = untag_ptr(this_ptr);
79467         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
79468         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
79469         this_ptr_conv.is_owned = false;
79470         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
79471         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *DelayedPaymentOutputDescriptor_get_channel_keys_id(&this_ptr_conv));
79472         return ret_arr;
79473 }
79474
79475 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1channel_1keys_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
79476         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
79477         this_ptr_conv.inner = untag_ptr(this_ptr);
79478         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
79479         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
79480         this_ptr_conv.is_owned = false;
79481         LDKThirtyTwoBytes val_ref;
79482         CHECK((*env)->GetArrayLength(env, val) == 32);
79483         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
79484         DelayedPaymentOutputDescriptor_set_channel_keys_id(&this_ptr_conv, val_ref);
79485 }
79486
79487 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
79488         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
79489         this_ptr_conv.inner = untag_ptr(this_ptr);
79490         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
79491         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
79492         this_ptr_conv.is_owned = false;
79493         int64_t ret_conv = DelayedPaymentOutputDescriptor_get_channel_value_satoshis(&this_ptr_conv);
79494         return ret_conv;
79495 }
79496
79497 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
79498         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
79499         this_ptr_conv.inner = untag_ptr(this_ptr);
79500         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
79501         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
79502         this_ptr_conv.is_owned = false;
79503         DelayedPaymentOutputDescriptor_set_channel_value_satoshis(&this_ptr_conv, val);
79504 }
79505
79506 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1channel_1transaction_1parameters(JNIEnv *env, jclass clz, int64_t this_ptr) {
79507         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
79508         this_ptr_conv.inner = untag_ptr(this_ptr);
79509         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
79510         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
79511         this_ptr_conv.is_owned = false;
79512         LDKChannelTransactionParameters ret_var = DelayedPaymentOutputDescriptor_get_channel_transaction_parameters(&this_ptr_conv);
79513         int64_t ret_ref = 0;
79514         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
79515         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
79516         return ret_ref;
79517 }
79518
79519 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1channel_1transaction_1parameters(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
79520         LDKDelayedPaymentOutputDescriptor this_ptr_conv;
79521         this_ptr_conv.inner = untag_ptr(this_ptr);
79522         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
79523         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
79524         this_ptr_conv.is_owned = false;
79525         LDKChannelTransactionParameters val_conv;
79526         val_conv.inner = untag_ptr(val);
79527         val_conv.is_owned = ptr_is_owned(val);
79528         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
79529         val_conv = ChannelTransactionParameters_clone(&val_conv);
79530         DelayedPaymentOutputDescriptor_set_channel_transaction_parameters(&this_ptr_conv, val_conv);
79531 }
79532
79533 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1new(JNIEnv *env, jclass clz, int64_t outpoint_arg, int8_tArray per_commitment_point_arg, int16_t to_self_delay_arg, int64_t output_arg, int64_t revocation_pubkey_arg, int8_tArray channel_keys_id_arg, int64_t channel_value_satoshis_arg, int64_t channel_transaction_parameters_arg) {
79534         LDKOutPoint outpoint_arg_conv;
79535         outpoint_arg_conv.inner = untag_ptr(outpoint_arg);
79536         outpoint_arg_conv.is_owned = ptr_is_owned(outpoint_arg);
79537         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
79538         outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
79539         LDKPublicKey per_commitment_point_arg_ref;
79540         CHECK((*env)->GetArrayLength(env, per_commitment_point_arg) == 33);
79541         (*env)->GetByteArrayRegion(env, per_commitment_point_arg, 0, 33, per_commitment_point_arg_ref.compressed_form);
79542         void* output_arg_ptr = untag_ptr(output_arg);
79543         CHECK_ACCESS(output_arg_ptr);
79544         LDKTxOut output_arg_conv = *(LDKTxOut*)(output_arg_ptr);
79545         output_arg_conv = TxOut_clone((LDKTxOut*)untag_ptr(output_arg));
79546         LDKRevocationKey revocation_pubkey_arg_conv;
79547         revocation_pubkey_arg_conv.inner = untag_ptr(revocation_pubkey_arg);
79548         revocation_pubkey_arg_conv.is_owned = ptr_is_owned(revocation_pubkey_arg);
79549         CHECK_INNER_FIELD_ACCESS_OR_NULL(revocation_pubkey_arg_conv);
79550         revocation_pubkey_arg_conv = RevocationKey_clone(&revocation_pubkey_arg_conv);
79551         LDKThirtyTwoBytes channel_keys_id_arg_ref;
79552         CHECK((*env)->GetArrayLength(env, channel_keys_id_arg) == 32);
79553         (*env)->GetByteArrayRegion(env, channel_keys_id_arg, 0, 32, channel_keys_id_arg_ref.data);
79554         LDKChannelTransactionParameters channel_transaction_parameters_arg_conv;
79555         channel_transaction_parameters_arg_conv.inner = untag_ptr(channel_transaction_parameters_arg);
79556         channel_transaction_parameters_arg_conv.is_owned = ptr_is_owned(channel_transaction_parameters_arg);
79557         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_transaction_parameters_arg_conv);
79558         channel_transaction_parameters_arg_conv = ChannelTransactionParameters_clone(&channel_transaction_parameters_arg_conv);
79559         LDKDelayedPaymentOutputDescriptor ret_var = DelayedPaymentOutputDescriptor_new(outpoint_arg_conv, per_commitment_point_arg_ref, to_self_delay_arg, output_arg_conv, revocation_pubkey_arg_conv, channel_keys_id_arg_ref, channel_value_satoshis_arg, channel_transaction_parameters_arg_conv);
79560         int64_t ret_ref = 0;
79561         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
79562         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
79563         return ret_ref;
79564 }
79565
79566 static inline uint64_t DelayedPaymentOutputDescriptor_clone_ptr(LDKDelayedPaymentOutputDescriptor *NONNULL_PTR arg) {
79567         LDKDelayedPaymentOutputDescriptor ret_var = DelayedPaymentOutputDescriptor_clone(arg);
79568         int64_t ret_ref = 0;
79569         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
79570         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
79571         return ret_ref;
79572 }
79573 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
79574         LDKDelayedPaymentOutputDescriptor arg_conv;
79575         arg_conv.inner = untag_ptr(arg);
79576         arg_conv.is_owned = ptr_is_owned(arg);
79577         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
79578         arg_conv.is_owned = false;
79579         int64_t ret_conv = DelayedPaymentOutputDescriptor_clone_ptr(&arg_conv);
79580         return ret_conv;
79581 }
79582
79583 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
79584         LDKDelayedPaymentOutputDescriptor orig_conv;
79585         orig_conv.inner = untag_ptr(orig);
79586         orig_conv.is_owned = ptr_is_owned(orig);
79587         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
79588         orig_conv.is_owned = false;
79589         LDKDelayedPaymentOutputDescriptor ret_var = DelayedPaymentOutputDescriptor_clone(&orig_conv);
79590         int64_t ret_ref = 0;
79591         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
79592         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
79593         return ret_ref;
79594 }
79595
79596 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1hash(JNIEnv *env, jclass clz, int64_t o) {
79597         LDKDelayedPaymentOutputDescriptor o_conv;
79598         o_conv.inner = untag_ptr(o);
79599         o_conv.is_owned = ptr_is_owned(o);
79600         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
79601         o_conv.is_owned = false;
79602         int64_t ret_conv = DelayedPaymentOutputDescriptor_hash(&o_conv);
79603         return ret_conv;
79604 }
79605
79606 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
79607         LDKDelayedPaymentOutputDescriptor a_conv;
79608         a_conv.inner = untag_ptr(a);
79609         a_conv.is_owned = ptr_is_owned(a);
79610         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
79611         a_conv.is_owned = false;
79612         LDKDelayedPaymentOutputDescriptor b_conv;
79613         b_conv.inner = untag_ptr(b);
79614         b_conv.is_owned = ptr_is_owned(b);
79615         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
79616         b_conv.is_owned = false;
79617         jboolean ret_conv = DelayedPaymentOutputDescriptor_eq(&a_conv, &b_conv);
79618         return ret_conv;
79619 }
79620
79621 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1write(JNIEnv *env, jclass clz, int64_t obj) {
79622         LDKDelayedPaymentOutputDescriptor obj_conv;
79623         obj_conv.inner = untag_ptr(obj);
79624         obj_conv.is_owned = ptr_is_owned(obj);
79625         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
79626         obj_conv.is_owned = false;
79627         LDKCVec_u8Z ret_var = DelayedPaymentOutputDescriptor_write(&obj_conv);
79628         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
79629         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
79630         CVec_u8Z_free(ret_var);
79631         return ret_arr;
79632 }
79633
79634 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
79635         LDKu8slice ser_ref;
79636         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
79637         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
79638         LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
79639         *ret_conv = DelayedPaymentOutputDescriptor_read(ser_ref);
79640         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
79641         return tag_ptr(ret_conv, true);
79642 }
79643
79644 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
79645         LDKStaticPaymentOutputDescriptor this_obj_conv;
79646         this_obj_conv.inner = untag_ptr(this_obj);
79647         this_obj_conv.is_owned = ptr_is_owned(this_obj);
79648         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
79649         StaticPaymentOutputDescriptor_free(this_obj_conv);
79650 }
79651
79652 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1get_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
79653         LDKStaticPaymentOutputDescriptor this_ptr_conv;
79654         this_ptr_conv.inner = untag_ptr(this_ptr);
79655         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
79656         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
79657         this_ptr_conv.is_owned = false;
79658         LDKOutPoint ret_var = StaticPaymentOutputDescriptor_get_outpoint(&this_ptr_conv);
79659         int64_t ret_ref = 0;
79660         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
79661         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
79662         return ret_ref;
79663 }
79664
79665 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1set_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
79666         LDKStaticPaymentOutputDescriptor this_ptr_conv;
79667         this_ptr_conv.inner = untag_ptr(this_ptr);
79668         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
79669         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
79670         this_ptr_conv.is_owned = false;
79671         LDKOutPoint val_conv;
79672         val_conv.inner = untag_ptr(val);
79673         val_conv.is_owned = ptr_is_owned(val);
79674         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
79675         val_conv = OutPoint_clone(&val_conv);
79676         StaticPaymentOutputDescriptor_set_outpoint(&this_ptr_conv, val_conv);
79677 }
79678
79679 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1get_1output(JNIEnv *env, jclass clz, int64_t this_ptr) {
79680         LDKStaticPaymentOutputDescriptor this_ptr_conv;
79681         this_ptr_conv.inner = untag_ptr(this_ptr);
79682         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
79683         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
79684         this_ptr_conv.is_owned = false;
79685         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
79686         *ret_ref = StaticPaymentOutputDescriptor_get_output(&this_ptr_conv);
79687         return tag_ptr(ret_ref, true);
79688 }
79689
79690 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1set_1output(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
79691         LDKStaticPaymentOutputDescriptor this_ptr_conv;
79692         this_ptr_conv.inner = untag_ptr(this_ptr);
79693         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
79694         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
79695         this_ptr_conv.is_owned = false;
79696         void* val_ptr = untag_ptr(val);
79697         CHECK_ACCESS(val_ptr);
79698         LDKTxOut val_conv = *(LDKTxOut*)(val_ptr);
79699         val_conv = TxOut_clone((LDKTxOut*)untag_ptr(val));
79700         StaticPaymentOutputDescriptor_set_output(&this_ptr_conv, val_conv);
79701 }
79702
79703 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1get_1channel_1keys_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
79704         LDKStaticPaymentOutputDescriptor this_ptr_conv;
79705         this_ptr_conv.inner = untag_ptr(this_ptr);
79706         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
79707         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
79708         this_ptr_conv.is_owned = false;
79709         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
79710         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *StaticPaymentOutputDescriptor_get_channel_keys_id(&this_ptr_conv));
79711         return ret_arr;
79712 }
79713
79714 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1set_1channel_1keys_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
79715         LDKStaticPaymentOutputDescriptor this_ptr_conv;
79716         this_ptr_conv.inner = untag_ptr(this_ptr);
79717         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
79718         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
79719         this_ptr_conv.is_owned = false;
79720         LDKThirtyTwoBytes val_ref;
79721         CHECK((*env)->GetArrayLength(env, val) == 32);
79722         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
79723         StaticPaymentOutputDescriptor_set_channel_keys_id(&this_ptr_conv, val_ref);
79724 }
79725
79726 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1get_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
79727         LDKStaticPaymentOutputDescriptor this_ptr_conv;
79728         this_ptr_conv.inner = untag_ptr(this_ptr);
79729         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
79730         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
79731         this_ptr_conv.is_owned = false;
79732         int64_t ret_conv = StaticPaymentOutputDescriptor_get_channel_value_satoshis(&this_ptr_conv);
79733         return ret_conv;
79734 }
79735
79736 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1set_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
79737         LDKStaticPaymentOutputDescriptor this_ptr_conv;
79738         this_ptr_conv.inner = untag_ptr(this_ptr);
79739         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
79740         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
79741         this_ptr_conv.is_owned = false;
79742         StaticPaymentOutputDescriptor_set_channel_value_satoshis(&this_ptr_conv, val);
79743 }
79744
79745 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1get_1channel_1transaction_1parameters(JNIEnv *env, jclass clz, int64_t this_ptr) {
79746         LDKStaticPaymentOutputDescriptor this_ptr_conv;
79747         this_ptr_conv.inner = untag_ptr(this_ptr);
79748         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
79749         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
79750         this_ptr_conv.is_owned = false;
79751         LDKChannelTransactionParameters ret_var = StaticPaymentOutputDescriptor_get_channel_transaction_parameters(&this_ptr_conv);
79752         int64_t ret_ref = 0;
79753         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
79754         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
79755         return ret_ref;
79756 }
79757
79758 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1set_1channel_1transaction_1parameters(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
79759         LDKStaticPaymentOutputDescriptor this_ptr_conv;
79760         this_ptr_conv.inner = untag_ptr(this_ptr);
79761         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
79762         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
79763         this_ptr_conv.is_owned = false;
79764         LDKChannelTransactionParameters val_conv;
79765         val_conv.inner = untag_ptr(val);
79766         val_conv.is_owned = ptr_is_owned(val);
79767         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
79768         val_conv = ChannelTransactionParameters_clone(&val_conv);
79769         StaticPaymentOutputDescriptor_set_channel_transaction_parameters(&this_ptr_conv, val_conv);
79770 }
79771
79772 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) {
79773         LDKOutPoint outpoint_arg_conv;
79774         outpoint_arg_conv.inner = untag_ptr(outpoint_arg);
79775         outpoint_arg_conv.is_owned = ptr_is_owned(outpoint_arg);
79776         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
79777         outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
79778         void* output_arg_ptr = untag_ptr(output_arg);
79779         CHECK_ACCESS(output_arg_ptr);
79780         LDKTxOut output_arg_conv = *(LDKTxOut*)(output_arg_ptr);
79781         output_arg_conv = TxOut_clone((LDKTxOut*)untag_ptr(output_arg));
79782         LDKThirtyTwoBytes channel_keys_id_arg_ref;
79783         CHECK((*env)->GetArrayLength(env, channel_keys_id_arg) == 32);
79784         (*env)->GetByteArrayRegion(env, channel_keys_id_arg, 0, 32, channel_keys_id_arg_ref.data);
79785         LDKChannelTransactionParameters channel_transaction_parameters_arg_conv;
79786         channel_transaction_parameters_arg_conv.inner = untag_ptr(channel_transaction_parameters_arg);
79787         channel_transaction_parameters_arg_conv.is_owned = ptr_is_owned(channel_transaction_parameters_arg);
79788         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_transaction_parameters_arg_conv);
79789         channel_transaction_parameters_arg_conv = ChannelTransactionParameters_clone(&channel_transaction_parameters_arg_conv);
79790         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);
79791         int64_t ret_ref = 0;
79792         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
79793         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
79794         return ret_ref;
79795 }
79796
79797 static inline uint64_t StaticPaymentOutputDescriptor_clone_ptr(LDKStaticPaymentOutputDescriptor *NONNULL_PTR arg) {
79798         LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_clone(arg);
79799         int64_t ret_ref = 0;
79800         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
79801         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
79802         return ret_ref;
79803 }
79804 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
79805         LDKStaticPaymentOutputDescriptor arg_conv;
79806         arg_conv.inner = untag_ptr(arg);
79807         arg_conv.is_owned = ptr_is_owned(arg);
79808         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
79809         arg_conv.is_owned = false;
79810         int64_t ret_conv = StaticPaymentOutputDescriptor_clone_ptr(&arg_conv);
79811         return ret_conv;
79812 }
79813
79814 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
79815         LDKStaticPaymentOutputDescriptor orig_conv;
79816         orig_conv.inner = untag_ptr(orig);
79817         orig_conv.is_owned = ptr_is_owned(orig);
79818         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
79819         orig_conv.is_owned = false;
79820         LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_clone(&orig_conv);
79821         int64_t ret_ref = 0;
79822         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
79823         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
79824         return ret_ref;
79825 }
79826
79827 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1hash(JNIEnv *env, jclass clz, int64_t o) {
79828         LDKStaticPaymentOutputDescriptor o_conv;
79829         o_conv.inner = untag_ptr(o);
79830         o_conv.is_owned = ptr_is_owned(o);
79831         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
79832         o_conv.is_owned = false;
79833         int64_t ret_conv = StaticPaymentOutputDescriptor_hash(&o_conv);
79834         return ret_conv;
79835 }
79836
79837 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
79838         LDKStaticPaymentOutputDescriptor a_conv;
79839         a_conv.inner = untag_ptr(a);
79840         a_conv.is_owned = ptr_is_owned(a);
79841         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
79842         a_conv.is_owned = false;
79843         LDKStaticPaymentOutputDescriptor b_conv;
79844         b_conv.inner = untag_ptr(b);
79845         b_conv.is_owned = ptr_is_owned(b);
79846         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
79847         b_conv.is_owned = false;
79848         jboolean ret_conv = StaticPaymentOutputDescriptor_eq(&a_conv, &b_conv);
79849         return ret_conv;
79850 }
79851
79852 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1witness_1script(JNIEnv *env, jclass clz, int64_t this_arg) {
79853         LDKStaticPaymentOutputDescriptor this_arg_conv;
79854         this_arg_conv.inner = untag_ptr(this_arg);
79855         this_arg_conv.is_owned = ptr_is_owned(this_arg);
79856         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
79857         this_arg_conv.is_owned = false;
79858         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
79859         *ret_copy = StaticPaymentOutputDescriptor_witness_script(&this_arg_conv);
79860         int64_t ret_ref = tag_ptr(ret_copy, true);
79861         return ret_ref;
79862 }
79863
79864 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1max_1witness_1length(JNIEnv *env, jclass clz, int64_t this_arg) {
79865         LDKStaticPaymentOutputDescriptor this_arg_conv;
79866         this_arg_conv.inner = untag_ptr(this_arg);
79867         this_arg_conv.is_owned = ptr_is_owned(this_arg);
79868         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
79869         this_arg_conv.is_owned = false;
79870         int64_t ret_conv = StaticPaymentOutputDescriptor_max_witness_length(&this_arg_conv);
79871         return ret_conv;
79872 }
79873
79874 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1write(JNIEnv *env, jclass clz, int64_t obj) {
79875         LDKStaticPaymentOutputDescriptor obj_conv;
79876         obj_conv.inner = untag_ptr(obj);
79877         obj_conv.is_owned = ptr_is_owned(obj);
79878         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
79879         obj_conv.is_owned = false;
79880         LDKCVec_u8Z ret_var = StaticPaymentOutputDescriptor_write(&obj_conv);
79881         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
79882         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
79883         CVec_u8Z_free(ret_var);
79884         return ret_arr;
79885 }
79886
79887 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
79888         LDKu8slice ser_ref;
79889         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
79890         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
79891         LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
79892         *ret_conv = StaticPaymentOutputDescriptor_read(ser_ref);
79893         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
79894         return tag_ptr(ret_conv, true);
79895 }
79896
79897 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
79898         if (!ptr_is_owned(this_ptr)) return;
79899         void* this_ptr_ptr = untag_ptr(this_ptr);
79900         CHECK_ACCESS(this_ptr_ptr);
79901         LDKSpendableOutputDescriptor this_ptr_conv = *(LDKSpendableOutputDescriptor*)(this_ptr_ptr);
79902         FREE(untag_ptr(this_ptr));
79903         SpendableOutputDescriptor_free(this_ptr_conv);
79904 }
79905
79906 static inline uint64_t SpendableOutputDescriptor_clone_ptr(LDKSpendableOutputDescriptor *NONNULL_PTR arg) {
79907         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
79908         *ret_copy = SpendableOutputDescriptor_clone(arg);
79909         int64_t ret_ref = tag_ptr(ret_copy, true);
79910         return ret_ref;
79911 }
79912 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
79913         LDKSpendableOutputDescriptor* arg_conv = (LDKSpendableOutputDescriptor*)untag_ptr(arg);
79914         int64_t ret_conv = SpendableOutputDescriptor_clone_ptr(arg_conv);
79915         return ret_conv;
79916 }
79917
79918 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
79919         LDKSpendableOutputDescriptor* orig_conv = (LDKSpendableOutputDescriptor*)untag_ptr(orig);
79920         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
79921         *ret_copy = SpendableOutputDescriptor_clone(orig_conv);
79922         int64_t ret_ref = tag_ptr(ret_copy, true);
79923         return ret_ref;
79924 }
79925
79926 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) {
79927         LDKOutPoint outpoint_conv;
79928         outpoint_conv.inner = untag_ptr(outpoint);
79929         outpoint_conv.is_owned = ptr_is_owned(outpoint);
79930         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_conv);
79931         outpoint_conv = OutPoint_clone(&outpoint_conv);
79932         void* output_ptr = untag_ptr(output);
79933         CHECK_ACCESS(output_ptr);
79934         LDKTxOut output_conv = *(LDKTxOut*)(output_ptr);
79935         output_conv = TxOut_clone((LDKTxOut*)untag_ptr(output));
79936         LDKThirtyTwoBytes channel_keys_id_ref;
79937         CHECK((*env)->GetArrayLength(env, channel_keys_id) == 32);
79938         (*env)->GetByteArrayRegion(env, channel_keys_id, 0, 32, channel_keys_id_ref.data);
79939         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
79940         *ret_copy = SpendableOutputDescriptor_static_output(outpoint_conv, output_conv, channel_keys_id_ref);
79941         int64_t ret_ref = tag_ptr(ret_copy, true);
79942         return ret_ref;
79943 }
79944
79945 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1delayed_1payment_1output(JNIEnv *env, jclass clz, int64_t a) {
79946         LDKDelayedPaymentOutputDescriptor a_conv;
79947         a_conv.inner = untag_ptr(a);
79948         a_conv.is_owned = ptr_is_owned(a);
79949         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
79950         a_conv = DelayedPaymentOutputDescriptor_clone(&a_conv);
79951         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
79952         *ret_copy = SpendableOutputDescriptor_delayed_payment_output(a_conv);
79953         int64_t ret_ref = tag_ptr(ret_copy, true);
79954         return ret_ref;
79955 }
79956
79957 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1static_1payment_1output(JNIEnv *env, jclass clz, int64_t a) {
79958         LDKStaticPaymentOutputDescriptor a_conv;
79959         a_conv.inner = untag_ptr(a);
79960         a_conv.is_owned = ptr_is_owned(a);
79961         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
79962         a_conv = StaticPaymentOutputDescriptor_clone(&a_conv);
79963         LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
79964         *ret_copy = SpendableOutputDescriptor_static_payment_output(a_conv);
79965         int64_t ret_ref = tag_ptr(ret_copy, true);
79966         return ret_ref;
79967 }
79968
79969 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1hash(JNIEnv *env, jclass clz, int64_t o) {
79970         LDKSpendableOutputDescriptor* o_conv = (LDKSpendableOutputDescriptor*)untag_ptr(o);
79971         int64_t ret_conv = SpendableOutputDescriptor_hash(o_conv);
79972         return ret_conv;
79973 }
79974
79975 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
79976         LDKSpendableOutputDescriptor* a_conv = (LDKSpendableOutputDescriptor*)untag_ptr(a);
79977         LDKSpendableOutputDescriptor* b_conv = (LDKSpendableOutputDescriptor*)untag_ptr(b);
79978         jboolean ret_conv = SpendableOutputDescriptor_eq(a_conv, b_conv);
79979         return ret_conv;
79980 }
79981
79982 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1write(JNIEnv *env, jclass clz, int64_t obj) {
79983         LDKSpendableOutputDescriptor* obj_conv = (LDKSpendableOutputDescriptor*)untag_ptr(obj);
79984         LDKCVec_u8Z ret_var = SpendableOutputDescriptor_write(obj_conv);
79985         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
79986         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
79987         CVec_u8Z_free(ret_var);
79988         return ret_arr;
79989 }
79990
79991 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
79992         LDKu8slice ser_ref;
79993         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
79994         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
79995         LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
79996         *ret_conv = SpendableOutputDescriptor_read(ser_ref);
79997         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
79998         return tag_ptr(ret_conv, true);
79999 }
80000
80001 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) {
80002         LDKCVec_SpendableOutputDescriptorZ descriptors_constr;
80003         descriptors_constr.datalen = (*env)->GetArrayLength(env, descriptors);
80004         if (descriptors_constr.datalen > 0)
80005                 descriptors_constr.data = MALLOC(descriptors_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
80006         else
80007                 descriptors_constr.data = NULL;
80008         int64_t* descriptors_vals = (*env)->GetLongArrayElements (env, descriptors, NULL);
80009         for (size_t b = 0; b < descriptors_constr.datalen; b++) {
80010                 int64_t descriptors_conv_27 = descriptors_vals[b];
80011                 void* descriptors_conv_27_ptr = untag_ptr(descriptors_conv_27);
80012                 CHECK_ACCESS(descriptors_conv_27_ptr);
80013                 LDKSpendableOutputDescriptor descriptors_conv_27_conv = *(LDKSpendableOutputDescriptor*)(descriptors_conv_27_ptr);
80014                 descriptors_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)untag_ptr(descriptors_conv_27));
80015                 descriptors_constr.data[b] = descriptors_conv_27_conv;
80016         }
80017         (*env)->ReleaseLongArrayElements(env, descriptors, descriptors_vals, 0);
80018         LDKCVec_TxOutZ outputs_constr;
80019         outputs_constr.datalen = (*env)->GetArrayLength(env, outputs);
80020         if (outputs_constr.datalen > 0)
80021                 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
80022         else
80023                 outputs_constr.data = NULL;
80024         int64_t* outputs_vals = (*env)->GetLongArrayElements (env, outputs, NULL);
80025         for (size_t h = 0; h < outputs_constr.datalen; h++) {
80026                 int64_t outputs_conv_7 = outputs_vals[h];
80027                 void* outputs_conv_7_ptr = untag_ptr(outputs_conv_7);
80028                 CHECK_ACCESS(outputs_conv_7_ptr);
80029                 LDKTxOut outputs_conv_7_conv = *(LDKTxOut*)(outputs_conv_7_ptr);
80030                 outputs_conv_7_conv = TxOut_clone((LDKTxOut*)untag_ptr(outputs_conv_7));
80031                 outputs_constr.data[h] = outputs_conv_7_conv;
80032         }
80033         (*env)->ReleaseLongArrayElements(env, outputs, outputs_vals, 0);
80034         LDKCVec_u8Z change_destination_script_ref;
80035         change_destination_script_ref.datalen = (*env)->GetArrayLength(env, change_destination_script);
80036         change_destination_script_ref.data = MALLOC(change_destination_script_ref.datalen, "LDKCVec_u8Z Bytes");
80037         (*env)->GetByteArrayRegion(env, change_destination_script, 0, change_destination_script_ref.datalen, change_destination_script_ref.data);
80038         void* locktime_ptr = untag_ptr(locktime);
80039         CHECK_ACCESS(locktime_ptr);
80040         LDKCOption_u32Z locktime_conv = *(LDKCOption_u32Z*)(locktime_ptr);
80041         locktime_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(locktime));
80042         LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ), "LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ");
80043         *ret_conv = SpendableOutputDescriptor_create_spendable_outputs_psbt(descriptors_constr, outputs_constr, change_destination_script_ref, feerate_sat_per_1000_weight, locktime_conv);
80044         return tag_ptr(ret_conv, true);
80045 }
80046
80047 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDerivationParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
80048         LDKChannelDerivationParameters this_obj_conv;
80049         this_obj_conv.inner = untag_ptr(this_obj);
80050         this_obj_conv.is_owned = ptr_is_owned(this_obj);
80051         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
80052         ChannelDerivationParameters_free(this_obj_conv);
80053 }
80054
80055 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDerivationParameters_1get_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
80056         LDKChannelDerivationParameters this_ptr_conv;
80057         this_ptr_conv.inner = untag_ptr(this_ptr);
80058         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
80059         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
80060         this_ptr_conv.is_owned = false;
80061         int64_t ret_conv = ChannelDerivationParameters_get_value_satoshis(&this_ptr_conv);
80062         return ret_conv;
80063 }
80064
80065 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDerivationParameters_1set_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
80066         LDKChannelDerivationParameters this_ptr_conv;
80067         this_ptr_conv.inner = untag_ptr(this_ptr);
80068         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
80069         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
80070         this_ptr_conv.is_owned = false;
80071         ChannelDerivationParameters_set_value_satoshis(&this_ptr_conv, val);
80072 }
80073
80074 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelDerivationParameters_1get_1keys_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
80075         LDKChannelDerivationParameters this_ptr_conv;
80076         this_ptr_conv.inner = untag_ptr(this_ptr);
80077         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
80078         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
80079         this_ptr_conv.is_owned = false;
80080         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
80081         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ChannelDerivationParameters_get_keys_id(&this_ptr_conv));
80082         return ret_arr;
80083 }
80084
80085 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDerivationParameters_1set_1keys_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
80086         LDKChannelDerivationParameters this_ptr_conv;
80087         this_ptr_conv.inner = untag_ptr(this_ptr);
80088         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
80089         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
80090         this_ptr_conv.is_owned = false;
80091         LDKThirtyTwoBytes val_ref;
80092         CHECK((*env)->GetArrayLength(env, val) == 32);
80093         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
80094         ChannelDerivationParameters_set_keys_id(&this_ptr_conv, val_ref);
80095 }
80096
80097 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDerivationParameters_1get_1transaction_1parameters(JNIEnv *env, jclass clz, int64_t this_ptr) {
80098         LDKChannelDerivationParameters this_ptr_conv;
80099         this_ptr_conv.inner = untag_ptr(this_ptr);
80100         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
80101         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
80102         this_ptr_conv.is_owned = false;
80103         LDKChannelTransactionParameters ret_var = ChannelDerivationParameters_get_transaction_parameters(&this_ptr_conv);
80104         int64_t ret_ref = 0;
80105         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
80106         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
80107         return ret_ref;
80108 }
80109
80110 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDerivationParameters_1set_1transaction_1parameters(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
80111         LDKChannelDerivationParameters this_ptr_conv;
80112         this_ptr_conv.inner = untag_ptr(this_ptr);
80113         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
80114         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
80115         this_ptr_conv.is_owned = false;
80116         LDKChannelTransactionParameters val_conv;
80117         val_conv.inner = untag_ptr(val);
80118         val_conv.is_owned = ptr_is_owned(val);
80119         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
80120         val_conv = ChannelTransactionParameters_clone(&val_conv);
80121         ChannelDerivationParameters_set_transaction_parameters(&this_ptr_conv, val_conv);
80122 }
80123
80124 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) {
80125         LDKThirtyTwoBytes keys_id_arg_ref;
80126         CHECK((*env)->GetArrayLength(env, keys_id_arg) == 32);
80127         (*env)->GetByteArrayRegion(env, keys_id_arg, 0, 32, keys_id_arg_ref.data);
80128         LDKChannelTransactionParameters transaction_parameters_arg_conv;
80129         transaction_parameters_arg_conv.inner = untag_ptr(transaction_parameters_arg);
80130         transaction_parameters_arg_conv.is_owned = ptr_is_owned(transaction_parameters_arg);
80131         CHECK_INNER_FIELD_ACCESS_OR_NULL(transaction_parameters_arg_conv);
80132         transaction_parameters_arg_conv = ChannelTransactionParameters_clone(&transaction_parameters_arg_conv);
80133         LDKChannelDerivationParameters ret_var = ChannelDerivationParameters_new(value_satoshis_arg, keys_id_arg_ref, transaction_parameters_arg_conv);
80134         int64_t ret_ref = 0;
80135         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
80136         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
80137         return ret_ref;
80138 }
80139
80140 static inline uint64_t ChannelDerivationParameters_clone_ptr(LDKChannelDerivationParameters *NONNULL_PTR arg) {
80141         LDKChannelDerivationParameters ret_var = ChannelDerivationParameters_clone(arg);
80142         int64_t ret_ref = 0;
80143         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
80144         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
80145         return ret_ref;
80146 }
80147 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDerivationParameters_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
80148         LDKChannelDerivationParameters arg_conv;
80149         arg_conv.inner = untag_ptr(arg);
80150         arg_conv.is_owned = ptr_is_owned(arg);
80151         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
80152         arg_conv.is_owned = false;
80153         int64_t ret_conv = ChannelDerivationParameters_clone_ptr(&arg_conv);
80154         return ret_conv;
80155 }
80156
80157 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDerivationParameters_1clone(JNIEnv *env, jclass clz, int64_t orig) {
80158         LDKChannelDerivationParameters orig_conv;
80159         orig_conv.inner = untag_ptr(orig);
80160         orig_conv.is_owned = ptr_is_owned(orig);
80161         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
80162         orig_conv.is_owned = false;
80163         LDKChannelDerivationParameters ret_var = ChannelDerivationParameters_clone(&orig_conv);
80164         int64_t ret_ref = 0;
80165         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
80166         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
80167         return ret_ref;
80168 }
80169
80170 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelDerivationParameters_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
80171         LDKChannelDerivationParameters a_conv;
80172         a_conv.inner = untag_ptr(a);
80173         a_conv.is_owned = ptr_is_owned(a);
80174         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
80175         a_conv.is_owned = false;
80176         LDKChannelDerivationParameters b_conv;
80177         b_conv.inner = untag_ptr(b);
80178         b_conv.is_owned = ptr_is_owned(b);
80179         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
80180         b_conv.is_owned = false;
80181         jboolean ret_conv = ChannelDerivationParameters_eq(&a_conv, &b_conv);
80182         return ret_conv;
80183 }
80184
80185 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelDerivationParameters_1write(JNIEnv *env, jclass clz, int64_t obj) {
80186         LDKChannelDerivationParameters obj_conv;
80187         obj_conv.inner = untag_ptr(obj);
80188         obj_conv.is_owned = ptr_is_owned(obj);
80189         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
80190         obj_conv.is_owned = false;
80191         LDKCVec_u8Z ret_var = ChannelDerivationParameters_write(&obj_conv);
80192         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
80193         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
80194         CVec_u8Z_free(ret_var);
80195         return ret_arr;
80196 }
80197
80198 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDerivationParameters_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
80199         LDKu8slice ser_ref;
80200         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
80201         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
80202         LDKCResult_ChannelDerivationParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDerivationParametersDecodeErrorZ), "LDKCResult_ChannelDerivationParametersDecodeErrorZ");
80203         *ret_conv = ChannelDerivationParameters_read(ser_ref);
80204         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
80205         return tag_ptr(ret_conv, true);
80206 }
80207
80208 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
80209         LDKHTLCDescriptor this_obj_conv;
80210         this_obj_conv.inner = untag_ptr(this_obj);
80211         this_obj_conv.is_owned = ptr_is_owned(this_obj);
80212         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
80213         HTLCDescriptor_free(this_obj_conv);
80214 }
80215
80216 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1get_1channel_1derivation_1parameters(JNIEnv *env, jclass clz, int64_t this_ptr) {
80217         LDKHTLCDescriptor this_ptr_conv;
80218         this_ptr_conv.inner = untag_ptr(this_ptr);
80219         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
80220         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
80221         this_ptr_conv.is_owned = false;
80222         LDKChannelDerivationParameters ret_var = HTLCDescriptor_get_channel_derivation_parameters(&this_ptr_conv);
80223         int64_t ret_ref = 0;
80224         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
80225         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
80226         return ret_ref;
80227 }
80228
80229 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1set_1channel_1derivation_1parameters(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
80230         LDKHTLCDescriptor this_ptr_conv;
80231         this_ptr_conv.inner = untag_ptr(this_ptr);
80232         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
80233         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
80234         this_ptr_conv.is_owned = false;
80235         LDKChannelDerivationParameters val_conv;
80236         val_conv.inner = untag_ptr(val);
80237         val_conv.is_owned = ptr_is_owned(val);
80238         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
80239         val_conv = ChannelDerivationParameters_clone(&val_conv);
80240         HTLCDescriptor_set_channel_derivation_parameters(&this_ptr_conv, val_conv);
80241 }
80242
80243 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1get_1commitment_1txid(JNIEnv *env, jclass clz, int64_t this_ptr) {
80244         LDKHTLCDescriptor this_ptr_conv;
80245         this_ptr_conv.inner = untag_ptr(this_ptr);
80246         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
80247         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
80248         this_ptr_conv.is_owned = false;
80249         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
80250         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *HTLCDescriptor_get_commitment_txid(&this_ptr_conv));
80251         return ret_arr;
80252 }
80253
80254 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1set_1commitment_1txid(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
80255         LDKHTLCDescriptor this_ptr_conv;
80256         this_ptr_conv.inner = untag_ptr(this_ptr);
80257         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
80258         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
80259         this_ptr_conv.is_owned = false;
80260         LDKThirtyTwoBytes val_ref;
80261         CHECK((*env)->GetArrayLength(env, val) == 32);
80262         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
80263         HTLCDescriptor_set_commitment_txid(&this_ptr_conv, val_ref);
80264 }
80265
80266 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1get_1per_1commitment_1number(JNIEnv *env, jclass clz, int64_t this_ptr) {
80267         LDKHTLCDescriptor this_ptr_conv;
80268         this_ptr_conv.inner = untag_ptr(this_ptr);
80269         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
80270         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
80271         this_ptr_conv.is_owned = false;
80272         int64_t ret_conv = HTLCDescriptor_get_per_commitment_number(&this_ptr_conv);
80273         return ret_conv;
80274 }
80275
80276 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1set_1per_1commitment_1number(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
80277         LDKHTLCDescriptor this_ptr_conv;
80278         this_ptr_conv.inner = untag_ptr(this_ptr);
80279         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
80280         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
80281         this_ptr_conv.is_owned = false;
80282         HTLCDescriptor_set_per_commitment_number(&this_ptr_conv, val);
80283 }
80284
80285 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1get_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
80286         LDKHTLCDescriptor this_ptr_conv;
80287         this_ptr_conv.inner = untag_ptr(this_ptr);
80288         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
80289         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
80290         this_ptr_conv.is_owned = false;
80291         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
80292         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, HTLCDescriptor_get_per_commitment_point(&this_ptr_conv).compressed_form);
80293         return ret_arr;
80294 }
80295
80296 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1set_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
80297         LDKHTLCDescriptor this_ptr_conv;
80298         this_ptr_conv.inner = untag_ptr(this_ptr);
80299         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
80300         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
80301         this_ptr_conv.is_owned = false;
80302         LDKPublicKey val_ref;
80303         CHECK((*env)->GetArrayLength(env, val) == 33);
80304         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
80305         HTLCDescriptor_set_per_commitment_point(&this_ptr_conv, val_ref);
80306 }
80307
80308 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1get_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_ptr) {
80309         LDKHTLCDescriptor this_ptr_conv;
80310         this_ptr_conv.inner = untag_ptr(this_ptr);
80311         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
80312         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
80313         this_ptr_conv.is_owned = false;
80314         int32_t ret_conv = HTLCDescriptor_get_feerate_per_kw(&this_ptr_conv);
80315         return ret_conv;
80316 }
80317
80318 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1set_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
80319         LDKHTLCDescriptor this_ptr_conv;
80320         this_ptr_conv.inner = untag_ptr(this_ptr);
80321         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
80322         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
80323         this_ptr_conv.is_owned = false;
80324         HTLCDescriptor_set_feerate_per_kw(&this_ptr_conv, val);
80325 }
80326
80327 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1get_1htlc(JNIEnv *env, jclass clz, int64_t this_ptr) {
80328         LDKHTLCDescriptor this_ptr_conv;
80329         this_ptr_conv.inner = untag_ptr(this_ptr);
80330         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
80331         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
80332         this_ptr_conv.is_owned = false;
80333         LDKHTLCOutputInCommitment ret_var = HTLCDescriptor_get_htlc(&this_ptr_conv);
80334         int64_t ret_ref = 0;
80335         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
80336         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
80337         return ret_ref;
80338 }
80339
80340 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1set_1htlc(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
80341         LDKHTLCDescriptor this_ptr_conv;
80342         this_ptr_conv.inner = untag_ptr(this_ptr);
80343         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
80344         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
80345         this_ptr_conv.is_owned = false;
80346         LDKHTLCOutputInCommitment val_conv;
80347         val_conv.inner = untag_ptr(val);
80348         val_conv.is_owned = ptr_is_owned(val);
80349         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
80350         val_conv = HTLCOutputInCommitment_clone(&val_conv);
80351         HTLCDescriptor_set_htlc(&this_ptr_conv, val_conv);
80352 }
80353
80354 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1get_1preimage(JNIEnv *env, jclass clz, int64_t this_ptr) {
80355         LDKHTLCDescriptor this_ptr_conv;
80356         this_ptr_conv.inner = untag_ptr(this_ptr);
80357         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
80358         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
80359         this_ptr_conv.is_owned = false;
80360         LDKCOption_ThirtyTwoBytesZ *ret_copy = MALLOC(sizeof(LDKCOption_ThirtyTwoBytesZ), "LDKCOption_ThirtyTwoBytesZ");
80361         *ret_copy = HTLCDescriptor_get_preimage(&this_ptr_conv);
80362         int64_t ret_ref = tag_ptr(ret_copy, true);
80363         return ret_ref;
80364 }
80365
80366 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1set_1preimage(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
80367         LDKHTLCDescriptor this_ptr_conv;
80368         this_ptr_conv.inner = untag_ptr(this_ptr);
80369         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
80370         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
80371         this_ptr_conv.is_owned = false;
80372         void* val_ptr = untag_ptr(val);
80373         CHECK_ACCESS(val_ptr);
80374         LDKCOption_ThirtyTwoBytesZ val_conv = *(LDKCOption_ThirtyTwoBytesZ*)(val_ptr);
80375         val_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(val));
80376         HTLCDescriptor_set_preimage(&this_ptr_conv, val_conv);
80377 }
80378
80379 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1get_1counterparty_1sig(JNIEnv *env, jclass clz, int64_t this_ptr) {
80380         LDKHTLCDescriptor this_ptr_conv;
80381         this_ptr_conv.inner = untag_ptr(this_ptr);
80382         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
80383         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
80384         this_ptr_conv.is_owned = false;
80385         int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
80386         (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, HTLCDescriptor_get_counterparty_sig(&this_ptr_conv).compact_form);
80387         return ret_arr;
80388 }
80389
80390 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1set_1counterparty_1sig(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
80391         LDKHTLCDescriptor this_ptr_conv;
80392         this_ptr_conv.inner = untag_ptr(this_ptr);
80393         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
80394         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
80395         this_ptr_conv.is_owned = false;
80396         LDKECDSASignature val_ref;
80397         CHECK((*env)->GetArrayLength(env, val) == 64);
80398         (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
80399         HTLCDescriptor_set_counterparty_sig(&this_ptr_conv, val_ref);
80400 }
80401
80402 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1new(JNIEnv *env, jclass clz, int64_t channel_derivation_parameters_arg, int8_tArray commitment_txid_arg, int64_t per_commitment_number_arg, int8_tArray per_commitment_point_arg, int32_t feerate_per_kw_arg, int64_t htlc_arg, int64_t preimage_arg, int8_tArray counterparty_sig_arg) {
80403         LDKChannelDerivationParameters channel_derivation_parameters_arg_conv;
80404         channel_derivation_parameters_arg_conv.inner = untag_ptr(channel_derivation_parameters_arg);
80405         channel_derivation_parameters_arg_conv.is_owned = ptr_is_owned(channel_derivation_parameters_arg);
80406         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_derivation_parameters_arg_conv);
80407         channel_derivation_parameters_arg_conv = ChannelDerivationParameters_clone(&channel_derivation_parameters_arg_conv);
80408         LDKThirtyTwoBytes commitment_txid_arg_ref;
80409         CHECK((*env)->GetArrayLength(env, commitment_txid_arg) == 32);
80410         (*env)->GetByteArrayRegion(env, commitment_txid_arg, 0, 32, commitment_txid_arg_ref.data);
80411         LDKPublicKey per_commitment_point_arg_ref;
80412         CHECK((*env)->GetArrayLength(env, per_commitment_point_arg) == 33);
80413         (*env)->GetByteArrayRegion(env, per_commitment_point_arg, 0, 33, per_commitment_point_arg_ref.compressed_form);
80414         LDKHTLCOutputInCommitment htlc_arg_conv;
80415         htlc_arg_conv.inner = untag_ptr(htlc_arg);
80416         htlc_arg_conv.is_owned = ptr_is_owned(htlc_arg);
80417         CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_arg_conv);
80418         htlc_arg_conv = HTLCOutputInCommitment_clone(&htlc_arg_conv);
80419         void* preimage_arg_ptr = untag_ptr(preimage_arg);
80420         CHECK_ACCESS(preimage_arg_ptr);
80421         LDKCOption_ThirtyTwoBytesZ preimage_arg_conv = *(LDKCOption_ThirtyTwoBytesZ*)(preimage_arg_ptr);
80422         preimage_arg_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(preimage_arg));
80423         LDKECDSASignature counterparty_sig_arg_ref;
80424         CHECK((*env)->GetArrayLength(env, counterparty_sig_arg) == 64);
80425         (*env)->GetByteArrayRegion(env, counterparty_sig_arg, 0, 64, counterparty_sig_arg_ref.compact_form);
80426         LDKHTLCDescriptor ret_var = HTLCDescriptor_new(channel_derivation_parameters_arg_conv, commitment_txid_arg_ref, per_commitment_number_arg, per_commitment_point_arg_ref, feerate_per_kw_arg, htlc_arg_conv, preimage_arg_conv, counterparty_sig_arg_ref);
80427         int64_t ret_ref = 0;
80428         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
80429         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
80430         return ret_ref;
80431 }
80432
80433 static inline uint64_t HTLCDescriptor_clone_ptr(LDKHTLCDescriptor *NONNULL_PTR arg) {
80434         LDKHTLCDescriptor ret_var = HTLCDescriptor_clone(arg);
80435         int64_t ret_ref = 0;
80436         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
80437         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
80438         return ret_ref;
80439 }
80440 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
80441         LDKHTLCDescriptor arg_conv;
80442         arg_conv.inner = untag_ptr(arg);
80443         arg_conv.is_owned = ptr_is_owned(arg);
80444         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
80445         arg_conv.is_owned = false;
80446         int64_t ret_conv = HTLCDescriptor_clone_ptr(&arg_conv);
80447         return ret_conv;
80448 }
80449
80450 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
80451         LDKHTLCDescriptor orig_conv;
80452         orig_conv.inner = untag_ptr(orig);
80453         orig_conv.is_owned = ptr_is_owned(orig);
80454         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
80455         orig_conv.is_owned = false;
80456         LDKHTLCDescriptor ret_var = HTLCDescriptor_clone(&orig_conv);
80457         int64_t ret_ref = 0;
80458         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
80459         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
80460         return ret_ref;
80461 }
80462
80463 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
80464         LDKHTLCDescriptor a_conv;
80465         a_conv.inner = untag_ptr(a);
80466         a_conv.is_owned = ptr_is_owned(a);
80467         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
80468         a_conv.is_owned = false;
80469         LDKHTLCDescriptor b_conv;
80470         b_conv.inner = untag_ptr(b);
80471         b_conv.is_owned = ptr_is_owned(b);
80472         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
80473         b_conv.is_owned = false;
80474         jboolean ret_conv = HTLCDescriptor_eq(&a_conv, &b_conv);
80475         return ret_conv;
80476 }
80477
80478 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1write(JNIEnv *env, jclass clz, int64_t obj) {
80479         LDKHTLCDescriptor obj_conv;
80480         obj_conv.inner = untag_ptr(obj);
80481         obj_conv.is_owned = ptr_is_owned(obj);
80482         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
80483         obj_conv.is_owned = false;
80484         LDKCVec_u8Z ret_var = HTLCDescriptor_write(&obj_conv);
80485         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
80486         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
80487         CVec_u8Z_free(ret_var);
80488         return ret_arr;
80489 }
80490
80491 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
80492         LDKu8slice ser_ref;
80493         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
80494         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
80495         LDKCResult_HTLCDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCDescriptorDecodeErrorZ), "LDKCResult_HTLCDescriptorDecodeErrorZ");
80496         *ret_conv = HTLCDescriptor_read(ser_ref);
80497         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
80498         return tag_ptr(ret_conv, true);
80499 }
80500
80501 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1outpoint(JNIEnv *env, jclass clz, int64_t this_arg) {
80502         LDKHTLCDescriptor this_arg_conv;
80503         this_arg_conv.inner = untag_ptr(this_arg);
80504         this_arg_conv.is_owned = ptr_is_owned(this_arg);
80505         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
80506         this_arg_conv.is_owned = false;
80507         LDKOutPoint ret_var = HTLCDescriptor_outpoint(&this_arg_conv);
80508         int64_t ret_ref = 0;
80509         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
80510         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
80511         return ret_ref;
80512 }
80513
80514 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1previous_1utxo(JNIEnv *env, jclass clz, int64_t this_arg) {
80515         LDKHTLCDescriptor this_arg_conv;
80516         this_arg_conv.inner = untag_ptr(this_arg);
80517         this_arg_conv.is_owned = ptr_is_owned(this_arg);
80518         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
80519         this_arg_conv.is_owned = false;
80520         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
80521         *ret_ref = HTLCDescriptor_previous_utxo(&this_arg_conv);
80522         return tag_ptr(ret_ref, true);
80523 }
80524
80525 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1unsigned_1tx_1input(JNIEnv *env, jclass clz, int64_t this_arg) {
80526         LDKHTLCDescriptor this_arg_conv;
80527         this_arg_conv.inner = untag_ptr(this_arg);
80528         this_arg_conv.is_owned = ptr_is_owned(this_arg);
80529         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
80530         this_arg_conv.is_owned = false;
80531         LDKTxIn* ret_ref = MALLOC(sizeof(LDKTxIn), "LDKTxIn");
80532         *ret_ref = HTLCDescriptor_unsigned_tx_input(&this_arg_conv);
80533         return tag_ptr(ret_ref, true);
80534 }
80535
80536 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1tx_1output(JNIEnv *env, jclass clz, int64_t this_arg) {
80537         LDKHTLCDescriptor this_arg_conv;
80538         this_arg_conv.inner = untag_ptr(this_arg);
80539         this_arg_conv.is_owned = ptr_is_owned(this_arg);
80540         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
80541         this_arg_conv.is_owned = false;
80542         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
80543         *ret_ref = HTLCDescriptor_tx_output(&this_arg_conv);
80544         return tag_ptr(ret_ref, true);
80545 }
80546
80547 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1witness_1script(JNIEnv *env, jclass clz, int64_t this_arg) {
80548         LDKHTLCDescriptor this_arg_conv;
80549         this_arg_conv.inner = untag_ptr(this_arg);
80550         this_arg_conv.is_owned = ptr_is_owned(this_arg);
80551         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
80552         this_arg_conv.is_owned = false;
80553         LDKCVec_u8Z ret_var = HTLCDescriptor_witness_script(&this_arg_conv);
80554         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
80555         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
80556         CVec_u8Z_free(ret_var);
80557         return ret_arr;
80558 }
80559
80560 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) {
80561         LDKHTLCDescriptor this_arg_conv;
80562         this_arg_conv.inner = untag_ptr(this_arg);
80563         this_arg_conv.is_owned = ptr_is_owned(this_arg);
80564         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
80565         this_arg_conv.is_owned = false;
80566         LDKECDSASignature signature_ref;
80567         CHECK((*env)->GetArrayLength(env, signature) == 64);
80568         (*env)->GetByteArrayRegion(env, signature, 0, 64, signature_ref.compact_form);
80569         LDKu8slice witness_script_ref;
80570         witness_script_ref.datalen = (*env)->GetArrayLength(env, witness_script);
80571         witness_script_ref.data = (*env)->GetByteArrayElements (env, witness_script, NULL);
80572         LDKWitness ret_var = HTLCDescriptor_tx_input_witness(&this_arg_conv, signature_ref, witness_script_ref);
80573         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
80574         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
80575         Witness_free(ret_var);
80576         (*env)->ReleaseByteArrayElements(env, witness_script, (int8_t*)witness_script_ref.data, 0);
80577         return ret_arr;
80578 }
80579
80580 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) {
80581         LDKHTLCDescriptor this_arg_conv;
80582         this_arg_conv.inner = untag_ptr(this_arg);
80583         this_arg_conv.is_owned = ptr_is_owned(this_arg);
80584         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
80585         this_arg_conv.is_owned = false;
80586         void* signer_provider_ptr = untag_ptr(signer_provider);
80587         if (ptr_is_owned(signer_provider)) { CHECK_ACCESS(signer_provider_ptr); }
80588         LDKSignerProvider* signer_provider_conv = (LDKSignerProvider*)signer_provider_ptr;
80589         LDKWriteableEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner");
80590         *ret_ret = HTLCDescriptor_derive_channel_signer(&this_arg_conv, signer_provider_conv);
80591         return tag_ptr(ret_ret, true);
80592 }
80593
80594 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelSigner_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
80595         if (!ptr_is_owned(this_ptr)) return;
80596         void* this_ptr_ptr = untag_ptr(this_ptr);
80597         CHECK_ACCESS(this_ptr_ptr);
80598         LDKChannelSigner this_ptr_conv = *(LDKChannelSigner*)(this_ptr_ptr);
80599         FREE(untag_ptr(this_ptr));
80600         ChannelSigner_free(this_ptr_conv);
80601 }
80602
80603 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Recipient_1clone(JNIEnv *env, jclass clz, int64_t orig) {
80604         LDKRecipient* orig_conv = (LDKRecipient*)untag_ptr(orig);
80605         jclass ret_conv = LDKRecipient_to_java(env, Recipient_clone(orig_conv));
80606         return ret_conv;
80607 }
80608
80609 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Recipient_1node(JNIEnv *env, jclass clz) {
80610         jclass ret_conv = LDKRecipient_to_java(env, Recipient_node());
80611         return ret_conv;
80612 }
80613
80614 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Recipient_1phantom_1node(JNIEnv *env, jclass clz) {
80615         jclass ret_conv = LDKRecipient_to_java(env, Recipient_phantom_node());
80616         return ret_conv;
80617 }
80618
80619 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EntropySource_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
80620         if (!ptr_is_owned(this_ptr)) return;
80621         void* this_ptr_ptr = untag_ptr(this_ptr);
80622         CHECK_ACCESS(this_ptr_ptr);
80623         LDKEntropySource this_ptr_conv = *(LDKEntropySource*)(this_ptr_ptr);
80624         FREE(untag_ptr(this_ptr));
80625         EntropySource_free(this_ptr_conv);
80626 }
80627
80628 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeSigner_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
80629         if (!ptr_is_owned(this_ptr)) return;
80630         void* this_ptr_ptr = untag_ptr(this_ptr);
80631         CHECK_ACCESS(this_ptr_ptr);
80632         LDKNodeSigner this_ptr_conv = *(LDKNodeSigner*)(this_ptr_ptr);
80633         FREE(untag_ptr(this_ptr));
80634         NodeSigner_free(this_ptr_conv);
80635 }
80636
80637 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OutputSpender_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
80638         if (!ptr_is_owned(this_ptr)) return;
80639         void* this_ptr_ptr = untag_ptr(this_ptr);
80640         CHECK_ACCESS(this_ptr_ptr);
80641         LDKOutputSpender this_ptr_conv = *(LDKOutputSpender*)(this_ptr_ptr);
80642         FREE(untag_ptr(this_ptr));
80643         OutputSpender_free(this_ptr_conv);
80644 }
80645
80646 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SignerProvider_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
80647         if (!ptr_is_owned(this_ptr)) return;
80648         void* this_ptr_ptr = untag_ptr(this_ptr);
80649         CHECK_ACCESS(this_ptr_ptr);
80650         LDKSignerProvider this_ptr_conv = *(LDKSignerProvider*)(this_ptr_ptr);
80651         FREE(untag_ptr(this_ptr));
80652         SignerProvider_free(this_ptr_conv);
80653 }
80654
80655 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChangeDestinationSource_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
80656         if (!ptr_is_owned(this_ptr)) return;
80657         void* this_ptr_ptr = untag_ptr(this_ptr);
80658         CHECK_ACCESS(this_ptr_ptr);
80659         LDKChangeDestinationSource this_ptr_conv = *(LDKChangeDestinationSource*)(this_ptr_ptr);
80660         FREE(untag_ptr(this_ptr));
80661         ChangeDestinationSource_free(this_ptr_conv);
80662 }
80663
80664 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
80665         LDKInMemorySigner this_obj_conv;
80666         this_obj_conv.inner = untag_ptr(this_obj);
80667         this_obj_conv.is_owned = ptr_is_owned(this_obj);
80668         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
80669         InMemorySigner_free(this_obj_conv);
80670 }
80671
80672 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1funding_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
80673         LDKInMemorySigner this_ptr_conv;
80674         this_ptr_conv.inner = untag_ptr(this_ptr);
80675         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
80676         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
80677         this_ptr_conv.is_owned = false;
80678         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
80679         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_funding_key(&this_ptr_conv));
80680         return ret_arr;
80681 }
80682
80683 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1set_1funding_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
80684         LDKInMemorySigner this_ptr_conv;
80685         this_ptr_conv.inner = untag_ptr(this_ptr);
80686         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
80687         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
80688         this_ptr_conv.is_owned = false;
80689         LDKSecretKey val_ref;
80690         CHECK((*env)->GetArrayLength(env, val) == 32);
80691         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.bytes);
80692         InMemorySigner_set_funding_key(&this_ptr_conv, val_ref);
80693 }
80694
80695 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1revocation_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
80696         LDKInMemorySigner this_ptr_conv;
80697         this_ptr_conv.inner = untag_ptr(this_ptr);
80698         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
80699         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
80700         this_ptr_conv.is_owned = false;
80701         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
80702         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_revocation_base_key(&this_ptr_conv));
80703         return ret_arr;
80704 }
80705
80706 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1set_1revocation_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
80707         LDKInMemorySigner this_ptr_conv;
80708         this_ptr_conv.inner = untag_ptr(this_ptr);
80709         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
80710         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
80711         this_ptr_conv.is_owned = false;
80712         LDKSecretKey val_ref;
80713         CHECK((*env)->GetArrayLength(env, val) == 32);
80714         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.bytes);
80715         InMemorySigner_set_revocation_base_key(&this_ptr_conv, val_ref);
80716 }
80717
80718 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1payment_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
80719         LDKInMemorySigner this_ptr_conv;
80720         this_ptr_conv.inner = untag_ptr(this_ptr);
80721         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
80722         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
80723         this_ptr_conv.is_owned = false;
80724         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
80725         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_payment_key(&this_ptr_conv));
80726         return ret_arr;
80727 }
80728
80729 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1set_1payment_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
80730         LDKInMemorySigner this_ptr_conv;
80731         this_ptr_conv.inner = untag_ptr(this_ptr);
80732         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
80733         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
80734         this_ptr_conv.is_owned = false;
80735         LDKSecretKey val_ref;
80736         CHECK((*env)->GetArrayLength(env, val) == 32);
80737         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.bytes);
80738         InMemorySigner_set_payment_key(&this_ptr_conv, val_ref);
80739 }
80740
80741 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1delayed_1payment_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
80742         LDKInMemorySigner this_ptr_conv;
80743         this_ptr_conv.inner = untag_ptr(this_ptr);
80744         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
80745         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
80746         this_ptr_conv.is_owned = false;
80747         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
80748         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_delayed_payment_base_key(&this_ptr_conv));
80749         return ret_arr;
80750 }
80751
80752 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) {
80753         LDKInMemorySigner this_ptr_conv;
80754         this_ptr_conv.inner = untag_ptr(this_ptr);
80755         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
80756         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
80757         this_ptr_conv.is_owned = false;
80758         LDKSecretKey val_ref;
80759         CHECK((*env)->GetArrayLength(env, val) == 32);
80760         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.bytes);
80761         InMemorySigner_set_delayed_payment_base_key(&this_ptr_conv, val_ref);
80762 }
80763
80764 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1htlc_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
80765         LDKInMemorySigner this_ptr_conv;
80766         this_ptr_conv.inner = untag_ptr(this_ptr);
80767         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
80768         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
80769         this_ptr_conv.is_owned = false;
80770         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
80771         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_htlc_base_key(&this_ptr_conv));
80772         return ret_arr;
80773 }
80774
80775 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1set_1htlc_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
80776         LDKInMemorySigner this_ptr_conv;
80777         this_ptr_conv.inner = untag_ptr(this_ptr);
80778         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
80779         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
80780         this_ptr_conv.is_owned = false;
80781         LDKSecretKey val_ref;
80782         CHECK((*env)->GetArrayLength(env, val) == 32);
80783         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.bytes);
80784         InMemorySigner_set_htlc_base_key(&this_ptr_conv, val_ref);
80785 }
80786
80787 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1commitment_1seed(JNIEnv *env, jclass clz, int64_t this_ptr) {
80788         LDKInMemorySigner this_ptr_conv;
80789         this_ptr_conv.inner = untag_ptr(this_ptr);
80790         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
80791         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
80792         this_ptr_conv.is_owned = false;
80793         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
80794         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_commitment_seed(&this_ptr_conv));
80795         return ret_arr;
80796 }
80797
80798 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1set_1commitment_1seed(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
80799         LDKInMemorySigner this_ptr_conv;
80800         this_ptr_conv.inner = untag_ptr(this_ptr);
80801         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
80802         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
80803         this_ptr_conv.is_owned = false;
80804         LDKThirtyTwoBytes val_ref;
80805         CHECK((*env)->GetArrayLength(env, val) == 32);
80806         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
80807         InMemorySigner_set_commitment_seed(&this_ptr_conv, val_ref);
80808 }
80809
80810 static inline uint64_t InMemorySigner_clone_ptr(LDKInMemorySigner *NONNULL_PTR arg) {
80811         LDKInMemorySigner ret_var = InMemorySigner_clone(arg);
80812         int64_t ret_ref = 0;
80813         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
80814         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
80815         return ret_ref;
80816 }
80817 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
80818         LDKInMemorySigner arg_conv;
80819         arg_conv.inner = untag_ptr(arg);
80820         arg_conv.is_owned = ptr_is_owned(arg);
80821         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
80822         arg_conv.is_owned = false;
80823         int64_t ret_conv = InMemorySigner_clone_ptr(&arg_conv);
80824         return ret_conv;
80825 }
80826
80827 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1clone(JNIEnv *env, jclass clz, int64_t orig) {
80828         LDKInMemorySigner orig_conv;
80829         orig_conv.inner = untag_ptr(orig);
80830         orig_conv.is_owned = ptr_is_owned(orig);
80831         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
80832         orig_conv.is_owned = false;
80833         LDKInMemorySigner ret_var = InMemorySigner_clone(&orig_conv);
80834         int64_t ret_ref = 0;
80835         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
80836         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
80837         return ret_ref;
80838 }
80839
80840 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) {
80841         LDKSecretKey funding_key_ref;
80842         CHECK((*env)->GetArrayLength(env, funding_key) == 32);
80843         (*env)->GetByteArrayRegion(env, funding_key, 0, 32, funding_key_ref.bytes);
80844         LDKSecretKey revocation_base_key_ref;
80845         CHECK((*env)->GetArrayLength(env, revocation_base_key) == 32);
80846         (*env)->GetByteArrayRegion(env, revocation_base_key, 0, 32, revocation_base_key_ref.bytes);
80847         LDKSecretKey payment_key_ref;
80848         CHECK((*env)->GetArrayLength(env, payment_key) == 32);
80849         (*env)->GetByteArrayRegion(env, payment_key, 0, 32, payment_key_ref.bytes);
80850         LDKSecretKey delayed_payment_base_key_ref;
80851         CHECK((*env)->GetArrayLength(env, delayed_payment_base_key) == 32);
80852         (*env)->GetByteArrayRegion(env, delayed_payment_base_key, 0, 32, delayed_payment_base_key_ref.bytes);
80853         LDKSecretKey htlc_base_key_ref;
80854         CHECK((*env)->GetArrayLength(env, htlc_base_key) == 32);
80855         (*env)->GetByteArrayRegion(env, htlc_base_key, 0, 32, htlc_base_key_ref.bytes);
80856         LDKThirtyTwoBytes commitment_seed_ref;
80857         CHECK((*env)->GetArrayLength(env, commitment_seed) == 32);
80858         (*env)->GetByteArrayRegion(env, commitment_seed, 0, 32, commitment_seed_ref.data);
80859         LDKThirtyTwoBytes channel_keys_id_ref;
80860         CHECK((*env)->GetArrayLength(env, channel_keys_id) == 32);
80861         (*env)->GetByteArrayRegion(env, channel_keys_id, 0, 32, channel_keys_id_ref.data);
80862         LDKThirtyTwoBytes rand_bytes_unique_start_ref;
80863         CHECK((*env)->GetArrayLength(env, rand_bytes_unique_start) == 32);
80864         (*env)->GetByteArrayRegion(env, rand_bytes_unique_start, 0, 32, rand_bytes_unique_start_ref.data);
80865         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);
80866         int64_t ret_ref = 0;
80867         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
80868         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
80869         return ret_ref;
80870 }
80871
80872 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1counterparty_1pubkeys(JNIEnv *env, jclass clz, int64_t this_arg) {
80873         LDKInMemorySigner this_arg_conv;
80874         this_arg_conv.inner = untag_ptr(this_arg);
80875         this_arg_conv.is_owned = ptr_is_owned(this_arg);
80876         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
80877         this_arg_conv.is_owned = false;
80878         LDKChannelPublicKeys ret_var = InMemorySigner_counterparty_pubkeys(&this_arg_conv);
80879         int64_t ret_ref = 0;
80880         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
80881         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
80882         return ret_ref;
80883 }
80884
80885 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1counterparty_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_arg) {
80886         LDKInMemorySigner this_arg_conv;
80887         this_arg_conv.inner = untag_ptr(this_arg);
80888         this_arg_conv.is_owned = ptr_is_owned(this_arg);
80889         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
80890         this_arg_conv.is_owned = false;
80891         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
80892         *ret_copy = InMemorySigner_counterparty_selected_contest_delay(&this_arg_conv);
80893         int64_t ret_ref = tag_ptr(ret_copy, true);
80894         return ret_ref;
80895 }
80896
80897 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1holder_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_arg) {
80898         LDKInMemorySigner this_arg_conv;
80899         this_arg_conv.inner = untag_ptr(this_arg);
80900         this_arg_conv.is_owned = ptr_is_owned(this_arg);
80901         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
80902         this_arg_conv.is_owned = false;
80903         LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
80904         *ret_copy = InMemorySigner_holder_selected_contest_delay(&this_arg_conv);
80905         int64_t ret_ref = tag_ptr(ret_copy, true);
80906         return ret_ref;
80907 }
80908
80909 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1is_1outbound(JNIEnv *env, jclass clz, int64_t this_arg) {
80910         LDKInMemorySigner this_arg_conv;
80911         this_arg_conv.inner = untag_ptr(this_arg);
80912         this_arg_conv.is_owned = ptr_is_owned(this_arg);
80913         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
80914         this_arg_conv.is_owned = false;
80915         LDKCOption_boolZ *ret_copy = MALLOC(sizeof(LDKCOption_boolZ), "LDKCOption_boolZ");
80916         *ret_copy = InMemorySigner_is_outbound(&this_arg_conv);
80917         int64_t ret_ref = tag_ptr(ret_copy, true);
80918         return ret_ref;
80919 }
80920
80921 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1funding_1outpoint(JNIEnv *env, jclass clz, int64_t this_arg) {
80922         LDKInMemorySigner this_arg_conv;
80923         this_arg_conv.inner = untag_ptr(this_arg);
80924         this_arg_conv.is_owned = ptr_is_owned(this_arg);
80925         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
80926         this_arg_conv.is_owned = false;
80927         LDKOutPoint ret_var = InMemorySigner_funding_outpoint(&this_arg_conv);
80928         int64_t ret_ref = 0;
80929         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
80930         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
80931         return ret_ref;
80932 }
80933
80934 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1channel_1parameters(JNIEnv *env, jclass clz, int64_t this_arg) {
80935         LDKInMemorySigner this_arg_conv;
80936         this_arg_conv.inner = untag_ptr(this_arg);
80937         this_arg_conv.is_owned = ptr_is_owned(this_arg);
80938         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
80939         this_arg_conv.is_owned = false;
80940         LDKChannelTransactionParameters ret_var = InMemorySigner_get_channel_parameters(&this_arg_conv);
80941         int64_t ret_ref = 0;
80942         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
80943         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
80944         return ret_ref;
80945 }
80946
80947 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1channel_1type_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
80948         LDKInMemorySigner this_arg_conv;
80949         this_arg_conv.inner = untag_ptr(this_arg);
80950         this_arg_conv.is_owned = ptr_is_owned(this_arg);
80951         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
80952         this_arg_conv.is_owned = false;
80953         LDKChannelTypeFeatures ret_var = InMemorySigner_channel_type_features(&this_arg_conv);
80954         int64_t ret_ref = 0;
80955         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
80956         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
80957         return ret_ref;
80958 }
80959
80960 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) {
80961         LDKInMemorySigner this_arg_conv;
80962         this_arg_conv.inner = untag_ptr(this_arg);
80963         this_arg_conv.is_owned = ptr_is_owned(this_arg);
80964         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
80965         this_arg_conv.is_owned = false;
80966         LDKTransaction spend_tx_ref;
80967         spend_tx_ref.datalen = (*env)->GetArrayLength(env, spend_tx);
80968         spend_tx_ref.data = MALLOC(spend_tx_ref.datalen, "LDKTransaction Bytes");
80969         (*env)->GetByteArrayRegion(env, spend_tx, 0, spend_tx_ref.datalen, spend_tx_ref.data);
80970         spend_tx_ref.data_is_owned = true;
80971         LDKStaticPaymentOutputDescriptor descriptor_conv;
80972         descriptor_conv.inner = untag_ptr(descriptor);
80973         descriptor_conv.is_owned = ptr_is_owned(descriptor);
80974         CHECK_INNER_FIELD_ACCESS_OR_NULL(descriptor_conv);
80975         descriptor_conv.is_owned = false;
80976         LDKCResult_WitnessNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_WitnessNoneZ), "LDKCResult_WitnessNoneZ");
80977         *ret_conv = InMemorySigner_sign_counterparty_payment_input(&this_arg_conv, spend_tx_ref, input_idx, &descriptor_conv);
80978         return tag_ptr(ret_conv, true);
80979 }
80980
80981 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) {
80982         LDKInMemorySigner this_arg_conv;
80983         this_arg_conv.inner = untag_ptr(this_arg);
80984         this_arg_conv.is_owned = ptr_is_owned(this_arg);
80985         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
80986         this_arg_conv.is_owned = false;
80987         LDKTransaction spend_tx_ref;
80988         spend_tx_ref.datalen = (*env)->GetArrayLength(env, spend_tx);
80989         spend_tx_ref.data = MALLOC(spend_tx_ref.datalen, "LDKTransaction Bytes");
80990         (*env)->GetByteArrayRegion(env, spend_tx, 0, spend_tx_ref.datalen, spend_tx_ref.data);
80991         spend_tx_ref.data_is_owned = true;
80992         LDKDelayedPaymentOutputDescriptor descriptor_conv;
80993         descriptor_conv.inner = untag_ptr(descriptor);
80994         descriptor_conv.is_owned = ptr_is_owned(descriptor);
80995         CHECK_INNER_FIELD_ACCESS_OR_NULL(descriptor_conv);
80996         descriptor_conv.is_owned = false;
80997         LDKCResult_WitnessNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_WitnessNoneZ), "LDKCResult_WitnessNoneZ");
80998         *ret_conv = InMemorySigner_sign_dynamic_p2wsh_input(&this_arg_conv, spend_tx_ref, input_idx, &descriptor_conv);
80999         return tag_ptr(ret_conv, true);
81000 }
81001
81002 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1as_1EntropySource(JNIEnv *env, jclass clz, int64_t this_arg) {
81003         LDKInMemorySigner this_arg_conv;
81004         this_arg_conv.inner = untag_ptr(this_arg);
81005         this_arg_conv.is_owned = ptr_is_owned(this_arg);
81006         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
81007         this_arg_conv.is_owned = false;
81008         LDKEntropySource* ret_ret = MALLOC(sizeof(LDKEntropySource), "LDKEntropySource");
81009         *ret_ret = InMemorySigner_as_EntropySource(&this_arg_conv);
81010         return tag_ptr(ret_ret, true);
81011 }
81012
81013 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1as_1ChannelSigner(JNIEnv *env, jclass clz, int64_t this_arg) {
81014         LDKInMemorySigner this_arg_conv;
81015         this_arg_conv.inner = untag_ptr(this_arg);
81016         this_arg_conv.is_owned = ptr_is_owned(this_arg);
81017         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
81018         this_arg_conv.is_owned = false;
81019         LDKChannelSigner* ret_ret = MALLOC(sizeof(LDKChannelSigner), "LDKChannelSigner");
81020         *ret_ret = InMemorySigner_as_ChannelSigner(&this_arg_conv);
81021         return tag_ptr(ret_ret, true);
81022 }
81023
81024 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1as_1EcdsaChannelSigner(JNIEnv *env, jclass clz, int64_t this_arg) {
81025         LDKInMemorySigner this_arg_conv;
81026         this_arg_conv.inner = untag_ptr(this_arg);
81027         this_arg_conv.is_owned = ptr_is_owned(this_arg);
81028         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
81029         this_arg_conv.is_owned = false;
81030         LDKEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKEcdsaChannelSigner), "LDKEcdsaChannelSigner");
81031         *ret_ret = InMemorySigner_as_EcdsaChannelSigner(&this_arg_conv);
81032         return tag_ptr(ret_ret, true);
81033 }
81034
81035 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1as_1WriteableEcdsaChannelSigner(JNIEnv *env, jclass clz, int64_t this_arg) {
81036         LDKInMemorySigner this_arg_conv;
81037         this_arg_conv.inner = untag_ptr(this_arg);
81038         this_arg_conv.is_owned = ptr_is_owned(this_arg);
81039         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
81040         this_arg_conv.is_owned = false;
81041         LDKWriteableEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner");
81042         *ret_ret = InMemorySigner_as_WriteableEcdsaChannelSigner(&this_arg_conv);
81043         return tag_ptr(ret_ret, true);
81044 }
81045
81046 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1write(JNIEnv *env, jclass clz, int64_t obj) {
81047         LDKInMemorySigner obj_conv;
81048         obj_conv.inner = untag_ptr(obj);
81049         obj_conv.is_owned = ptr_is_owned(obj);
81050         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
81051         obj_conv.is_owned = false;
81052         LDKCVec_u8Z ret_var = InMemorySigner_write(&obj_conv);
81053         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
81054         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
81055         CVec_u8Z_free(ret_var);
81056         return ret_arr;
81057 }
81058
81059 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1read(JNIEnv *env, jclass clz, int8_tArray ser, int64_t arg) {
81060         LDKu8slice ser_ref;
81061         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
81062         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
81063         void* arg_ptr = untag_ptr(arg);
81064         CHECK_ACCESS(arg_ptr);
81065         LDKEntropySource arg_conv = *(LDKEntropySource*)(arg_ptr);
81066         if (arg_conv.free == LDKEntropySource_JCalls_free) {
81067                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
81068                 LDKEntropySource_JCalls_cloned(&arg_conv);
81069         }
81070         LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
81071         *ret_conv = InMemorySigner_read(ser_ref, arg_conv);
81072         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
81073         return tag_ptr(ret_conv, true);
81074 }
81075
81076 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_KeysManager_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
81077         LDKKeysManager this_obj_conv;
81078         this_obj_conv.inner = untag_ptr(this_obj);
81079         this_obj_conv.is_owned = ptr_is_owned(this_obj);
81080         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
81081         KeysManager_free(this_obj_conv);
81082 }
81083
81084 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) {
81085         uint8_t seed_arr[32];
81086         CHECK((*env)->GetArrayLength(env, seed) == 32);
81087         (*env)->GetByteArrayRegion(env, seed, 0, 32, seed_arr);
81088         uint8_t (*seed_ref)[32] = &seed_arr;
81089         LDKKeysManager ret_var = KeysManager_new(seed_ref, starting_time_secs, starting_time_nanos);
81090         int64_t ret_ref = 0;
81091         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
81092         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
81093         return ret_ref;
81094 }
81095
81096 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_KeysManager_1get_1node_1secret_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
81097         LDKKeysManager this_arg_conv;
81098         this_arg_conv.inner = untag_ptr(this_arg);
81099         this_arg_conv.is_owned = ptr_is_owned(this_arg);
81100         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
81101         this_arg_conv.is_owned = false;
81102         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
81103         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, KeysManager_get_node_secret_key(&this_arg_conv).bytes);
81104         return ret_arr;
81105 }
81106
81107 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) {
81108         LDKKeysManager this_arg_conv;
81109         this_arg_conv.inner = untag_ptr(this_arg);
81110         this_arg_conv.is_owned = ptr_is_owned(this_arg);
81111         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
81112         this_arg_conv.is_owned = false;
81113         uint8_t params_arr[32];
81114         CHECK((*env)->GetArrayLength(env, params) == 32);
81115         (*env)->GetByteArrayRegion(env, params, 0, 32, params_arr);
81116         uint8_t (*params_ref)[32] = &params_arr;
81117         LDKInMemorySigner ret_var = KeysManager_derive_channel_keys(&this_arg_conv, channel_value_satoshis, params_ref);
81118         int64_t ret_ref = 0;
81119         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
81120         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
81121         return ret_ref;
81122 }
81123
81124 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) {
81125         LDKKeysManager this_arg_conv;
81126         this_arg_conv.inner = untag_ptr(this_arg);
81127         this_arg_conv.is_owned = ptr_is_owned(this_arg);
81128         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
81129         this_arg_conv.is_owned = false;
81130         LDKCVec_SpendableOutputDescriptorZ descriptors_constr;
81131         descriptors_constr.datalen = (*env)->GetArrayLength(env, descriptors);
81132         if (descriptors_constr.datalen > 0)
81133                 descriptors_constr.data = MALLOC(descriptors_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
81134         else
81135                 descriptors_constr.data = NULL;
81136         int64_t* descriptors_vals = (*env)->GetLongArrayElements (env, descriptors, NULL);
81137         for (size_t b = 0; b < descriptors_constr.datalen; b++) {
81138                 int64_t descriptors_conv_27 = descriptors_vals[b];
81139                 void* descriptors_conv_27_ptr = untag_ptr(descriptors_conv_27);
81140                 CHECK_ACCESS(descriptors_conv_27_ptr);
81141                 LDKSpendableOutputDescriptor descriptors_conv_27_conv = *(LDKSpendableOutputDescriptor*)(descriptors_conv_27_ptr);
81142                 descriptors_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)untag_ptr(descriptors_conv_27));
81143                 descriptors_constr.data[b] = descriptors_conv_27_conv;
81144         }
81145         (*env)->ReleaseLongArrayElements(env, descriptors, descriptors_vals, 0);
81146         LDKCVec_u8Z psbt_ref;
81147         psbt_ref.datalen = (*env)->GetArrayLength(env, psbt);
81148         psbt_ref.data = MALLOC(psbt_ref.datalen, "LDKCVec_u8Z Bytes");
81149         (*env)->GetByteArrayRegion(env, psbt, 0, psbt_ref.datalen, psbt_ref.data);
81150         LDKCResult_CVec_u8ZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZNoneZ), "LDKCResult_CVec_u8ZNoneZ");
81151         *ret_conv = KeysManager_sign_spendable_outputs_psbt(&this_arg_conv, descriptors_constr, psbt_ref);
81152         return tag_ptr(ret_conv, true);
81153 }
81154
81155 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysManager_1as_1EntropySource(JNIEnv *env, jclass clz, int64_t this_arg) {
81156         LDKKeysManager this_arg_conv;
81157         this_arg_conv.inner = untag_ptr(this_arg);
81158         this_arg_conv.is_owned = ptr_is_owned(this_arg);
81159         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
81160         this_arg_conv.is_owned = false;
81161         LDKEntropySource* ret_ret = MALLOC(sizeof(LDKEntropySource), "LDKEntropySource");
81162         *ret_ret = KeysManager_as_EntropySource(&this_arg_conv);
81163         return tag_ptr(ret_ret, true);
81164 }
81165
81166 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysManager_1as_1NodeSigner(JNIEnv *env, jclass clz, int64_t this_arg) {
81167         LDKKeysManager this_arg_conv;
81168         this_arg_conv.inner = untag_ptr(this_arg);
81169         this_arg_conv.is_owned = ptr_is_owned(this_arg);
81170         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
81171         this_arg_conv.is_owned = false;
81172         LDKNodeSigner* ret_ret = MALLOC(sizeof(LDKNodeSigner), "LDKNodeSigner");
81173         *ret_ret = KeysManager_as_NodeSigner(&this_arg_conv);
81174         return tag_ptr(ret_ret, true);
81175 }
81176
81177 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysManager_1as_1OutputSpender(JNIEnv *env, jclass clz, int64_t this_arg) {
81178         LDKKeysManager this_arg_conv;
81179         this_arg_conv.inner = untag_ptr(this_arg);
81180         this_arg_conv.is_owned = ptr_is_owned(this_arg);
81181         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
81182         this_arg_conv.is_owned = false;
81183         LDKOutputSpender* ret_ret = MALLOC(sizeof(LDKOutputSpender), "LDKOutputSpender");
81184         *ret_ret = KeysManager_as_OutputSpender(&this_arg_conv);
81185         return tag_ptr(ret_ret, true);
81186 }
81187
81188 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysManager_1as_1SignerProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
81189         LDKKeysManager this_arg_conv;
81190         this_arg_conv.inner = untag_ptr(this_arg);
81191         this_arg_conv.is_owned = ptr_is_owned(this_arg);
81192         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
81193         this_arg_conv.is_owned = false;
81194         LDKSignerProvider* ret_ret = MALLOC(sizeof(LDKSignerProvider), "LDKSignerProvider");
81195         *ret_ret = KeysManager_as_SignerProvider(&this_arg_conv);
81196         return tag_ptr(ret_ret, true);
81197 }
81198
81199 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PhantomKeysManager_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
81200         LDKPhantomKeysManager this_obj_conv;
81201         this_obj_conv.inner = untag_ptr(this_obj);
81202         this_obj_conv.is_owned = ptr_is_owned(this_obj);
81203         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
81204         PhantomKeysManager_free(this_obj_conv);
81205 }
81206
81207 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PhantomKeysManager_1as_1EntropySource(JNIEnv *env, jclass clz, int64_t this_arg) {
81208         LDKPhantomKeysManager this_arg_conv;
81209         this_arg_conv.inner = untag_ptr(this_arg);
81210         this_arg_conv.is_owned = ptr_is_owned(this_arg);
81211         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
81212         this_arg_conv.is_owned = false;
81213         LDKEntropySource* ret_ret = MALLOC(sizeof(LDKEntropySource), "LDKEntropySource");
81214         *ret_ret = PhantomKeysManager_as_EntropySource(&this_arg_conv);
81215         return tag_ptr(ret_ret, true);
81216 }
81217
81218 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PhantomKeysManager_1as_1NodeSigner(JNIEnv *env, jclass clz, int64_t this_arg) {
81219         LDKPhantomKeysManager this_arg_conv;
81220         this_arg_conv.inner = untag_ptr(this_arg);
81221         this_arg_conv.is_owned = ptr_is_owned(this_arg);
81222         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
81223         this_arg_conv.is_owned = false;
81224         LDKNodeSigner* ret_ret = MALLOC(sizeof(LDKNodeSigner), "LDKNodeSigner");
81225         *ret_ret = PhantomKeysManager_as_NodeSigner(&this_arg_conv);
81226         return tag_ptr(ret_ret, true);
81227 }
81228
81229 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PhantomKeysManager_1as_1OutputSpender(JNIEnv *env, jclass clz, int64_t this_arg) {
81230         LDKPhantomKeysManager this_arg_conv;
81231         this_arg_conv.inner = untag_ptr(this_arg);
81232         this_arg_conv.is_owned = ptr_is_owned(this_arg);
81233         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
81234         this_arg_conv.is_owned = false;
81235         LDKOutputSpender* ret_ret = MALLOC(sizeof(LDKOutputSpender), "LDKOutputSpender");
81236         *ret_ret = PhantomKeysManager_as_OutputSpender(&this_arg_conv);
81237         return tag_ptr(ret_ret, true);
81238 }
81239
81240 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PhantomKeysManager_1as_1SignerProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
81241         LDKPhantomKeysManager this_arg_conv;
81242         this_arg_conv.inner = untag_ptr(this_arg);
81243         this_arg_conv.is_owned = ptr_is_owned(this_arg);
81244         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
81245         this_arg_conv.is_owned = false;
81246         LDKSignerProvider* ret_ret = MALLOC(sizeof(LDKSignerProvider), "LDKSignerProvider");
81247         *ret_ret = PhantomKeysManager_as_SignerProvider(&this_arg_conv);
81248         return tag_ptr(ret_ret, true);
81249 }
81250
81251 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) {
81252         uint8_t seed_arr[32];
81253         CHECK((*env)->GetArrayLength(env, seed) == 32);
81254         (*env)->GetByteArrayRegion(env, seed, 0, 32, seed_arr);
81255         uint8_t (*seed_ref)[32] = &seed_arr;
81256         uint8_t cross_node_seed_arr[32];
81257         CHECK((*env)->GetArrayLength(env, cross_node_seed) == 32);
81258         (*env)->GetByteArrayRegion(env, cross_node_seed, 0, 32, cross_node_seed_arr);
81259         uint8_t (*cross_node_seed_ref)[32] = &cross_node_seed_arr;
81260         LDKPhantomKeysManager ret_var = PhantomKeysManager_new(seed_ref, starting_time_secs, starting_time_nanos, cross_node_seed_ref);
81261         int64_t ret_ref = 0;
81262         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
81263         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
81264         return ret_ref;
81265 }
81266
81267 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) {
81268         LDKPhantomKeysManager this_arg_conv;
81269         this_arg_conv.inner = untag_ptr(this_arg);
81270         this_arg_conv.is_owned = ptr_is_owned(this_arg);
81271         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
81272         this_arg_conv.is_owned = false;
81273         uint8_t params_arr[32];
81274         CHECK((*env)->GetArrayLength(env, params) == 32);
81275         (*env)->GetByteArrayRegion(env, params, 0, 32, params_arr);
81276         uint8_t (*params_ref)[32] = &params_arr;
81277         LDKInMemorySigner ret_var = PhantomKeysManager_derive_channel_keys(&this_arg_conv, channel_value_satoshis, params_ref);
81278         int64_t ret_ref = 0;
81279         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
81280         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
81281         return ret_ref;
81282 }
81283
81284 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_PhantomKeysManager_1get_1node_1secret_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
81285         LDKPhantomKeysManager this_arg_conv;
81286         this_arg_conv.inner = untag_ptr(this_arg);
81287         this_arg_conv.is_owned = ptr_is_owned(this_arg);
81288         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
81289         this_arg_conv.is_owned = false;
81290         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
81291         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, PhantomKeysManager_get_node_secret_key(&this_arg_conv).bytes);
81292         return ret_arr;
81293 }
81294
81295 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_PhantomKeysManager_1get_1phantom_1node_1secret_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
81296         LDKPhantomKeysManager this_arg_conv;
81297         this_arg_conv.inner = untag_ptr(this_arg);
81298         this_arg_conv.is_owned = ptr_is_owned(this_arg);
81299         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
81300         this_arg_conv.is_owned = false;
81301         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
81302         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, PhantomKeysManager_get_phantom_node_secret_key(&this_arg_conv).bytes);
81303         return ret_arr;
81304 }
81305
81306 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RandomBytes_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
81307         LDKRandomBytes this_obj_conv;
81308         this_obj_conv.inner = untag_ptr(this_obj);
81309         this_obj_conv.is_owned = ptr_is_owned(this_obj);
81310         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
81311         RandomBytes_free(this_obj_conv);
81312 }
81313
81314 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RandomBytes_1new(JNIEnv *env, jclass clz, int8_tArray seed) {
81315         LDKThirtyTwoBytes seed_ref;
81316         CHECK((*env)->GetArrayLength(env, seed) == 32);
81317         (*env)->GetByteArrayRegion(env, seed, 0, 32, seed_ref.data);
81318         LDKRandomBytes ret_var = RandomBytes_new(seed_ref);
81319         int64_t ret_ref = 0;
81320         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
81321         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
81322         return ret_ref;
81323 }
81324
81325 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RandomBytes_1as_1EntropySource(JNIEnv *env, jclass clz, int64_t this_arg) {
81326         LDKRandomBytes this_arg_conv;
81327         this_arg_conv.inner = untag_ptr(this_arg);
81328         this_arg_conv.is_owned = ptr_is_owned(this_arg);
81329         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
81330         this_arg_conv.is_owned = false;
81331         LDKEntropySource* ret_ret = MALLOC(sizeof(LDKEntropySource), "LDKEntropySource");
81332         *ret_ret = RandomBytes_as_EntropySource(&this_arg_conv);
81333         return tag_ptr(ret_ret, true);
81334 }
81335
81336 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EcdsaChannelSigner_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
81337         if (!ptr_is_owned(this_ptr)) return;
81338         void* this_ptr_ptr = untag_ptr(this_ptr);
81339         CHECK_ACCESS(this_ptr_ptr);
81340         LDKEcdsaChannelSigner this_ptr_conv = *(LDKEcdsaChannelSigner*)(this_ptr_ptr);
81341         FREE(untag_ptr(this_ptr));
81342         EcdsaChannelSigner_free(this_ptr_conv);
81343 }
81344
81345 static inline uint64_t WriteableEcdsaChannelSigner_clone_ptr(LDKWriteableEcdsaChannelSigner *NONNULL_PTR arg) {
81346         LDKWriteableEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner");
81347         *ret_ret = WriteableEcdsaChannelSigner_clone(arg);
81348         return tag_ptr(ret_ret, true);
81349 }
81350 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WriteableEcdsaChannelSigner_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
81351         void* arg_ptr = untag_ptr(arg);
81352         if (ptr_is_owned(arg)) { CHECK_ACCESS(arg_ptr); }
81353         LDKWriteableEcdsaChannelSigner* arg_conv = (LDKWriteableEcdsaChannelSigner*)arg_ptr;
81354         int64_t ret_conv = WriteableEcdsaChannelSigner_clone_ptr(arg_conv);
81355         return ret_conv;
81356 }
81357
81358 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WriteableEcdsaChannelSigner_1clone(JNIEnv *env, jclass clz, int64_t orig) {
81359         void* orig_ptr = untag_ptr(orig);
81360         if (ptr_is_owned(orig)) { CHECK_ACCESS(orig_ptr); }
81361         LDKWriteableEcdsaChannelSigner* orig_conv = (LDKWriteableEcdsaChannelSigner*)orig_ptr;
81362         LDKWriteableEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner");
81363         *ret_ret = WriteableEcdsaChannelSigner_clone(orig_conv);
81364         return tag_ptr(ret_ret, true);
81365 }
81366
81367 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WriteableEcdsaChannelSigner_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
81368         if (!ptr_is_owned(this_ptr)) return;
81369         void* this_ptr_ptr = untag_ptr(this_ptr);
81370         CHECK_ACCESS(this_ptr_ptr);
81371         LDKWriteableEcdsaChannelSigner this_ptr_conv = *(LDKWriteableEcdsaChannelSigner*)(this_ptr_ptr);
81372         FREE(untag_ptr(this_ptr));
81373         WriteableEcdsaChannelSigner_free(this_ptr_conv);
81374 }
81375
81376 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OnionMessenger_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
81377         LDKOnionMessenger this_obj_conv;
81378         this_obj_conv.inner = untag_ptr(this_obj);
81379         this_obj_conv.is_owned = ptr_is_owned(this_obj);
81380         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
81381         OnionMessenger_free(this_obj_conv);
81382 }
81383
81384 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageRouter_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
81385         if (!ptr_is_owned(this_ptr)) return;
81386         void* this_ptr_ptr = untag_ptr(this_ptr);
81387         CHECK_ACCESS(this_ptr_ptr);
81388         LDKMessageRouter this_ptr_conv = *(LDKMessageRouter*)(this_ptr_ptr);
81389         FREE(untag_ptr(this_ptr));
81390         MessageRouter_free(this_ptr_conv);
81391 }
81392
81393 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DefaultMessageRouter_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
81394         LDKDefaultMessageRouter this_obj_conv;
81395         this_obj_conv.inner = untag_ptr(this_obj);
81396         this_obj_conv.is_owned = ptr_is_owned(this_obj);
81397         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
81398         DefaultMessageRouter_free(this_obj_conv);
81399 }
81400
81401 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DefaultMessageRouter_1new(JNIEnv *env, jclass clz, int64_t network_graph, int64_t entropy_source) {
81402         LDKNetworkGraph network_graph_conv;
81403         network_graph_conv.inner = untag_ptr(network_graph);
81404         network_graph_conv.is_owned = ptr_is_owned(network_graph);
81405         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
81406         network_graph_conv.is_owned = false;
81407         void* entropy_source_ptr = untag_ptr(entropy_source);
81408         CHECK_ACCESS(entropy_source_ptr);
81409         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
81410         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
81411                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
81412                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
81413         }
81414         LDKDefaultMessageRouter ret_var = DefaultMessageRouter_new(&network_graph_conv, entropy_source_conv);
81415         int64_t ret_ref = 0;
81416         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
81417         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
81418         return ret_ref;
81419 }
81420
81421 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DefaultMessageRouter_1as_1MessageRouter(JNIEnv *env, jclass clz, int64_t this_arg) {
81422         LDKDefaultMessageRouter this_arg_conv;
81423         this_arg_conv.inner = untag_ptr(this_arg);
81424         this_arg_conv.is_owned = ptr_is_owned(this_arg);
81425         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
81426         this_arg_conv.is_owned = false;
81427         LDKMessageRouter* ret_ret = MALLOC(sizeof(LDKMessageRouter), "LDKMessageRouter");
81428         *ret_ret = DefaultMessageRouter_as_MessageRouter(&this_arg_conv);
81429         return tag_ptr(ret_ret, true);
81430 }
81431
81432 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OnionMessagePath_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
81433         LDKOnionMessagePath this_obj_conv;
81434         this_obj_conv.inner = untag_ptr(this_obj);
81435         this_obj_conv.is_owned = ptr_is_owned(this_obj);
81436         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
81437         OnionMessagePath_free(this_obj_conv);
81438 }
81439
81440 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_OnionMessagePath_1get_1intermediate_1nodes(JNIEnv *env, jclass clz, int64_t this_ptr) {
81441         LDKOnionMessagePath this_ptr_conv;
81442         this_ptr_conv.inner = untag_ptr(this_ptr);
81443         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
81444         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
81445         this_ptr_conv.is_owned = false;
81446         LDKCVec_PublicKeyZ ret_var = OnionMessagePath_get_intermediate_nodes(&this_ptr_conv);
81447         jobjectArray ret_arr = NULL;
81448         ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
81449         ;
81450         for (size_t i = 0; i < ret_var.datalen; i++) {
81451                 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, 33);
81452                 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, 33, ret_var.data[i].compressed_form);
81453                 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
81454         }
81455         
81456         FREE(ret_var.data);
81457         return ret_arr;
81458 }
81459
81460 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OnionMessagePath_1set_1intermediate_1nodes(JNIEnv *env, jclass clz, int64_t this_ptr, jobjectArray val) {
81461         LDKOnionMessagePath this_ptr_conv;
81462         this_ptr_conv.inner = untag_ptr(this_ptr);
81463         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
81464         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
81465         this_ptr_conv.is_owned = false;
81466         LDKCVec_PublicKeyZ val_constr;
81467         val_constr.datalen = (*env)->GetArrayLength(env, val);
81468         if (val_constr.datalen > 0)
81469                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
81470         else
81471                 val_constr.data = NULL;
81472         for (size_t i = 0; i < val_constr.datalen; i++) {
81473                 int8_tArray val_conv_8 = (*env)->GetObjectArrayElement(env, val, i);
81474                 LDKPublicKey val_conv_8_ref;
81475                 CHECK((*env)->GetArrayLength(env, val_conv_8) == 33);
81476                 (*env)->GetByteArrayRegion(env, val_conv_8, 0, 33, val_conv_8_ref.compressed_form);
81477                 val_constr.data[i] = val_conv_8_ref;
81478         }
81479         OnionMessagePath_set_intermediate_nodes(&this_ptr_conv, val_constr);
81480 }
81481
81482 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OnionMessagePath_1get_1destination(JNIEnv *env, jclass clz, int64_t this_ptr) {
81483         LDKOnionMessagePath this_ptr_conv;
81484         this_ptr_conv.inner = untag_ptr(this_ptr);
81485         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
81486         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
81487         this_ptr_conv.is_owned = false;
81488         LDKDestination *ret_copy = MALLOC(sizeof(LDKDestination), "LDKDestination");
81489         *ret_copy = OnionMessagePath_get_destination(&this_ptr_conv);
81490         int64_t ret_ref = tag_ptr(ret_copy, true);
81491         return ret_ref;
81492 }
81493
81494 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OnionMessagePath_1set_1destination(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
81495         LDKOnionMessagePath this_ptr_conv;
81496         this_ptr_conv.inner = untag_ptr(this_ptr);
81497         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
81498         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
81499         this_ptr_conv.is_owned = false;
81500         void* val_ptr = untag_ptr(val);
81501         CHECK_ACCESS(val_ptr);
81502         LDKDestination val_conv = *(LDKDestination*)(val_ptr);
81503         val_conv = Destination_clone((LDKDestination*)untag_ptr(val));
81504         OnionMessagePath_set_destination(&this_ptr_conv, val_conv);
81505 }
81506
81507 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OnionMessagePath_1get_1first_1node_1addresses(JNIEnv *env, jclass clz, int64_t this_ptr) {
81508         LDKOnionMessagePath this_ptr_conv;
81509         this_ptr_conv.inner = untag_ptr(this_ptr);
81510         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
81511         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
81512         this_ptr_conv.is_owned = false;
81513         LDKCOption_CVec_SocketAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_SocketAddressZZ), "LDKCOption_CVec_SocketAddressZZ");
81514         *ret_copy = OnionMessagePath_get_first_node_addresses(&this_ptr_conv);
81515         int64_t ret_ref = tag_ptr(ret_copy, true);
81516         return ret_ref;
81517 }
81518
81519 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OnionMessagePath_1set_1first_1node_1addresses(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
81520         LDKOnionMessagePath this_ptr_conv;
81521         this_ptr_conv.inner = untag_ptr(this_ptr);
81522         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
81523         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
81524         this_ptr_conv.is_owned = false;
81525         void* val_ptr = untag_ptr(val);
81526         CHECK_ACCESS(val_ptr);
81527         LDKCOption_CVec_SocketAddressZZ val_conv = *(LDKCOption_CVec_SocketAddressZZ*)(val_ptr);
81528         val_conv = COption_CVec_SocketAddressZZ_clone((LDKCOption_CVec_SocketAddressZZ*)untag_ptr(val));
81529         OnionMessagePath_set_first_node_addresses(&this_ptr_conv, val_conv);
81530 }
81531
81532 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) {
81533         LDKCVec_PublicKeyZ intermediate_nodes_arg_constr;
81534         intermediate_nodes_arg_constr.datalen = (*env)->GetArrayLength(env, intermediate_nodes_arg);
81535         if (intermediate_nodes_arg_constr.datalen > 0)
81536                 intermediate_nodes_arg_constr.data = MALLOC(intermediate_nodes_arg_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
81537         else
81538                 intermediate_nodes_arg_constr.data = NULL;
81539         for (size_t i = 0; i < intermediate_nodes_arg_constr.datalen; i++) {
81540                 int8_tArray intermediate_nodes_arg_conv_8 = (*env)->GetObjectArrayElement(env, intermediate_nodes_arg, i);
81541                 LDKPublicKey intermediate_nodes_arg_conv_8_ref;
81542                 CHECK((*env)->GetArrayLength(env, intermediate_nodes_arg_conv_8) == 33);
81543                 (*env)->GetByteArrayRegion(env, intermediate_nodes_arg_conv_8, 0, 33, intermediate_nodes_arg_conv_8_ref.compressed_form);
81544                 intermediate_nodes_arg_constr.data[i] = intermediate_nodes_arg_conv_8_ref;
81545         }
81546         void* destination_arg_ptr = untag_ptr(destination_arg);
81547         CHECK_ACCESS(destination_arg_ptr);
81548         LDKDestination destination_arg_conv = *(LDKDestination*)(destination_arg_ptr);
81549         destination_arg_conv = Destination_clone((LDKDestination*)untag_ptr(destination_arg));
81550         void* first_node_addresses_arg_ptr = untag_ptr(first_node_addresses_arg);
81551         CHECK_ACCESS(first_node_addresses_arg_ptr);
81552         LDKCOption_CVec_SocketAddressZZ first_node_addresses_arg_conv = *(LDKCOption_CVec_SocketAddressZZ*)(first_node_addresses_arg_ptr);
81553         LDKOnionMessagePath ret_var = OnionMessagePath_new(intermediate_nodes_arg_constr, destination_arg_conv, first_node_addresses_arg_conv);
81554         int64_t ret_ref = 0;
81555         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
81556         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
81557         return ret_ref;
81558 }
81559
81560 static inline uint64_t OnionMessagePath_clone_ptr(LDKOnionMessagePath *NONNULL_PTR arg) {
81561         LDKOnionMessagePath ret_var = OnionMessagePath_clone(arg);
81562         int64_t ret_ref = 0;
81563         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
81564         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
81565         return ret_ref;
81566 }
81567 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OnionMessagePath_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
81568         LDKOnionMessagePath arg_conv;
81569         arg_conv.inner = untag_ptr(arg);
81570         arg_conv.is_owned = ptr_is_owned(arg);
81571         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
81572         arg_conv.is_owned = false;
81573         int64_t ret_conv = OnionMessagePath_clone_ptr(&arg_conv);
81574         return ret_conv;
81575 }
81576
81577 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OnionMessagePath_1clone(JNIEnv *env, jclass clz, int64_t orig) {
81578         LDKOnionMessagePath orig_conv;
81579         orig_conv.inner = untag_ptr(orig);
81580         orig_conv.is_owned = ptr_is_owned(orig);
81581         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
81582         orig_conv.is_owned = false;
81583         LDKOnionMessagePath ret_var = OnionMessagePath_clone(&orig_conv);
81584         int64_t ret_ref = 0;
81585         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
81586         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
81587         return ret_ref;
81588 }
81589
81590 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OnionMessagePath_1first_1node(JNIEnv *env, jclass clz, int64_t this_arg) {
81591         LDKOnionMessagePath this_arg_conv;
81592         this_arg_conv.inner = untag_ptr(this_arg);
81593         this_arg_conv.is_owned = ptr_is_owned(this_arg);
81594         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
81595         this_arg_conv.is_owned = false;
81596         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
81597         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OnionMessagePath_first_node(&this_arg_conv).compressed_form);
81598         return ret_arr;
81599 }
81600
81601 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Destination_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
81602         if (!ptr_is_owned(this_ptr)) return;
81603         void* this_ptr_ptr = untag_ptr(this_ptr);
81604         CHECK_ACCESS(this_ptr_ptr);
81605         LDKDestination this_ptr_conv = *(LDKDestination*)(this_ptr_ptr);
81606         FREE(untag_ptr(this_ptr));
81607         Destination_free(this_ptr_conv);
81608 }
81609
81610 static inline uint64_t Destination_clone_ptr(LDKDestination *NONNULL_PTR arg) {
81611         LDKDestination *ret_copy = MALLOC(sizeof(LDKDestination), "LDKDestination");
81612         *ret_copy = Destination_clone(arg);
81613         int64_t ret_ref = tag_ptr(ret_copy, true);
81614         return ret_ref;
81615 }
81616 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Destination_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
81617         LDKDestination* arg_conv = (LDKDestination*)untag_ptr(arg);
81618         int64_t ret_conv = Destination_clone_ptr(arg_conv);
81619         return ret_conv;
81620 }
81621
81622 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Destination_1clone(JNIEnv *env, jclass clz, int64_t orig) {
81623         LDKDestination* orig_conv = (LDKDestination*)untag_ptr(orig);
81624         LDKDestination *ret_copy = MALLOC(sizeof(LDKDestination), "LDKDestination");
81625         *ret_copy = Destination_clone(orig_conv);
81626         int64_t ret_ref = tag_ptr(ret_copy, true);
81627         return ret_ref;
81628 }
81629
81630 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Destination_1node(JNIEnv *env, jclass clz, int8_tArray a) {
81631         LDKPublicKey a_ref;
81632         CHECK((*env)->GetArrayLength(env, a) == 33);
81633         (*env)->GetByteArrayRegion(env, a, 0, 33, a_ref.compressed_form);
81634         LDKDestination *ret_copy = MALLOC(sizeof(LDKDestination), "LDKDestination");
81635         *ret_copy = Destination_node(a_ref);
81636         int64_t ret_ref = tag_ptr(ret_copy, true);
81637         return ret_ref;
81638 }
81639
81640 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Destination_1blinded_1path(JNIEnv *env, jclass clz, int64_t a) {
81641         LDKBlindedPath a_conv;
81642         a_conv.inner = untag_ptr(a);
81643         a_conv.is_owned = ptr_is_owned(a);
81644         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
81645         a_conv = BlindedPath_clone(&a_conv);
81646         LDKDestination *ret_copy = MALLOC(sizeof(LDKDestination), "LDKDestination");
81647         *ret_copy = Destination_blinded_path(a_conv);
81648         int64_t ret_ref = tag_ptr(ret_copy, true);
81649         return ret_ref;
81650 }
81651
81652 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Destination_1hash(JNIEnv *env, jclass clz, int64_t o) {
81653         LDKDestination* o_conv = (LDKDestination*)untag_ptr(o);
81654         int64_t ret_conv = Destination_hash(o_conv);
81655         return ret_conv;
81656 }
81657
81658 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Destination_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
81659         LDKDestination* a_conv = (LDKDestination*)untag_ptr(a);
81660         LDKDestination* b_conv = (LDKDestination*)untag_ptr(b);
81661         jboolean ret_conv = Destination_eq(a_conv, b_conv);
81662         return ret_conv;
81663 }
81664
81665 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Destination_1resolve(JNIEnv *env, jclass clz, int64_t this_arg, int64_t network_graph) {
81666         LDKDestination* this_arg_conv = (LDKDestination*)untag_ptr(this_arg);
81667         LDKReadOnlyNetworkGraph network_graph_conv;
81668         network_graph_conv.inner = untag_ptr(network_graph);
81669         network_graph_conv.is_owned = ptr_is_owned(network_graph);
81670         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
81671         network_graph_conv.is_owned = false;
81672         Destination_resolve(this_arg_conv, &network_graph_conv);
81673 }
81674
81675 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SendSuccess_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
81676         if (!ptr_is_owned(this_ptr)) return;
81677         void* this_ptr_ptr = untag_ptr(this_ptr);
81678         CHECK_ACCESS(this_ptr_ptr);
81679         LDKSendSuccess this_ptr_conv = *(LDKSendSuccess*)(this_ptr_ptr);
81680         FREE(untag_ptr(this_ptr));
81681         SendSuccess_free(this_ptr_conv);
81682 }
81683
81684 static inline uint64_t SendSuccess_clone_ptr(LDKSendSuccess *NONNULL_PTR arg) {
81685         LDKSendSuccess *ret_copy = MALLOC(sizeof(LDKSendSuccess), "LDKSendSuccess");
81686         *ret_copy = SendSuccess_clone(arg);
81687         int64_t ret_ref = tag_ptr(ret_copy, true);
81688         return ret_ref;
81689 }
81690 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SendSuccess_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
81691         LDKSendSuccess* arg_conv = (LDKSendSuccess*)untag_ptr(arg);
81692         int64_t ret_conv = SendSuccess_clone_ptr(arg_conv);
81693         return ret_conv;
81694 }
81695
81696 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SendSuccess_1clone(JNIEnv *env, jclass clz, int64_t orig) {
81697         LDKSendSuccess* orig_conv = (LDKSendSuccess*)untag_ptr(orig);
81698         LDKSendSuccess *ret_copy = MALLOC(sizeof(LDKSendSuccess), "LDKSendSuccess");
81699         *ret_copy = SendSuccess_clone(orig_conv);
81700         int64_t ret_ref = tag_ptr(ret_copy, true);
81701         return ret_ref;
81702 }
81703
81704 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SendSuccess_1buffered(JNIEnv *env, jclass clz) {
81705         LDKSendSuccess *ret_copy = MALLOC(sizeof(LDKSendSuccess), "LDKSendSuccess");
81706         *ret_copy = SendSuccess_buffered();
81707         int64_t ret_ref = tag_ptr(ret_copy, true);
81708         return ret_ref;
81709 }
81710
81711 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SendSuccess_1buffered_1awaiting_1connection(JNIEnv *env, jclass clz, int8_tArray a) {
81712         LDKPublicKey a_ref;
81713         CHECK((*env)->GetArrayLength(env, a) == 33);
81714         (*env)->GetByteArrayRegion(env, a, 0, 33, a_ref.compressed_form);
81715         LDKSendSuccess *ret_copy = MALLOC(sizeof(LDKSendSuccess), "LDKSendSuccess");
81716         *ret_copy = SendSuccess_buffered_awaiting_connection(a_ref);
81717         int64_t ret_ref = tag_ptr(ret_copy, true);
81718         return ret_ref;
81719 }
81720
81721 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SendSuccess_1hash(JNIEnv *env, jclass clz, int64_t o) {
81722         LDKSendSuccess* o_conv = (LDKSendSuccess*)untag_ptr(o);
81723         int64_t ret_conv = SendSuccess_hash(o_conv);
81724         return ret_conv;
81725 }
81726
81727 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_SendSuccess_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
81728         LDKSendSuccess* a_conv = (LDKSendSuccess*)untag_ptr(a);
81729         LDKSendSuccess* b_conv = (LDKSendSuccess*)untag_ptr(b);
81730         jboolean ret_conv = SendSuccess_eq(a_conv, b_conv);
81731         return ret_conv;
81732 }
81733
81734 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SendError_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
81735         if (!ptr_is_owned(this_ptr)) return;
81736         void* this_ptr_ptr = untag_ptr(this_ptr);
81737         CHECK_ACCESS(this_ptr_ptr);
81738         LDKSendError this_ptr_conv = *(LDKSendError*)(this_ptr_ptr);
81739         FREE(untag_ptr(this_ptr));
81740         SendError_free(this_ptr_conv);
81741 }
81742
81743 static inline uint64_t SendError_clone_ptr(LDKSendError *NONNULL_PTR arg) {
81744         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
81745         *ret_copy = SendError_clone(arg);
81746         int64_t ret_ref = tag_ptr(ret_copy, true);
81747         return ret_ref;
81748 }
81749 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SendError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
81750         LDKSendError* arg_conv = (LDKSendError*)untag_ptr(arg);
81751         int64_t ret_conv = SendError_clone_ptr(arg_conv);
81752         return ret_conv;
81753 }
81754
81755 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SendError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
81756         LDKSendError* orig_conv = (LDKSendError*)untag_ptr(orig);
81757         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
81758         *ret_copy = SendError_clone(orig_conv);
81759         int64_t ret_ref = tag_ptr(ret_copy, true);
81760         return ret_ref;
81761 }
81762
81763 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SendError_1secp256k1(JNIEnv *env, jclass clz, jclass a) {
81764         LDKSecp256k1Error a_conv = LDKSecp256k1Error_from_java(env, a);
81765         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
81766         *ret_copy = SendError_secp256k1(a_conv);
81767         int64_t ret_ref = tag_ptr(ret_copy, true);
81768         return ret_ref;
81769 }
81770
81771 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SendError_1too_1big_1packet(JNIEnv *env, jclass clz) {
81772         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
81773         *ret_copy = SendError_too_big_packet();
81774         int64_t ret_ref = tag_ptr(ret_copy, true);
81775         return ret_ref;
81776 }
81777
81778 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SendError_1too_1few_1blinded_1hops(JNIEnv *env, jclass clz) {
81779         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
81780         *ret_copy = SendError_too_few_blinded_hops();
81781         int64_t ret_ref = tag_ptr(ret_copy, true);
81782         return ret_ref;
81783 }
81784
81785 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SendError_1invalid_1first_1hop(JNIEnv *env, jclass clz, int8_tArray a) {
81786         LDKPublicKey a_ref;
81787         CHECK((*env)->GetArrayLength(env, a) == 33);
81788         (*env)->GetByteArrayRegion(env, a, 0, 33, a_ref.compressed_form);
81789         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
81790         *ret_copy = SendError_invalid_first_hop(a_ref);
81791         int64_t ret_ref = tag_ptr(ret_copy, true);
81792         return ret_ref;
81793 }
81794
81795 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SendError_1path_1not_1found(JNIEnv *env, jclass clz) {
81796         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
81797         *ret_copy = SendError_path_not_found();
81798         int64_t ret_ref = tag_ptr(ret_copy, true);
81799         return ret_ref;
81800 }
81801
81802 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SendError_1invalid_1message(JNIEnv *env, jclass clz) {
81803         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
81804         *ret_copy = SendError_invalid_message();
81805         int64_t ret_ref = tag_ptr(ret_copy, true);
81806         return ret_ref;
81807 }
81808
81809 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SendError_1buffer_1full(JNIEnv *env, jclass clz) {
81810         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
81811         *ret_copy = SendError_buffer_full();
81812         int64_t ret_ref = tag_ptr(ret_copy, true);
81813         return ret_ref;
81814 }
81815
81816 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SendError_1get_1node_1id_1failed(JNIEnv *env, jclass clz) {
81817         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
81818         *ret_copy = SendError_get_node_id_failed();
81819         int64_t ret_ref = tag_ptr(ret_copy, true);
81820         return ret_ref;
81821 }
81822
81823 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SendError_1unresolved_1introduction_1node(JNIEnv *env, jclass clz) {
81824         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
81825         *ret_copy = SendError_unresolved_introduction_node();
81826         int64_t ret_ref = tag_ptr(ret_copy, true);
81827         return ret_ref;
81828 }
81829
81830 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SendError_1blinded_1path_1advance_1failed(JNIEnv *env, jclass clz) {
81831         LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
81832         *ret_copy = SendError_blinded_path_advance_failed();
81833         int64_t ret_ref = tag_ptr(ret_copy, true);
81834         return ret_ref;
81835 }
81836
81837 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SendError_1hash(JNIEnv *env, jclass clz, int64_t o) {
81838         LDKSendError* o_conv = (LDKSendError*)untag_ptr(o);
81839         int64_t ret_conv = SendError_hash(o_conv);
81840         return ret_conv;
81841 }
81842
81843 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_SendError_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
81844         LDKSendError* a_conv = (LDKSendError*)untag_ptr(a);
81845         LDKSendError* b_conv = (LDKSendError*)untag_ptr(b);
81846         jboolean ret_conv = SendError_eq(a_conv, b_conv);
81847         return ret_conv;
81848 }
81849
81850 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CustomOnionMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
81851         if (!ptr_is_owned(this_ptr)) return;
81852         void* this_ptr_ptr = untag_ptr(this_ptr);
81853         CHECK_ACCESS(this_ptr_ptr);
81854         LDKCustomOnionMessageHandler this_ptr_conv = *(LDKCustomOnionMessageHandler*)(this_ptr_ptr);
81855         FREE(untag_ptr(this_ptr));
81856         CustomOnionMessageHandler_free(this_ptr_conv);
81857 }
81858
81859 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeeledOnion_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
81860         if (!ptr_is_owned(this_ptr)) return;
81861         void* this_ptr_ptr = untag_ptr(this_ptr);
81862         CHECK_ACCESS(this_ptr_ptr);
81863         LDKPeeledOnion this_ptr_conv = *(LDKPeeledOnion*)(this_ptr_ptr);
81864         FREE(untag_ptr(this_ptr));
81865         PeeledOnion_free(this_ptr_conv);
81866 }
81867
81868 static inline uint64_t PeeledOnion_clone_ptr(LDKPeeledOnion *NONNULL_PTR arg) {
81869         LDKPeeledOnion *ret_copy = MALLOC(sizeof(LDKPeeledOnion), "LDKPeeledOnion");
81870         *ret_copy = PeeledOnion_clone(arg);
81871         int64_t ret_ref = tag_ptr(ret_copy, true);
81872         return ret_ref;
81873 }
81874 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeeledOnion_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
81875         LDKPeeledOnion* arg_conv = (LDKPeeledOnion*)untag_ptr(arg);
81876         int64_t ret_conv = PeeledOnion_clone_ptr(arg_conv);
81877         return ret_conv;
81878 }
81879
81880 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeeledOnion_1clone(JNIEnv *env, jclass clz, int64_t orig) {
81881         LDKPeeledOnion* orig_conv = (LDKPeeledOnion*)untag_ptr(orig);
81882         LDKPeeledOnion *ret_copy = MALLOC(sizeof(LDKPeeledOnion), "LDKPeeledOnion");
81883         *ret_copy = PeeledOnion_clone(orig_conv);
81884         int64_t ret_ref = tag_ptr(ret_copy, true);
81885         return ret_ref;
81886 }
81887
81888 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeeledOnion_1forward(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
81889         void* a_ptr = untag_ptr(a);
81890         CHECK_ACCESS(a_ptr);
81891         LDKNextMessageHop a_conv = *(LDKNextMessageHop*)(a_ptr);
81892         a_conv = NextMessageHop_clone((LDKNextMessageHop*)untag_ptr(a));
81893         LDKOnionMessage b_conv;
81894         b_conv.inner = untag_ptr(b);
81895         b_conv.is_owned = ptr_is_owned(b);
81896         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
81897         b_conv = OnionMessage_clone(&b_conv);
81898         LDKPeeledOnion *ret_copy = MALLOC(sizeof(LDKPeeledOnion), "LDKPeeledOnion");
81899         *ret_copy = PeeledOnion_forward(a_conv, b_conv);
81900         int64_t ret_ref = tag_ptr(ret_copy, true);
81901         return ret_ref;
81902 }
81903
81904 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeeledOnion_1receive(JNIEnv *env, jclass clz, int64_t a, int8_tArray b, int64_t c) {
81905         void* a_ptr = untag_ptr(a);
81906         CHECK_ACCESS(a_ptr);
81907         LDKParsedOnionMessageContents a_conv = *(LDKParsedOnionMessageContents*)(a_ptr);
81908         a_conv = ParsedOnionMessageContents_clone((LDKParsedOnionMessageContents*)untag_ptr(a));
81909         LDKThirtyTwoBytes b_ref;
81910         CHECK((*env)->GetArrayLength(env, b) == 32);
81911         (*env)->GetByteArrayRegion(env, b, 0, 32, b_ref.data);
81912         LDKBlindedPath c_conv;
81913         c_conv.inner = untag_ptr(c);
81914         c_conv.is_owned = ptr_is_owned(c);
81915         CHECK_INNER_FIELD_ACCESS_OR_NULL(c_conv);
81916         c_conv = BlindedPath_clone(&c_conv);
81917         LDKPeeledOnion *ret_copy = MALLOC(sizeof(LDKPeeledOnion), "LDKPeeledOnion");
81918         *ret_copy = PeeledOnion_receive(a_conv, b_ref, c_conv);
81919         int64_t ret_ref = tag_ptr(ret_copy, true);
81920         return ret_ref;
81921 }
81922
81923 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_create_1onion_1message_1resolving_1destination(JNIEnv *env, jclass clz, int64_t entropy_source, int64_t node_signer, int64_t node_id_lookup, int64_t network_graph, int64_t path, int64_t contents, int64_t reply_path) {
81924         void* entropy_source_ptr = untag_ptr(entropy_source);
81925         if (ptr_is_owned(entropy_source)) { CHECK_ACCESS(entropy_source_ptr); }
81926         LDKEntropySource* entropy_source_conv = (LDKEntropySource*)entropy_source_ptr;
81927         void* node_signer_ptr = untag_ptr(node_signer);
81928         if (ptr_is_owned(node_signer)) { CHECK_ACCESS(node_signer_ptr); }
81929         LDKNodeSigner* node_signer_conv = (LDKNodeSigner*)node_signer_ptr;
81930         void* node_id_lookup_ptr = untag_ptr(node_id_lookup);
81931         if (ptr_is_owned(node_id_lookup)) { CHECK_ACCESS(node_id_lookup_ptr); }
81932         LDKNodeIdLookUp* node_id_lookup_conv = (LDKNodeIdLookUp*)node_id_lookup_ptr;
81933         LDKReadOnlyNetworkGraph network_graph_conv;
81934         network_graph_conv.inner = untag_ptr(network_graph);
81935         network_graph_conv.is_owned = ptr_is_owned(network_graph);
81936         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
81937         network_graph_conv.is_owned = false;
81938         LDKOnionMessagePath path_conv;
81939         path_conv.inner = untag_ptr(path);
81940         path_conv.is_owned = ptr_is_owned(path);
81941         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
81942         path_conv = OnionMessagePath_clone(&path_conv);
81943         void* contents_ptr = untag_ptr(contents);
81944         CHECK_ACCESS(contents_ptr);
81945         LDKOnionMessageContents contents_conv = *(LDKOnionMessageContents*)(contents_ptr);
81946         if (contents_conv.free == LDKOnionMessageContents_JCalls_free) {
81947                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
81948                 LDKOnionMessageContents_JCalls_cloned(&contents_conv);
81949         }
81950         LDKBlindedPath reply_path_conv;
81951         reply_path_conv.inner = untag_ptr(reply_path);
81952         reply_path_conv.is_owned = ptr_is_owned(reply_path);
81953         CHECK_INNER_FIELD_ACCESS_OR_NULL(reply_path_conv);
81954         reply_path_conv = BlindedPath_clone(&reply_path_conv);
81955         LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ), "LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ");
81956         *ret_conv = create_onion_message_resolving_destination(entropy_source_conv, node_signer_conv, node_id_lookup_conv, &network_graph_conv, path_conv, contents_conv, reply_path_conv);
81957         return tag_ptr(ret_conv, true);
81958 }
81959
81960 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_create_1onion_1message(JNIEnv *env, jclass clz, int64_t entropy_source, int64_t node_signer, int64_t node_id_lookup, int64_t path, int64_t contents, int64_t reply_path) {
81961         void* entropy_source_ptr = untag_ptr(entropy_source);
81962         if (ptr_is_owned(entropy_source)) { CHECK_ACCESS(entropy_source_ptr); }
81963         LDKEntropySource* entropy_source_conv = (LDKEntropySource*)entropy_source_ptr;
81964         void* node_signer_ptr = untag_ptr(node_signer);
81965         if (ptr_is_owned(node_signer)) { CHECK_ACCESS(node_signer_ptr); }
81966         LDKNodeSigner* node_signer_conv = (LDKNodeSigner*)node_signer_ptr;
81967         void* node_id_lookup_ptr = untag_ptr(node_id_lookup);
81968         if (ptr_is_owned(node_id_lookup)) { CHECK_ACCESS(node_id_lookup_ptr); }
81969         LDKNodeIdLookUp* node_id_lookup_conv = (LDKNodeIdLookUp*)node_id_lookup_ptr;
81970         LDKOnionMessagePath path_conv;
81971         path_conv.inner = untag_ptr(path);
81972         path_conv.is_owned = ptr_is_owned(path);
81973         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
81974         path_conv = OnionMessagePath_clone(&path_conv);
81975         void* contents_ptr = untag_ptr(contents);
81976         CHECK_ACCESS(contents_ptr);
81977         LDKOnionMessageContents contents_conv = *(LDKOnionMessageContents*)(contents_ptr);
81978         if (contents_conv.free == LDKOnionMessageContents_JCalls_free) {
81979                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
81980                 LDKOnionMessageContents_JCalls_cloned(&contents_conv);
81981         }
81982         LDKBlindedPath reply_path_conv;
81983         reply_path_conv.inner = untag_ptr(reply_path);
81984         reply_path_conv.is_owned = ptr_is_owned(reply_path);
81985         CHECK_INNER_FIELD_ACCESS_OR_NULL(reply_path_conv);
81986         reply_path_conv = BlindedPath_clone(&reply_path_conv);
81987         LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ), "LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ");
81988         *ret_conv = create_onion_message(entropy_source_conv, node_signer_conv, node_id_lookup_conv, path_conv, contents_conv, reply_path_conv);
81989         return tag_ptr(ret_conv, true);
81990 }
81991
81992 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) {
81993         LDKOnionMessage msg_conv;
81994         msg_conv.inner = untag_ptr(msg);
81995         msg_conv.is_owned = ptr_is_owned(msg);
81996         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
81997         msg_conv.is_owned = false;
81998         void* node_signer_ptr = untag_ptr(node_signer);
81999         CHECK_ACCESS(node_signer_ptr);
82000         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
82001         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
82002                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
82003                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
82004         }
82005         void* logger_ptr = untag_ptr(logger);
82006         CHECK_ACCESS(logger_ptr);
82007         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
82008         if (logger_conv.free == LDKLogger_JCalls_free) {
82009                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
82010                 LDKLogger_JCalls_cloned(&logger_conv);
82011         }
82012         void* custom_handler_ptr = untag_ptr(custom_handler);
82013         CHECK_ACCESS(custom_handler_ptr);
82014         LDKCustomOnionMessageHandler custom_handler_conv = *(LDKCustomOnionMessageHandler*)(custom_handler_ptr);
82015         if (custom_handler_conv.free == LDKCustomOnionMessageHandler_JCalls_free) {
82016                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
82017                 LDKCustomOnionMessageHandler_JCalls_cloned(&custom_handler_conv);
82018         }
82019         LDKCResult_PeeledOnionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PeeledOnionNoneZ), "LDKCResult_PeeledOnionNoneZ");
82020         *ret_conv = peel_onion_message(&msg_conv, node_signer_conv, logger_conv, custom_handler_conv);
82021         return tag_ptr(ret_conv, true);
82022 }
82023
82024 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OnionMessenger_1new(JNIEnv *env, jclass clz, int64_t entropy_source, int64_t node_signer, int64_t logger, int64_t node_id_lookup, int64_t message_router, int64_t offers_handler, int64_t custom_handler) {
82025         void* entropy_source_ptr = untag_ptr(entropy_source);
82026         CHECK_ACCESS(entropy_source_ptr);
82027         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
82028         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
82029                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
82030                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
82031         }
82032         void* node_signer_ptr = untag_ptr(node_signer);
82033         CHECK_ACCESS(node_signer_ptr);
82034         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
82035         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
82036                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
82037                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
82038         }
82039         void* logger_ptr = untag_ptr(logger);
82040         CHECK_ACCESS(logger_ptr);
82041         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
82042         if (logger_conv.free == LDKLogger_JCalls_free) {
82043                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
82044                 LDKLogger_JCalls_cloned(&logger_conv);
82045         }
82046         void* node_id_lookup_ptr = untag_ptr(node_id_lookup);
82047         CHECK_ACCESS(node_id_lookup_ptr);
82048         LDKNodeIdLookUp node_id_lookup_conv = *(LDKNodeIdLookUp*)(node_id_lookup_ptr);
82049         if (node_id_lookup_conv.free == LDKNodeIdLookUp_JCalls_free) {
82050                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
82051                 LDKNodeIdLookUp_JCalls_cloned(&node_id_lookup_conv);
82052         }
82053         void* message_router_ptr = untag_ptr(message_router);
82054         CHECK_ACCESS(message_router_ptr);
82055         LDKMessageRouter message_router_conv = *(LDKMessageRouter*)(message_router_ptr);
82056         if (message_router_conv.free == LDKMessageRouter_JCalls_free) {
82057                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
82058                 LDKMessageRouter_JCalls_cloned(&message_router_conv);
82059         }
82060         void* offers_handler_ptr = untag_ptr(offers_handler);
82061         CHECK_ACCESS(offers_handler_ptr);
82062         LDKOffersMessageHandler offers_handler_conv = *(LDKOffersMessageHandler*)(offers_handler_ptr);
82063         if (offers_handler_conv.free == LDKOffersMessageHandler_JCalls_free) {
82064                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
82065                 LDKOffersMessageHandler_JCalls_cloned(&offers_handler_conv);
82066         }
82067         void* custom_handler_ptr = untag_ptr(custom_handler);
82068         CHECK_ACCESS(custom_handler_ptr);
82069         LDKCustomOnionMessageHandler custom_handler_conv = *(LDKCustomOnionMessageHandler*)(custom_handler_ptr);
82070         if (custom_handler_conv.free == LDKCustomOnionMessageHandler_JCalls_free) {
82071                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
82072                 LDKCustomOnionMessageHandler_JCalls_cloned(&custom_handler_conv);
82073         }
82074         LDKOnionMessenger ret_var = OnionMessenger_new(entropy_source_conv, node_signer_conv, logger_conv, node_id_lookup_conv, message_router_conv, offers_handler_conv, custom_handler_conv);
82075         int64_t ret_ref = 0;
82076         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
82077         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
82078         return ret_ref;
82079 }
82080
82081 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) {
82082         LDKOnionMessenger this_arg_conv;
82083         this_arg_conv.inner = untag_ptr(this_arg);
82084         this_arg_conv.is_owned = ptr_is_owned(this_arg);
82085         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
82086         this_arg_conv.is_owned = false;
82087         void* contents_ptr = untag_ptr(contents);
82088         CHECK_ACCESS(contents_ptr);
82089         LDKOnionMessageContents contents_conv = *(LDKOnionMessageContents*)(contents_ptr);
82090         if (contents_conv.free == LDKOnionMessageContents_JCalls_free) {
82091                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
82092                 LDKOnionMessageContents_JCalls_cloned(&contents_conv);
82093         }
82094         void* destination_ptr = untag_ptr(destination);
82095         CHECK_ACCESS(destination_ptr);
82096         LDKDestination destination_conv = *(LDKDestination*)(destination_ptr);
82097         destination_conv = Destination_clone((LDKDestination*)untag_ptr(destination));
82098         LDKBlindedPath reply_path_conv;
82099         reply_path_conv.inner = untag_ptr(reply_path);
82100         reply_path_conv.is_owned = ptr_is_owned(reply_path);
82101         CHECK_INNER_FIELD_ACCESS_OR_NULL(reply_path_conv);
82102         reply_path_conv = BlindedPath_clone(&reply_path_conv);
82103         LDKCResult_SendSuccessSendErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SendSuccessSendErrorZ), "LDKCResult_SendSuccessSendErrorZ");
82104         *ret_conv = OnionMessenger_send_onion_message(&this_arg_conv, contents_conv, destination_conv, reply_path_conv);
82105         return tag_ptr(ret_conv, true);
82106 }
82107
82108 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OnionMessenger_1as_1OnionMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
82109         LDKOnionMessenger this_arg_conv;
82110         this_arg_conv.inner = untag_ptr(this_arg);
82111         this_arg_conv.is_owned = ptr_is_owned(this_arg);
82112         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
82113         this_arg_conv.is_owned = false;
82114         LDKOnionMessageHandler* ret_ret = MALLOC(sizeof(LDKOnionMessageHandler), "LDKOnionMessageHandler");
82115         *ret_ret = OnionMessenger_as_OnionMessageHandler(&this_arg_conv);
82116         return tag_ptr(ret_ret, true);
82117 }
82118
82119 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OffersMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
82120         if (!ptr_is_owned(this_ptr)) return;
82121         void* this_ptr_ptr = untag_ptr(this_ptr);
82122         CHECK_ACCESS(this_ptr_ptr);
82123         LDKOffersMessageHandler this_ptr_conv = *(LDKOffersMessageHandler*)(this_ptr_ptr);
82124         FREE(untag_ptr(this_ptr));
82125         OffersMessageHandler_free(this_ptr_conv);
82126 }
82127
82128 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OffersMessage_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
82129         if (!ptr_is_owned(this_ptr)) return;
82130         void* this_ptr_ptr = untag_ptr(this_ptr);
82131         CHECK_ACCESS(this_ptr_ptr);
82132         LDKOffersMessage this_ptr_conv = *(LDKOffersMessage*)(this_ptr_ptr);
82133         FREE(untag_ptr(this_ptr));
82134         OffersMessage_free(this_ptr_conv);
82135 }
82136
82137 static inline uint64_t OffersMessage_clone_ptr(LDKOffersMessage *NONNULL_PTR arg) {
82138         LDKOffersMessage *ret_copy = MALLOC(sizeof(LDKOffersMessage), "LDKOffersMessage");
82139         *ret_copy = OffersMessage_clone(arg);
82140         int64_t ret_ref = tag_ptr(ret_copy, true);
82141         return ret_ref;
82142 }
82143 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OffersMessage_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
82144         LDKOffersMessage* arg_conv = (LDKOffersMessage*)untag_ptr(arg);
82145         int64_t ret_conv = OffersMessage_clone_ptr(arg_conv);
82146         return ret_conv;
82147 }
82148
82149 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OffersMessage_1clone(JNIEnv *env, jclass clz, int64_t orig) {
82150         LDKOffersMessage* orig_conv = (LDKOffersMessage*)untag_ptr(orig);
82151         LDKOffersMessage *ret_copy = MALLOC(sizeof(LDKOffersMessage), "LDKOffersMessage");
82152         *ret_copy = OffersMessage_clone(orig_conv);
82153         int64_t ret_ref = tag_ptr(ret_copy, true);
82154         return ret_ref;
82155 }
82156
82157 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OffersMessage_1invoice_1request(JNIEnv *env, jclass clz, int64_t a) {
82158         LDKInvoiceRequest a_conv;
82159         a_conv.inner = untag_ptr(a);
82160         a_conv.is_owned = ptr_is_owned(a);
82161         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
82162         a_conv = InvoiceRequest_clone(&a_conv);
82163         LDKOffersMessage *ret_copy = MALLOC(sizeof(LDKOffersMessage), "LDKOffersMessage");
82164         *ret_copy = OffersMessage_invoice_request(a_conv);
82165         int64_t ret_ref = tag_ptr(ret_copy, true);
82166         return ret_ref;
82167 }
82168
82169 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OffersMessage_1invoice(JNIEnv *env, jclass clz, int64_t a) {
82170         LDKBolt12Invoice a_conv;
82171         a_conv.inner = untag_ptr(a);
82172         a_conv.is_owned = ptr_is_owned(a);
82173         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
82174         a_conv = Bolt12Invoice_clone(&a_conv);
82175         LDKOffersMessage *ret_copy = MALLOC(sizeof(LDKOffersMessage), "LDKOffersMessage");
82176         *ret_copy = OffersMessage_invoice(a_conv);
82177         int64_t ret_ref = tag_ptr(ret_copy, true);
82178         return ret_ref;
82179 }
82180
82181 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OffersMessage_1invoice_1error(JNIEnv *env, jclass clz, int64_t a) {
82182         LDKInvoiceError a_conv;
82183         a_conv.inner = untag_ptr(a);
82184         a_conv.is_owned = ptr_is_owned(a);
82185         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
82186         a_conv = InvoiceError_clone(&a_conv);
82187         LDKOffersMessage *ret_copy = MALLOC(sizeof(LDKOffersMessage), "LDKOffersMessage");
82188         *ret_copy = OffersMessage_invoice_error(a_conv);
82189         int64_t ret_ref = tag_ptr(ret_copy, true);
82190         return ret_ref;
82191 }
82192
82193 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_OffersMessage_1is_1known_1type(JNIEnv *env, jclass clz, int64_t tlv_type) {
82194         jboolean ret_conv = OffersMessage_is_known_type(tlv_type);
82195         return ret_conv;
82196 }
82197
82198 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OffersMessage_1as_1OnionMessageContents(JNIEnv *env, jclass clz, int64_t this_arg) {
82199         LDKOffersMessage* this_arg_conv = (LDKOffersMessage*)untag_ptr(this_arg);
82200         LDKOnionMessageContents* ret_ret = MALLOC(sizeof(LDKOnionMessageContents), "LDKOnionMessageContents");
82201         *ret_ret = OffersMessage_as_OnionMessageContents(this_arg_conv);
82202         return tag_ptr(ret_ret, true);
82203 }
82204
82205 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OffersMessage_1write(JNIEnv *env, jclass clz, int64_t obj) {
82206         LDKOffersMessage* obj_conv = (LDKOffersMessage*)untag_ptr(obj);
82207         LDKCVec_u8Z ret_var = OffersMessage_write(obj_conv);
82208         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
82209         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
82210         CVec_u8Z_free(ret_var);
82211         return ret_arr;
82212 }
82213
82214 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) {
82215         LDKu8slice ser_ref;
82216         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
82217         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
82218         void* arg_b_ptr = untag_ptr(arg_b);
82219         if (ptr_is_owned(arg_b)) { CHECK_ACCESS(arg_b_ptr); }
82220         LDKLogger* arg_b_conv = (LDKLogger*)arg_b_ptr;
82221         LDKCResult_OffersMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OffersMessageDecodeErrorZ), "LDKCResult_OffersMessageDecodeErrorZ");
82222         *ret_conv = OffersMessage_read(ser_ref, arg_a, arg_b_conv);
82223         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
82224         return tag_ptr(ret_conv, true);
82225 }
82226
82227 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Packet_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
82228         LDKPacket this_obj_conv;
82229         this_obj_conv.inner = untag_ptr(this_obj);
82230         this_obj_conv.is_owned = ptr_is_owned(this_obj);
82231         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
82232         Packet_free(this_obj_conv);
82233 }
82234
82235 JNIEXPORT int8_t JNICALL Java_org_ldk_impl_bindings_Packet_1get_1version(JNIEnv *env, jclass clz, int64_t this_ptr) {
82236         LDKPacket this_ptr_conv;
82237         this_ptr_conv.inner = untag_ptr(this_ptr);
82238         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
82239         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
82240         this_ptr_conv.is_owned = false;
82241         int8_t ret_conv = Packet_get_version(&this_ptr_conv);
82242         return ret_conv;
82243 }
82244
82245 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Packet_1set_1version(JNIEnv *env, jclass clz, int64_t this_ptr, int8_t val) {
82246         LDKPacket this_ptr_conv;
82247         this_ptr_conv.inner = untag_ptr(this_ptr);
82248         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
82249         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
82250         this_ptr_conv.is_owned = false;
82251         Packet_set_version(&this_ptr_conv, val);
82252 }
82253
82254 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Packet_1get_1public_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
82255         LDKPacket this_ptr_conv;
82256         this_ptr_conv.inner = untag_ptr(this_ptr);
82257         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
82258         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
82259         this_ptr_conv.is_owned = false;
82260         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
82261         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, Packet_get_public_key(&this_ptr_conv).compressed_form);
82262         return ret_arr;
82263 }
82264
82265 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Packet_1set_1public_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
82266         LDKPacket this_ptr_conv;
82267         this_ptr_conv.inner = untag_ptr(this_ptr);
82268         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
82269         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
82270         this_ptr_conv.is_owned = false;
82271         LDKPublicKey val_ref;
82272         CHECK((*env)->GetArrayLength(env, val) == 33);
82273         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
82274         Packet_set_public_key(&this_ptr_conv, val_ref);
82275 }
82276
82277 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Packet_1get_1hop_1data(JNIEnv *env, jclass clz, int64_t this_ptr) {
82278         LDKPacket this_ptr_conv;
82279         this_ptr_conv.inner = untag_ptr(this_ptr);
82280         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
82281         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
82282         this_ptr_conv.is_owned = false;
82283         LDKCVec_u8Z ret_var = Packet_get_hop_data(&this_ptr_conv);
82284         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
82285         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
82286         CVec_u8Z_free(ret_var);
82287         return ret_arr;
82288 }
82289
82290 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Packet_1set_1hop_1data(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
82291         LDKPacket this_ptr_conv;
82292         this_ptr_conv.inner = untag_ptr(this_ptr);
82293         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
82294         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
82295         this_ptr_conv.is_owned = false;
82296         LDKCVec_u8Z val_ref;
82297         val_ref.datalen = (*env)->GetArrayLength(env, val);
82298         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
82299         (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
82300         Packet_set_hop_data(&this_ptr_conv, val_ref);
82301 }
82302
82303 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Packet_1get_1hmac(JNIEnv *env, jclass clz, int64_t this_ptr) {
82304         LDKPacket this_ptr_conv;
82305         this_ptr_conv.inner = untag_ptr(this_ptr);
82306         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
82307         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
82308         this_ptr_conv.is_owned = false;
82309         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
82310         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *Packet_get_hmac(&this_ptr_conv));
82311         return ret_arr;
82312 }
82313
82314 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Packet_1set_1hmac(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
82315         LDKPacket this_ptr_conv;
82316         this_ptr_conv.inner = untag_ptr(this_ptr);
82317         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
82318         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
82319         this_ptr_conv.is_owned = false;
82320         LDKThirtyTwoBytes val_ref;
82321         CHECK((*env)->GetArrayLength(env, val) == 32);
82322         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
82323         Packet_set_hmac(&this_ptr_conv, val_ref);
82324 }
82325
82326 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) {
82327         LDKPublicKey public_key_arg_ref;
82328         CHECK((*env)->GetArrayLength(env, public_key_arg) == 33);
82329         (*env)->GetByteArrayRegion(env, public_key_arg, 0, 33, public_key_arg_ref.compressed_form);
82330         LDKCVec_u8Z hop_data_arg_ref;
82331         hop_data_arg_ref.datalen = (*env)->GetArrayLength(env, hop_data_arg);
82332         hop_data_arg_ref.data = MALLOC(hop_data_arg_ref.datalen, "LDKCVec_u8Z Bytes");
82333         (*env)->GetByteArrayRegion(env, hop_data_arg, 0, hop_data_arg_ref.datalen, hop_data_arg_ref.data);
82334         LDKThirtyTwoBytes hmac_arg_ref;
82335         CHECK((*env)->GetArrayLength(env, hmac_arg) == 32);
82336         (*env)->GetByteArrayRegion(env, hmac_arg, 0, 32, hmac_arg_ref.data);
82337         LDKPacket ret_var = Packet_new(version_arg, public_key_arg_ref, hop_data_arg_ref, hmac_arg_ref);
82338         int64_t ret_ref = 0;
82339         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
82340         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
82341         return ret_ref;
82342 }
82343
82344 static inline uint64_t Packet_clone_ptr(LDKPacket *NONNULL_PTR arg) {
82345         LDKPacket ret_var = Packet_clone(arg);
82346         int64_t ret_ref = 0;
82347         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
82348         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
82349         return ret_ref;
82350 }
82351 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Packet_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
82352         LDKPacket arg_conv;
82353         arg_conv.inner = untag_ptr(arg);
82354         arg_conv.is_owned = ptr_is_owned(arg);
82355         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
82356         arg_conv.is_owned = false;
82357         int64_t ret_conv = Packet_clone_ptr(&arg_conv);
82358         return ret_conv;
82359 }
82360
82361 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Packet_1clone(JNIEnv *env, jclass clz, int64_t orig) {
82362         LDKPacket orig_conv;
82363         orig_conv.inner = untag_ptr(orig);
82364         orig_conv.is_owned = ptr_is_owned(orig);
82365         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
82366         orig_conv.is_owned = false;
82367         LDKPacket ret_var = Packet_clone(&orig_conv);
82368         int64_t ret_ref = 0;
82369         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
82370         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
82371         return ret_ref;
82372 }
82373
82374 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Packet_1hash(JNIEnv *env, jclass clz, int64_t o) {
82375         LDKPacket o_conv;
82376         o_conv.inner = untag_ptr(o);
82377         o_conv.is_owned = ptr_is_owned(o);
82378         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
82379         o_conv.is_owned = false;
82380         int64_t ret_conv = Packet_hash(&o_conv);
82381         return ret_conv;
82382 }
82383
82384 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Packet_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
82385         LDKPacket a_conv;
82386         a_conv.inner = untag_ptr(a);
82387         a_conv.is_owned = ptr_is_owned(a);
82388         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
82389         a_conv.is_owned = false;
82390         LDKPacket b_conv;
82391         b_conv.inner = untag_ptr(b);
82392         b_conv.is_owned = ptr_is_owned(b);
82393         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
82394         b_conv.is_owned = false;
82395         jboolean ret_conv = Packet_eq(&a_conv, &b_conv);
82396         return ret_conv;
82397 }
82398
82399 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Packet_1write(JNIEnv *env, jclass clz, int64_t obj) {
82400         LDKPacket obj_conv;
82401         obj_conv.inner = untag_ptr(obj);
82402         obj_conv.is_owned = ptr_is_owned(obj);
82403         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
82404         obj_conv.is_owned = false;
82405         LDKCVec_u8Z ret_var = Packet_write(&obj_conv);
82406         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
82407         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
82408         CVec_u8Z_free(ret_var);
82409         return ret_arr;
82410 }
82411
82412 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ParsedOnionMessageContents_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
82413         if (!ptr_is_owned(this_ptr)) return;
82414         void* this_ptr_ptr = untag_ptr(this_ptr);
82415         CHECK_ACCESS(this_ptr_ptr);
82416         LDKParsedOnionMessageContents this_ptr_conv = *(LDKParsedOnionMessageContents*)(this_ptr_ptr);
82417         FREE(untag_ptr(this_ptr));
82418         ParsedOnionMessageContents_free(this_ptr_conv);
82419 }
82420
82421 static inline uint64_t ParsedOnionMessageContents_clone_ptr(LDKParsedOnionMessageContents *NONNULL_PTR arg) {
82422         LDKParsedOnionMessageContents *ret_copy = MALLOC(sizeof(LDKParsedOnionMessageContents), "LDKParsedOnionMessageContents");
82423         *ret_copy = ParsedOnionMessageContents_clone(arg);
82424         int64_t ret_ref = tag_ptr(ret_copy, true);
82425         return ret_ref;
82426 }
82427 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParsedOnionMessageContents_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
82428         LDKParsedOnionMessageContents* arg_conv = (LDKParsedOnionMessageContents*)untag_ptr(arg);
82429         int64_t ret_conv = ParsedOnionMessageContents_clone_ptr(arg_conv);
82430         return ret_conv;
82431 }
82432
82433 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParsedOnionMessageContents_1clone(JNIEnv *env, jclass clz, int64_t orig) {
82434         LDKParsedOnionMessageContents* orig_conv = (LDKParsedOnionMessageContents*)untag_ptr(orig);
82435         LDKParsedOnionMessageContents *ret_copy = MALLOC(sizeof(LDKParsedOnionMessageContents), "LDKParsedOnionMessageContents");
82436         *ret_copy = ParsedOnionMessageContents_clone(orig_conv);
82437         int64_t ret_ref = tag_ptr(ret_copy, true);
82438         return ret_ref;
82439 }
82440
82441 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParsedOnionMessageContents_1offers(JNIEnv *env, jclass clz, int64_t a) {
82442         void* a_ptr = untag_ptr(a);
82443         CHECK_ACCESS(a_ptr);
82444         LDKOffersMessage a_conv = *(LDKOffersMessage*)(a_ptr);
82445         a_conv = OffersMessage_clone((LDKOffersMessage*)untag_ptr(a));
82446         LDKParsedOnionMessageContents *ret_copy = MALLOC(sizeof(LDKParsedOnionMessageContents), "LDKParsedOnionMessageContents");
82447         *ret_copy = ParsedOnionMessageContents_offers(a_conv);
82448         int64_t ret_ref = tag_ptr(ret_copy, true);
82449         return ret_ref;
82450 }
82451
82452 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParsedOnionMessageContents_1custom(JNIEnv *env, jclass clz, int64_t a) {
82453         void* a_ptr = untag_ptr(a);
82454         CHECK_ACCESS(a_ptr);
82455         LDKOnionMessageContents a_conv = *(LDKOnionMessageContents*)(a_ptr);
82456         if (a_conv.free == LDKOnionMessageContents_JCalls_free) {
82457                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
82458                 LDKOnionMessageContents_JCalls_cloned(&a_conv);
82459         }
82460         LDKParsedOnionMessageContents *ret_copy = MALLOC(sizeof(LDKParsedOnionMessageContents), "LDKParsedOnionMessageContents");
82461         *ret_copy = ParsedOnionMessageContents_custom(a_conv);
82462         int64_t ret_ref = tag_ptr(ret_copy, true);
82463         return ret_ref;
82464 }
82465
82466 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParsedOnionMessageContents_1as_1OnionMessageContents(JNIEnv *env, jclass clz, int64_t this_arg) {
82467         LDKParsedOnionMessageContents* this_arg_conv = (LDKParsedOnionMessageContents*)untag_ptr(this_arg);
82468         LDKOnionMessageContents* ret_ret = MALLOC(sizeof(LDKOnionMessageContents), "LDKOnionMessageContents");
82469         *ret_ret = ParsedOnionMessageContents_as_OnionMessageContents(this_arg_conv);
82470         return tag_ptr(ret_ret, true);
82471 }
82472
82473 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ParsedOnionMessageContents_1write(JNIEnv *env, jclass clz, int64_t obj) {
82474         LDKParsedOnionMessageContents* obj_conv = (LDKParsedOnionMessageContents*)untag_ptr(obj);
82475         LDKCVec_u8Z ret_var = ParsedOnionMessageContents_write(obj_conv);
82476         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
82477         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
82478         CVec_u8Z_free(ret_var);
82479         return ret_arr;
82480 }
82481
82482 static inline uint64_t OnionMessageContents_clone_ptr(LDKOnionMessageContents *NONNULL_PTR arg) {
82483         LDKOnionMessageContents* ret_ret = MALLOC(sizeof(LDKOnionMessageContents), "LDKOnionMessageContents");
82484         *ret_ret = OnionMessageContents_clone(arg);
82485         return tag_ptr(ret_ret, true);
82486 }
82487 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OnionMessageContents_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
82488         void* arg_ptr = untag_ptr(arg);
82489         if (ptr_is_owned(arg)) { CHECK_ACCESS(arg_ptr); }
82490         LDKOnionMessageContents* arg_conv = (LDKOnionMessageContents*)arg_ptr;
82491         int64_t ret_conv = OnionMessageContents_clone_ptr(arg_conv);
82492         return ret_conv;
82493 }
82494
82495 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OnionMessageContents_1clone(JNIEnv *env, jclass clz, int64_t orig) {
82496         void* orig_ptr = untag_ptr(orig);
82497         if (ptr_is_owned(orig)) { CHECK_ACCESS(orig_ptr); }
82498         LDKOnionMessageContents* orig_conv = (LDKOnionMessageContents*)orig_ptr;
82499         LDKOnionMessageContents* ret_ret = MALLOC(sizeof(LDKOnionMessageContents), "LDKOnionMessageContents");
82500         *ret_ret = OnionMessageContents_clone(orig_conv);
82501         return tag_ptr(ret_ret, true);
82502 }
82503
82504 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OnionMessageContents_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
82505         if (!ptr_is_owned(this_ptr)) return;
82506         void* this_ptr_ptr = untag_ptr(this_ptr);
82507         CHECK_ACCESS(this_ptr_ptr);
82508         LDKOnionMessageContents this_ptr_conv = *(LDKOnionMessageContents*)(this_ptr_ptr);
82509         FREE(untag_ptr(this_ptr));
82510         OnionMessageContents_free(this_ptr_conv);
82511 }
82512
82513 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NextMessageHop_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
82514         if (!ptr_is_owned(this_ptr)) return;
82515         void* this_ptr_ptr = untag_ptr(this_ptr);
82516         CHECK_ACCESS(this_ptr_ptr);
82517         LDKNextMessageHop this_ptr_conv = *(LDKNextMessageHop*)(this_ptr_ptr);
82518         FREE(untag_ptr(this_ptr));
82519         NextMessageHop_free(this_ptr_conv);
82520 }
82521
82522 static inline uint64_t NextMessageHop_clone_ptr(LDKNextMessageHop *NONNULL_PTR arg) {
82523         LDKNextMessageHop *ret_copy = MALLOC(sizeof(LDKNextMessageHop), "LDKNextMessageHop");
82524         *ret_copy = NextMessageHop_clone(arg);
82525         int64_t ret_ref = tag_ptr(ret_copy, true);
82526         return ret_ref;
82527 }
82528 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NextMessageHop_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
82529         LDKNextMessageHop* arg_conv = (LDKNextMessageHop*)untag_ptr(arg);
82530         int64_t ret_conv = NextMessageHop_clone_ptr(arg_conv);
82531         return ret_conv;
82532 }
82533
82534 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NextMessageHop_1clone(JNIEnv *env, jclass clz, int64_t orig) {
82535         LDKNextMessageHop* orig_conv = (LDKNextMessageHop*)untag_ptr(orig);
82536         LDKNextMessageHop *ret_copy = MALLOC(sizeof(LDKNextMessageHop), "LDKNextMessageHop");
82537         *ret_copy = NextMessageHop_clone(orig_conv);
82538         int64_t ret_ref = tag_ptr(ret_copy, true);
82539         return ret_ref;
82540 }
82541
82542 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NextMessageHop_1node_1id(JNIEnv *env, jclass clz, int8_tArray a) {
82543         LDKPublicKey a_ref;
82544         CHECK((*env)->GetArrayLength(env, a) == 33);
82545         (*env)->GetByteArrayRegion(env, a, 0, 33, a_ref.compressed_form);
82546         LDKNextMessageHop *ret_copy = MALLOC(sizeof(LDKNextMessageHop), "LDKNextMessageHop");
82547         *ret_copy = NextMessageHop_node_id(a_ref);
82548         int64_t ret_ref = tag_ptr(ret_copy, true);
82549         return ret_ref;
82550 }
82551
82552 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NextMessageHop_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t a) {
82553         LDKNextMessageHop *ret_copy = MALLOC(sizeof(LDKNextMessageHop), "LDKNextMessageHop");
82554         *ret_copy = NextMessageHop_short_channel_id(a);
82555         int64_t ret_ref = tag_ptr(ret_copy, true);
82556         return ret_ref;
82557 }
82558
82559 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NextMessageHop_1hash(JNIEnv *env, jclass clz, int64_t o) {
82560         LDKNextMessageHop* o_conv = (LDKNextMessageHop*)untag_ptr(o);
82561         int64_t ret_conv = NextMessageHop_hash(o_conv);
82562         return ret_conv;
82563 }
82564
82565 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NextMessageHop_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
82566         LDKNextMessageHop* a_conv = (LDKNextMessageHop*)untag_ptr(a);
82567         LDKNextMessageHop* b_conv = (LDKNextMessageHop*)untag_ptr(b);
82568         jboolean ret_conv = NextMessageHop_eq(a_conv, b_conv);
82569         return ret_conv;
82570 }
82571
82572 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BlindedPath_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
82573         LDKBlindedPath this_obj_conv;
82574         this_obj_conv.inner = untag_ptr(this_obj);
82575         this_obj_conv.is_owned = ptr_is_owned(this_obj);
82576         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
82577         BlindedPath_free(this_obj_conv);
82578 }
82579
82580 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedPath_1get_1introduction_1node(JNIEnv *env, jclass clz, int64_t this_ptr) {
82581         LDKBlindedPath this_ptr_conv;
82582         this_ptr_conv.inner = untag_ptr(this_ptr);
82583         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
82584         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
82585         this_ptr_conv.is_owned = false;
82586         LDKIntroductionNode *ret_copy = MALLOC(sizeof(LDKIntroductionNode), "LDKIntroductionNode");
82587         *ret_copy = BlindedPath_get_introduction_node(&this_ptr_conv);
82588         int64_t ret_ref = tag_ptr(ret_copy, true);
82589         return ret_ref;
82590 }
82591
82592 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BlindedPath_1set_1introduction_1node(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
82593         LDKBlindedPath this_ptr_conv;
82594         this_ptr_conv.inner = untag_ptr(this_ptr);
82595         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
82596         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
82597         this_ptr_conv.is_owned = false;
82598         void* val_ptr = untag_ptr(val);
82599         CHECK_ACCESS(val_ptr);
82600         LDKIntroductionNode val_conv = *(LDKIntroductionNode*)(val_ptr);
82601         val_conv = IntroductionNode_clone((LDKIntroductionNode*)untag_ptr(val));
82602         BlindedPath_set_introduction_node(&this_ptr_conv, val_conv);
82603 }
82604
82605 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BlindedPath_1get_1blinding_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
82606         LDKBlindedPath this_ptr_conv;
82607         this_ptr_conv.inner = untag_ptr(this_ptr);
82608         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
82609         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
82610         this_ptr_conv.is_owned = false;
82611         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
82612         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, BlindedPath_get_blinding_point(&this_ptr_conv).compressed_form);
82613         return ret_arr;
82614 }
82615
82616 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BlindedPath_1set_1blinding_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
82617         LDKBlindedPath this_ptr_conv;
82618         this_ptr_conv.inner = untag_ptr(this_ptr);
82619         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
82620         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
82621         this_ptr_conv.is_owned = false;
82622         LDKPublicKey val_ref;
82623         CHECK((*env)->GetArrayLength(env, val) == 33);
82624         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
82625         BlindedPath_set_blinding_point(&this_ptr_conv, val_ref);
82626 }
82627
82628 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_BlindedPath_1get_1blinded_1hops(JNIEnv *env, jclass clz, int64_t this_ptr) {
82629         LDKBlindedPath this_ptr_conv;
82630         this_ptr_conv.inner = untag_ptr(this_ptr);
82631         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
82632         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
82633         this_ptr_conv.is_owned = false;
82634         LDKCVec_BlindedHopZ ret_var = BlindedPath_get_blinded_hops(&this_ptr_conv);
82635         int64_tArray ret_arr = NULL;
82636         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
82637         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
82638         for (size_t m = 0; m < ret_var.datalen; m++) {
82639                 LDKBlindedHop ret_conv_12_var = ret_var.data[m];
82640                 int64_t ret_conv_12_ref = 0;
82641                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_12_var);
82642                 ret_conv_12_ref = tag_ptr(ret_conv_12_var.inner, ret_conv_12_var.is_owned);
82643                 ret_arr_ptr[m] = ret_conv_12_ref;
82644         }
82645         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
82646         FREE(ret_var.data);
82647         return ret_arr;
82648 }
82649
82650 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BlindedPath_1set_1blinded_1hops(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
82651         LDKBlindedPath this_ptr_conv;
82652         this_ptr_conv.inner = untag_ptr(this_ptr);
82653         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
82654         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
82655         this_ptr_conv.is_owned = false;
82656         LDKCVec_BlindedHopZ val_constr;
82657         val_constr.datalen = (*env)->GetArrayLength(env, val);
82658         if (val_constr.datalen > 0)
82659                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKBlindedHop), "LDKCVec_BlindedHopZ Elements");
82660         else
82661                 val_constr.data = NULL;
82662         int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
82663         for (size_t m = 0; m < val_constr.datalen; m++) {
82664                 int64_t val_conv_12 = val_vals[m];
82665                 LDKBlindedHop val_conv_12_conv;
82666                 val_conv_12_conv.inner = untag_ptr(val_conv_12);
82667                 val_conv_12_conv.is_owned = ptr_is_owned(val_conv_12);
82668                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_12_conv);
82669                 val_conv_12_conv = BlindedHop_clone(&val_conv_12_conv);
82670                 val_constr.data[m] = val_conv_12_conv;
82671         }
82672         (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
82673         BlindedPath_set_blinded_hops(&this_ptr_conv, val_constr);
82674 }
82675
82676 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedPath_1new(JNIEnv *env, jclass clz, int64_t introduction_node_arg, int8_tArray blinding_point_arg, int64_tArray blinded_hops_arg) {
82677         void* introduction_node_arg_ptr = untag_ptr(introduction_node_arg);
82678         CHECK_ACCESS(introduction_node_arg_ptr);
82679         LDKIntroductionNode introduction_node_arg_conv = *(LDKIntroductionNode*)(introduction_node_arg_ptr);
82680         introduction_node_arg_conv = IntroductionNode_clone((LDKIntroductionNode*)untag_ptr(introduction_node_arg));
82681         LDKPublicKey blinding_point_arg_ref;
82682         CHECK((*env)->GetArrayLength(env, blinding_point_arg) == 33);
82683         (*env)->GetByteArrayRegion(env, blinding_point_arg, 0, 33, blinding_point_arg_ref.compressed_form);
82684         LDKCVec_BlindedHopZ blinded_hops_arg_constr;
82685         blinded_hops_arg_constr.datalen = (*env)->GetArrayLength(env, blinded_hops_arg);
82686         if (blinded_hops_arg_constr.datalen > 0)
82687                 blinded_hops_arg_constr.data = MALLOC(blinded_hops_arg_constr.datalen * sizeof(LDKBlindedHop), "LDKCVec_BlindedHopZ Elements");
82688         else
82689                 blinded_hops_arg_constr.data = NULL;
82690         int64_t* blinded_hops_arg_vals = (*env)->GetLongArrayElements (env, blinded_hops_arg, NULL);
82691         for (size_t m = 0; m < blinded_hops_arg_constr.datalen; m++) {
82692                 int64_t blinded_hops_arg_conv_12 = blinded_hops_arg_vals[m];
82693                 LDKBlindedHop blinded_hops_arg_conv_12_conv;
82694                 blinded_hops_arg_conv_12_conv.inner = untag_ptr(blinded_hops_arg_conv_12);
82695                 blinded_hops_arg_conv_12_conv.is_owned = ptr_is_owned(blinded_hops_arg_conv_12);
82696                 CHECK_INNER_FIELD_ACCESS_OR_NULL(blinded_hops_arg_conv_12_conv);
82697                 blinded_hops_arg_conv_12_conv = BlindedHop_clone(&blinded_hops_arg_conv_12_conv);
82698                 blinded_hops_arg_constr.data[m] = blinded_hops_arg_conv_12_conv;
82699         }
82700         (*env)->ReleaseLongArrayElements(env, blinded_hops_arg, blinded_hops_arg_vals, 0);
82701         LDKBlindedPath ret_var = BlindedPath_new(introduction_node_arg_conv, blinding_point_arg_ref, blinded_hops_arg_constr);
82702         int64_t ret_ref = 0;
82703         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
82704         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
82705         return ret_ref;
82706 }
82707
82708 static inline uint64_t BlindedPath_clone_ptr(LDKBlindedPath *NONNULL_PTR arg) {
82709         LDKBlindedPath ret_var = BlindedPath_clone(arg);
82710         int64_t ret_ref = 0;
82711         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
82712         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
82713         return ret_ref;
82714 }
82715 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedPath_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
82716         LDKBlindedPath arg_conv;
82717         arg_conv.inner = untag_ptr(arg);
82718         arg_conv.is_owned = ptr_is_owned(arg);
82719         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
82720         arg_conv.is_owned = false;
82721         int64_t ret_conv = BlindedPath_clone_ptr(&arg_conv);
82722         return ret_conv;
82723 }
82724
82725 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedPath_1clone(JNIEnv *env, jclass clz, int64_t orig) {
82726         LDKBlindedPath orig_conv;
82727         orig_conv.inner = untag_ptr(orig);
82728         orig_conv.is_owned = ptr_is_owned(orig);
82729         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
82730         orig_conv.is_owned = false;
82731         LDKBlindedPath ret_var = BlindedPath_clone(&orig_conv);
82732         int64_t ret_ref = 0;
82733         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
82734         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
82735         return ret_ref;
82736 }
82737
82738 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedPath_1hash(JNIEnv *env, jclass clz, int64_t o) {
82739         LDKBlindedPath o_conv;
82740         o_conv.inner = untag_ptr(o);
82741         o_conv.is_owned = ptr_is_owned(o);
82742         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
82743         o_conv.is_owned = false;
82744         int64_t ret_conv = BlindedPath_hash(&o_conv);
82745         return ret_conv;
82746 }
82747
82748 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_BlindedPath_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
82749         LDKBlindedPath a_conv;
82750         a_conv.inner = untag_ptr(a);
82751         a_conv.is_owned = ptr_is_owned(a);
82752         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
82753         a_conv.is_owned = false;
82754         LDKBlindedPath b_conv;
82755         b_conv.inner = untag_ptr(b);
82756         b_conv.is_owned = ptr_is_owned(b);
82757         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
82758         b_conv.is_owned = false;
82759         jboolean ret_conv = BlindedPath_eq(&a_conv, &b_conv);
82760         return ret_conv;
82761 }
82762
82763 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_IntroductionNode_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
82764         if (!ptr_is_owned(this_ptr)) return;
82765         void* this_ptr_ptr = untag_ptr(this_ptr);
82766         CHECK_ACCESS(this_ptr_ptr);
82767         LDKIntroductionNode this_ptr_conv = *(LDKIntroductionNode*)(this_ptr_ptr);
82768         FREE(untag_ptr(this_ptr));
82769         IntroductionNode_free(this_ptr_conv);
82770 }
82771
82772 static inline uint64_t IntroductionNode_clone_ptr(LDKIntroductionNode *NONNULL_PTR arg) {
82773         LDKIntroductionNode *ret_copy = MALLOC(sizeof(LDKIntroductionNode), "LDKIntroductionNode");
82774         *ret_copy = IntroductionNode_clone(arg);
82775         int64_t ret_ref = tag_ptr(ret_copy, true);
82776         return ret_ref;
82777 }
82778 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IntroductionNode_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
82779         LDKIntroductionNode* arg_conv = (LDKIntroductionNode*)untag_ptr(arg);
82780         int64_t ret_conv = IntroductionNode_clone_ptr(arg_conv);
82781         return ret_conv;
82782 }
82783
82784 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IntroductionNode_1clone(JNIEnv *env, jclass clz, int64_t orig) {
82785         LDKIntroductionNode* orig_conv = (LDKIntroductionNode*)untag_ptr(orig);
82786         LDKIntroductionNode *ret_copy = MALLOC(sizeof(LDKIntroductionNode), "LDKIntroductionNode");
82787         *ret_copy = IntroductionNode_clone(orig_conv);
82788         int64_t ret_ref = tag_ptr(ret_copy, true);
82789         return ret_ref;
82790 }
82791
82792 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IntroductionNode_1node_1id(JNIEnv *env, jclass clz, int8_tArray a) {
82793         LDKPublicKey a_ref;
82794         CHECK((*env)->GetArrayLength(env, a) == 33);
82795         (*env)->GetByteArrayRegion(env, a, 0, 33, a_ref.compressed_form);
82796         LDKIntroductionNode *ret_copy = MALLOC(sizeof(LDKIntroductionNode), "LDKIntroductionNode");
82797         *ret_copy = IntroductionNode_node_id(a_ref);
82798         int64_t ret_ref = tag_ptr(ret_copy, true);
82799         return ret_ref;
82800 }
82801
82802 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IntroductionNode_1directed_1short_1channel_1id(JNIEnv *env, jclass clz, jclass a, int64_t b) {
82803         LDKDirection a_conv = LDKDirection_from_java(env, a);
82804         LDKIntroductionNode *ret_copy = MALLOC(sizeof(LDKIntroductionNode), "LDKIntroductionNode");
82805         *ret_copy = IntroductionNode_directed_short_channel_id(a_conv, b);
82806         int64_t ret_ref = tag_ptr(ret_copy, true);
82807         return ret_ref;
82808 }
82809
82810 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IntroductionNode_1hash(JNIEnv *env, jclass clz, int64_t o) {
82811         LDKIntroductionNode* o_conv = (LDKIntroductionNode*)untag_ptr(o);
82812         int64_t ret_conv = IntroductionNode_hash(o_conv);
82813         return ret_conv;
82814 }
82815
82816 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_IntroductionNode_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
82817         LDKIntroductionNode* a_conv = (LDKIntroductionNode*)untag_ptr(a);
82818         LDKIntroductionNode* b_conv = (LDKIntroductionNode*)untag_ptr(b);
82819         jboolean ret_conv = IntroductionNode_eq(a_conv, b_conv);
82820         return ret_conv;
82821 }
82822
82823 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Direction_1clone(JNIEnv *env, jclass clz, int64_t orig) {
82824         LDKDirection* orig_conv = (LDKDirection*)untag_ptr(orig);
82825         jclass ret_conv = LDKDirection_to_java(env, Direction_clone(orig_conv));
82826         return ret_conv;
82827 }
82828
82829 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Direction_1node_1one(JNIEnv *env, jclass clz) {
82830         jclass ret_conv = LDKDirection_to_java(env, Direction_node_one());
82831         return ret_conv;
82832 }
82833
82834 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Direction_1node_1two(JNIEnv *env, jclass clz) {
82835         jclass ret_conv = LDKDirection_to_java(env, Direction_node_two());
82836         return ret_conv;
82837 }
82838
82839 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Direction_1hash(JNIEnv *env, jclass clz, int64_t o) {
82840         LDKDirection* o_conv = (LDKDirection*)untag_ptr(o);
82841         int64_t ret_conv = Direction_hash(o_conv);
82842         return ret_conv;
82843 }
82844
82845 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Direction_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
82846         LDKDirection* a_conv = (LDKDirection*)untag_ptr(a);
82847         LDKDirection* b_conv = (LDKDirection*)untag_ptr(b);
82848         jboolean ret_conv = Direction_eq(a_conv, b_conv);
82849         return ret_conv;
82850 }
82851
82852 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeIdLookUp_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
82853         if (!ptr_is_owned(this_ptr)) return;
82854         void* this_ptr_ptr = untag_ptr(this_ptr);
82855         CHECK_ACCESS(this_ptr_ptr);
82856         LDKNodeIdLookUp this_ptr_conv = *(LDKNodeIdLookUp*)(this_ptr_ptr);
82857         FREE(untag_ptr(this_ptr));
82858         NodeIdLookUp_free(this_ptr_conv);
82859 }
82860
82861 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EmptyNodeIdLookUp_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
82862         LDKEmptyNodeIdLookUp this_obj_conv;
82863         this_obj_conv.inner = untag_ptr(this_obj);
82864         this_obj_conv.is_owned = ptr_is_owned(this_obj);
82865         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
82866         EmptyNodeIdLookUp_free(this_obj_conv);
82867 }
82868
82869 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EmptyNodeIdLookUp_1new(JNIEnv *env, jclass clz) {
82870         LDKEmptyNodeIdLookUp ret_var = EmptyNodeIdLookUp_new();
82871         int64_t ret_ref = 0;
82872         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
82873         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
82874         return ret_ref;
82875 }
82876
82877 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EmptyNodeIdLookUp_1as_1NodeIdLookUp(JNIEnv *env, jclass clz, int64_t this_arg) {
82878         LDKEmptyNodeIdLookUp this_arg_conv;
82879         this_arg_conv.inner = untag_ptr(this_arg);
82880         this_arg_conv.is_owned = ptr_is_owned(this_arg);
82881         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
82882         this_arg_conv.is_owned = false;
82883         LDKNodeIdLookUp* ret_ret = MALLOC(sizeof(LDKNodeIdLookUp), "LDKNodeIdLookUp");
82884         *ret_ret = EmptyNodeIdLookUp_as_NodeIdLookUp(&this_arg_conv);
82885         return tag_ptr(ret_ret, true);
82886 }
82887
82888 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BlindedHop_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
82889         LDKBlindedHop this_obj_conv;
82890         this_obj_conv.inner = untag_ptr(this_obj);
82891         this_obj_conv.is_owned = ptr_is_owned(this_obj);
82892         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
82893         BlindedHop_free(this_obj_conv);
82894 }
82895
82896 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BlindedHop_1get_1blinded_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
82897         LDKBlindedHop this_ptr_conv;
82898         this_ptr_conv.inner = untag_ptr(this_ptr);
82899         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
82900         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
82901         this_ptr_conv.is_owned = false;
82902         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
82903         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, BlindedHop_get_blinded_node_id(&this_ptr_conv).compressed_form);
82904         return ret_arr;
82905 }
82906
82907 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BlindedHop_1set_1blinded_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
82908         LDKBlindedHop this_ptr_conv;
82909         this_ptr_conv.inner = untag_ptr(this_ptr);
82910         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
82911         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
82912         this_ptr_conv.is_owned = false;
82913         LDKPublicKey val_ref;
82914         CHECK((*env)->GetArrayLength(env, val) == 33);
82915         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
82916         BlindedHop_set_blinded_node_id(&this_ptr_conv, val_ref);
82917 }
82918
82919 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BlindedHop_1get_1encrypted_1payload(JNIEnv *env, jclass clz, int64_t this_ptr) {
82920         LDKBlindedHop this_ptr_conv;
82921         this_ptr_conv.inner = untag_ptr(this_ptr);
82922         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
82923         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
82924         this_ptr_conv.is_owned = false;
82925         LDKCVec_u8Z ret_var = BlindedHop_get_encrypted_payload(&this_ptr_conv);
82926         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
82927         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
82928         CVec_u8Z_free(ret_var);
82929         return ret_arr;
82930 }
82931
82932 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BlindedHop_1set_1encrypted_1payload(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
82933         LDKBlindedHop this_ptr_conv;
82934         this_ptr_conv.inner = untag_ptr(this_ptr);
82935         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
82936         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
82937         this_ptr_conv.is_owned = false;
82938         LDKCVec_u8Z val_ref;
82939         val_ref.datalen = (*env)->GetArrayLength(env, val);
82940         val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
82941         (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
82942         BlindedHop_set_encrypted_payload(&this_ptr_conv, val_ref);
82943 }
82944
82945 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) {
82946         LDKPublicKey blinded_node_id_arg_ref;
82947         CHECK((*env)->GetArrayLength(env, blinded_node_id_arg) == 33);
82948         (*env)->GetByteArrayRegion(env, blinded_node_id_arg, 0, 33, blinded_node_id_arg_ref.compressed_form);
82949         LDKCVec_u8Z encrypted_payload_arg_ref;
82950         encrypted_payload_arg_ref.datalen = (*env)->GetArrayLength(env, encrypted_payload_arg);
82951         encrypted_payload_arg_ref.data = MALLOC(encrypted_payload_arg_ref.datalen, "LDKCVec_u8Z Bytes");
82952         (*env)->GetByteArrayRegion(env, encrypted_payload_arg, 0, encrypted_payload_arg_ref.datalen, encrypted_payload_arg_ref.data);
82953         LDKBlindedHop ret_var = BlindedHop_new(blinded_node_id_arg_ref, encrypted_payload_arg_ref);
82954         int64_t ret_ref = 0;
82955         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
82956         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
82957         return ret_ref;
82958 }
82959
82960 static inline uint64_t BlindedHop_clone_ptr(LDKBlindedHop *NONNULL_PTR arg) {
82961         LDKBlindedHop ret_var = BlindedHop_clone(arg);
82962         int64_t ret_ref = 0;
82963         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
82964         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
82965         return ret_ref;
82966 }
82967 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedHop_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
82968         LDKBlindedHop arg_conv;
82969         arg_conv.inner = untag_ptr(arg);
82970         arg_conv.is_owned = ptr_is_owned(arg);
82971         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
82972         arg_conv.is_owned = false;
82973         int64_t ret_conv = BlindedHop_clone_ptr(&arg_conv);
82974         return ret_conv;
82975 }
82976
82977 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedHop_1clone(JNIEnv *env, jclass clz, int64_t orig) {
82978         LDKBlindedHop orig_conv;
82979         orig_conv.inner = untag_ptr(orig);
82980         orig_conv.is_owned = ptr_is_owned(orig);
82981         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
82982         orig_conv.is_owned = false;
82983         LDKBlindedHop ret_var = BlindedHop_clone(&orig_conv);
82984         int64_t ret_ref = 0;
82985         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
82986         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
82987         return ret_ref;
82988 }
82989
82990 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedHop_1hash(JNIEnv *env, jclass clz, int64_t o) {
82991         LDKBlindedHop o_conv;
82992         o_conv.inner = untag_ptr(o);
82993         o_conv.is_owned = ptr_is_owned(o);
82994         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
82995         o_conv.is_owned = false;
82996         int64_t ret_conv = BlindedHop_hash(&o_conv);
82997         return ret_conv;
82998 }
82999
83000 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_BlindedHop_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
83001         LDKBlindedHop a_conv;
83002         a_conv.inner = untag_ptr(a);
83003         a_conv.is_owned = ptr_is_owned(a);
83004         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
83005         a_conv.is_owned = false;
83006         LDKBlindedHop b_conv;
83007         b_conv.inner = untag_ptr(b);
83008         b_conv.is_owned = ptr_is_owned(b);
83009         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
83010         b_conv.is_owned = false;
83011         jboolean ret_conv = BlindedHop_eq(&a_conv, &b_conv);
83012         return ret_conv;
83013 }
83014
83015 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) {
83016         LDKPublicKey recipient_node_id_ref;
83017         CHECK((*env)->GetArrayLength(env, recipient_node_id) == 33);
83018         (*env)->GetByteArrayRegion(env, recipient_node_id, 0, 33, recipient_node_id_ref.compressed_form);
83019         void* entropy_source_ptr = untag_ptr(entropy_source);
83020         CHECK_ACCESS(entropy_source_ptr);
83021         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
83022         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
83023                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
83024                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
83025         }
83026         LDKCResult_BlindedPathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathNoneZ), "LDKCResult_BlindedPathNoneZ");
83027         *ret_conv = BlindedPath_one_hop_for_message(recipient_node_id_ref, entropy_source_conv);
83028         return tag_ptr(ret_conv, true);
83029 }
83030
83031 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedPath_1new_1for_1message(JNIEnv *env, jclass clz, jobjectArray node_pks, int64_t entropy_source) {
83032         LDKCVec_PublicKeyZ node_pks_constr;
83033         node_pks_constr.datalen = (*env)->GetArrayLength(env, node_pks);
83034         if (node_pks_constr.datalen > 0)
83035                 node_pks_constr.data = MALLOC(node_pks_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
83036         else
83037                 node_pks_constr.data = NULL;
83038         for (size_t i = 0; i < node_pks_constr.datalen; i++) {
83039                 int8_tArray node_pks_conv_8 = (*env)->GetObjectArrayElement(env, node_pks, i);
83040                 LDKPublicKey node_pks_conv_8_ref;
83041                 CHECK((*env)->GetArrayLength(env, node_pks_conv_8) == 33);
83042                 (*env)->GetByteArrayRegion(env, node_pks_conv_8, 0, 33, node_pks_conv_8_ref.compressed_form);
83043                 node_pks_constr.data[i] = node_pks_conv_8_ref;
83044         }
83045         void* entropy_source_ptr = untag_ptr(entropy_source);
83046         CHECK_ACCESS(entropy_source_ptr);
83047         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
83048         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
83049                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
83050                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
83051         }
83052         LDKCResult_BlindedPathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathNoneZ), "LDKCResult_BlindedPathNoneZ");
83053         *ret_conv = BlindedPath_new_for_message(node_pks_constr, entropy_source_conv);
83054         return tag_ptr(ret_conv, true);
83055 }
83056
83057 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedPath_1one_1hop_1for_1payment(JNIEnv *env, jclass clz, int8_tArray payee_node_id, int64_t payee_tlvs, int16_t min_final_cltv_expiry_delta, int64_t entropy_source) {
83058         LDKPublicKey payee_node_id_ref;
83059         CHECK((*env)->GetArrayLength(env, payee_node_id) == 33);
83060         (*env)->GetByteArrayRegion(env, payee_node_id, 0, 33, payee_node_id_ref.compressed_form);
83061         LDKReceiveTlvs payee_tlvs_conv;
83062         payee_tlvs_conv.inner = untag_ptr(payee_tlvs);
83063         payee_tlvs_conv.is_owned = ptr_is_owned(payee_tlvs);
83064         CHECK_INNER_FIELD_ACCESS_OR_NULL(payee_tlvs_conv);
83065         payee_tlvs_conv = ReceiveTlvs_clone(&payee_tlvs_conv);
83066         void* entropy_source_ptr = untag_ptr(entropy_source);
83067         CHECK_ACCESS(entropy_source_ptr);
83068         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
83069         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
83070                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
83071                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
83072         }
83073         LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ), "LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ");
83074         *ret_conv = BlindedPath_one_hop_for_payment(payee_node_id_ref, payee_tlvs_conv, min_final_cltv_expiry_delta, entropy_source_conv);
83075         return tag_ptr(ret_conv, true);
83076 }
83077
83078 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedPath_1new_1for_1payment(JNIEnv *env, jclass clz, int64_tArray intermediate_nodes, int8_tArray payee_node_id, int64_t payee_tlvs, int64_t htlc_maximum_msat, int16_t min_final_cltv_expiry_delta, int64_t entropy_source) {
83079         LDKCVec_ForwardNodeZ intermediate_nodes_constr;
83080         intermediate_nodes_constr.datalen = (*env)->GetArrayLength(env, intermediate_nodes);
83081         if (intermediate_nodes_constr.datalen > 0)
83082                 intermediate_nodes_constr.data = MALLOC(intermediate_nodes_constr.datalen * sizeof(LDKForwardNode), "LDKCVec_ForwardNodeZ Elements");
83083         else
83084                 intermediate_nodes_constr.data = NULL;
83085         int64_t* intermediate_nodes_vals = (*env)->GetLongArrayElements (env, intermediate_nodes, NULL);
83086         for (size_t n = 0; n < intermediate_nodes_constr.datalen; n++) {
83087                 int64_t intermediate_nodes_conv_13 = intermediate_nodes_vals[n];
83088                 LDKForwardNode intermediate_nodes_conv_13_conv;
83089                 intermediate_nodes_conv_13_conv.inner = untag_ptr(intermediate_nodes_conv_13);
83090                 intermediate_nodes_conv_13_conv.is_owned = ptr_is_owned(intermediate_nodes_conv_13);
83091                 CHECK_INNER_FIELD_ACCESS_OR_NULL(intermediate_nodes_conv_13_conv);
83092                 intermediate_nodes_conv_13_conv = ForwardNode_clone(&intermediate_nodes_conv_13_conv);
83093                 intermediate_nodes_constr.data[n] = intermediate_nodes_conv_13_conv;
83094         }
83095         (*env)->ReleaseLongArrayElements(env, intermediate_nodes, intermediate_nodes_vals, 0);
83096         LDKPublicKey payee_node_id_ref;
83097         CHECK((*env)->GetArrayLength(env, payee_node_id) == 33);
83098         (*env)->GetByteArrayRegion(env, payee_node_id, 0, 33, payee_node_id_ref.compressed_form);
83099         LDKReceiveTlvs payee_tlvs_conv;
83100         payee_tlvs_conv.inner = untag_ptr(payee_tlvs);
83101         payee_tlvs_conv.is_owned = ptr_is_owned(payee_tlvs);
83102         CHECK_INNER_FIELD_ACCESS_OR_NULL(payee_tlvs_conv);
83103         payee_tlvs_conv = ReceiveTlvs_clone(&payee_tlvs_conv);
83104         void* entropy_source_ptr = untag_ptr(entropy_source);
83105         CHECK_ACCESS(entropy_source_ptr);
83106         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
83107         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
83108                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
83109                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
83110         }
83111         LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ), "LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ");
83112         *ret_conv = BlindedPath_new_for_payment(intermediate_nodes_constr, payee_node_id_ref, payee_tlvs_conv, htlc_maximum_msat, min_final_cltv_expiry_delta, entropy_source_conv);
83113         return tag_ptr(ret_conv, true);
83114 }
83115
83116 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedPath_1public_1introduction_1node_1id(JNIEnv *env, jclass clz, int64_t this_arg, int64_t network_graph) {
83117         LDKBlindedPath this_arg_conv;
83118         this_arg_conv.inner = untag_ptr(this_arg);
83119         this_arg_conv.is_owned = ptr_is_owned(this_arg);
83120         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
83121         this_arg_conv.is_owned = false;
83122         LDKReadOnlyNetworkGraph network_graph_conv;
83123         network_graph_conv.inner = untag_ptr(network_graph);
83124         network_graph_conv.is_owned = ptr_is_owned(network_graph);
83125         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
83126         network_graph_conv.is_owned = false;
83127         LDKNodeId ret_var = BlindedPath_public_introduction_node_id(&this_arg_conv, &network_graph_conv);
83128         int64_t ret_ref = 0;
83129         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
83130         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
83131         return ret_ref;
83132 }
83133
83134 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BlindedPath_1write(JNIEnv *env, jclass clz, int64_t obj) {
83135         LDKBlindedPath obj_conv;
83136         obj_conv.inner = untag_ptr(obj);
83137         obj_conv.is_owned = ptr_is_owned(obj);
83138         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
83139         obj_conv.is_owned = false;
83140         LDKCVec_u8Z ret_var = BlindedPath_write(&obj_conv);
83141         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
83142         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
83143         CVec_u8Z_free(ret_var);
83144         return ret_arr;
83145 }
83146
83147 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedPath_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
83148         LDKu8slice ser_ref;
83149         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
83150         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
83151         LDKCResult_BlindedPathDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathDecodeErrorZ), "LDKCResult_BlindedPathDecodeErrorZ");
83152         *ret_conv = BlindedPath_read(ser_ref);
83153         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
83154         return tag_ptr(ret_conv, true);
83155 }
83156
83157 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BlindedHop_1write(JNIEnv *env, jclass clz, int64_t obj) {
83158         LDKBlindedHop obj_conv;
83159         obj_conv.inner = untag_ptr(obj);
83160         obj_conv.is_owned = ptr_is_owned(obj);
83161         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
83162         obj_conv.is_owned = false;
83163         LDKCVec_u8Z ret_var = BlindedHop_write(&obj_conv);
83164         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
83165         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
83166         CVec_u8Z_free(ret_var);
83167         return ret_arr;
83168 }
83169
83170 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedHop_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
83171         LDKu8slice ser_ref;
83172         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
83173         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
83174         LDKCResult_BlindedHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopDecodeErrorZ), "LDKCResult_BlindedHopDecodeErrorZ");
83175         *ret_conv = BlindedHop_read(ser_ref);
83176         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
83177         return tag_ptr(ret_conv, true);
83178 }
83179
83180 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ForwardNode_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
83181         LDKForwardNode this_obj_conv;
83182         this_obj_conv.inner = untag_ptr(this_obj);
83183         this_obj_conv.is_owned = ptr_is_owned(this_obj);
83184         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
83185         ForwardNode_free(this_obj_conv);
83186 }
83187
83188 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ForwardNode_1get_1tlvs(JNIEnv *env, jclass clz, int64_t this_ptr) {
83189         LDKForwardNode this_ptr_conv;
83190         this_ptr_conv.inner = untag_ptr(this_ptr);
83191         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
83192         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
83193         this_ptr_conv.is_owned = false;
83194         LDKForwardTlvs ret_var = ForwardNode_get_tlvs(&this_ptr_conv);
83195         int64_t ret_ref = 0;
83196         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
83197         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
83198         return ret_ref;
83199 }
83200
83201 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ForwardNode_1set_1tlvs(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
83202         LDKForwardNode this_ptr_conv;
83203         this_ptr_conv.inner = untag_ptr(this_ptr);
83204         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
83205         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
83206         this_ptr_conv.is_owned = false;
83207         LDKForwardTlvs val_conv;
83208         val_conv.inner = untag_ptr(val);
83209         val_conv.is_owned = ptr_is_owned(val);
83210         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
83211         val_conv = ForwardTlvs_clone(&val_conv);
83212         ForwardNode_set_tlvs(&this_ptr_conv, val_conv);
83213 }
83214
83215 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ForwardNode_1get_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
83216         LDKForwardNode this_ptr_conv;
83217         this_ptr_conv.inner = untag_ptr(this_ptr);
83218         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
83219         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
83220         this_ptr_conv.is_owned = false;
83221         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
83222         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ForwardNode_get_node_id(&this_ptr_conv).compressed_form);
83223         return ret_arr;
83224 }
83225
83226 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ForwardNode_1set_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
83227         LDKForwardNode this_ptr_conv;
83228         this_ptr_conv.inner = untag_ptr(this_ptr);
83229         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
83230         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
83231         this_ptr_conv.is_owned = false;
83232         LDKPublicKey val_ref;
83233         CHECK((*env)->GetArrayLength(env, val) == 33);
83234         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
83235         ForwardNode_set_node_id(&this_ptr_conv, val_ref);
83236 }
83237
83238 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ForwardNode_1get_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
83239         LDKForwardNode this_ptr_conv;
83240         this_ptr_conv.inner = untag_ptr(this_ptr);
83241         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
83242         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
83243         this_ptr_conv.is_owned = false;
83244         int64_t ret_conv = ForwardNode_get_htlc_maximum_msat(&this_ptr_conv);
83245         return ret_conv;
83246 }
83247
83248 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ForwardNode_1set_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
83249         LDKForwardNode this_ptr_conv;
83250         this_ptr_conv.inner = untag_ptr(this_ptr);
83251         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
83252         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
83253         this_ptr_conv.is_owned = false;
83254         ForwardNode_set_htlc_maximum_msat(&this_ptr_conv, val);
83255 }
83256
83257 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) {
83258         LDKForwardTlvs tlvs_arg_conv;
83259         tlvs_arg_conv.inner = untag_ptr(tlvs_arg);
83260         tlvs_arg_conv.is_owned = ptr_is_owned(tlvs_arg);
83261         CHECK_INNER_FIELD_ACCESS_OR_NULL(tlvs_arg_conv);
83262         tlvs_arg_conv = ForwardTlvs_clone(&tlvs_arg_conv);
83263         LDKPublicKey node_id_arg_ref;
83264         CHECK((*env)->GetArrayLength(env, node_id_arg) == 33);
83265         (*env)->GetByteArrayRegion(env, node_id_arg, 0, 33, node_id_arg_ref.compressed_form);
83266         LDKForwardNode ret_var = ForwardNode_new(tlvs_arg_conv, node_id_arg_ref, htlc_maximum_msat_arg);
83267         int64_t ret_ref = 0;
83268         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
83269         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
83270         return ret_ref;
83271 }
83272
83273 static inline uint64_t ForwardNode_clone_ptr(LDKForwardNode *NONNULL_PTR arg) {
83274         LDKForwardNode ret_var = ForwardNode_clone(arg);
83275         int64_t ret_ref = 0;
83276         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
83277         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
83278         return ret_ref;
83279 }
83280 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ForwardNode_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
83281         LDKForwardNode arg_conv;
83282         arg_conv.inner = untag_ptr(arg);
83283         arg_conv.is_owned = ptr_is_owned(arg);
83284         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
83285         arg_conv.is_owned = false;
83286         int64_t ret_conv = ForwardNode_clone_ptr(&arg_conv);
83287         return ret_conv;
83288 }
83289
83290 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ForwardNode_1clone(JNIEnv *env, jclass clz, int64_t orig) {
83291         LDKForwardNode orig_conv;
83292         orig_conv.inner = untag_ptr(orig);
83293         orig_conv.is_owned = ptr_is_owned(orig);
83294         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
83295         orig_conv.is_owned = false;
83296         LDKForwardNode ret_var = ForwardNode_clone(&orig_conv);
83297         int64_t ret_ref = 0;
83298         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
83299         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
83300         return ret_ref;
83301 }
83302
83303 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ForwardTlvs_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
83304         LDKForwardTlvs this_obj_conv;
83305         this_obj_conv.inner = untag_ptr(this_obj);
83306         this_obj_conv.is_owned = ptr_is_owned(this_obj);
83307         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
83308         ForwardTlvs_free(this_obj_conv);
83309 }
83310
83311 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ForwardTlvs_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
83312         LDKForwardTlvs this_ptr_conv;
83313         this_ptr_conv.inner = untag_ptr(this_ptr);
83314         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
83315         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
83316         this_ptr_conv.is_owned = false;
83317         int64_t ret_conv = ForwardTlvs_get_short_channel_id(&this_ptr_conv);
83318         return ret_conv;
83319 }
83320
83321 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ForwardTlvs_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
83322         LDKForwardTlvs this_ptr_conv;
83323         this_ptr_conv.inner = untag_ptr(this_ptr);
83324         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
83325         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
83326         this_ptr_conv.is_owned = false;
83327         ForwardTlvs_set_short_channel_id(&this_ptr_conv, val);
83328 }
83329
83330 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ForwardTlvs_1get_1payment_1relay(JNIEnv *env, jclass clz, int64_t this_ptr) {
83331         LDKForwardTlvs this_ptr_conv;
83332         this_ptr_conv.inner = untag_ptr(this_ptr);
83333         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
83334         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
83335         this_ptr_conv.is_owned = false;
83336         LDKPaymentRelay ret_var = ForwardTlvs_get_payment_relay(&this_ptr_conv);
83337         int64_t ret_ref = 0;
83338         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
83339         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
83340         return ret_ref;
83341 }
83342
83343 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ForwardTlvs_1set_1payment_1relay(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
83344         LDKForwardTlvs this_ptr_conv;
83345         this_ptr_conv.inner = untag_ptr(this_ptr);
83346         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
83347         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
83348         this_ptr_conv.is_owned = false;
83349         LDKPaymentRelay val_conv;
83350         val_conv.inner = untag_ptr(val);
83351         val_conv.is_owned = ptr_is_owned(val);
83352         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
83353         val_conv = PaymentRelay_clone(&val_conv);
83354         ForwardTlvs_set_payment_relay(&this_ptr_conv, val_conv);
83355 }
83356
83357 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ForwardTlvs_1get_1payment_1constraints(JNIEnv *env, jclass clz, int64_t this_ptr) {
83358         LDKForwardTlvs this_ptr_conv;
83359         this_ptr_conv.inner = untag_ptr(this_ptr);
83360         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
83361         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
83362         this_ptr_conv.is_owned = false;
83363         LDKPaymentConstraints ret_var = ForwardTlvs_get_payment_constraints(&this_ptr_conv);
83364         int64_t ret_ref = 0;
83365         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
83366         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
83367         return ret_ref;
83368 }
83369
83370 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ForwardTlvs_1set_1payment_1constraints(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
83371         LDKForwardTlvs this_ptr_conv;
83372         this_ptr_conv.inner = untag_ptr(this_ptr);
83373         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
83374         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
83375         this_ptr_conv.is_owned = false;
83376         LDKPaymentConstraints val_conv;
83377         val_conv.inner = untag_ptr(val);
83378         val_conv.is_owned = ptr_is_owned(val);
83379         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
83380         val_conv = PaymentConstraints_clone(&val_conv);
83381         ForwardTlvs_set_payment_constraints(&this_ptr_conv, val_conv);
83382 }
83383
83384 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ForwardTlvs_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
83385         LDKForwardTlvs this_ptr_conv;
83386         this_ptr_conv.inner = untag_ptr(this_ptr);
83387         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
83388         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
83389         this_ptr_conv.is_owned = false;
83390         LDKBlindedHopFeatures ret_var = ForwardTlvs_get_features(&this_ptr_conv);
83391         int64_t ret_ref = 0;
83392         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
83393         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
83394         return ret_ref;
83395 }
83396
83397 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ForwardTlvs_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
83398         LDKForwardTlvs this_ptr_conv;
83399         this_ptr_conv.inner = untag_ptr(this_ptr);
83400         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
83401         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
83402         this_ptr_conv.is_owned = false;
83403         LDKBlindedHopFeatures val_conv;
83404         val_conv.inner = untag_ptr(val);
83405         val_conv.is_owned = ptr_is_owned(val);
83406         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
83407         val_conv = BlindedHopFeatures_clone(&val_conv);
83408         ForwardTlvs_set_features(&this_ptr_conv, val_conv);
83409 }
83410
83411 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) {
83412         LDKPaymentRelay payment_relay_arg_conv;
83413         payment_relay_arg_conv.inner = untag_ptr(payment_relay_arg);
83414         payment_relay_arg_conv.is_owned = ptr_is_owned(payment_relay_arg);
83415         CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_relay_arg_conv);
83416         payment_relay_arg_conv = PaymentRelay_clone(&payment_relay_arg_conv);
83417         LDKPaymentConstraints payment_constraints_arg_conv;
83418         payment_constraints_arg_conv.inner = untag_ptr(payment_constraints_arg);
83419         payment_constraints_arg_conv.is_owned = ptr_is_owned(payment_constraints_arg);
83420         CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_constraints_arg_conv);
83421         payment_constraints_arg_conv = PaymentConstraints_clone(&payment_constraints_arg_conv);
83422         LDKBlindedHopFeatures features_arg_conv;
83423         features_arg_conv.inner = untag_ptr(features_arg);
83424         features_arg_conv.is_owned = ptr_is_owned(features_arg);
83425         CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
83426         features_arg_conv = BlindedHopFeatures_clone(&features_arg_conv);
83427         LDKForwardTlvs ret_var = ForwardTlvs_new(short_channel_id_arg, payment_relay_arg_conv, payment_constraints_arg_conv, features_arg_conv);
83428         int64_t ret_ref = 0;
83429         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
83430         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
83431         return ret_ref;
83432 }
83433
83434 static inline uint64_t ForwardTlvs_clone_ptr(LDKForwardTlvs *NONNULL_PTR arg) {
83435         LDKForwardTlvs ret_var = ForwardTlvs_clone(arg);
83436         int64_t ret_ref = 0;
83437         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
83438         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
83439         return ret_ref;
83440 }
83441 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ForwardTlvs_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
83442         LDKForwardTlvs arg_conv;
83443         arg_conv.inner = untag_ptr(arg);
83444         arg_conv.is_owned = ptr_is_owned(arg);
83445         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
83446         arg_conv.is_owned = false;
83447         int64_t ret_conv = ForwardTlvs_clone_ptr(&arg_conv);
83448         return ret_conv;
83449 }
83450
83451 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ForwardTlvs_1clone(JNIEnv *env, jclass clz, int64_t orig) {
83452         LDKForwardTlvs orig_conv;
83453         orig_conv.inner = untag_ptr(orig);
83454         orig_conv.is_owned = ptr_is_owned(orig);
83455         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
83456         orig_conv.is_owned = false;
83457         LDKForwardTlvs ret_var = ForwardTlvs_clone(&orig_conv);
83458         int64_t ret_ref = 0;
83459         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
83460         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
83461         return ret_ref;
83462 }
83463
83464 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReceiveTlvs_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
83465         LDKReceiveTlvs this_obj_conv;
83466         this_obj_conv.inner = untag_ptr(this_obj);
83467         this_obj_conv.is_owned = ptr_is_owned(this_obj);
83468         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
83469         ReceiveTlvs_free(this_obj_conv);
83470 }
83471
83472 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ReceiveTlvs_1get_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_ptr) {
83473         LDKReceiveTlvs this_ptr_conv;
83474         this_ptr_conv.inner = untag_ptr(this_ptr);
83475         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
83476         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
83477         this_ptr_conv.is_owned = false;
83478         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
83479         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ReceiveTlvs_get_payment_secret(&this_ptr_conv));
83480         return ret_arr;
83481 }
83482
83483 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReceiveTlvs_1set_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
83484         LDKReceiveTlvs this_ptr_conv;
83485         this_ptr_conv.inner = untag_ptr(this_ptr);
83486         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
83487         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
83488         this_ptr_conv.is_owned = false;
83489         LDKThirtyTwoBytes val_ref;
83490         CHECK((*env)->GetArrayLength(env, val) == 32);
83491         (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
83492         ReceiveTlvs_set_payment_secret(&this_ptr_conv, val_ref);
83493 }
83494
83495 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReceiveTlvs_1get_1payment_1constraints(JNIEnv *env, jclass clz, int64_t this_ptr) {
83496         LDKReceiveTlvs this_ptr_conv;
83497         this_ptr_conv.inner = untag_ptr(this_ptr);
83498         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
83499         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
83500         this_ptr_conv.is_owned = false;
83501         LDKPaymentConstraints ret_var = ReceiveTlvs_get_payment_constraints(&this_ptr_conv);
83502         int64_t ret_ref = 0;
83503         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
83504         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
83505         return ret_ref;
83506 }
83507
83508 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReceiveTlvs_1set_1payment_1constraints(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
83509         LDKReceiveTlvs this_ptr_conv;
83510         this_ptr_conv.inner = untag_ptr(this_ptr);
83511         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
83512         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
83513         this_ptr_conv.is_owned = false;
83514         LDKPaymentConstraints val_conv;
83515         val_conv.inner = untag_ptr(val);
83516         val_conv.is_owned = ptr_is_owned(val);
83517         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
83518         val_conv = PaymentConstraints_clone(&val_conv);
83519         ReceiveTlvs_set_payment_constraints(&this_ptr_conv, val_conv);
83520 }
83521
83522 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReceiveTlvs_1get_1payment_1context(JNIEnv *env, jclass clz, int64_t this_ptr) {
83523         LDKReceiveTlvs this_ptr_conv;
83524         this_ptr_conv.inner = untag_ptr(this_ptr);
83525         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
83526         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
83527         this_ptr_conv.is_owned = false;
83528         LDKPaymentContext *ret_copy = MALLOC(sizeof(LDKPaymentContext), "LDKPaymentContext");
83529         *ret_copy = ReceiveTlvs_get_payment_context(&this_ptr_conv);
83530         int64_t ret_ref = tag_ptr(ret_copy, true);
83531         return ret_ref;
83532 }
83533
83534 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReceiveTlvs_1set_1payment_1context(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
83535         LDKReceiveTlvs this_ptr_conv;
83536         this_ptr_conv.inner = untag_ptr(this_ptr);
83537         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
83538         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
83539         this_ptr_conv.is_owned = false;
83540         void* val_ptr = untag_ptr(val);
83541         CHECK_ACCESS(val_ptr);
83542         LDKPaymentContext val_conv = *(LDKPaymentContext*)(val_ptr);
83543         val_conv = PaymentContext_clone((LDKPaymentContext*)untag_ptr(val));
83544         ReceiveTlvs_set_payment_context(&this_ptr_conv, val_conv);
83545 }
83546
83547 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReceiveTlvs_1new(JNIEnv *env, jclass clz, int8_tArray payment_secret_arg, int64_t payment_constraints_arg, int64_t payment_context_arg) {
83548         LDKThirtyTwoBytes payment_secret_arg_ref;
83549         CHECK((*env)->GetArrayLength(env, payment_secret_arg) == 32);
83550         (*env)->GetByteArrayRegion(env, payment_secret_arg, 0, 32, payment_secret_arg_ref.data);
83551         LDKPaymentConstraints payment_constraints_arg_conv;
83552         payment_constraints_arg_conv.inner = untag_ptr(payment_constraints_arg);
83553         payment_constraints_arg_conv.is_owned = ptr_is_owned(payment_constraints_arg);
83554         CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_constraints_arg_conv);
83555         payment_constraints_arg_conv = PaymentConstraints_clone(&payment_constraints_arg_conv);
83556         void* payment_context_arg_ptr = untag_ptr(payment_context_arg);
83557         CHECK_ACCESS(payment_context_arg_ptr);
83558         LDKPaymentContext payment_context_arg_conv = *(LDKPaymentContext*)(payment_context_arg_ptr);
83559         payment_context_arg_conv = PaymentContext_clone((LDKPaymentContext*)untag_ptr(payment_context_arg));
83560         LDKReceiveTlvs ret_var = ReceiveTlvs_new(payment_secret_arg_ref, payment_constraints_arg_conv, payment_context_arg_conv);
83561         int64_t ret_ref = 0;
83562         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
83563         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
83564         return ret_ref;
83565 }
83566
83567 static inline uint64_t ReceiveTlvs_clone_ptr(LDKReceiveTlvs *NONNULL_PTR arg) {
83568         LDKReceiveTlvs ret_var = ReceiveTlvs_clone(arg);
83569         int64_t ret_ref = 0;
83570         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
83571         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
83572         return ret_ref;
83573 }
83574 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReceiveTlvs_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
83575         LDKReceiveTlvs arg_conv;
83576         arg_conv.inner = untag_ptr(arg);
83577         arg_conv.is_owned = ptr_is_owned(arg);
83578         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
83579         arg_conv.is_owned = false;
83580         int64_t ret_conv = ReceiveTlvs_clone_ptr(&arg_conv);
83581         return ret_conv;
83582 }
83583
83584 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReceiveTlvs_1clone(JNIEnv *env, jclass clz, int64_t orig) {
83585         LDKReceiveTlvs orig_conv;
83586         orig_conv.inner = untag_ptr(orig);
83587         orig_conv.is_owned = ptr_is_owned(orig);
83588         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
83589         orig_conv.is_owned = false;
83590         LDKReceiveTlvs ret_var = ReceiveTlvs_clone(&orig_conv);
83591         int64_t ret_ref = 0;
83592         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
83593         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
83594         return ret_ref;
83595 }
83596
83597 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentRelay_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
83598         LDKPaymentRelay this_obj_conv;
83599         this_obj_conv.inner = untag_ptr(this_obj);
83600         this_obj_conv.is_owned = ptr_is_owned(this_obj);
83601         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
83602         PaymentRelay_free(this_obj_conv);
83603 }
83604
83605 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_PaymentRelay_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
83606         LDKPaymentRelay this_ptr_conv;
83607         this_ptr_conv.inner = untag_ptr(this_ptr);
83608         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
83609         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
83610         this_ptr_conv.is_owned = false;
83611         int16_t ret_conv = PaymentRelay_get_cltv_expiry_delta(&this_ptr_conv);
83612         return ret_conv;
83613 }
83614
83615 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentRelay_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
83616         LDKPaymentRelay this_ptr_conv;
83617         this_ptr_conv.inner = untag_ptr(this_ptr);
83618         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
83619         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
83620         this_ptr_conv.is_owned = false;
83621         PaymentRelay_set_cltv_expiry_delta(&this_ptr_conv, val);
83622 }
83623
83624 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_PaymentRelay_1get_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr) {
83625         LDKPaymentRelay this_ptr_conv;
83626         this_ptr_conv.inner = untag_ptr(this_ptr);
83627         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
83628         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
83629         this_ptr_conv.is_owned = false;
83630         int32_t ret_conv = PaymentRelay_get_fee_proportional_millionths(&this_ptr_conv);
83631         return ret_conv;
83632 }
83633
83634 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentRelay_1set_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
83635         LDKPaymentRelay this_ptr_conv;
83636         this_ptr_conv.inner = untag_ptr(this_ptr);
83637         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
83638         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
83639         this_ptr_conv.is_owned = false;
83640         PaymentRelay_set_fee_proportional_millionths(&this_ptr_conv, val);
83641 }
83642
83643 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_PaymentRelay_1get_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
83644         LDKPaymentRelay this_ptr_conv;
83645         this_ptr_conv.inner = untag_ptr(this_ptr);
83646         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
83647         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
83648         this_ptr_conv.is_owned = false;
83649         int32_t ret_conv = PaymentRelay_get_fee_base_msat(&this_ptr_conv);
83650         return ret_conv;
83651 }
83652
83653 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentRelay_1set_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
83654         LDKPaymentRelay this_ptr_conv;
83655         this_ptr_conv.inner = untag_ptr(this_ptr);
83656         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
83657         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
83658         this_ptr_conv.is_owned = false;
83659         PaymentRelay_set_fee_base_msat(&this_ptr_conv, val);
83660 }
83661
83662 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) {
83663         LDKPaymentRelay ret_var = PaymentRelay_new(cltv_expiry_delta_arg, fee_proportional_millionths_arg, fee_base_msat_arg);
83664         int64_t ret_ref = 0;
83665         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
83666         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
83667         return ret_ref;
83668 }
83669
83670 static inline uint64_t PaymentRelay_clone_ptr(LDKPaymentRelay *NONNULL_PTR arg) {
83671         LDKPaymentRelay ret_var = PaymentRelay_clone(arg);
83672         int64_t ret_ref = 0;
83673         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
83674         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
83675         return ret_ref;
83676 }
83677 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentRelay_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
83678         LDKPaymentRelay arg_conv;
83679         arg_conv.inner = untag_ptr(arg);
83680         arg_conv.is_owned = ptr_is_owned(arg);
83681         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
83682         arg_conv.is_owned = false;
83683         int64_t ret_conv = PaymentRelay_clone_ptr(&arg_conv);
83684         return ret_conv;
83685 }
83686
83687 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentRelay_1clone(JNIEnv *env, jclass clz, int64_t orig) {
83688         LDKPaymentRelay orig_conv;
83689         orig_conv.inner = untag_ptr(orig);
83690         orig_conv.is_owned = ptr_is_owned(orig);
83691         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
83692         orig_conv.is_owned = false;
83693         LDKPaymentRelay ret_var = PaymentRelay_clone(&orig_conv);
83694         int64_t ret_ref = 0;
83695         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
83696         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
83697         return ret_ref;
83698 }
83699
83700 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentConstraints_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
83701         LDKPaymentConstraints this_obj_conv;
83702         this_obj_conv.inner = untag_ptr(this_obj);
83703         this_obj_conv.is_owned = ptr_is_owned(this_obj);
83704         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
83705         PaymentConstraints_free(this_obj_conv);
83706 }
83707
83708 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_PaymentConstraints_1get_1max_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_ptr) {
83709         LDKPaymentConstraints this_ptr_conv;
83710         this_ptr_conv.inner = untag_ptr(this_ptr);
83711         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
83712         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
83713         this_ptr_conv.is_owned = false;
83714         int32_t ret_conv = PaymentConstraints_get_max_cltv_expiry(&this_ptr_conv);
83715         return ret_conv;
83716 }
83717
83718 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentConstraints_1set_1max_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
83719         LDKPaymentConstraints this_ptr_conv;
83720         this_ptr_conv.inner = untag_ptr(this_ptr);
83721         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
83722         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
83723         this_ptr_conv.is_owned = false;
83724         PaymentConstraints_set_max_cltv_expiry(&this_ptr_conv, val);
83725 }
83726
83727 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentConstraints_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
83728         LDKPaymentConstraints this_ptr_conv;
83729         this_ptr_conv.inner = untag_ptr(this_ptr);
83730         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
83731         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
83732         this_ptr_conv.is_owned = false;
83733         int64_t ret_conv = PaymentConstraints_get_htlc_minimum_msat(&this_ptr_conv);
83734         return ret_conv;
83735 }
83736
83737 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentConstraints_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
83738         LDKPaymentConstraints this_ptr_conv;
83739         this_ptr_conv.inner = untag_ptr(this_ptr);
83740         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
83741         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
83742         this_ptr_conv.is_owned = false;
83743         PaymentConstraints_set_htlc_minimum_msat(&this_ptr_conv, val);
83744 }
83745
83746 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) {
83747         LDKPaymentConstraints ret_var = PaymentConstraints_new(max_cltv_expiry_arg, htlc_minimum_msat_arg);
83748         int64_t ret_ref = 0;
83749         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
83750         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
83751         return ret_ref;
83752 }
83753
83754 static inline uint64_t PaymentConstraints_clone_ptr(LDKPaymentConstraints *NONNULL_PTR arg) {
83755         LDKPaymentConstraints ret_var = PaymentConstraints_clone(arg);
83756         int64_t ret_ref = 0;
83757         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
83758         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
83759         return ret_ref;
83760 }
83761 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentConstraints_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
83762         LDKPaymentConstraints arg_conv;
83763         arg_conv.inner = untag_ptr(arg);
83764         arg_conv.is_owned = ptr_is_owned(arg);
83765         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
83766         arg_conv.is_owned = false;
83767         int64_t ret_conv = PaymentConstraints_clone_ptr(&arg_conv);
83768         return ret_conv;
83769 }
83770
83771 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentConstraints_1clone(JNIEnv *env, jclass clz, int64_t orig) {
83772         LDKPaymentConstraints orig_conv;
83773         orig_conv.inner = untag_ptr(orig);
83774         orig_conv.is_owned = ptr_is_owned(orig);
83775         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
83776         orig_conv.is_owned = false;
83777         LDKPaymentConstraints ret_var = PaymentConstraints_clone(&orig_conv);
83778         int64_t ret_ref = 0;
83779         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
83780         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
83781         return ret_ref;
83782 }
83783
83784 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentContext_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
83785         if (!ptr_is_owned(this_ptr)) return;
83786         void* this_ptr_ptr = untag_ptr(this_ptr);
83787         CHECK_ACCESS(this_ptr_ptr);
83788         LDKPaymentContext this_ptr_conv = *(LDKPaymentContext*)(this_ptr_ptr);
83789         FREE(untag_ptr(this_ptr));
83790         PaymentContext_free(this_ptr_conv);
83791 }
83792
83793 static inline uint64_t PaymentContext_clone_ptr(LDKPaymentContext *NONNULL_PTR arg) {
83794         LDKPaymentContext *ret_copy = MALLOC(sizeof(LDKPaymentContext), "LDKPaymentContext");
83795         *ret_copy = PaymentContext_clone(arg);
83796         int64_t ret_ref = tag_ptr(ret_copy, true);
83797         return ret_ref;
83798 }
83799 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentContext_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
83800         LDKPaymentContext* arg_conv = (LDKPaymentContext*)untag_ptr(arg);
83801         int64_t ret_conv = PaymentContext_clone_ptr(arg_conv);
83802         return ret_conv;
83803 }
83804
83805 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentContext_1clone(JNIEnv *env, jclass clz, int64_t orig) {
83806         LDKPaymentContext* orig_conv = (LDKPaymentContext*)untag_ptr(orig);
83807         LDKPaymentContext *ret_copy = MALLOC(sizeof(LDKPaymentContext), "LDKPaymentContext");
83808         *ret_copy = PaymentContext_clone(orig_conv);
83809         int64_t ret_ref = tag_ptr(ret_copy, true);
83810         return ret_ref;
83811 }
83812
83813 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentContext_1unknown(JNIEnv *env, jclass clz, int64_t a) {
83814         LDKUnknownPaymentContext a_conv;
83815         a_conv.inner = untag_ptr(a);
83816         a_conv.is_owned = ptr_is_owned(a);
83817         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
83818         a_conv = UnknownPaymentContext_clone(&a_conv);
83819         LDKPaymentContext *ret_copy = MALLOC(sizeof(LDKPaymentContext), "LDKPaymentContext");
83820         *ret_copy = PaymentContext_unknown(a_conv);
83821         int64_t ret_ref = tag_ptr(ret_copy, true);
83822         return ret_ref;
83823 }
83824
83825 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentContext_1bolt12_1offer(JNIEnv *env, jclass clz, int64_t a) {
83826         LDKBolt12OfferContext a_conv;
83827         a_conv.inner = untag_ptr(a);
83828         a_conv.is_owned = ptr_is_owned(a);
83829         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
83830         a_conv = Bolt12OfferContext_clone(&a_conv);
83831         LDKPaymentContext *ret_copy = MALLOC(sizeof(LDKPaymentContext), "LDKPaymentContext");
83832         *ret_copy = PaymentContext_bolt12_offer(a_conv);
83833         int64_t ret_ref = tag_ptr(ret_copy, true);
83834         return ret_ref;
83835 }
83836
83837 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentContext_1bolt12_1refund(JNIEnv *env, jclass clz, int64_t a) {
83838         LDKBolt12RefundContext a_conv;
83839         a_conv.inner = untag_ptr(a);
83840         a_conv.is_owned = ptr_is_owned(a);
83841         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
83842         a_conv = Bolt12RefundContext_clone(&a_conv);
83843         LDKPaymentContext *ret_copy = MALLOC(sizeof(LDKPaymentContext), "LDKPaymentContext");
83844         *ret_copy = PaymentContext_bolt12_refund(a_conv);
83845         int64_t ret_ref = tag_ptr(ret_copy, true);
83846         return ret_ref;
83847 }
83848
83849 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PaymentContext_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
83850         LDKPaymentContext* a_conv = (LDKPaymentContext*)untag_ptr(a);
83851         LDKPaymentContext* b_conv = (LDKPaymentContext*)untag_ptr(b);
83852         jboolean ret_conv = PaymentContext_eq(a_conv, b_conv);
83853         return ret_conv;
83854 }
83855
83856 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnknownPaymentContext_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
83857         LDKUnknownPaymentContext this_obj_conv;
83858         this_obj_conv.inner = untag_ptr(this_obj);
83859         this_obj_conv.is_owned = ptr_is_owned(this_obj);
83860         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
83861         UnknownPaymentContext_free(this_obj_conv);
83862 }
83863
83864 static inline uint64_t UnknownPaymentContext_clone_ptr(LDKUnknownPaymentContext *NONNULL_PTR arg) {
83865         LDKUnknownPaymentContext ret_var = UnknownPaymentContext_clone(arg);
83866         int64_t ret_ref = 0;
83867         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
83868         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
83869         return ret_ref;
83870 }
83871 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnknownPaymentContext_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
83872         LDKUnknownPaymentContext arg_conv;
83873         arg_conv.inner = untag_ptr(arg);
83874         arg_conv.is_owned = ptr_is_owned(arg);
83875         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
83876         arg_conv.is_owned = false;
83877         int64_t ret_conv = UnknownPaymentContext_clone_ptr(&arg_conv);
83878         return ret_conv;
83879 }
83880
83881 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnknownPaymentContext_1clone(JNIEnv *env, jclass clz, int64_t orig) {
83882         LDKUnknownPaymentContext orig_conv;
83883         orig_conv.inner = untag_ptr(orig);
83884         orig_conv.is_owned = ptr_is_owned(orig);
83885         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
83886         orig_conv.is_owned = false;
83887         LDKUnknownPaymentContext ret_var = UnknownPaymentContext_clone(&orig_conv);
83888         int64_t ret_ref = 0;
83889         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
83890         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
83891         return ret_ref;
83892 }
83893
83894 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_UnknownPaymentContext_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
83895         LDKUnknownPaymentContext a_conv;
83896         a_conv.inner = untag_ptr(a);
83897         a_conv.is_owned = ptr_is_owned(a);
83898         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
83899         a_conv.is_owned = false;
83900         LDKUnknownPaymentContext b_conv;
83901         b_conv.inner = untag_ptr(b);
83902         b_conv.is_owned = ptr_is_owned(b);
83903         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
83904         b_conv.is_owned = false;
83905         jboolean ret_conv = UnknownPaymentContext_eq(&a_conv, &b_conv);
83906         return ret_conv;
83907 }
83908
83909 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Bolt12OfferContext_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
83910         LDKBolt12OfferContext this_obj_conv;
83911         this_obj_conv.inner = untag_ptr(this_obj);
83912         this_obj_conv.is_owned = ptr_is_owned(this_obj);
83913         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
83914         Bolt12OfferContext_free(this_obj_conv);
83915 }
83916
83917 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12OfferContext_1get_1offer_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
83918         LDKBolt12OfferContext this_ptr_conv;
83919         this_ptr_conv.inner = untag_ptr(this_ptr);
83920         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
83921         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
83922         this_ptr_conv.is_owned = false;
83923         LDKOfferId ret_var = Bolt12OfferContext_get_offer_id(&this_ptr_conv);
83924         int64_t ret_ref = 0;
83925         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
83926         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
83927         return ret_ref;
83928 }
83929
83930 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Bolt12OfferContext_1set_1offer_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
83931         LDKBolt12OfferContext this_ptr_conv;
83932         this_ptr_conv.inner = untag_ptr(this_ptr);
83933         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
83934         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
83935         this_ptr_conv.is_owned = false;
83936         LDKOfferId val_conv;
83937         val_conv.inner = untag_ptr(val);
83938         val_conv.is_owned = ptr_is_owned(val);
83939         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
83940         val_conv = OfferId_clone(&val_conv);
83941         Bolt12OfferContext_set_offer_id(&this_ptr_conv, val_conv);
83942 }
83943
83944 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12OfferContext_1get_1invoice_1request(JNIEnv *env, jclass clz, int64_t this_ptr) {
83945         LDKBolt12OfferContext this_ptr_conv;
83946         this_ptr_conv.inner = untag_ptr(this_ptr);
83947         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
83948         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
83949         this_ptr_conv.is_owned = false;
83950         LDKInvoiceRequestFields ret_var = Bolt12OfferContext_get_invoice_request(&this_ptr_conv);
83951         int64_t ret_ref = 0;
83952         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
83953         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
83954         return ret_ref;
83955 }
83956
83957 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Bolt12OfferContext_1set_1invoice_1request(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
83958         LDKBolt12OfferContext this_ptr_conv;
83959         this_ptr_conv.inner = untag_ptr(this_ptr);
83960         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
83961         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
83962         this_ptr_conv.is_owned = false;
83963         LDKInvoiceRequestFields val_conv;
83964         val_conv.inner = untag_ptr(val);
83965         val_conv.is_owned = ptr_is_owned(val);
83966         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
83967         val_conv = InvoiceRequestFields_clone(&val_conv);
83968         Bolt12OfferContext_set_invoice_request(&this_ptr_conv, val_conv);
83969 }
83970
83971 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12OfferContext_1new(JNIEnv *env, jclass clz, int64_t offer_id_arg, int64_t invoice_request_arg) {
83972         LDKOfferId offer_id_arg_conv;
83973         offer_id_arg_conv.inner = untag_ptr(offer_id_arg);
83974         offer_id_arg_conv.is_owned = ptr_is_owned(offer_id_arg);
83975         CHECK_INNER_FIELD_ACCESS_OR_NULL(offer_id_arg_conv);
83976         offer_id_arg_conv = OfferId_clone(&offer_id_arg_conv);
83977         LDKInvoiceRequestFields invoice_request_arg_conv;
83978         invoice_request_arg_conv.inner = untag_ptr(invoice_request_arg);
83979         invoice_request_arg_conv.is_owned = ptr_is_owned(invoice_request_arg);
83980         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_request_arg_conv);
83981         invoice_request_arg_conv = InvoiceRequestFields_clone(&invoice_request_arg_conv);
83982         LDKBolt12OfferContext ret_var = Bolt12OfferContext_new(offer_id_arg_conv, invoice_request_arg_conv);
83983         int64_t ret_ref = 0;
83984         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
83985         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
83986         return ret_ref;
83987 }
83988
83989 static inline uint64_t Bolt12OfferContext_clone_ptr(LDKBolt12OfferContext *NONNULL_PTR arg) {
83990         LDKBolt12OfferContext ret_var = Bolt12OfferContext_clone(arg);
83991         int64_t ret_ref = 0;
83992         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
83993         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
83994         return ret_ref;
83995 }
83996 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12OfferContext_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
83997         LDKBolt12OfferContext arg_conv;
83998         arg_conv.inner = untag_ptr(arg);
83999         arg_conv.is_owned = ptr_is_owned(arg);
84000         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
84001         arg_conv.is_owned = false;
84002         int64_t ret_conv = Bolt12OfferContext_clone_ptr(&arg_conv);
84003         return ret_conv;
84004 }
84005
84006 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12OfferContext_1clone(JNIEnv *env, jclass clz, int64_t orig) {
84007         LDKBolt12OfferContext orig_conv;
84008         orig_conv.inner = untag_ptr(orig);
84009         orig_conv.is_owned = ptr_is_owned(orig);
84010         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
84011         orig_conv.is_owned = false;
84012         LDKBolt12OfferContext ret_var = Bolt12OfferContext_clone(&orig_conv);
84013         int64_t ret_ref = 0;
84014         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
84015         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
84016         return ret_ref;
84017 }
84018
84019 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt12OfferContext_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
84020         LDKBolt12OfferContext a_conv;
84021         a_conv.inner = untag_ptr(a);
84022         a_conv.is_owned = ptr_is_owned(a);
84023         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
84024         a_conv.is_owned = false;
84025         LDKBolt12OfferContext b_conv;
84026         b_conv.inner = untag_ptr(b);
84027         b_conv.is_owned = ptr_is_owned(b);
84028         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
84029         b_conv.is_owned = false;
84030         jboolean ret_conv = Bolt12OfferContext_eq(&a_conv, &b_conv);
84031         return ret_conv;
84032 }
84033
84034 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Bolt12RefundContext_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
84035         LDKBolt12RefundContext this_obj_conv;
84036         this_obj_conv.inner = untag_ptr(this_obj);
84037         this_obj_conv.is_owned = ptr_is_owned(this_obj);
84038         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
84039         Bolt12RefundContext_free(this_obj_conv);
84040 }
84041
84042 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12RefundContext_1new(JNIEnv *env, jclass clz) {
84043         LDKBolt12RefundContext ret_var = Bolt12RefundContext_new();
84044         int64_t ret_ref = 0;
84045         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
84046         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
84047         return ret_ref;
84048 }
84049
84050 static inline uint64_t Bolt12RefundContext_clone_ptr(LDKBolt12RefundContext *NONNULL_PTR arg) {
84051         LDKBolt12RefundContext ret_var = Bolt12RefundContext_clone(arg);
84052         int64_t ret_ref = 0;
84053         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
84054         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
84055         return ret_ref;
84056 }
84057 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12RefundContext_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
84058         LDKBolt12RefundContext arg_conv;
84059         arg_conv.inner = untag_ptr(arg);
84060         arg_conv.is_owned = ptr_is_owned(arg);
84061         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
84062         arg_conv.is_owned = false;
84063         int64_t ret_conv = Bolt12RefundContext_clone_ptr(&arg_conv);
84064         return ret_conv;
84065 }
84066
84067 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12RefundContext_1clone(JNIEnv *env, jclass clz, int64_t orig) {
84068         LDKBolt12RefundContext orig_conv;
84069         orig_conv.inner = untag_ptr(orig);
84070         orig_conv.is_owned = ptr_is_owned(orig);
84071         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
84072         orig_conv.is_owned = false;
84073         LDKBolt12RefundContext ret_var = Bolt12RefundContext_clone(&orig_conv);
84074         int64_t ret_ref = 0;
84075         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
84076         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
84077         return ret_ref;
84078 }
84079
84080 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt12RefundContext_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
84081         LDKBolt12RefundContext a_conv;
84082         a_conv.inner = untag_ptr(a);
84083         a_conv.is_owned = ptr_is_owned(a);
84084         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
84085         a_conv.is_owned = false;
84086         LDKBolt12RefundContext b_conv;
84087         b_conv.inner = untag_ptr(b);
84088         b_conv.is_owned = ptr_is_owned(b);
84089         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
84090         b_conv.is_owned = false;
84091         jboolean ret_conv = Bolt12RefundContext_eq(&a_conv, &b_conv);
84092         return ret_conv;
84093 }
84094
84095 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ForwardTlvs_1write(JNIEnv *env, jclass clz, int64_t obj) {
84096         LDKForwardTlvs obj_conv;
84097         obj_conv.inner = untag_ptr(obj);
84098         obj_conv.is_owned = ptr_is_owned(obj);
84099         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
84100         obj_conv.is_owned = false;
84101         LDKCVec_u8Z ret_var = ForwardTlvs_write(&obj_conv);
84102         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
84103         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
84104         CVec_u8Z_free(ret_var);
84105         return ret_arr;
84106 }
84107
84108 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ReceiveTlvs_1write(JNIEnv *env, jclass clz, int64_t obj) {
84109         LDKReceiveTlvs obj_conv;
84110         obj_conv.inner = untag_ptr(obj);
84111         obj_conv.is_owned = ptr_is_owned(obj);
84112         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
84113         obj_conv.is_owned = false;
84114         LDKCVec_u8Z ret_var = ReceiveTlvs_write(&obj_conv);
84115         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
84116         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
84117         CVec_u8Z_free(ret_var);
84118         return ret_arr;
84119 }
84120
84121 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_PaymentRelay_1write(JNIEnv *env, jclass clz, int64_t obj) {
84122         LDKPaymentRelay obj_conv;
84123         obj_conv.inner = untag_ptr(obj);
84124         obj_conv.is_owned = ptr_is_owned(obj);
84125         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
84126         obj_conv.is_owned = false;
84127         LDKCVec_u8Z ret_var = PaymentRelay_write(&obj_conv);
84128         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
84129         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
84130         CVec_u8Z_free(ret_var);
84131         return ret_arr;
84132 }
84133
84134 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentRelay_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
84135         LDKu8slice ser_ref;
84136         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
84137         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
84138         LDKCResult_PaymentRelayDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentRelayDecodeErrorZ), "LDKCResult_PaymentRelayDecodeErrorZ");
84139         *ret_conv = PaymentRelay_read(ser_ref);
84140         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
84141         return tag_ptr(ret_conv, true);
84142 }
84143
84144 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_PaymentConstraints_1write(JNIEnv *env, jclass clz, int64_t obj) {
84145         LDKPaymentConstraints obj_conv;
84146         obj_conv.inner = untag_ptr(obj);
84147         obj_conv.is_owned = ptr_is_owned(obj);
84148         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
84149         obj_conv.is_owned = false;
84150         LDKCVec_u8Z ret_var = PaymentConstraints_write(&obj_conv);
84151         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
84152         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
84153         CVec_u8Z_free(ret_var);
84154         return ret_arr;
84155 }
84156
84157 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentConstraints_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
84158         LDKu8slice ser_ref;
84159         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
84160         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
84161         LDKCResult_PaymentConstraintsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentConstraintsDecodeErrorZ), "LDKCResult_PaymentConstraintsDecodeErrorZ");
84162         *ret_conv = PaymentConstraints_read(ser_ref);
84163         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
84164         return tag_ptr(ret_conv, true);
84165 }
84166
84167 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_PaymentContext_1write(JNIEnv *env, jclass clz, int64_t obj) {
84168         LDKPaymentContext* obj_conv = (LDKPaymentContext*)untag_ptr(obj);
84169         LDKCVec_u8Z ret_var = PaymentContext_write(obj_conv);
84170         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
84171         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
84172         CVec_u8Z_free(ret_var);
84173         return ret_arr;
84174 }
84175
84176 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentContext_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
84177         LDKu8slice ser_ref;
84178         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
84179         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
84180         LDKCResult_PaymentContextDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentContextDecodeErrorZ), "LDKCResult_PaymentContextDecodeErrorZ");
84181         *ret_conv = PaymentContext_read(ser_ref);
84182         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
84183         return tag_ptr(ret_conv, true);
84184 }
84185
84186 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnknownPaymentContext_1write(JNIEnv *env, jclass clz, int64_t obj) {
84187         LDKUnknownPaymentContext obj_conv;
84188         obj_conv.inner = untag_ptr(obj);
84189         obj_conv.is_owned = ptr_is_owned(obj);
84190         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
84191         obj_conv.is_owned = false;
84192         LDKCVec_u8Z ret_var = UnknownPaymentContext_write(&obj_conv);
84193         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
84194         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
84195         CVec_u8Z_free(ret_var);
84196         return ret_arr;
84197 }
84198
84199 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnknownPaymentContext_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
84200         LDKu8slice ser_ref;
84201         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
84202         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
84203         LDKCResult_UnknownPaymentContextDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnknownPaymentContextDecodeErrorZ), "LDKCResult_UnknownPaymentContextDecodeErrorZ");
84204         *ret_conv = UnknownPaymentContext_read(ser_ref);
84205         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
84206         return tag_ptr(ret_conv, true);
84207 }
84208
84209 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Bolt12OfferContext_1write(JNIEnv *env, jclass clz, int64_t obj) {
84210         LDKBolt12OfferContext obj_conv;
84211         obj_conv.inner = untag_ptr(obj);
84212         obj_conv.is_owned = ptr_is_owned(obj);
84213         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
84214         obj_conv.is_owned = false;
84215         LDKCVec_u8Z ret_var = Bolt12OfferContext_write(&obj_conv);
84216         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
84217         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
84218         CVec_u8Z_free(ret_var);
84219         return ret_arr;
84220 }
84221
84222 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12OfferContext_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
84223         LDKu8slice ser_ref;
84224         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
84225         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
84226         LDKCResult_Bolt12OfferContextDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt12OfferContextDecodeErrorZ), "LDKCResult_Bolt12OfferContextDecodeErrorZ");
84227         *ret_conv = Bolt12OfferContext_read(ser_ref);
84228         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
84229         return tag_ptr(ret_conv, true);
84230 }
84231
84232 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Bolt12RefundContext_1write(JNIEnv *env, jclass clz, int64_t obj) {
84233         LDKBolt12RefundContext obj_conv;
84234         obj_conv.inner = untag_ptr(obj);
84235         obj_conv.is_owned = ptr_is_owned(obj);
84236         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
84237         obj_conv.is_owned = false;
84238         LDKCVec_u8Z ret_var = Bolt12RefundContext_write(&obj_conv);
84239         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
84240         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
84241         CVec_u8Z_free(ret_var);
84242         return ret_arr;
84243 }
84244
84245 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt12RefundContext_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
84246         LDKu8slice ser_ref;
84247         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
84248         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
84249         LDKCResult_Bolt12RefundContextDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt12RefundContextDecodeErrorZ), "LDKCResult_Bolt12RefundContextDecodeErrorZ");
84250         *ret_conv = Bolt12RefundContext_read(ser_ref);
84251         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
84252         return tag_ptr(ret_conv, true);
84253 }
84254
84255 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
84256         if (!ptr_is_owned(this_ptr)) return;
84257         void* this_ptr_ptr = untag_ptr(this_ptr);
84258         CHECK_ACCESS(this_ptr_ptr);
84259         LDKPaymentPurpose this_ptr_conv = *(LDKPaymentPurpose*)(this_ptr_ptr);
84260         FREE(untag_ptr(this_ptr));
84261         PaymentPurpose_free(this_ptr_conv);
84262 }
84263
84264 static inline uint64_t PaymentPurpose_clone_ptr(LDKPaymentPurpose *NONNULL_PTR arg) {
84265         LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
84266         *ret_copy = PaymentPurpose_clone(arg);
84267         int64_t ret_ref = tag_ptr(ret_copy, true);
84268         return ret_ref;
84269 }
84270 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
84271         LDKPaymentPurpose* arg_conv = (LDKPaymentPurpose*)untag_ptr(arg);
84272         int64_t ret_conv = PaymentPurpose_clone_ptr(arg_conv);
84273         return ret_conv;
84274 }
84275
84276 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1clone(JNIEnv *env, jclass clz, int64_t orig) {
84277         LDKPaymentPurpose* orig_conv = (LDKPaymentPurpose*)untag_ptr(orig);
84278         LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
84279         *ret_copy = PaymentPurpose_clone(orig_conv);
84280         int64_t ret_ref = tag_ptr(ret_copy, true);
84281         return ret_ref;
84282 }
84283
84284 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1bolt11_1invoice_1payment(JNIEnv *env, jclass clz, int64_t payment_preimage, int8_tArray payment_secret) {
84285         void* payment_preimage_ptr = untag_ptr(payment_preimage);
84286         CHECK_ACCESS(payment_preimage_ptr);
84287         LDKCOption_ThirtyTwoBytesZ payment_preimage_conv = *(LDKCOption_ThirtyTwoBytesZ*)(payment_preimage_ptr);
84288         payment_preimage_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(payment_preimage));
84289         LDKThirtyTwoBytes payment_secret_ref;
84290         CHECK((*env)->GetArrayLength(env, payment_secret) == 32);
84291         (*env)->GetByteArrayRegion(env, payment_secret, 0, 32, payment_secret_ref.data);
84292         LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
84293         *ret_copy = PaymentPurpose_bolt11_invoice_payment(payment_preimage_conv, payment_secret_ref);
84294         int64_t ret_ref = tag_ptr(ret_copy, true);
84295         return ret_ref;
84296 }
84297
84298 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1bolt12_1offer_1payment(JNIEnv *env, jclass clz, int64_t payment_preimage, int8_tArray payment_secret, int64_t payment_context) {
84299         void* payment_preimage_ptr = untag_ptr(payment_preimage);
84300         CHECK_ACCESS(payment_preimage_ptr);
84301         LDKCOption_ThirtyTwoBytesZ payment_preimage_conv = *(LDKCOption_ThirtyTwoBytesZ*)(payment_preimage_ptr);
84302         payment_preimage_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(payment_preimage));
84303         LDKThirtyTwoBytes payment_secret_ref;
84304         CHECK((*env)->GetArrayLength(env, payment_secret) == 32);
84305         (*env)->GetByteArrayRegion(env, payment_secret, 0, 32, payment_secret_ref.data);
84306         LDKBolt12OfferContext payment_context_conv;
84307         payment_context_conv.inner = untag_ptr(payment_context);
84308         payment_context_conv.is_owned = ptr_is_owned(payment_context);
84309         CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_context_conv);
84310         payment_context_conv = Bolt12OfferContext_clone(&payment_context_conv);
84311         LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
84312         *ret_copy = PaymentPurpose_bolt12_offer_payment(payment_preimage_conv, payment_secret_ref, payment_context_conv);
84313         int64_t ret_ref = tag_ptr(ret_copy, true);
84314         return ret_ref;
84315 }
84316
84317 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1bolt12_1refund_1payment(JNIEnv *env, jclass clz, int64_t payment_preimage, int8_tArray payment_secret, int64_t payment_context) {
84318         void* payment_preimage_ptr = untag_ptr(payment_preimage);
84319         CHECK_ACCESS(payment_preimage_ptr);
84320         LDKCOption_ThirtyTwoBytesZ payment_preimage_conv = *(LDKCOption_ThirtyTwoBytesZ*)(payment_preimage_ptr);
84321         payment_preimage_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(payment_preimage));
84322         LDKThirtyTwoBytes payment_secret_ref;
84323         CHECK((*env)->GetArrayLength(env, payment_secret) == 32);
84324         (*env)->GetByteArrayRegion(env, payment_secret, 0, 32, payment_secret_ref.data);
84325         LDKBolt12RefundContext payment_context_conv;
84326         payment_context_conv.inner = untag_ptr(payment_context);
84327         payment_context_conv.is_owned = ptr_is_owned(payment_context);
84328         CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_context_conv);
84329         payment_context_conv = Bolt12RefundContext_clone(&payment_context_conv);
84330         LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
84331         *ret_copy = PaymentPurpose_bolt12_refund_payment(payment_preimage_conv, payment_secret_ref, payment_context_conv);
84332         int64_t ret_ref = tag_ptr(ret_copy, true);
84333         return ret_ref;
84334 }
84335
84336 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1spontaneous_1payment(JNIEnv *env, jclass clz, int8_tArray a) {
84337         LDKThirtyTwoBytes a_ref;
84338         CHECK((*env)->GetArrayLength(env, a) == 32);
84339         (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
84340         LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
84341         *ret_copy = PaymentPurpose_spontaneous_payment(a_ref);
84342         int64_t ret_ref = tag_ptr(ret_copy, true);
84343         return ret_ref;
84344 }
84345
84346 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
84347         LDKPaymentPurpose* a_conv = (LDKPaymentPurpose*)untag_ptr(a);
84348         LDKPaymentPurpose* b_conv = (LDKPaymentPurpose*)untag_ptr(b);
84349         jboolean ret_conv = PaymentPurpose_eq(a_conv, b_conv);
84350         return ret_conv;
84351 }
84352
84353 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1preimage(JNIEnv *env, jclass clz, int64_t this_arg) {
84354         LDKPaymentPurpose* this_arg_conv = (LDKPaymentPurpose*)untag_ptr(this_arg);
84355         LDKCOption_ThirtyTwoBytesZ *ret_copy = MALLOC(sizeof(LDKCOption_ThirtyTwoBytesZ), "LDKCOption_ThirtyTwoBytesZ");
84356         *ret_copy = PaymentPurpose_preimage(this_arg_conv);
84357         int64_t ret_ref = tag_ptr(ret_copy, true);
84358         return ret_ref;
84359 }
84360
84361 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1write(JNIEnv *env, jclass clz, int64_t obj) {
84362         LDKPaymentPurpose* obj_conv = (LDKPaymentPurpose*)untag_ptr(obj);
84363         LDKCVec_u8Z ret_var = PaymentPurpose_write(obj_conv);
84364         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
84365         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
84366         CVec_u8Z_free(ret_var);
84367         return ret_arr;
84368 }
84369
84370 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
84371         LDKu8slice ser_ref;
84372         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
84373         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
84374         LDKCResult_PaymentPurposeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPurposeDecodeErrorZ), "LDKCResult_PaymentPurposeDecodeErrorZ");
84375         *ret_conv = PaymentPurpose_read(ser_ref);
84376         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
84377         return tag_ptr(ret_conv, true);
84378 }
84379
84380 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClaimedHTLC_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
84381         LDKClaimedHTLC this_obj_conv;
84382         this_obj_conv.inner = untag_ptr(this_obj);
84383         this_obj_conv.is_owned = ptr_is_owned(this_obj);
84384         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
84385         ClaimedHTLC_free(this_obj_conv);
84386 }
84387
84388 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClaimedHTLC_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
84389         LDKClaimedHTLC this_ptr_conv;
84390         this_ptr_conv.inner = untag_ptr(this_ptr);
84391         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
84392         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
84393         this_ptr_conv.is_owned = false;
84394         LDKChannelId ret_var = ClaimedHTLC_get_channel_id(&this_ptr_conv);
84395         int64_t ret_ref = 0;
84396         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
84397         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
84398         return ret_ref;
84399 }
84400
84401 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClaimedHTLC_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
84402         LDKClaimedHTLC this_ptr_conv;
84403         this_ptr_conv.inner = untag_ptr(this_ptr);
84404         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
84405         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
84406         this_ptr_conv.is_owned = false;
84407         LDKChannelId val_conv;
84408         val_conv.inner = untag_ptr(val);
84409         val_conv.is_owned = ptr_is_owned(val);
84410         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
84411         val_conv = ChannelId_clone(&val_conv);
84412         ClaimedHTLC_set_channel_id(&this_ptr_conv, val_conv);
84413 }
84414
84415 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClaimedHTLC_1get_1user_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
84416         LDKClaimedHTLC this_ptr_conv;
84417         this_ptr_conv.inner = untag_ptr(this_ptr);
84418         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
84419         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
84420         this_ptr_conv.is_owned = false;
84421         int8_tArray ret_arr = (*env)->NewByteArray(env, 16);
84422         (*env)->SetByteArrayRegion(env, ret_arr, 0, 16, ClaimedHTLC_get_user_channel_id(&this_ptr_conv).le_bytes);
84423         return ret_arr;
84424 }
84425
84426 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClaimedHTLC_1set_1user_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
84427         LDKClaimedHTLC this_ptr_conv;
84428         this_ptr_conv.inner = untag_ptr(this_ptr);
84429         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
84430         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
84431         this_ptr_conv.is_owned = false;
84432         LDKU128 val_ref;
84433         CHECK((*env)->GetArrayLength(env, val) == 16);
84434         (*env)->GetByteArrayRegion(env, val, 0, 16, val_ref.le_bytes);
84435         ClaimedHTLC_set_user_channel_id(&this_ptr_conv, val_ref);
84436 }
84437
84438 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ClaimedHTLC_1get_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_ptr) {
84439         LDKClaimedHTLC this_ptr_conv;
84440         this_ptr_conv.inner = untag_ptr(this_ptr);
84441         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
84442         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
84443         this_ptr_conv.is_owned = false;
84444         int32_t ret_conv = ClaimedHTLC_get_cltv_expiry(&this_ptr_conv);
84445         return ret_conv;
84446 }
84447
84448 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClaimedHTLC_1set_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
84449         LDKClaimedHTLC this_ptr_conv;
84450         this_ptr_conv.inner = untag_ptr(this_ptr);
84451         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
84452         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
84453         this_ptr_conv.is_owned = false;
84454         ClaimedHTLC_set_cltv_expiry(&this_ptr_conv, val);
84455 }
84456
84457 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClaimedHTLC_1get_1value_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
84458         LDKClaimedHTLC this_ptr_conv;
84459         this_ptr_conv.inner = untag_ptr(this_ptr);
84460         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
84461         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
84462         this_ptr_conv.is_owned = false;
84463         int64_t ret_conv = ClaimedHTLC_get_value_msat(&this_ptr_conv);
84464         return ret_conv;
84465 }
84466
84467 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClaimedHTLC_1set_1value_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
84468         LDKClaimedHTLC this_ptr_conv;
84469         this_ptr_conv.inner = untag_ptr(this_ptr);
84470         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
84471         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
84472         this_ptr_conv.is_owned = false;
84473         ClaimedHTLC_set_value_msat(&this_ptr_conv, val);
84474 }
84475
84476 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClaimedHTLC_1get_1counterparty_1skimmed_1fee_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
84477         LDKClaimedHTLC this_ptr_conv;
84478         this_ptr_conv.inner = untag_ptr(this_ptr);
84479         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
84480         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
84481         this_ptr_conv.is_owned = false;
84482         int64_t ret_conv = ClaimedHTLC_get_counterparty_skimmed_fee_msat(&this_ptr_conv);
84483         return ret_conv;
84484 }
84485
84486 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) {
84487         LDKClaimedHTLC this_ptr_conv;
84488         this_ptr_conv.inner = untag_ptr(this_ptr);
84489         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
84490         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
84491         this_ptr_conv.is_owned = false;
84492         ClaimedHTLC_set_counterparty_skimmed_fee_msat(&this_ptr_conv, val);
84493 }
84494
84495 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClaimedHTLC_1new(JNIEnv *env, jclass clz, int64_t channel_id_arg, int8_tArray user_channel_id_arg, int32_t cltv_expiry_arg, int64_t value_msat_arg, int64_t counterparty_skimmed_fee_msat_arg) {
84496         LDKChannelId channel_id_arg_conv;
84497         channel_id_arg_conv.inner = untag_ptr(channel_id_arg);
84498         channel_id_arg_conv.is_owned = ptr_is_owned(channel_id_arg);
84499         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_arg_conv);
84500         channel_id_arg_conv = ChannelId_clone(&channel_id_arg_conv);
84501         LDKU128 user_channel_id_arg_ref;
84502         CHECK((*env)->GetArrayLength(env, user_channel_id_arg) == 16);
84503         (*env)->GetByteArrayRegion(env, user_channel_id_arg, 0, 16, user_channel_id_arg_ref.le_bytes);
84504         LDKClaimedHTLC ret_var = ClaimedHTLC_new(channel_id_arg_conv, user_channel_id_arg_ref, cltv_expiry_arg, value_msat_arg, counterparty_skimmed_fee_msat_arg);
84505         int64_t ret_ref = 0;
84506         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
84507         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
84508         return ret_ref;
84509 }
84510
84511 static inline uint64_t ClaimedHTLC_clone_ptr(LDKClaimedHTLC *NONNULL_PTR arg) {
84512         LDKClaimedHTLC ret_var = ClaimedHTLC_clone(arg);
84513         int64_t ret_ref = 0;
84514         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
84515         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
84516         return ret_ref;
84517 }
84518 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClaimedHTLC_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
84519         LDKClaimedHTLC arg_conv;
84520         arg_conv.inner = untag_ptr(arg);
84521         arg_conv.is_owned = ptr_is_owned(arg);
84522         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
84523         arg_conv.is_owned = false;
84524         int64_t ret_conv = ClaimedHTLC_clone_ptr(&arg_conv);
84525         return ret_conv;
84526 }
84527
84528 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClaimedHTLC_1clone(JNIEnv *env, jclass clz, int64_t orig) {
84529         LDKClaimedHTLC orig_conv;
84530         orig_conv.inner = untag_ptr(orig);
84531         orig_conv.is_owned = ptr_is_owned(orig);
84532         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
84533         orig_conv.is_owned = false;
84534         LDKClaimedHTLC ret_var = ClaimedHTLC_clone(&orig_conv);
84535         int64_t ret_ref = 0;
84536         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
84537         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
84538         return ret_ref;
84539 }
84540
84541 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ClaimedHTLC_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
84542         LDKClaimedHTLC a_conv;
84543         a_conv.inner = untag_ptr(a);
84544         a_conv.is_owned = ptr_is_owned(a);
84545         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
84546         a_conv.is_owned = false;
84547         LDKClaimedHTLC b_conv;
84548         b_conv.inner = untag_ptr(b);
84549         b_conv.is_owned = ptr_is_owned(b);
84550         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
84551         b_conv.is_owned = false;
84552         jboolean ret_conv = ClaimedHTLC_eq(&a_conv, &b_conv);
84553         return ret_conv;
84554 }
84555
84556 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClaimedHTLC_1write(JNIEnv *env, jclass clz, int64_t obj) {
84557         LDKClaimedHTLC obj_conv;
84558         obj_conv.inner = untag_ptr(obj);
84559         obj_conv.is_owned = ptr_is_owned(obj);
84560         CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
84561         obj_conv.is_owned = false;
84562         LDKCVec_u8Z ret_var = ClaimedHTLC_write(&obj_conv);
84563         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
84564         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
84565         CVec_u8Z_free(ret_var);
84566         return ret_arr;
84567 }
84568
84569 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClaimedHTLC_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
84570         LDKu8slice ser_ref;
84571         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
84572         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
84573         LDKCResult_ClaimedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClaimedHTLCDecodeErrorZ), "LDKCResult_ClaimedHTLCDecodeErrorZ");
84574         *ret_conv = ClaimedHTLC_read(ser_ref);
84575         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
84576         return tag_ptr(ret_conv, true);
84577 }
84578
84579 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PathFailure_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
84580         if (!ptr_is_owned(this_ptr)) return;
84581         void* this_ptr_ptr = untag_ptr(this_ptr);
84582         CHECK_ACCESS(this_ptr_ptr);
84583         LDKPathFailure this_ptr_conv = *(LDKPathFailure*)(this_ptr_ptr);
84584         FREE(untag_ptr(this_ptr));
84585         PathFailure_free(this_ptr_conv);
84586 }
84587
84588 static inline uint64_t PathFailure_clone_ptr(LDKPathFailure *NONNULL_PTR arg) {
84589         LDKPathFailure *ret_copy = MALLOC(sizeof(LDKPathFailure), "LDKPathFailure");
84590         *ret_copy = PathFailure_clone(arg);
84591         int64_t ret_ref = tag_ptr(ret_copy, true);
84592         return ret_ref;
84593 }
84594 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PathFailure_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
84595         LDKPathFailure* arg_conv = (LDKPathFailure*)untag_ptr(arg);
84596         int64_t ret_conv = PathFailure_clone_ptr(arg_conv);
84597         return ret_conv;
84598 }
84599
84600 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PathFailure_1clone(JNIEnv *env, jclass clz, int64_t orig) {
84601         LDKPathFailure* orig_conv = (LDKPathFailure*)untag_ptr(orig);
84602         LDKPathFailure *ret_copy = MALLOC(sizeof(LDKPathFailure), "LDKPathFailure");
84603         *ret_copy = PathFailure_clone(orig_conv);
84604         int64_t ret_ref = tag_ptr(ret_copy, true);
84605         return ret_ref;
84606 }
84607
84608 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PathFailure_1initial_1send(JNIEnv *env, jclass clz, int64_t err) {
84609         void* err_ptr = untag_ptr(err);
84610         CHECK_ACCESS(err_ptr);
84611         LDKAPIError err_conv = *(LDKAPIError*)(err_ptr);
84612         err_conv = APIError_clone((LDKAPIError*)untag_ptr(err));
84613         LDKPathFailure *ret_copy = MALLOC(sizeof(LDKPathFailure), "LDKPathFailure");
84614         *ret_copy = PathFailure_initial_send(err_conv);
84615         int64_t ret_ref = tag_ptr(ret_copy, true);
84616         return ret_ref;
84617 }
84618
84619 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PathFailure_1on_1path(JNIEnv *env, jclass clz, int64_t network_update) {
84620         void* network_update_ptr = untag_ptr(network_update);
84621         CHECK_ACCESS(network_update_ptr);
84622         LDKCOption_NetworkUpdateZ network_update_conv = *(LDKCOption_NetworkUpdateZ*)(network_update_ptr);
84623         network_update_conv = COption_NetworkUpdateZ_clone((LDKCOption_NetworkUpdateZ*)untag_ptr(network_update));
84624         LDKPathFailure *ret_copy = MALLOC(sizeof(LDKPathFailure), "LDKPathFailure");
84625         *ret_copy = PathFailure_on_path(network_update_conv);
84626         int64_t ret_ref = tag_ptr(ret_copy, true);
84627         return ret_ref;
84628 }
84629
84630 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PathFailure_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
84631         LDKPathFailure* a_conv = (LDKPathFailure*)untag_ptr(a);
84632         LDKPathFailure* b_conv = (LDKPathFailure*)untag_ptr(b);
84633         jboolean ret_conv = PathFailure_eq(a_conv, b_conv);
84634         return ret_conv;
84635 }
84636
84637 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_PathFailure_1write(JNIEnv *env, jclass clz, int64_t obj) {
84638         LDKPathFailure* obj_conv = (LDKPathFailure*)untag_ptr(obj);
84639         LDKCVec_u8Z ret_var = PathFailure_write(obj_conv);
84640         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
84641         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
84642         CVec_u8Z_free(ret_var);
84643         return ret_arr;
84644 }
84645
84646 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PathFailure_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
84647         LDKu8slice ser_ref;
84648         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
84649         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
84650         LDKCResult_COption_PathFailureZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_PathFailureZDecodeErrorZ), "LDKCResult_COption_PathFailureZDecodeErrorZ");
84651         *ret_conv = PathFailure_read(ser_ref);
84652         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
84653         return tag_ptr(ret_conv, true);
84654 }
84655
84656 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosureReason_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
84657         if (!ptr_is_owned(this_ptr)) return;
84658         void* this_ptr_ptr = untag_ptr(this_ptr);
84659         CHECK_ACCESS(this_ptr_ptr);
84660         LDKClosureReason this_ptr_conv = *(LDKClosureReason*)(this_ptr_ptr);
84661         FREE(untag_ptr(this_ptr));
84662         ClosureReason_free(this_ptr_conv);
84663 }
84664
84665 static inline uint64_t ClosureReason_clone_ptr(LDKClosureReason *NONNULL_PTR arg) {
84666         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
84667         *ret_copy = ClosureReason_clone(arg);
84668         int64_t ret_ref = tag_ptr(ret_copy, true);
84669         return ret_ref;
84670 }
84671 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
84672         LDKClosureReason* arg_conv = (LDKClosureReason*)untag_ptr(arg);
84673         int64_t ret_conv = ClosureReason_clone_ptr(arg_conv);
84674         return ret_conv;
84675 }
84676
84677 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1clone(JNIEnv *env, jclass clz, int64_t orig) {
84678         LDKClosureReason* orig_conv = (LDKClosureReason*)untag_ptr(orig);
84679         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
84680         *ret_copy = ClosureReason_clone(orig_conv);
84681         int64_t ret_ref = tag_ptr(ret_copy, true);
84682         return ret_ref;
84683 }
84684
84685 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1counterparty_1force_1closed(JNIEnv *env, jclass clz, int64_t peer_msg) {
84686         LDKUntrustedString peer_msg_conv;
84687         peer_msg_conv.inner = untag_ptr(peer_msg);
84688         peer_msg_conv.is_owned = ptr_is_owned(peer_msg);
84689         CHECK_INNER_FIELD_ACCESS_OR_NULL(peer_msg_conv);
84690         peer_msg_conv = UntrustedString_clone(&peer_msg_conv);
84691         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
84692         *ret_copy = ClosureReason_counterparty_force_closed(peer_msg_conv);
84693         int64_t ret_ref = tag_ptr(ret_copy, true);
84694         return ret_ref;
84695 }
84696
84697 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1holder_1force_1closed(JNIEnv *env, jclass clz) {
84698         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
84699         *ret_copy = ClosureReason_holder_force_closed();
84700         int64_t ret_ref = tag_ptr(ret_copy, true);
84701         return ret_ref;
84702 }
84703
84704 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1legacy_1cooperative_1closure(JNIEnv *env, jclass clz) {
84705         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
84706         *ret_copy = ClosureReason_legacy_cooperative_closure();
84707         int64_t ret_ref = tag_ptr(ret_copy, true);
84708         return ret_ref;
84709 }
84710
84711 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1counterparty_1initiated_1cooperative_1closure(JNIEnv *env, jclass clz) {
84712         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
84713         *ret_copy = ClosureReason_counterparty_initiated_cooperative_closure();
84714         int64_t ret_ref = tag_ptr(ret_copy, true);
84715         return ret_ref;
84716 }
84717
84718 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1locally_1initiated_1cooperative_1closure(JNIEnv *env, jclass clz) {
84719         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
84720         *ret_copy = ClosureReason_locally_initiated_cooperative_closure();
84721         int64_t ret_ref = tag_ptr(ret_copy, true);
84722         return ret_ref;
84723 }
84724
84725 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1commitment_1tx_1confirmed(JNIEnv *env, jclass clz) {
84726         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
84727         *ret_copy = ClosureReason_commitment_tx_confirmed();
84728         int64_t ret_ref = tag_ptr(ret_copy, true);
84729         return ret_ref;
84730 }
84731
84732 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1funding_1timed_1out(JNIEnv *env, jclass clz) {
84733         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
84734         *ret_copy = ClosureReason_funding_timed_out();
84735         int64_t ret_ref = tag_ptr(ret_copy, true);
84736         return ret_ref;
84737 }
84738
84739 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1processing_1error(JNIEnv *env, jclass clz, jstring err) {
84740         LDKStr err_conv = java_to_owned_str(env, err);
84741         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
84742         *ret_copy = ClosureReason_processing_error(err_conv);
84743         int64_t ret_ref = tag_ptr(ret_copy, true);
84744         return ret_ref;
84745 }
84746
84747 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1disconnected_1peer(JNIEnv *env, jclass clz) {
84748         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
84749         *ret_copy = ClosureReason_disconnected_peer();
84750         int64_t ret_ref = tag_ptr(ret_copy, true);
84751         return ret_ref;
84752 }
84753
84754 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1outdated_1channel_1manager(JNIEnv *env, jclass clz) {
84755         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
84756         *ret_copy = ClosureReason_outdated_channel_manager();
84757         int64_t ret_ref = tag_ptr(ret_copy, true);
84758         return ret_ref;
84759 }
84760
84761 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1counterparty_1coop_1closed_1unfunded_1channel(JNIEnv *env, jclass clz) {
84762         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
84763         *ret_copy = ClosureReason_counterparty_coop_closed_unfunded_channel();
84764         int64_t ret_ref = tag_ptr(ret_copy, true);
84765         return ret_ref;
84766 }
84767
84768 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1funding_1batch_1closure(JNIEnv *env, jclass clz) {
84769         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
84770         *ret_copy = ClosureReason_funding_batch_closure();
84771         int64_t ret_ref = tag_ptr(ret_copy, true);
84772         return ret_ref;
84773 }
84774
84775 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1htlcs_1timed_1out(JNIEnv *env, jclass clz) {
84776         LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
84777         *ret_copy = ClosureReason_htlcs_timed_out();
84778         int64_t ret_ref = tag_ptr(ret_copy, true);
84779         return ret_ref;
84780 }
84781
84782 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ClosureReason_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
84783         LDKClosureReason* a_conv = (LDKClosureReason*)untag_ptr(a);
84784         LDKClosureReason* b_conv = (LDKClosureReason*)untag_ptr(b);
84785         jboolean ret_conv = ClosureReason_eq(a_conv, b_conv);
84786         return ret_conv;
84787 }
84788
84789 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosureReason_1write(JNIEnv *env, jclass clz, int64_t obj) {
84790         LDKClosureReason* obj_conv = (LDKClosureReason*)untag_ptr(obj);
84791         LDKCVec_u8Z ret_var = ClosureReason_write(obj_conv);
84792         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
84793         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
84794         CVec_u8Z_free(ret_var);
84795         return ret_arr;
84796 }
84797
84798 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
84799         LDKu8slice ser_ref;
84800         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
84801         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
84802         LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
84803         *ret_conv = ClosureReason_read(ser_ref);
84804         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
84805         return tag_ptr(ret_conv, true);
84806 }
84807
84808 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCDestination_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
84809         if (!ptr_is_owned(this_ptr)) return;
84810         void* this_ptr_ptr = untag_ptr(this_ptr);
84811         CHECK_ACCESS(this_ptr_ptr);
84812         LDKHTLCDestination this_ptr_conv = *(LDKHTLCDestination*)(this_ptr_ptr);
84813         FREE(untag_ptr(this_ptr));
84814         HTLCDestination_free(this_ptr_conv);
84815 }
84816
84817 static inline uint64_t HTLCDestination_clone_ptr(LDKHTLCDestination *NONNULL_PTR arg) {
84818         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
84819         *ret_copy = HTLCDestination_clone(arg);
84820         int64_t ret_ref = tag_ptr(ret_copy, true);
84821         return ret_ref;
84822 }
84823 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDestination_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
84824         LDKHTLCDestination* arg_conv = (LDKHTLCDestination*)untag_ptr(arg);
84825         int64_t ret_conv = HTLCDestination_clone_ptr(arg_conv);
84826         return ret_conv;
84827 }
84828
84829 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDestination_1clone(JNIEnv *env, jclass clz, int64_t orig) {
84830         LDKHTLCDestination* orig_conv = (LDKHTLCDestination*)untag_ptr(orig);
84831         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
84832         *ret_copy = HTLCDestination_clone(orig_conv);
84833         int64_t ret_ref = tag_ptr(ret_copy, true);
84834         return ret_ref;
84835 }
84836
84837 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDestination_1next_1hop_1channel(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t channel_id) {
84838         LDKPublicKey node_id_ref;
84839         CHECK((*env)->GetArrayLength(env, node_id) == 33);
84840         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
84841         LDKChannelId channel_id_conv;
84842         channel_id_conv.inner = untag_ptr(channel_id);
84843         channel_id_conv.is_owned = ptr_is_owned(channel_id);
84844         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_conv);
84845         channel_id_conv = ChannelId_clone(&channel_id_conv);
84846         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
84847         *ret_copy = HTLCDestination_next_hop_channel(node_id_ref, channel_id_conv);
84848         int64_t ret_ref = tag_ptr(ret_copy, true);
84849         return ret_ref;
84850 }
84851
84852 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDestination_1unknown_1next_1hop(JNIEnv *env, jclass clz, int64_t requested_forward_scid) {
84853         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
84854         *ret_copy = HTLCDestination_unknown_next_hop(requested_forward_scid);
84855         int64_t ret_ref = tag_ptr(ret_copy, true);
84856         return ret_ref;
84857 }
84858
84859 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDestination_1invalid_1forward(JNIEnv *env, jclass clz, int64_t requested_forward_scid) {
84860         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
84861         *ret_copy = HTLCDestination_invalid_forward(requested_forward_scid);
84862         int64_t ret_ref = tag_ptr(ret_copy, true);
84863         return ret_ref;
84864 }
84865
84866 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDestination_1invalid_1onion(JNIEnv *env, jclass clz) {
84867         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
84868         *ret_copy = HTLCDestination_invalid_onion();
84869         int64_t ret_ref = tag_ptr(ret_copy, true);
84870         return ret_ref;
84871 }
84872
84873 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDestination_1failed_1payment(JNIEnv *env, jclass clz, int8_tArray payment_hash) {
84874         LDKThirtyTwoBytes payment_hash_ref;
84875         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
84876         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
84877         LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
84878         *ret_copy = HTLCDestination_failed_payment(payment_hash_ref);
84879         int64_t ret_ref = tag_ptr(ret_copy, true);
84880         return ret_ref;
84881 }
84882
84883 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_HTLCDestination_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
84884         LDKHTLCDestination* a_conv = (LDKHTLCDestination*)untag_ptr(a);
84885         LDKHTLCDestination* b_conv = (LDKHTLCDestination*)untag_ptr(b);
84886         jboolean ret_conv = HTLCDestination_eq(a_conv, b_conv);
84887         return ret_conv;
84888 }
84889
84890 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HTLCDestination_1write(JNIEnv *env, jclass clz, int64_t obj) {
84891         LDKHTLCDestination* obj_conv = (LDKHTLCDestination*)untag_ptr(obj);
84892         LDKCVec_u8Z ret_var = HTLCDestination_write(obj_conv);
84893         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
84894         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
84895         CVec_u8Z_free(ret_var);
84896         return ret_arr;
84897 }
84898
84899 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDestination_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
84900         LDKu8slice ser_ref;
84901         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
84902         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
84903         LDKCResult_COption_HTLCDestinationZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_HTLCDestinationZDecodeErrorZ), "LDKCResult_COption_HTLCDestinationZDecodeErrorZ");
84904         *ret_conv = HTLCDestination_read(ser_ref);
84905         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
84906         return tag_ptr(ret_conv, true);
84907 }
84908
84909 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_PaymentFailureReason_1clone(JNIEnv *env, jclass clz, int64_t orig) {
84910         LDKPaymentFailureReason* orig_conv = (LDKPaymentFailureReason*)untag_ptr(orig);
84911         jclass ret_conv = LDKPaymentFailureReason_to_java(env, PaymentFailureReason_clone(orig_conv));
84912         return ret_conv;
84913 }
84914
84915 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_PaymentFailureReason_1recipient_1rejected(JNIEnv *env, jclass clz) {
84916         jclass ret_conv = LDKPaymentFailureReason_to_java(env, PaymentFailureReason_recipient_rejected());
84917         return ret_conv;
84918 }
84919
84920 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_PaymentFailureReason_1user_1abandoned(JNIEnv *env, jclass clz) {
84921         jclass ret_conv = LDKPaymentFailureReason_to_java(env, PaymentFailureReason_user_abandoned());
84922         return ret_conv;
84923 }
84924
84925 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_PaymentFailureReason_1retries_1exhausted(JNIEnv *env, jclass clz) {
84926         jclass ret_conv = LDKPaymentFailureReason_to_java(env, PaymentFailureReason_retries_exhausted());
84927         return ret_conv;
84928 }
84929
84930 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_PaymentFailureReason_1payment_1expired(JNIEnv *env, jclass clz) {
84931         jclass ret_conv = LDKPaymentFailureReason_to_java(env, PaymentFailureReason_payment_expired());
84932         return ret_conv;
84933 }
84934
84935 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_PaymentFailureReason_1route_1not_1found(JNIEnv *env, jclass clz) {
84936         jclass ret_conv = LDKPaymentFailureReason_to_java(env, PaymentFailureReason_route_not_found());
84937         return ret_conv;
84938 }
84939
84940 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_PaymentFailureReason_1unexpected_1error(JNIEnv *env, jclass clz) {
84941         jclass ret_conv = LDKPaymentFailureReason_to_java(env, PaymentFailureReason_unexpected_error());
84942         return ret_conv;
84943 }
84944
84945 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PaymentFailureReason_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
84946         LDKPaymentFailureReason* a_conv = (LDKPaymentFailureReason*)untag_ptr(a);
84947         LDKPaymentFailureReason* b_conv = (LDKPaymentFailureReason*)untag_ptr(b);
84948         jboolean ret_conv = PaymentFailureReason_eq(a_conv, b_conv);
84949         return ret_conv;
84950 }
84951
84952 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_PaymentFailureReason_1write(JNIEnv *env, jclass clz, int64_t obj) {
84953         LDKPaymentFailureReason* obj_conv = (LDKPaymentFailureReason*)untag_ptr(obj);
84954         LDKCVec_u8Z ret_var = PaymentFailureReason_write(obj_conv);
84955         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
84956         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
84957         CVec_u8Z_free(ret_var);
84958         return ret_arr;
84959 }
84960
84961 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentFailureReason_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
84962         LDKu8slice ser_ref;
84963         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
84964         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
84965         LDKCResult_PaymentFailureReasonDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentFailureReasonDecodeErrorZ), "LDKCResult_PaymentFailureReasonDecodeErrorZ");
84966         *ret_conv = PaymentFailureReason_read(ser_ref);
84967         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
84968         return tag_ptr(ret_conv, true);
84969 }
84970
84971 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Event_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
84972         if (!ptr_is_owned(this_ptr)) return;
84973         void* this_ptr_ptr = untag_ptr(this_ptr);
84974         CHECK_ACCESS(this_ptr_ptr);
84975         LDKEvent this_ptr_conv = *(LDKEvent*)(this_ptr_ptr);
84976         FREE(untag_ptr(this_ptr));
84977         Event_free(this_ptr_conv);
84978 }
84979
84980 static inline uint64_t Event_clone_ptr(LDKEvent *NONNULL_PTR arg) {
84981         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
84982         *ret_copy = Event_clone(arg);
84983         int64_t ret_ref = tag_ptr(ret_copy, true);
84984         return ret_ref;
84985 }
84986 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
84987         LDKEvent* arg_conv = (LDKEvent*)untag_ptr(arg);
84988         int64_t ret_conv = Event_clone_ptr(arg_conv);
84989         return ret_conv;
84990 }
84991
84992 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1clone(JNIEnv *env, jclass clz, int64_t orig) {
84993         LDKEvent* orig_conv = (LDKEvent*)untag_ptr(orig);
84994         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
84995         *ret_copy = Event_clone(orig_conv);
84996         int64_t ret_ref = tag_ptr(ret_copy, true);
84997         return ret_ref;
84998 }
84999
85000 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1funding_1generation_1ready(JNIEnv *env, jclass clz, int64_t temporary_channel_id, int8_tArray counterparty_node_id, int64_t channel_value_satoshis, int8_tArray output_script, int8_tArray user_channel_id) {
85001         LDKChannelId temporary_channel_id_conv;
85002         temporary_channel_id_conv.inner = untag_ptr(temporary_channel_id);
85003         temporary_channel_id_conv.is_owned = ptr_is_owned(temporary_channel_id);
85004         CHECK_INNER_FIELD_ACCESS_OR_NULL(temporary_channel_id_conv);
85005         temporary_channel_id_conv = ChannelId_clone(&temporary_channel_id_conv);
85006         LDKPublicKey counterparty_node_id_ref;
85007         CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
85008         (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
85009         LDKCVec_u8Z output_script_ref;
85010         output_script_ref.datalen = (*env)->GetArrayLength(env, output_script);
85011         output_script_ref.data = MALLOC(output_script_ref.datalen, "LDKCVec_u8Z Bytes");
85012         (*env)->GetByteArrayRegion(env, output_script, 0, output_script_ref.datalen, output_script_ref.data);
85013         LDKU128 user_channel_id_ref;
85014         CHECK((*env)->GetArrayLength(env, user_channel_id) == 16);
85015         (*env)->GetByteArrayRegion(env, user_channel_id, 0, 16, user_channel_id_ref.le_bytes);
85016         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
85017         *ret_copy = Event_funding_generation_ready(temporary_channel_id_conv, counterparty_node_id_ref, channel_value_satoshis, output_script_ref, user_channel_id_ref);
85018         int64_t ret_ref = tag_ptr(ret_copy, true);
85019         return ret_ref;
85020 }
85021
85022 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) {
85023         LDKPublicKey receiver_node_id_ref;
85024         CHECK((*env)->GetArrayLength(env, receiver_node_id) == 33);
85025         (*env)->GetByteArrayRegion(env, receiver_node_id, 0, 33, receiver_node_id_ref.compressed_form);
85026         LDKThirtyTwoBytes payment_hash_ref;
85027         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
85028         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
85029         LDKRecipientOnionFields onion_fields_conv;
85030         onion_fields_conv.inner = untag_ptr(onion_fields);
85031         onion_fields_conv.is_owned = ptr_is_owned(onion_fields);
85032         CHECK_INNER_FIELD_ACCESS_OR_NULL(onion_fields_conv);
85033         onion_fields_conv = RecipientOnionFields_clone(&onion_fields_conv);
85034         void* purpose_ptr = untag_ptr(purpose);
85035         CHECK_ACCESS(purpose_ptr);
85036         LDKPaymentPurpose purpose_conv = *(LDKPaymentPurpose*)(purpose_ptr);
85037         purpose_conv = PaymentPurpose_clone((LDKPaymentPurpose*)untag_ptr(purpose));
85038         LDKChannelId via_channel_id_conv;
85039         via_channel_id_conv.inner = untag_ptr(via_channel_id);
85040         via_channel_id_conv.is_owned = ptr_is_owned(via_channel_id);
85041         CHECK_INNER_FIELD_ACCESS_OR_NULL(via_channel_id_conv);
85042         via_channel_id_conv = ChannelId_clone(&via_channel_id_conv);
85043         void* via_user_channel_id_ptr = untag_ptr(via_user_channel_id);
85044         CHECK_ACCESS(via_user_channel_id_ptr);
85045         LDKCOption_U128Z via_user_channel_id_conv = *(LDKCOption_U128Z*)(via_user_channel_id_ptr);
85046         via_user_channel_id_conv = COption_U128Z_clone((LDKCOption_U128Z*)untag_ptr(via_user_channel_id));
85047         void* claim_deadline_ptr = untag_ptr(claim_deadline);
85048         CHECK_ACCESS(claim_deadline_ptr);
85049         LDKCOption_u32Z claim_deadline_conv = *(LDKCOption_u32Z*)(claim_deadline_ptr);
85050         claim_deadline_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(claim_deadline));
85051         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
85052         *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);
85053         int64_t ret_ref = tag_ptr(ret_copy, true);
85054         return ret_ref;
85055 }
85056
85057 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) {
85058         LDKPublicKey receiver_node_id_ref;
85059         CHECK((*env)->GetArrayLength(env, receiver_node_id) == 33);
85060         (*env)->GetByteArrayRegion(env, receiver_node_id, 0, 33, receiver_node_id_ref.compressed_form);
85061         LDKThirtyTwoBytes payment_hash_ref;
85062         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
85063         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
85064         void* purpose_ptr = untag_ptr(purpose);
85065         CHECK_ACCESS(purpose_ptr);
85066         LDKPaymentPurpose purpose_conv = *(LDKPaymentPurpose*)(purpose_ptr);
85067         purpose_conv = PaymentPurpose_clone((LDKPaymentPurpose*)untag_ptr(purpose));
85068         LDKCVec_ClaimedHTLCZ htlcs_constr;
85069         htlcs_constr.datalen = (*env)->GetArrayLength(env, htlcs);
85070         if (htlcs_constr.datalen > 0)
85071                 htlcs_constr.data = MALLOC(htlcs_constr.datalen * sizeof(LDKClaimedHTLC), "LDKCVec_ClaimedHTLCZ Elements");
85072         else
85073                 htlcs_constr.data = NULL;
85074         int64_t* htlcs_vals = (*env)->GetLongArrayElements (env, htlcs, NULL);
85075         for (size_t n = 0; n < htlcs_constr.datalen; n++) {
85076                 int64_t htlcs_conv_13 = htlcs_vals[n];
85077                 LDKClaimedHTLC htlcs_conv_13_conv;
85078                 htlcs_conv_13_conv.inner = untag_ptr(htlcs_conv_13);
85079                 htlcs_conv_13_conv.is_owned = ptr_is_owned(htlcs_conv_13);
85080                 CHECK_INNER_FIELD_ACCESS_OR_NULL(htlcs_conv_13_conv);
85081                 htlcs_conv_13_conv = ClaimedHTLC_clone(&htlcs_conv_13_conv);
85082                 htlcs_constr.data[n] = htlcs_conv_13_conv;
85083         }
85084         (*env)->ReleaseLongArrayElements(env, htlcs, htlcs_vals, 0);
85085         void* sender_intended_total_msat_ptr = untag_ptr(sender_intended_total_msat);
85086         CHECK_ACCESS(sender_intended_total_msat_ptr);
85087         LDKCOption_u64Z sender_intended_total_msat_conv = *(LDKCOption_u64Z*)(sender_intended_total_msat_ptr);
85088         sender_intended_total_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(sender_intended_total_msat));
85089         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
85090         *ret_copy = Event_payment_claimed(receiver_node_id_ref, payment_hash_ref, amount_msat, purpose_conv, htlcs_constr, sender_intended_total_msat_conv);
85091         int64_t ret_ref = tag_ptr(ret_copy, true);
85092         return ret_ref;
85093 }
85094
85095 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1connection_1needed(JNIEnv *env, jclass clz, int8_tArray node_id, int64_tArray addresses) {
85096         LDKPublicKey node_id_ref;
85097         CHECK((*env)->GetArrayLength(env, node_id) == 33);
85098         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
85099         LDKCVec_SocketAddressZ addresses_constr;
85100         addresses_constr.datalen = (*env)->GetArrayLength(env, addresses);
85101         if (addresses_constr.datalen > 0)
85102                 addresses_constr.data = MALLOC(addresses_constr.datalen * sizeof(LDKSocketAddress), "LDKCVec_SocketAddressZ Elements");
85103         else
85104                 addresses_constr.data = NULL;
85105         int64_t* addresses_vals = (*env)->GetLongArrayElements (env, addresses, NULL);
85106         for (size_t p = 0; p < addresses_constr.datalen; p++) {
85107                 int64_t addresses_conv_15 = addresses_vals[p];
85108                 void* addresses_conv_15_ptr = untag_ptr(addresses_conv_15);
85109                 CHECK_ACCESS(addresses_conv_15_ptr);
85110                 LDKSocketAddress addresses_conv_15_conv = *(LDKSocketAddress*)(addresses_conv_15_ptr);
85111                 addresses_constr.data[p] = addresses_conv_15_conv;
85112         }
85113         (*env)->ReleaseLongArrayElements(env, addresses, addresses_vals, 0);
85114         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
85115         *ret_copy = Event_connection_needed(node_id_ref, addresses_constr);
85116         int64_t ret_ref = tag_ptr(ret_copy, true);
85117         return ret_ref;
85118 }
85119
85120 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1invoice_1request_1failed(JNIEnv *env, jclass clz, int8_tArray payment_id) {
85121         LDKThirtyTwoBytes payment_id_ref;
85122         CHECK((*env)->GetArrayLength(env, payment_id) == 32);
85123         (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
85124         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
85125         *ret_copy = Event_invoice_request_failed(payment_id_ref);
85126         int64_t ret_ref = tag_ptr(ret_copy, true);
85127         return ret_ref;
85128 }
85129
85130 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) {
85131         void* payment_id_ptr = untag_ptr(payment_id);
85132         CHECK_ACCESS(payment_id_ptr);
85133         LDKCOption_ThirtyTwoBytesZ payment_id_conv = *(LDKCOption_ThirtyTwoBytesZ*)(payment_id_ptr);
85134         payment_id_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(payment_id));
85135         LDKThirtyTwoBytes payment_preimage_ref;
85136         CHECK((*env)->GetArrayLength(env, payment_preimage) == 32);
85137         (*env)->GetByteArrayRegion(env, payment_preimage, 0, 32, payment_preimage_ref.data);
85138         LDKThirtyTwoBytes payment_hash_ref;
85139         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
85140         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
85141         void* fee_paid_msat_ptr = untag_ptr(fee_paid_msat);
85142         CHECK_ACCESS(fee_paid_msat_ptr);
85143         LDKCOption_u64Z fee_paid_msat_conv = *(LDKCOption_u64Z*)(fee_paid_msat_ptr);
85144         fee_paid_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(fee_paid_msat));
85145         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
85146         *ret_copy = Event_payment_sent(payment_id_conv, payment_preimage_ref, payment_hash_ref, fee_paid_msat_conv);
85147         int64_t ret_ref = tag_ptr(ret_copy, true);
85148         return ret_ref;
85149 }
85150
85151 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) {
85152         LDKThirtyTwoBytes payment_id_ref;
85153         CHECK((*env)->GetArrayLength(env, payment_id) == 32);
85154         (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
85155         LDKThirtyTwoBytes payment_hash_ref;
85156         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
85157         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
85158         void* reason_ptr = untag_ptr(reason);
85159         CHECK_ACCESS(reason_ptr);
85160         LDKCOption_PaymentFailureReasonZ reason_conv = *(LDKCOption_PaymentFailureReasonZ*)(reason_ptr);
85161         reason_conv = COption_PaymentFailureReasonZ_clone((LDKCOption_PaymentFailureReasonZ*)untag_ptr(reason));
85162         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
85163         *ret_copy = Event_payment_failed(payment_id_ref, payment_hash_ref, reason_conv);
85164         int64_t ret_ref = tag_ptr(ret_copy, true);
85165         return ret_ref;
85166 }
85167
85168 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) {
85169         LDKThirtyTwoBytes payment_id_ref;
85170         CHECK((*env)->GetArrayLength(env, payment_id) == 32);
85171         (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
85172         void* payment_hash_ptr = untag_ptr(payment_hash);
85173         CHECK_ACCESS(payment_hash_ptr);
85174         LDKCOption_ThirtyTwoBytesZ payment_hash_conv = *(LDKCOption_ThirtyTwoBytesZ*)(payment_hash_ptr);
85175         payment_hash_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(payment_hash));
85176         LDKPath path_conv;
85177         path_conv.inner = untag_ptr(path);
85178         path_conv.is_owned = ptr_is_owned(path);
85179         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
85180         path_conv = Path_clone(&path_conv);
85181         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
85182         *ret_copy = Event_payment_path_successful(payment_id_ref, payment_hash_conv, path_conv);
85183         int64_t ret_ref = tag_ptr(ret_copy, true);
85184         return ret_ref;
85185 }
85186
85187 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) {
85188         void* payment_id_ptr = untag_ptr(payment_id);
85189         CHECK_ACCESS(payment_id_ptr);
85190         LDKCOption_ThirtyTwoBytesZ payment_id_conv = *(LDKCOption_ThirtyTwoBytesZ*)(payment_id_ptr);
85191         payment_id_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(payment_id));
85192         LDKThirtyTwoBytes payment_hash_ref;
85193         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
85194         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
85195         void* failure_ptr = untag_ptr(failure);
85196         CHECK_ACCESS(failure_ptr);
85197         LDKPathFailure failure_conv = *(LDKPathFailure*)(failure_ptr);
85198         failure_conv = PathFailure_clone((LDKPathFailure*)untag_ptr(failure));
85199         LDKPath path_conv;
85200         path_conv.inner = untag_ptr(path);
85201         path_conv.is_owned = ptr_is_owned(path);
85202         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
85203         path_conv = Path_clone(&path_conv);
85204         void* short_channel_id_ptr = untag_ptr(short_channel_id);
85205         CHECK_ACCESS(short_channel_id_ptr);
85206         LDKCOption_u64Z short_channel_id_conv = *(LDKCOption_u64Z*)(short_channel_id_ptr);
85207         short_channel_id_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(short_channel_id));
85208         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
85209         *ret_copy = Event_payment_path_failed(payment_id_conv, payment_hash_ref, payment_failed_permanently, failure_conv, path_conv, short_channel_id_conv);
85210         int64_t ret_ref = tag_ptr(ret_copy, true);
85211         return ret_ref;
85212 }
85213
85214 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) {
85215         LDKThirtyTwoBytes payment_id_ref;
85216         CHECK((*env)->GetArrayLength(env, payment_id) == 32);
85217         (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
85218         LDKThirtyTwoBytes payment_hash_ref;
85219         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
85220         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
85221         LDKPath path_conv;
85222         path_conv.inner = untag_ptr(path);
85223         path_conv.is_owned = ptr_is_owned(path);
85224         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
85225         path_conv = Path_clone(&path_conv);
85226         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
85227         *ret_copy = Event_probe_successful(payment_id_ref, payment_hash_ref, path_conv);
85228         int64_t ret_ref = tag_ptr(ret_copy, true);
85229         return ret_ref;
85230 }
85231
85232 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) {
85233         LDKThirtyTwoBytes payment_id_ref;
85234         CHECK((*env)->GetArrayLength(env, payment_id) == 32);
85235         (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data);
85236         LDKThirtyTwoBytes payment_hash_ref;
85237         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
85238         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
85239         LDKPath path_conv;
85240         path_conv.inner = untag_ptr(path);
85241         path_conv.is_owned = ptr_is_owned(path);
85242         CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
85243         path_conv = Path_clone(&path_conv);
85244         void* short_channel_id_ptr = untag_ptr(short_channel_id);
85245         CHECK_ACCESS(short_channel_id_ptr);
85246         LDKCOption_u64Z short_channel_id_conv = *(LDKCOption_u64Z*)(short_channel_id_ptr);
85247         short_channel_id_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(short_channel_id));
85248         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
85249         *ret_copy = Event_probe_failed(payment_id_ref, payment_hash_ref, path_conv, short_channel_id_conv);
85250         int64_t ret_ref = tag_ptr(ret_copy, true);
85251         return ret_ref;
85252 }
85253
85254 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1pending_1htlcs_1forwardable(JNIEnv *env, jclass clz, int64_t time_forwardable) {
85255         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
85256         *ret_copy = Event_pending_htlcs_forwardable(time_forwardable);
85257         int64_t ret_ref = tag_ptr(ret_copy, true);
85258         return ret_ref;
85259 }
85260
85261 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) {
85262         LDKThirtyTwoBytes intercept_id_ref;
85263         CHECK((*env)->GetArrayLength(env, intercept_id) == 32);
85264         (*env)->GetByteArrayRegion(env, intercept_id, 0, 32, intercept_id_ref.data);
85265         LDKThirtyTwoBytes payment_hash_ref;
85266         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
85267         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
85268         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
85269         *ret_copy = Event_htlcintercepted(intercept_id_ref, requested_next_hop_scid, payment_hash_ref, inbound_amount_msat, expected_outbound_amount_msat);
85270         int64_t ret_ref = tag_ptr(ret_copy, true);
85271         return ret_ref;
85272 }
85273
85274 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1spendable_1outputs(JNIEnv *env, jclass clz, int64_tArray outputs, int64_t channel_id) {
85275         LDKCVec_SpendableOutputDescriptorZ outputs_constr;
85276         outputs_constr.datalen = (*env)->GetArrayLength(env, outputs);
85277         if (outputs_constr.datalen > 0)
85278                 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
85279         else
85280                 outputs_constr.data = NULL;
85281         int64_t* outputs_vals = (*env)->GetLongArrayElements (env, outputs, NULL);
85282         for (size_t b = 0; b < outputs_constr.datalen; b++) {
85283                 int64_t outputs_conv_27 = outputs_vals[b];
85284                 void* outputs_conv_27_ptr = untag_ptr(outputs_conv_27);
85285                 CHECK_ACCESS(outputs_conv_27_ptr);
85286                 LDKSpendableOutputDescriptor outputs_conv_27_conv = *(LDKSpendableOutputDescriptor*)(outputs_conv_27_ptr);
85287                 outputs_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)untag_ptr(outputs_conv_27));
85288                 outputs_constr.data[b] = outputs_conv_27_conv;
85289         }
85290         (*env)->ReleaseLongArrayElements(env, outputs, outputs_vals, 0);
85291         LDKChannelId channel_id_conv;
85292         channel_id_conv.inner = untag_ptr(channel_id);
85293         channel_id_conv.is_owned = ptr_is_owned(channel_id);
85294         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_conv);
85295         channel_id_conv = ChannelId_clone(&channel_id_conv);
85296         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
85297         *ret_copy = Event_spendable_outputs(outputs_constr, channel_id_conv);
85298         int64_t ret_ref = tag_ptr(ret_copy, true);
85299         return ret_ref;
85300 }
85301
85302 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1payment_1forwarded(JNIEnv *env, jclass clz, int64_t prev_channel_id, int64_t next_channel_id, int64_t prev_user_channel_id, int64_t next_user_channel_id, int64_t total_fee_earned_msat, int64_t skimmed_fee_msat, jboolean claim_from_onchain_tx, int64_t outbound_amount_forwarded_msat) {
85303         LDKChannelId prev_channel_id_conv;
85304         prev_channel_id_conv.inner = untag_ptr(prev_channel_id);
85305         prev_channel_id_conv.is_owned = ptr_is_owned(prev_channel_id);
85306         CHECK_INNER_FIELD_ACCESS_OR_NULL(prev_channel_id_conv);
85307         prev_channel_id_conv = ChannelId_clone(&prev_channel_id_conv);
85308         LDKChannelId next_channel_id_conv;
85309         next_channel_id_conv.inner = untag_ptr(next_channel_id);
85310         next_channel_id_conv.is_owned = ptr_is_owned(next_channel_id);
85311         CHECK_INNER_FIELD_ACCESS_OR_NULL(next_channel_id_conv);
85312         next_channel_id_conv = ChannelId_clone(&next_channel_id_conv);
85313         void* prev_user_channel_id_ptr = untag_ptr(prev_user_channel_id);
85314         CHECK_ACCESS(prev_user_channel_id_ptr);
85315         LDKCOption_U128Z prev_user_channel_id_conv = *(LDKCOption_U128Z*)(prev_user_channel_id_ptr);
85316         prev_user_channel_id_conv = COption_U128Z_clone((LDKCOption_U128Z*)untag_ptr(prev_user_channel_id));
85317         void* next_user_channel_id_ptr = untag_ptr(next_user_channel_id);
85318         CHECK_ACCESS(next_user_channel_id_ptr);
85319         LDKCOption_U128Z next_user_channel_id_conv = *(LDKCOption_U128Z*)(next_user_channel_id_ptr);
85320         next_user_channel_id_conv = COption_U128Z_clone((LDKCOption_U128Z*)untag_ptr(next_user_channel_id));
85321         void* total_fee_earned_msat_ptr = untag_ptr(total_fee_earned_msat);
85322         CHECK_ACCESS(total_fee_earned_msat_ptr);
85323         LDKCOption_u64Z total_fee_earned_msat_conv = *(LDKCOption_u64Z*)(total_fee_earned_msat_ptr);
85324         total_fee_earned_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(total_fee_earned_msat));
85325         void* skimmed_fee_msat_ptr = untag_ptr(skimmed_fee_msat);
85326         CHECK_ACCESS(skimmed_fee_msat_ptr);
85327         LDKCOption_u64Z skimmed_fee_msat_conv = *(LDKCOption_u64Z*)(skimmed_fee_msat_ptr);
85328         skimmed_fee_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(skimmed_fee_msat));
85329         void* outbound_amount_forwarded_msat_ptr = untag_ptr(outbound_amount_forwarded_msat);
85330         CHECK_ACCESS(outbound_amount_forwarded_msat_ptr);
85331         LDKCOption_u64Z outbound_amount_forwarded_msat_conv = *(LDKCOption_u64Z*)(outbound_amount_forwarded_msat_ptr);
85332         outbound_amount_forwarded_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(outbound_amount_forwarded_msat));
85333         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
85334         *ret_copy = Event_payment_forwarded(prev_channel_id_conv, next_channel_id_conv, prev_user_channel_id_conv, next_user_channel_id_conv, total_fee_earned_msat_conv, skimmed_fee_msat_conv, claim_from_onchain_tx, outbound_amount_forwarded_msat_conv);
85335         int64_t ret_ref = tag_ptr(ret_copy, true);
85336         return ret_ref;
85337 }
85338
85339 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1channel_1pending(JNIEnv *env, jclass clz, int64_t channel_id, int8_tArray user_channel_id, int64_t former_temporary_channel_id, int8_tArray counterparty_node_id, int64_t funding_txo, int64_t channel_type) {
85340         LDKChannelId channel_id_conv;
85341         channel_id_conv.inner = untag_ptr(channel_id);
85342         channel_id_conv.is_owned = ptr_is_owned(channel_id);
85343         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_conv);
85344         channel_id_conv = ChannelId_clone(&channel_id_conv);
85345         LDKU128 user_channel_id_ref;
85346         CHECK((*env)->GetArrayLength(env, user_channel_id) == 16);
85347         (*env)->GetByteArrayRegion(env, user_channel_id, 0, 16, user_channel_id_ref.le_bytes);
85348         LDKChannelId former_temporary_channel_id_conv;
85349         former_temporary_channel_id_conv.inner = untag_ptr(former_temporary_channel_id);
85350         former_temporary_channel_id_conv.is_owned = ptr_is_owned(former_temporary_channel_id);
85351         CHECK_INNER_FIELD_ACCESS_OR_NULL(former_temporary_channel_id_conv);
85352         former_temporary_channel_id_conv = ChannelId_clone(&former_temporary_channel_id_conv);
85353         LDKPublicKey counterparty_node_id_ref;
85354         CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
85355         (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
85356         LDKOutPoint funding_txo_conv;
85357         funding_txo_conv.inner = untag_ptr(funding_txo);
85358         funding_txo_conv.is_owned = ptr_is_owned(funding_txo);
85359         CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
85360         funding_txo_conv = OutPoint_clone(&funding_txo_conv);
85361         LDKChannelTypeFeatures channel_type_conv;
85362         channel_type_conv.inner = untag_ptr(channel_type);
85363         channel_type_conv.is_owned = ptr_is_owned(channel_type);
85364         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_conv);
85365         channel_type_conv = ChannelTypeFeatures_clone(&channel_type_conv);
85366         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
85367         *ret_copy = Event_channel_pending(channel_id_conv, user_channel_id_ref, former_temporary_channel_id_conv, counterparty_node_id_ref, funding_txo_conv, channel_type_conv);
85368         int64_t ret_ref = tag_ptr(ret_copy, true);
85369         return ret_ref;
85370 }
85371
85372 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1channel_1ready(JNIEnv *env, jclass clz, int64_t channel_id, int8_tArray user_channel_id, int8_tArray counterparty_node_id, int64_t channel_type) {
85373         LDKChannelId channel_id_conv;
85374         channel_id_conv.inner = untag_ptr(channel_id);
85375         channel_id_conv.is_owned = ptr_is_owned(channel_id);
85376         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_conv);
85377         channel_id_conv = ChannelId_clone(&channel_id_conv);
85378         LDKU128 user_channel_id_ref;
85379         CHECK((*env)->GetArrayLength(env, user_channel_id) == 16);
85380         (*env)->GetByteArrayRegion(env, user_channel_id, 0, 16, user_channel_id_ref.le_bytes);
85381         LDKPublicKey counterparty_node_id_ref;
85382         CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
85383         (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
85384         LDKChannelTypeFeatures channel_type_conv;
85385         channel_type_conv.inner = untag_ptr(channel_type);
85386         channel_type_conv.is_owned = ptr_is_owned(channel_type);
85387         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_conv);
85388         channel_type_conv = ChannelTypeFeatures_clone(&channel_type_conv);
85389         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
85390         *ret_copy = Event_channel_ready(channel_id_conv, user_channel_id_ref, counterparty_node_id_ref, channel_type_conv);
85391         int64_t ret_ref = tag_ptr(ret_copy, true);
85392         return ret_ref;
85393 }
85394
85395 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1channel_1closed(JNIEnv *env, jclass clz, int64_t channel_id, int8_tArray user_channel_id, int64_t reason, int8_tArray counterparty_node_id, int64_t channel_capacity_sats, int64_t channel_funding_txo) {
85396         LDKChannelId channel_id_conv;
85397         channel_id_conv.inner = untag_ptr(channel_id);
85398         channel_id_conv.is_owned = ptr_is_owned(channel_id);
85399         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_conv);
85400         channel_id_conv = ChannelId_clone(&channel_id_conv);
85401         LDKU128 user_channel_id_ref;
85402         CHECK((*env)->GetArrayLength(env, user_channel_id) == 16);
85403         (*env)->GetByteArrayRegion(env, user_channel_id, 0, 16, user_channel_id_ref.le_bytes);
85404         void* reason_ptr = untag_ptr(reason);
85405         CHECK_ACCESS(reason_ptr);
85406         LDKClosureReason reason_conv = *(LDKClosureReason*)(reason_ptr);
85407         reason_conv = ClosureReason_clone((LDKClosureReason*)untag_ptr(reason));
85408         LDKPublicKey counterparty_node_id_ref;
85409         CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
85410         (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
85411         void* channel_capacity_sats_ptr = untag_ptr(channel_capacity_sats);
85412         CHECK_ACCESS(channel_capacity_sats_ptr);
85413         LDKCOption_u64Z channel_capacity_sats_conv = *(LDKCOption_u64Z*)(channel_capacity_sats_ptr);
85414         channel_capacity_sats_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(channel_capacity_sats));
85415         LDKOutPoint channel_funding_txo_conv;
85416         channel_funding_txo_conv.inner = untag_ptr(channel_funding_txo);
85417         channel_funding_txo_conv.is_owned = ptr_is_owned(channel_funding_txo);
85418         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_funding_txo_conv);
85419         channel_funding_txo_conv = OutPoint_clone(&channel_funding_txo_conv);
85420         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
85421         *ret_copy = Event_channel_closed(channel_id_conv, user_channel_id_ref, reason_conv, counterparty_node_id_ref, channel_capacity_sats_conv, channel_funding_txo_conv);
85422         int64_t ret_ref = tag_ptr(ret_copy, true);
85423         return ret_ref;
85424 }
85425
85426 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1discard_1funding(JNIEnv *env, jclass clz, int64_t channel_id, int8_tArray transaction) {
85427         LDKChannelId channel_id_conv;
85428         channel_id_conv.inner = untag_ptr(channel_id);
85429         channel_id_conv.is_owned = ptr_is_owned(channel_id);
85430         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_conv);
85431         channel_id_conv = ChannelId_clone(&channel_id_conv);
85432         LDKTransaction transaction_ref;
85433         transaction_ref.datalen = (*env)->GetArrayLength(env, transaction);
85434         transaction_ref.data = MALLOC(transaction_ref.datalen, "LDKTransaction Bytes");
85435         (*env)->GetByteArrayRegion(env, transaction, 0, transaction_ref.datalen, transaction_ref.data);
85436         transaction_ref.data_is_owned = true;
85437         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
85438         *ret_copy = Event_discard_funding(channel_id_conv, transaction_ref);
85439         int64_t ret_ref = tag_ptr(ret_copy, true);
85440         return ret_ref;
85441 }
85442
85443 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1open_1channel_1request(JNIEnv *env, jclass clz, int64_t temporary_channel_id, int8_tArray counterparty_node_id, int64_t funding_satoshis, int64_t push_msat, int64_t channel_type) {
85444         LDKChannelId temporary_channel_id_conv;
85445         temporary_channel_id_conv.inner = untag_ptr(temporary_channel_id);
85446         temporary_channel_id_conv.is_owned = ptr_is_owned(temporary_channel_id);
85447         CHECK_INNER_FIELD_ACCESS_OR_NULL(temporary_channel_id_conv);
85448         temporary_channel_id_conv = ChannelId_clone(&temporary_channel_id_conv);
85449         LDKPublicKey counterparty_node_id_ref;
85450         CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
85451         (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
85452         LDKChannelTypeFeatures channel_type_conv;
85453         channel_type_conv.inner = untag_ptr(channel_type);
85454         channel_type_conv.is_owned = ptr_is_owned(channel_type);
85455         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_conv);
85456         channel_type_conv = ChannelTypeFeatures_clone(&channel_type_conv);
85457         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
85458         *ret_copy = Event_open_channel_request(temporary_channel_id_conv, counterparty_node_id_ref, funding_satoshis, push_msat, channel_type_conv);
85459         int64_t ret_ref = tag_ptr(ret_copy, true);
85460         return ret_ref;
85461 }
85462
85463 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1htlchandling_1failed(JNIEnv *env, jclass clz, int64_t prev_channel_id, int64_t failed_next_destination) {
85464         LDKChannelId prev_channel_id_conv;
85465         prev_channel_id_conv.inner = untag_ptr(prev_channel_id);
85466         prev_channel_id_conv.is_owned = ptr_is_owned(prev_channel_id);
85467         CHECK_INNER_FIELD_ACCESS_OR_NULL(prev_channel_id_conv);
85468         prev_channel_id_conv = ChannelId_clone(&prev_channel_id_conv);
85469         void* failed_next_destination_ptr = untag_ptr(failed_next_destination);
85470         CHECK_ACCESS(failed_next_destination_ptr);
85471         LDKHTLCDestination failed_next_destination_conv = *(LDKHTLCDestination*)(failed_next_destination_ptr);
85472         failed_next_destination_conv = HTLCDestination_clone((LDKHTLCDestination*)untag_ptr(failed_next_destination));
85473         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
85474         *ret_copy = Event_htlchandling_failed(prev_channel_id_conv, failed_next_destination_conv);
85475         int64_t ret_ref = tag_ptr(ret_copy, true);
85476         return ret_ref;
85477 }
85478
85479 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1bump_1transaction(JNIEnv *env, jclass clz, int64_t a) {
85480         void* a_ptr = untag_ptr(a);
85481         CHECK_ACCESS(a_ptr);
85482         LDKBumpTransactionEvent a_conv = *(LDKBumpTransactionEvent*)(a_ptr);
85483         a_conv = BumpTransactionEvent_clone((LDKBumpTransactionEvent*)untag_ptr(a));
85484         LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
85485         *ret_copy = Event_bump_transaction(a_conv);
85486         int64_t ret_ref = tag_ptr(ret_copy, true);
85487         return ret_ref;
85488 }
85489
85490 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Event_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
85491         LDKEvent* a_conv = (LDKEvent*)untag_ptr(a);
85492         LDKEvent* b_conv = (LDKEvent*)untag_ptr(b);
85493         jboolean ret_conv = Event_eq(a_conv, b_conv);
85494         return ret_conv;
85495 }
85496
85497 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Event_1write(JNIEnv *env, jclass clz, int64_t obj) {
85498         LDKEvent* obj_conv = (LDKEvent*)untag_ptr(obj);
85499         LDKCVec_u8Z ret_var = Event_write(obj_conv);
85500         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
85501         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
85502         CVec_u8Z_free(ret_var);
85503         return ret_arr;
85504 }
85505
85506 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
85507         LDKu8slice ser_ref;
85508         ser_ref.datalen = (*env)->GetArrayLength(env, ser);
85509         ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
85510         LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
85511         *ret_conv = Event_read(ser_ref);
85512         (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
85513         return tag_ptr(ret_conv, true);
85514 }
85515
85516 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
85517         if (!ptr_is_owned(this_ptr)) return;
85518         void* this_ptr_ptr = untag_ptr(this_ptr);
85519         CHECK_ACCESS(this_ptr_ptr);
85520         LDKMessageSendEvent this_ptr_conv = *(LDKMessageSendEvent*)(this_ptr_ptr);
85521         FREE(untag_ptr(this_ptr));
85522         MessageSendEvent_free(this_ptr_conv);
85523 }
85524
85525 static inline uint64_t MessageSendEvent_clone_ptr(LDKMessageSendEvent *NONNULL_PTR arg) {
85526         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
85527         *ret_copy = MessageSendEvent_clone(arg);
85528         int64_t ret_ref = tag_ptr(ret_copy, true);
85529         return ret_ref;
85530 }
85531 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
85532         LDKMessageSendEvent* arg_conv = (LDKMessageSendEvent*)untag_ptr(arg);
85533         int64_t ret_conv = MessageSendEvent_clone_ptr(arg_conv);
85534         return ret_conv;
85535 }
85536
85537 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1clone(JNIEnv *env, jclass clz, int64_t orig) {
85538         LDKMessageSendEvent* orig_conv = (LDKMessageSendEvent*)untag_ptr(orig);
85539         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
85540         *ret_copy = MessageSendEvent_clone(orig_conv);
85541         int64_t ret_ref = tag_ptr(ret_copy, true);
85542         return ret_ref;
85543 }
85544
85545 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1accept_1channel(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
85546         LDKPublicKey node_id_ref;
85547         CHECK((*env)->GetArrayLength(env, node_id) == 33);
85548         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
85549         LDKAcceptChannel msg_conv;
85550         msg_conv.inner = untag_ptr(msg);
85551         msg_conv.is_owned = ptr_is_owned(msg);
85552         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
85553         msg_conv = AcceptChannel_clone(&msg_conv);
85554         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
85555         *ret_copy = MessageSendEvent_send_accept_channel(node_id_ref, msg_conv);
85556         int64_t ret_ref = tag_ptr(ret_copy, true);
85557         return ret_ref;
85558 }
85559
85560 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) {
85561         LDKPublicKey node_id_ref;
85562         CHECK((*env)->GetArrayLength(env, node_id) == 33);
85563         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
85564         LDKAcceptChannelV2 msg_conv;
85565         msg_conv.inner = untag_ptr(msg);
85566         msg_conv.is_owned = ptr_is_owned(msg);
85567         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
85568         msg_conv = AcceptChannelV2_clone(&msg_conv);
85569         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
85570         *ret_copy = MessageSendEvent_send_accept_channel_v2(node_id_ref, msg_conv);
85571         int64_t ret_ref = tag_ptr(ret_copy, true);
85572         return ret_ref;
85573 }
85574
85575 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1open_1channel(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
85576         LDKPublicKey node_id_ref;
85577         CHECK((*env)->GetArrayLength(env, node_id) == 33);
85578         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
85579         LDKOpenChannel msg_conv;
85580         msg_conv.inner = untag_ptr(msg);
85581         msg_conv.is_owned = ptr_is_owned(msg);
85582         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
85583         msg_conv = OpenChannel_clone(&msg_conv);
85584         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
85585         *ret_copy = MessageSendEvent_send_open_channel(node_id_ref, msg_conv);
85586         int64_t ret_ref = tag_ptr(ret_copy, true);
85587         return ret_ref;
85588 }
85589
85590 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) {
85591         LDKPublicKey node_id_ref;
85592         CHECK((*env)->GetArrayLength(env, node_id) == 33);
85593         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
85594         LDKOpenChannelV2 msg_conv;
85595         msg_conv.inner = untag_ptr(msg);
85596         msg_conv.is_owned = ptr_is_owned(msg);
85597         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
85598         msg_conv = OpenChannelV2_clone(&msg_conv);
85599         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
85600         *ret_copy = MessageSendEvent_send_open_channel_v2(node_id_ref, msg_conv);
85601         int64_t ret_ref = tag_ptr(ret_copy, true);
85602         return ret_ref;
85603 }
85604
85605 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1funding_1created(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
85606         LDKPublicKey node_id_ref;
85607         CHECK((*env)->GetArrayLength(env, node_id) == 33);
85608         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
85609         LDKFundingCreated msg_conv;
85610         msg_conv.inner = untag_ptr(msg);
85611         msg_conv.is_owned = ptr_is_owned(msg);
85612         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
85613         msg_conv = FundingCreated_clone(&msg_conv);
85614         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
85615         *ret_copy = MessageSendEvent_send_funding_created(node_id_ref, msg_conv);
85616         int64_t ret_ref = tag_ptr(ret_copy, true);
85617         return ret_ref;
85618 }
85619
85620 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1funding_1signed(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
85621         LDKPublicKey node_id_ref;
85622         CHECK((*env)->GetArrayLength(env, node_id) == 33);
85623         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
85624         LDKFundingSigned msg_conv;
85625         msg_conv.inner = untag_ptr(msg);
85626         msg_conv.is_owned = ptr_is_owned(msg);
85627         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
85628         msg_conv = FundingSigned_clone(&msg_conv);
85629         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
85630         *ret_copy = MessageSendEvent_send_funding_signed(node_id_ref, msg_conv);
85631         int64_t ret_ref = tag_ptr(ret_copy, true);
85632         return ret_ref;
85633 }
85634
85635 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1stfu(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
85636         LDKPublicKey node_id_ref;
85637         CHECK((*env)->GetArrayLength(env, node_id) == 33);
85638         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
85639         LDKStfu msg_conv;
85640         msg_conv.inner = untag_ptr(msg);
85641         msg_conv.is_owned = ptr_is_owned(msg);
85642         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
85643         msg_conv = Stfu_clone(&msg_conv);
85644         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
85645         *ret_copy = MessageSendEvent_send_stfu(node_id_ref, msg_conv);
85646         int64_t ret_ref = tag_ptr(ret_copy, true);
85647         return ret_ref;
85648 }
85649
85650 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1splice(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
85651         LDKPublicKey node_id_ref;
85652         CHECK((*env)->GetArrayLength(env, node_id) == 33);
85653         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
85654         LDKSplice msg_conv;
85655         msg_conv.inner = untag_ptr(msg);
85656         msg_conv.is_owned = ptr_is_owned(msg);
85657         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
85658         msg_conv = Splice_clone(&msg_conv);
85659         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
85660         *ret_copy = MessageSendEvent_send_splice(node_id_ref, msg_conv);
85661         int64_t ret_ref = tag_ptr(ret_copy, true);
85662         return ret_ref;
85663 }
85664
85665 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1splice_1ack(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
85666         LDKPublicKey node_id_ref;
85667         CHECK((*env)->GetArrayLength(env, node_id) == 33);
85668         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
85669         LDKSpliceAck msg_conv;
85670         msg_conv.inner = untag_ptr(msg);
85671         msg_conv.is_owned = ptr_is_owned(msg);
85672         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
85673         msg_conv = SpliceAck_clone(&msg_conv);
85674         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
85675         *ret_copy = MessageSendEvent_send_splice_ack(node_id_ref, msg_conv);
85676         int64_t ret_ref = tag_ptr(ret_copy, true);
85677         return ret_ref;
85678 }
85679
85680 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1splice_1locked(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
85681         LDKPublicKey node_id_ref;
85682         CHECK((*env)->GetArrayLength(env, node_id) == 33);
85683         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
85684         LDKSpliceLocked msg_conv;
85685         msg_conv.inner = untag_ptr(msg);
85686         msg_conv.is_owned = ptr_is_owned(msg);
85687         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
85688         msg_conv = SpliceLocked_clone(&msg_conv);
85689         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
85690         *ret_copy = MessageSendEvent_send_splice_locked(node_id_ref, msg_conv);
85691         int64_t ret_ref = tag_ptr(ret_copy, true);
85692         return ret_ref;
85693 }
85694
85695 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) {
85696         LDKPublicKey node_id_ref;
85697         CHECK((*env)->GetArrayLength(env, node_id) == 33);
85698         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
85699         LDKTxAddInput msg_conv;
85700         msg_conv.inner = untag_ptr(msg);
85701         msg_conv.is_owned = ptr_is_owned(msg);
85702         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
85703         msg_conv = TxAddInput_clone(&msg_conv);
85704         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
85705         *ret_copy = MessageSendEvent_send_tx_add_input(node_id_ref, msg_conv);
85706         int64_t ret_ref = tag_ptr(ret_copy, true);
85707         return ret_ref;
85708 }
85709
85710 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) {
85711         LDKPublicKey node_id_ref;
85712         CHECK((*env)->GetArrayLength(env, node_id) == 33);
85713         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
85714         LDKTxAddOutput msg_conv;
85715         msg_conv.inner = untag_ptr(msg);
85716         msg_conv.is_owned = ptr_is_owned(msg);
85717         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
85718         msg_conv = TxAddOutput_clone(&msg_conv);
85719         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
85720         *ret_copy = MessageSendEvent_send_tx_add_output(node_id_ref, msg_conv);
85721         int64_t ret_ref = tag_ptr(ret_copy, true);
85722         return ret_ref;
85723 }
85724
85725 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) {
85726         LDKPublicKey node_id_ref;
85727         CHECK((*env)->GetArrayLength(env, node_id) == 33);
85728         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
85729         LDKTxRemoveInput msg_conv;
85730         msg_conv.inner = untag_ptr(msg);
85731         msg_conv.is_owned = ptr_is_owned(msg);
85732         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
85733         msg_conv = TxRemoveInput_clone(&msg_conv);
85734         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
85735         *ret_copy = MessageSendEvent_send_tx_remove_input(node_id_ref, msg_conv);
85736         int64_t ret_ref = tag_ptr(ret_copy, true);
85737         return ret_ref;
85738 }
85739
85740 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) {
85741         LDKPublicKey node_id_ref;
85742         CHECK((*env)->GetArrayLength(env, node_id) == 33);
85743         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
85744         LDKTxRemoveOutput msg_conv;
85745         msg_conv.inner = untag_ptr(msg);
85746         msg_conv.is_owned = ptr_is_owned(msg);
85747         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
85748         msg_conv = TxRemoveOutput_clone(&msg_conv);
85749         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
85750         *ret_copy = MessageSendEvent_send_tx_remove_output(node_id_ref, msg_conv);
85751         int64_t ret_ref = tag_ptr(ret_copy, true);
85752         return ret_ref;
85753 }
85754
85755 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1tx_1complete(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
85756         LDKPublicKey node_id_ref;
85757         CHECK((*env)->GetArrayLength(env, node_id) == 33);
85758         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
85759         LDKTxComplete msg_conv;
85760         msg_conv.inner = untag_ptr(msg);
85761         msg_conv.is_owned = ptr_is_owned(msg);
85762         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
85763         msg_conv = TxComplete_clone(&msg_conv);
85764         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
85765         *ret_copy = MessageSendEvent_send_tx_complete(node_id_ref, msg_conv);
85766         int64_t ret_ref = tag_ptr(ret_copy, true);
85767         return ret_ref;
85768 }
85769
85770 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1tx_1signatures(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
85771         LDKPublicKey node_id_ref;
85772         CHECK((*env)->GetArrayLength(env, node_id) == 33);
85773         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
85774         LDKTxSignatures msg_conv;
85775         msg_conv.inner = untag_ptr(msg);
85776         msg_conv.is_owned = ptr_is_owned(msg);
85777         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
85778         msg_conv = TxSignatures_clone(&msg_conv);
85779         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
85780         *ret_copy = MessageSendEvent_send_tx_signatures(node_id_ref, msg_conv);
85781         int64_t ret_ref = tag_ptr(ret_copy, true);
85782         return ret_ref;
85783 }
85784
85785 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) {
85786         LDKPublicKey node_id_ref;
85787         CHECK((*env)->GetArrayLength(env, node_id) == 33);
85788         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
85789         LDKTxInitRbf msg_conv;
85790         msg_conv.inner = untag_ptr(msg);
85791         msg_conv.is_owned = ptr_is_owned(msg);
85792         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
85793         msg_conv = TxInitRbf_clone(&msg_conv);
85794         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
85795         *ret_copy = MessageSendEvent_send_tx_init_rbf(node_id_ref, msg_conv);
85796         int64_t ret_ref = tag_ptr(ret_copy, true);
85797         return ret_ref;
85798 }
85799
85800 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) {
85801         LDKPublicKey node_id_ref;
85802         CHECK((*env)->GetArrayLength(env, node_id) == 33);
85803         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
85804         LDKTxAckRbf msg_conv;
85805         msg_conv.inner = untag_ptr(msg);
85806         msg_conv.is_owned = ptr_is_owned(msg);
85807         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
85808         msg_conv = TxAckRbf_clone(&msg_conv);
85809         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
85810         *ret_copy = MessageSendEvent_send_tx_ack_rbf(node_id_ref, msg_conv);
85811         int64_t ret_ref = tag_ptr(ret_copy, true);
85812         return ret_ref;
85813 }
85814
85815 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1tx_1abort(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
85816         LDKPublicKey node_id_ref;
85817         CHECK((*env)->GetArrayLength(env, node_id) == 33);
85818         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
85819         LDKTxAbort msg_conv;
85820         msg_conv.inner = untag_ptr(msg);
85821         msg_conv.is_owned = ptr_is_owned(msg);
85822         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
85823         msg_conv = TxAbort_clone(&msg_conv);
85824         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
85825         *ret_copy = MessageSendEvent_send_tx_abort(node_id_ref, msg_conv);
85826         int64_t ret_ref = tag_ptr(ret_copy, true);
85827         return ret_ref;
85828 }
85829
85830 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1channel_1ready(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
85831         LDKPublicKey node_id_ref;
85832         CHECK((*env)->GetArrayLength(env, node_id) == 33);
85833         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
85834         LDKChannelReady msg_conv;
85835         msg_conv.inner = untag_ptr(msg);
85836         msg_conv.is_owned = ptr_is_owned(msg);
85837         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
85838         msg_conv = ChannelReady_clone(&msg_conv);
85839         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
85840         *ret_copy = MessageSendEvent_send_channel_ready(node_id_ref, msg_conv);
85841         int64_t ret_ref = tag_ptr(ret_copy, true);
85842         return ret_ref;
85843 }
85844
85845 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1announcement_1signatures(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
85846         LDKPublicKey node_id_ref;
85847         CHECK((*env)->GetArrayLength(env, node_id) == 33);
85848         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
85849         LDKAnnouncementSignatures msg_conv;
85850         msg_conv.inner = untag_ptr(msg);
85851         msg_conv.is_owned = ptr_is_owned(msg);
85852         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
85853         msg_conv = AnnouncementSignatures_clone(&msg_conv);
85854         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
85855         *ret_copy = MessageSendEvent_send_announcement_signatures(node_id_ref, msg_conv);
85856         int64_t ret_ref = tag_ptr(ret_copy, true);
85857         return ret_ref;
85858 }
85859
85860 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1update_1htlcs(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t updates) {
85861         LDKPublicKey node_id_ref;
85862         CHECK((*env)->GetArrayLength(env, node_id) == 33);
85863         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
85864         LDKCommitmentUpdate updates_conv;
85865         updates_conv.inner = untag_ptr(updates);
85866         updates_conv.is_owned = ptr_is_owned(updates);
85867         CHECK_INNER_FIELD_ACCESS_OR_NULL(updates_conv);
85868         updates_conv = CommitmentUpdate_clone(&updates_conv);
85869         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
85870         *ret_copy = MessageSendEvent_update_htlcs(node_id_ref, updates_conv);
85871         int64_t ret_ref = tag_ptr(ret_copy, true);
85872         return ret_ref;
85873 }
85874
85875 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) {
85876         LDKPublicKey node_id_ref;
85877         CHECK((*env)->GetArrayLength(env, node_id) == 33);
85878         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
85879         LDKRevokeAndACK msg_conv;
85880         msg_conv.inner = untag_ptr(msg);
85881         msg_conv.is_owned = ptr_is_owned(msg);
85882         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
85883         msg_conv = RevokeAndACK_clone(&msg_conv);
85884         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
85885         *ret_copy = MessageSendEvent_send_revoke_and_ack(node_id_ref, msg_conv);
85886         int64_t ret_ref = tag_ptr(ret_copy, true);
85887         return ret_ref;
85888 }
85889
85890 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1closing_1signed(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
85891         LDKPublicKey node_id_ref;
85892         CHECK((*env)->GetArrayLength(env, node_id) == 33);
85893         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
85894         LDKClosingSigned msg_conv;
85895         msg_conv.inner = untag_ptr(msg);
85896         msg_conv.is_owned = ptr_is_owned(msg);
85897         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
85898         msg_conv = ClosingSigned_clone(&msg_conv);
85899         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
85900         *ret_copy = MessageSendEvent_send_closing_signed(node_id_ref, msg_conv);
85901         int64_t ret_ref = tag_ptr(ret_copy, true);
85902         return ret_ref;
85903 }
85904
85905 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1shutdown(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
85906         LDKPublicKey node_id_ref;
85907         CHECK((*env)->GetArrayLength(env, node_id) == 33);
85908         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
85909         LDKShutdown msg_conv;
85910         msg_conv.inner = untag_ptr(msg);
85911         msg_conv.is_owned = ptr_is_owned(msg);
85912         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
85913         msg_conv = Shutdown_clone(&msg_conv);
85914         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
85915         *ret_copy = MessageSendEvent_send_shutdown(node_id_ref, msg_conv);
85916         int64_t ret_ref = tag_ptr(ret_copy, true);
85917         return ret_ref;
85918 }
85919
85920 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1channel_1reestablish(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
85921         LDKPublicKey node_id_ref;
85922         CHECK((*env)->GetArrayLength(env, node_id) == 33);
85923         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
85924         LDKChannelReestablish msg_conv;
85925         msg_conv.inner = untag_ptr(msg);
85926         msg_conv.is_owned = ptr_is_owned(msg);
85927         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
85928         msg_conv = ChannelReestablish_clone(&msg_conv);
85929         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
85930         *ret_copy = MessageSendEvent_send_channel_reestablish(node_id_ref, msg_conv);
85931         int64_t ret_ref = tag_ptr(ret_copy, true);
85932         return ret_ref;
85933 }
85934
85935 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) {
85936         LDKPublicKey node_id_ref;
85937         CHECK((*env)->GetArrayLength(env, node_id) == 33);
85938         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
85939         LDKChannelAnnouncement msg_conv;
85940         msg_conv.inner = untag_ptr(msg);
85941         msg_conv.is_owned = ptr_is_owned(msg);
85942         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
85943         msg_conv = ChannelAnnouncement_clone(&msg_conv);
85944         LDKChannelUpdate update_msg_conv;
85945         update_msg_conv.inner = untag_ptr(update_msg);
85946         update_msg_conv.is_owned = ptr_is_owned(update_msg);
85947         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_msg_conv);
85948         update_msg_conv = ChannelUpdate_clone(&update_msg_conv);
85949         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
85950         *ret_copy = MessageSendEvent_send_channel_announcement(node_id_ref, msg_conv, update_msg_conv);
85951         int64_t ret_ref = tag_ptr(ret_copy, true);
85952         return ret_ref;
85953 }
85954
85955 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1broadcast_1channel_1announcement(JNIEnv *env, jclass clz, int64_t msg, int64_t update_msg) {
85956         LDKChannelAnnouncement msg_conv;
85957         msg_conv.inner = untag_ptr(msg);
85958         msg_conv.is_owned = ptr_is_owned(msg);
85959         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
85960         msg_conv = ChannelAnnouncement_clone(&msg_conv);
85961         LDKChannelUpdate update_msg_conv;
85962         update_msg_conv.inner = untag_ptr(update_msg);
85963         update_msg_conv.is_owned = ptr_is_owned(update_msg);
85964         CHECK_INNER_FIELD_ACCESS_OR_NULL(update_msg_conv);
85965         update_msg_conv = ChannelUpdate_clone(&update_msg_conv);
85966         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
85967         *ret_copy = MessageSendEvent_broadcast_channel_announcement(msg_conv, update_msg_conv);
85968         int64_t ret_ref = tag_ptr(ret_copy, true);
85969         return ret_ref;
85970 }
85971
85972 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1broadcast_1channel_1update(JNIEnv *env, jclass clz, int64_t msg) {
85973         LDKChannelUpdate msg_conv;
85974         msg_conv.inner = untag_ptr(msg);
85975         msg_conv.is_owned = ptr_is_owned(msg);
85976         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
85977         msg_conv = ChannelUpdate_clone(&msg_conv);
85978         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
85979         *ret_copy = MessageSendEvent_broadcast_channel_update(msg_conv);
85980         int64_t ret_ref = tag_ptr(ret_copy, true);
85981         return ret_ref;
85982 }
85983
85984 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1broadcast_1node_1announcement(JNIEnv *env, jclass clz, int64_t msg) {
85985         LDKNodeAnnouncement msg_conv;
85986         msg_conv.inner = untag_ptr(msg);
85987         msg_conv.is_owned = ptr_is_owned(msg);
85988         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
85989         msg_conv = NodeAnnouncement_clone(&msg_conv);
85990         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
85991         *ret_copy = MessageSendEvent_broadcast_node_announcement(msg_conv);
85992         int64_t ret_ref = tag_ptr(ret_copy, true);
85993         return ret_ref;
85994 }
85995
85996 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1channel_1update(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
85997         LDKPublicKey node_id_ref;
85998         CHECK((*env)->GetArrayLength(env, node_id) == 33);
85999         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
86000         LDKChannelUpdate msg_conv;
86001         msg_conv.inner = untag_ptr(msg);
86002         msg_conv.is_owned = ptr_is_owned(msg);
86003         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
86004         msg_conv = ChannelUpdate_clone(&msg_conv);
86005         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
86006         *ret_copy = MessageSendEvent_send_channel_update(node_id_ref, msg_conv);
86007         int64_t ret_ref = tag_ptr(ret_copy, true);
86008         return ret_ref;
86009 }
86010
86011 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1handle_1error(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t action) {
86012         LDKPublicKey node_id_ref;
86013         CHECK((*env)->GetArrayLength(env, node_id) == 33);
86014         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
86015         void* action_ptr = untag_ptr(action);
86016         CHECK_ACCESS(action_ptr);
86017         LDKErrorAction action_conv = *(LDKErrorAction*)(action_ptr);
86018         action_conv = ErrorAction_clone((LDKErrorAction*)untag_ptr(action));
86019         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
86020         *ret_copy = MessageSendEvent_handle_error(node_id_ref, action_conv);
86021         int64_t ret_ref = tag_ptr(ret_copy, true);
86022         return ret_ref;
86023 }
86024
86025 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) {
86026         LDKPublicKey node_id_ref;
86027         CHECK((*env)->GetArrayLength(env, node_id) == 33);
86028         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
86029         LDKQueryChannelRange msg_conv;
86030         msg_conv.inner = untag_ptr(msg);
86031         msg_conv.is_owned = ptr_is_owned(msg);
86032         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
86033         msg_conv = QueryChannelRange_clone(&msg_conv);
86034         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
86035         *ret_copy = MessageSendEvent_send_channel_range_query(node_id_ref, msg_conv);
86036         int64_t ret_ref = tag_ptr(ret_copy, true);
86037         return ret_ref;
86038 }
86039
86040 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) {
86041         LDKPublicKey node_id_ref;
86042         CHECK((*env)->GetArrayLength(env, node_id) == 33);
86043         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
86044         LDKQueryShortChannelIds msg_conv;
86045         msg_conv.inner = untag_ptr(msg);
86046         msg_conv.is_owned = ptr_is_owned(msg);
86047         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
86048         msg_conv = QueryShortChannelIds_clone(&msg_conv);
86049         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
86050         *ret_copy = MessageSendEvent_send_short_ids_query(node_id_ref, msg_conv);
86051         int64_t ret_ref = tag_ptr(ret_copy, true);
86052         return ret_ref;
86053 }
86054
86055 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) {
86056         LDKPublicKey node_id_ref;
86057         CHECK((*env)->GetArrayLength(env, node_id) == 33);
86058         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
86059         LDKReplyChannelRange msg_conv;
86060         msg_conv.inner = untag_ptr(msg);
86061         msg_conv.is_owned = ptr_is_owned(msg);
86062         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
86063         msg_conv = ReplyChannelRange_clone(&msg_conv);
86064         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
86065         *ret_copy = MessageSendEvent_send_reply_channel_range(node_id_ref, msg_conv);
86066         int64_t ret_ref = tag_ptr(ret_copy, true);
86067         return ret_ref;
86068 }
86069
86070 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) {
86071         LDKPublicKey node_id_ref;
86072         CHECK((*env)->GetArrayLength(env, node_id) == 33);
86073         (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
86074         LDKGossipTimestampFilter msg_conv;
86075         msg_conv.inner = untag_ptr(msg);
86076         msg_conv.is_owned = ptr_is_owned(msg);
86077         CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
86078         msg_conv = GossipTimestampFilter_clone(&msg_conv);
86079         LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
86080         *ret_copy = MessageSendEvent_send_gossip_timestamp_filter(node_id_ref, msg_conv);
86081         int64_t ret_ref = tag_ptr(ret_copy, true);
86082         return ret_ref;
86083 }
86084
86085 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageSendEventsProvider_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
86086         if (!ptr_is_owned(this_ptr)) return;
86087         void* this_ptr_ptr = untag_ptr(this_ptr);
86088         CHECK_ACCESS(this_ptr_ptr);
86089         LDKMessageSendEventsProvider this_ptr_conv = *(LDKMessageSendEventsProvider*)(this_ptr_ptr);
86090         FREE(untag_ptr(this_ptr));
86091         MessageSendEventsProvider_free(this_ptr_conv);
86092 }
86093
86094 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EventsProvider_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
86095         if (!ptr_is_owned(this_ptr)) return;
86096         void* this_ptr_ptr = untag_ptr(this_ptr);
86097         CHECK_ACCESS(this_ptr_ptr);
86098         LDKEventsProvider this_ptr_conv = *(LDKEventsProvider*)(this_ptr_ptr);
86099         FREE(untag_ptr(this_ptr));
86100         EventsProvider_free(this_ptr_conv);
86101 }
86102
86103 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EventHandler_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
86104         if (!ptr_is_owned(this_ptr)) return;
86105         void* this_ptr_ptr = untag_ptr(this_ptr);
86106         CHECK_ACCESS(this_ptr_ptr);
86107         LDKEventHandler this_ptr_conv = *(LDKEventHandler*)(this_ptr_ptr);
86108         FREE(untag_ptr(this_ptr));
86109         EventHandler_free(this_ptr_conv);
86110 }
86111
86112 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnchorDescriptor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
86113         LDKAnchorDescriptor this_obj_conv;
86114         this_obj_conv.inner = untag_ptr(this_obj);
86115         this_obj_conv.is_owned = ptr_is_owned(this_obj);
86116         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
86117         AnchorDescriptor_free(this_obj_conv);
86118 }
86119
86120 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnchorDescriptor_1get_1channel_1derivation_1parameters(JNIEnv *env, jclass clz, int64_t this_ptr) {
86121         LDKAnchorDescriptor this_ptr_conv;
86122         this_ptr_conv.inner = untag_ptr(this_ptr);
86123         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
86124         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
86125         this_ptr_conv.is_owned = false;
86126         LDKChannelDerivationParameters ret_var = AnchorDescriptor_get_channel_derivation_parameters(&this_ptr_conv);
86127         int64_t ret_ref = 0;
86128         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
86129         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
86130         return ret_ref;
86131 }
86132
86133 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnchorDescriptor_1set_1channel_1derivation_1parameters(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
86134         LDKAnchorDescriptor this_ptr_conv;
86135         this_ptr_conv.inner = untag_ptr(this_ptr);
86136         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
86137         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
86138         this_ptr_conv.is_owned = false;
86139         LDKChannelDerivationParameters val_conv;
86140         val_conv.inner = untag_ptr(val);
86141         val_conv.is_owned = ptr_is_owned(val);
86142         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
86143         val_conv = ChannelDerivationParameters_clone(&val_conv);
86144         AnchorDescriptor_set_channel_derivation_parameters(&this_ptr_conv, val_conv);
86145 }
86146
86147 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnchorDescriptor_1get_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
86148         LDKAnchorDescriptor this_ptr_conv;
86149         this_ptr_conv.inner = untag_ptr(this_ptr);
86150         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
86151         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
86152         this_ptr_conv.is_owned = false;
86153         LDKOutPoint ret_var = AnchorDescriptor_get_outpoint(&this_ptr_conv);
86154         int64_t ret_ref = 0;
86155         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
86156         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
86157         return ret_ref;
86158 }
86159
86160 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnchorDescriptor_1set_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
86161         LDKAnchorDescriptor this_ptr_conv;
86162         this_ptr_conv.inner = untag_ptr(this_ptr);
86163         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
86164         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
86165         this_ptr_conv.is_owned = false;
86166         LDKOutPoint val_conv;
86167         val_conv.inner = untag_ptr(val);
86168         val_conv.is_owned = ptr_is_owned(val);
86169         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
86170         val_conv = OutPoint_clone(&val_conv);
86171         AnchorDescriptor_set_outpoint(&this_ptr_conv, val_conv);
86172 }
86173
86174 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) {
86175         LDKChannelDerivationParameters channel_derivation_parameters_arg_conv;
86176         channel_derivation_parameters_arg_conv.inner = untag_ptr(channel_derivation_parameters_arg);
86177         channel_derivation_parameters_arg_conv.is_owned = ptr_is_owned(channel_derivation_parameters_arg);
86178         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_derivation_parameters_arg_conv);
86179         channel_derivation_parameters_arg_conv = ChannelDerivationParameters_clone(&channel_derivation_parameters_arg_conv);
86180         LDKOutPoint outpoint_arg_conv;
86181         outpoint_arg_conv.inner = untag_ptr(outpoint_arg);
86182         outpoint_arg_conv.is_owned = ptr_is_owned(outpoint_arg);
86183         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
86184         outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
86185         LDKAnchorDescriptor ret_var = AnchorDescriptor_new(channel_derivation_parameters_arg_conv, outpoint_arg_conv);
86186         int64_t ret_ref = 0;
86187         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
86188         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
86189         return ret_ref;
86190 }
86191
86192 static inline uint64_t AnchorDescriptor_clone_ptr(LDKAnchorDescriptor *NONNULL_PTR arg) {
86193         LDKAnchorDescriptor ret_var = AnchorDescriptor_clone(arg);
86194         int64_t ret_ref = 0;
86195         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
86196         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
86197         return ret_ref;
86198 }
86199 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnchorDescriptor_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
86200         LDKAnchorDescriptor arg_conv;
86201         arg_conv.inner = untag_ptr(arg);
86202         arg_conv.is_owned = ptr_is_owned(arg);
86203         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
86204         arg_conv.is_owned = false;
86205         int64_t ret_conv = AnchorDescriptor_clone_ptr(&arg_conv);
86206         return ret_conv;
86207 }
86208
86209 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnchorDescriptor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
86210         LDKAnchorDescriptor orig_conv;
86211         orig_conv.inner = untag_ptr(orig);
86212         orig_conv.is_owned = ptr_is_owned(orig);
86213         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
86214         orig_conv.is_owned = false;
86215         LDKAnchorDescriptor ret_var = AnchorDescriptor_clone(&orig_conv);
86216         int64_t ret_ref = 0;
86217         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
86218         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
86219         return ret_ref;
86220 }
86221
86222 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_AnchorDescriptor_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
86223         LDKAnchorDescriptor a_conv;
86224         a_conv.inner = untag_ptr(a);
86225         a_conv.is_owned = ptr_is_owned(a);
86226         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
86227         a_conv.is_owned = false;
86228         LDKAnchorDescriptor b_conv;
86229         b_conv.inner = untag_ptr(b);
86230         b_conv.is_owned = ptr_is_owned(b);
86231         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
86232         b_conv.is_owned = false;
86233         jboolean ret_conv = AnchorDescriptor_eq(&a_conv, &b_conv);
86234         return ret_conv;
86235 }
86236
86237 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnchorDescriptor_1previous_1utxo(JNIEnv *env, jclass clz, int64_t this_arg) {
86238         LDKAnchorDescriptor this_arg_conv;
86239         this_arg_conv.inner = untag_ptr(this_arg);
86240         this_arg_conv.is_owned = ptr_is_owned(this_arg);
86241         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
86242         this_arg_conv.is_owned = false;
86243         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
86244         *ret_ref = AnchorDescriptor_previous_utxo(&this_arg_conv);
86245         return tag_ptr(ret_ref, true);
86246 }
86247
86248 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnchorDescriptor_1unsigned_1tx_1input(JNIEnv *env, jclass clz, int64_t this_arg) {
86249         LDKAnchorDescriptor this_arg_conv;
86250         this_arg_conv.inner = untag_ptr(this_arg);
86251         this_arg_conv.is_owned = ptr_is_owned(this_arg);
86252         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
86253         this_arg_conv.is_owned = false;
86254         LDKTxIn* ret_ref = MALLOC(sizeof(LDKTxIn), "LDKTxIn");
86255         *ret_ref = AnchorDescriptor_unsigned_tx_input(&this_arg_conv);
86256         return tag_ptr(ret_ref, true);
86257 }
86258
86259 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AnchorDescriptor_1witness_1script(JNIEnv *env, jclass clz, int64_t this_arg) {
86260         LDKAnchorDescriptor this_arg_conv;
86261         this_arg_conv.inner = untag_ptr(this_arg);
86262         this_arg_conv.is_owned = ptr_is_owned(this_arg);
86263         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
86264         this_arg_conv.is_owned = false;
86265         LDKCVec_u8Z ret_var = AnchorDescriptor_witness_script(&this_arg_conv);
86266         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
86267         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
86268         CVec_u8Z_free(ret_var);
86269         return ret_arr;
86270 }
86271
86272 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AnchorDescriptor_1tx_1input_1witness(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray signature) {
86273         LDKAnchorDescriptor this_arg_conv;
86274         this_arg_conv.inner = untag_ptr(this_arg);
86275         this_arg_conv.is_owned = ptr_is_owned(this_arg);
86276         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
86277         this_arg_conv.is_owned = false;
86278         LDKECDSASignature signature_ref;
86279         CHECK((*env)->GetArrayLength(env, signature) == 64);
86280         (*env)->GetByteArrayRegion(env, signature, 0, 64, signature_ref.compact_form);
86281         LDKWitness ret_var = AnchorDescriptor_tx_input_witness(&this_arg_conv, signature_ref);
86282         int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
86283         (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
86284         Witness_free(ret_var);
86285         return ret_arr;
86286 }
86287
86288 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) {
86289         LDKAnchorDescriptor this_arg_conv;
86290         this_arg_conv.inner = untag_ptr(this_arg);
86291         this_arg_conv.is_owned = ptr_is_owned(this_arg);
86292         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
86293         this_arg_conv.is_owned = false;
86294         void* signer_provider_ptr = untag_ptr(signer_provider);
86295         if (ptr_is_owned(signer_provider)) { CHECK_ACCESS(signer_provider_ptr); }
86296         LDKSignerProvider* signer_provider_conv = (LDKSignerProvider*)signer_provider_ptr;
86297         LDKWriteableEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner");
86298         *ret_ret = AnchorDescriptor_derive_channel_signer(&this_arg_conv, signer_provider_conv);
86299         return tag_ptr(ret_ret, true);
86300 }
86301
86302 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BumpTransactionEvent_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
86303         if (!ptr_is_owned(this_ptr)) return;
86304         void* this_ptr_ptr = untag_ptr(this_ptr);
86305         CHECK_ACCESS(this_ptr_ptr);
86306         LDKBumpTransactionEvent this_ptr_conv = *(LDKBumpTransactionEvent*)(this_ptr_ptr);
86307         FREE(untag_ptr(this_ptr));
86308         BumpTransactionEvent_free(this_ptr_conv);
86309 }
86310
86311 static inline uint64_t BumpTransactionEvent_clone_ptr(LDKBumpTransactionEvent *NONNULL_PTR arg) {
86312         LDKBumpTransactionEvent *ret_copy = MALLOC(sizeof(LDKBumpTransactionEvent), "LDKBumpTransactionEvent");
86313         *ret_copy = BumpTransactionEvent_clone(arg);
86314         int64_t ret_ref = tag_ptr(ret_copy, true);
86315         return ret_ref;
86316 }
86317 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BumpTransactionEvent_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
86318         LDKBumpTransactionEvent* arg_conv = (LDKBumpTransactionEvent*)untag_ptr(arg);
86319         int64_t ret_conv = BumpTransactionEvent_clone_ptr(arg_conv);
86320         return ret_conv;
86321 }
86322
86323 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BumpTransactionEvent_1clone(JNIEnv *env, jclass clz, int64_t orig) {
86324         LDKBumpTransactionEvent* orig_conv = (LDKBumpTransactionEvent*)untag_ptr(orig);
86325         LDKBumpTransactionEvent *ret_copy = MALLOC(sizeof(LDKBumpTransactionEvent), "LDKBumpTransactionEvent");
86326         *ret_copy = BumpTransactionEvent_clone(orig_conv);
86327         int64_t ret_ref = tag_ptr(ret_copy, true);
86328         return ret_ref;
86329 }
86330
86331 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BumpTransactionEvent_1channel_1close(JNIEnv *env, jclass clz, int64_t channel_id, int8_tArray counterparty_node_id, int8_tArray claim_id, int32_t package_target_feerate_sat_per_1000_weight, int8_tArray commitment_tx, int64_t commitment_tx_fee_satoshis, int64_t anchor_descriptor, int64_tArray pending_htlcs) {
86332         LDKChannelId channel_id_conv;
86333         channel_id_conv.inner = untag_ptr(channel_id);
86334         channel_id_conv.is_owned = ptr_is_owned(channel_id);
86335         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_conv);
86336         channel_id_conv = ChannelId_clone(&channel_id_conv);
86337         LDKPublicKey counterparty_node_id_ref;
86338         CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
86339         (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
86340         LDKThirtyTwoBytes claim_id_ref;
86341         CHECK((*env)->GetArrayLength(env, claim_id) == 32);
86342         (*env)->GetByteArrayRegion(env, claim_id, 0, 32, claim_id_ref.data);
86343         LDKTransaction commitment_tx_ref;
86344         commitment_tx_ref.datalen = (*env)->GetArrayLength(env, commitment_tx);
86345         commitment_tx_ref.data = MALLOC(commitment_tx_ref.datalen, "LDKTransaction Bytes");
86346         (*env)->GetByteArrayRegion(env, commitment_tx, 0, commitment_tx_ref.datalen, commitment_tx_ref.data);
86347         commitment_tx_ref.data_is_owned = true;
86348         LDKAnchorDescriptor anchor_descriptor_conv;
86349         anchor_descriptor_conv.inner = untag_ptr(anchor_descriptor);
86350         anchor_descriptor_conv.is_owned = ptr_is_owned(anchor_descriptor);
86351         CHECK_INNER_FIELD_ACCESS_OR_NULL(anchor_descriptor_conv);
86352         anchor_descriptor_conv = AnchorDescriptor_clone(&anchor_descriptor_conv);
86353         LDKCVec_HTLCOutputInCommitmentZ pending_htlcs_constr;
86354         pending_htlcs_constr.datalen = (*env)->GetArrayLength(env, pending_htlcs);
86355         if (pending_htlcs_constr.datalen > 0)
86356                 pending_htlcs_constr.data = MALLOC(pending_htlcs_constr.datalen * sizeof(LDKHTLCOutputInCommitment), "LDKCVec_HTLCOutputInCommitmentZ Elements");
86357         else
86358                 pending_htlcs_constr.data = NULL;
86359         int64_t* pending_htlcs_vals = (*env)->GetLongArrayElements (env, pending_htlcs, NULL);
86360         for (size_t y = 0; y < pending_htlcs_constr.datalen; y++) {
86361                 int64_t pending_htlcs_conv_24 = pending_htlcs_vals[y];
86362                 LDKHTLCOutputInCommitment pending_htlcs_conv_24_conv;
86363                 pending_htlcs_conv_24_conv.inner = untag_ptr(pending_htlcs_conv_24);
86364                 pending_htlcs_conv_24_conv.is_owned = ptr_is_owned(pending_htlcs_conv_24);
86365                 CHECK_INNER_FIELD_ACCESS_OR_NULL(pending_htlcs_conv_24_conv);
86366                 pending_htlcs_conv_24_conv = HTLCOutputInCommitment_clone(&pending_htlcs_conv_24_conv);
86367                 pending_htlcs_constr.data[y] = pending_htlcs_conv_24_conv;
86368         }
86369         (*env)->ReleaseLongArrayElements(env, pending_htlcs, pending_htlcs_vals, 0);
86370         LDKBumpTransactionEvent *ret_copy = MALLOC(sizeof(LDKBumpTransactionEvent), "LDKBumpTransactionEvent");
86371         *ret_copy = BumpTransactionEvent_channel_close(channel_id_conv, counterparty_node_id_ref, claim_id_ref, package_target_feerate_sat_per_1000_weight, commitment_tx_ref, commitment_tx_fee_satoshis, anchor_descriptor_conv, pending_htlcs_constr);
86372         int64_t ret_ref = tag_ptr(ret_copy, true);
86373         return ret_ref;
86374 }
86375
86376 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BumpTransactionEvent_1htlcresolution(JNIEnv *env, jclass clz, int64_t channel_id, int8_tArray counterparty_node_id, int8_tArray claim_id, int32_t target_feerate_sat_per_1000_weight, int64_tArray htlc_descriptors, int32_t tx_lock_time) {
86377         LDKChannelId channel_id_conv;
86378         channel_id_conv.inner = untag_ptr(channel_id);
86379         channel_id_conv.is_owned = ptr_is_owned(channel_id);
86380         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_conv);
86381         channel_id_conv = ChannelId_clone(&channel_id_conv);
86382         LDKPublicKey counterparty_node_id_ref;
86383         CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33);
86384         (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form);
86385         LDKThirtyTwoBytes claim_id_ref;
86386         CHECK((*env)->GetArrayLength(env, claim_id) == 32);
86387         (*env)->GetByteArrayRegion(env, claim_id, 0, 32, claim_id_ref.data);
86388         LDKCVec_HTLCDescriptorZ htlc_descriptors_constr;
86389         htlc_descriptors_constr.datalen = (*env)->GetArrayLength(env, htlc_descriptors);
86390         if (htlc_descriptors_constr.datalen > 0)
86391                 htlc_descriptors_constr.data = MALLOC(htlc_descriptors_constr.datalen * sizeof(LDKHTLCDescriptor), "LDKCVec_HTLCDescriptorZ Elements");
86392         else
86393                 htlc_descriptors_constr.data = NULL;
86394         int64_t* htlc_descriptors_vals = (*env)->GetLongArrayElements (env, htlc_descriptors, NULL);
86395         for (size_t q = 0; q < htlc_descriptors_constr.datalen; q++) {
86396                 int64_t htlc_descriptors_conv_16 = htlc_descriptors_vals[q];
86397                 LDKHTLCDescriptor htlc_descriptors_conv_16_conv;
86398                 htlc_descriptors_conv_16_conv.inner = untag_ptr(htlc_descriptors_conv_16);
86399                 htlc_descriptors_conv_16_conv.is_owned = ptr_is_owned(htlc_descriptors_conv_16);
86400                 CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_descriptors_conv_16_conv);
86401                 htlc_descriptors_conv_16_conv = HTLCDescriptor_clone(&htlc_descriptors_conv_16_conv);
86402                 htlc_descriptors_constr.data[q] = htlc_descriptors_conv_16_conv;
86403         }
86404         (*env)->ReleaseLongArrayElements(env, htlc_descriptors, htlc_descriptors_vals, 0);
86405         LDKBumpTransactionEvent *ret_copy = MALLOC(sizeof(LDKBumpTransactionEvent), "LDKBumpTransactionEvent");
86406         *ret_copy = BumpTransactionEvent_htlcresolution(channel_id_conv, counterparty_node_id_ref, claim_id_ref, target_feerate_sat_per_1000_weight, htlc_descriptors_constr, tx_lock_time);
86407         int64_t ret_ref = tag_ptr(ret_copy, true);
86408         return ret_ref;
86409 }
86410
86411 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_BumpTransactionEvent_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
86412         LDKBumpTransactionEvent* a_conv = (LDKBumpTransactionEvent*)untag_ptr(a);
86413         LDKBumpTransactionEvent* b_conv = (LDKBumpTransactionEvent*)untag_ptr(b);
86414         jboolean ret_conv = BumpTransactionEvent_eq(a_conv, b_conv);
86415         return ret_conv;
86416 }
86417
86418 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Input_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
86419         LDKInput this_obj_conv;
86420         this_obj_conv.inner = untag_ptr(this_obj);
86421         this_obj_conv.is_owned = ptr_is_owned(this_obj);
86422         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
86423         Input_free(this_obj_conv);
86424 }
86425
86426 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Input_1get_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
86427         LDKInput this_ptr_conv;
86428         this_ptr_conv.inner = untag_ptr(this_ptr);
86429         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
86430         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
86431         this_ptr_conv.is_owned = false;
86432         LDKOutPoint ret_var = Input_get_outpoint(&this_ptr_conv);
86433         int64_t ret_ref = 0;
86434         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
86435         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
86436         return ret_ref;
86437 }
86438
86439 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Input_1set_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
86440         LDKInput this_ptr_conv;
86441         this_ptr_conv.inner = untag_ptr(this_ptr);
86442         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
86443         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
86444         this_ptr_conv.is_owned = false;
86445         LDKOutPoint val_conv;
86446         val_conv.inner = untag_ptr(val);
86447         val_conv.is_owned = ptr_is_owned(val);
86448         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
86449         val_conv = OutPoint_clone(&val_conv);
86450         Input_set_outpoint(&this_ptr_conv, val_conv);
86451 }
86452
86453 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Input_1get_1previous_1utxo(JNIEnv *env, jclass clz, int64_t this_ptr) {
86454         LDKInput this_ptr_conv;
86455         this_ptr_conv.inner = untag_ptr(this_ptr);
86456         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
86457         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
86458         this_ptr_conv.is_owned = false;
86459         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
86460         *ret_ref = Input_get_previous_utxo(&this_ptr_conv);
86461         return tag_ptr(ret_ref, true);
86462 }
86463
86464 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Input_1set_1previous_1utxo(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
86465         LDKInput this_ptr_conv;
86466         this_ptr_conv.inner = untag_ptr(this_ptr);
86467         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
86468         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
86469         this_ptr_conv.is_owned = false;
86470         void* val_ptr = untag_ptr(val);
86471         CHECK_ACCESS(val_ptr);
86472         LDKTxOut val_conv = *(LDKTxOut*)(val_ptr);
86473         val_conv = TxOut_clone((LDKTxOut*)untag_ptr(val));
86474         Input_set_previous_utxo(&this_ptr_conv, val_conv);
86475 }
86476
86477 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Input_1get_1satisfaction_1weight(JNIEnv *env, jclass clz, int64_t this_ptr) {
86478         LDKInput this_ptr_conv;
86479         this_ptr_conv.inner = untag_ptr(this_ptr);
86480         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
86481         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
86482         this_ptr_conv.is_owned = false;
86483         int64_t ret_conv = Input_get_satisfaction_weight(&this_ptr_conv);
86484         return ret_conv;
86485 }
86486
86487 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Input_1set_1satisfaction_1weight(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
86488         LDKInput this_ptr_conv;
86489         this_ptr_conv.inner = untag_ptr(this_ptr);
86490         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
86491         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
86492         this_ptr_conv.is_owned = false;
86493         Input_set_satisfaction_weight(&this_ptr_conv, val);
86494 }
86495
86496 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) {
86497         LDKOutPoint outpoint_arg_conv;
86498         outpoint_arg_conv.inner = untag_ptr(outpoint_arg);
86499         outpoint_arg_conv.is_owned = ptr_is_owned(outpoint_arg);
86500         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
86501         outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
86502         void* previous_utxo_arg_ptr = untag_ptr(previous_utxo_arg);
86503         CHECK_ACCESS(previous_utxo_arg_ptr);
86504         LDKTxOut previous_utxo_arg_conv = *(LDKTxOut*)(previous_utxo_arg_ptr);
86505         previous_utxo_arg_conv = TxOut_clone((LDKTxOut*)untag_ptr(previous_utxo_arg));
86506         LDKInput ret_var = Input_new(outpoint_arg_conv, previous_utxo_arg_conv, satisfaction_weight_arg);
86507         int64_t ret_ref = 0;
86508         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
86509         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
86510         return ret_ref;
86511 }
86512
86513 static inline uint64_t Input_clone_ptr(LDKInput *NONNULL_PTR arg) {
86514         LDKInput ret_var = Input_clone(arg);
86515         int64_t ret_ref = 0;
86516         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
86517         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
86518         return ret_ref;
86519 }
86520 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Input_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
86521         LDKInput arg_conv;
86522         arg_conv.inner = untag_ptr(arg);
86523         arg_conv.is_owned = ptr_is_owned(arg);
86524         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
86525         arg_conv.is_owned = false;
86526         int64_t ret_conv = Input_clone_ptr(&arg_conv);
86527         return ret_conv;
86528 }
86529
86530 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Input_1clone(JNIEnv *env, jclass clz, int64_t orig) {
86531         LDKInput orig_conv;
86532         orig_conv.inner = untag_ptr(orig);
86533         orig_conv.is_owned = ptr_is_owned(orig);
86534         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
86535         orig_conv.is_owned = false;
86536         LDKInput ret_var = Input_clone(&orig_conv);
86537         int64_t ret_ref = 0;
86538         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
86539         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
86540         return ret_ref;
86541 }
86542
86543 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Input_1hash(JNIEnv *env, jclass clz, int64_t o) {
86544         LDKInput o_conv;
86545         o_conv.inner = untag_ptr(o);
86546         o_conv.is_owned = ptr_is_owned(o);
86547         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
86548         o_conv.is_owned = false;
86549         int64_t ret_conv = Input_hash(&o_conv);
86550         return ret_conv;
86551 }
86552
86553 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Input_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
86554         LDKInput a_conv;
86555         a_conv.inner = untag_ptr(a);
86556         a_conv.is_owned = ptr_is_owned(a);
86557         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
86558         a_conv.is_owned = false;
86559         LDKInput b_conv;
86560         b_conv.inner = untag_ptr(b);
86561         b_conv.is_owned = ptr_is_owned(b);
86562         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
86563         b_conv.is_owned = false;
86564         jboolean ret_conv = Input_eq(&a_conv, &b_conv);
86565         return ret_conv;
86566 }
86567
86568 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Utxo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
86569         LDKUtxo this_obj_conv;
86570         this_obj_conv.inner = untag_ptr(this_obj);
86571         this_obj_conv.is_owned = ptr_is_owned(this_obj);
86572         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
86573         Utxo_free(this_obj_conv);
86574 }
86575
86576 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Utxo_1get_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
86577         LDKUtxo this_ptr_conv;
86578         this_ptr_conv.inner = untag_ptr(this_ptr);
86579         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
86580         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
86581         this_ptr_conv.is_owned = false;
86582         LDKOutPoint ret_var = Utxo_get_outpoint(&this_ptr_conv);
86583         int64_t ret_ref = 0;
86584         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
86585         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
86586         return ret_ref;
86587 }
86588
86589 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Utxo_1set_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
86590         LDKUtxo this_ptr_conv;
86591         this_ptr_conv.inner = untag_ptr(this_ptr);
86592         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
86593         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
86594         this_ptr_conv.is_owned = false;
86595         LDKOutPoint val_conv;
86596         val_conv.inner = untag_ptr(val);
86597         val_conv.is_owned = ptr_is_owned(val);
86598         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
86599         val_conv = OutPoint_clone(&val_conv);
86600         Utxo_set_outpoint(&this_ptr_conv, val_conv);
86601 }
86602
86603 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Utxo_1get_1output(JNIEnv *env, jclass clz, int64_t this_ptr) {
86604         LDKUtxo this_ptr_conv;
86605         this_ptr_conv.inner = untag_ptr(this_ptr);
86606         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
86607         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
86608         this_ptr_conv.is_owned = false;
86609         LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
86610         *ret_ref = Utxo_get_output(&this_ptr_conv);
86611         return tag_ptr(ret_ref, true);
86612 }
86613
86614 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Utxo_1set_1output(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
86615         LDKUtxo this_ptr_conv;
86616         this_ptr_conv.inner = untag_ptr(this_ptr);
86617         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
86618         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
86619         this_ptr_conv.is_owned = false;
86620         void* val_ptr = untag_ptr(val);
86621         CHECK_ACCESS(val_ptr);
86622         LDKTxOut val_conv = *(LDKTxOut*)(val_ptr);
86623         val_conv = TxOut_clone((LDKTxOut*)untag_ptr(val));
86624         Utxo_set_output(&this_ptr_conv, val_conv);
86625 }
86626
86627 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Utxo_1get_1satisfaction_1weight(JNIEnv *env, jclass clz, int64_t this_ptr) {
86628         LDKUtxo this_ptr_conv;
86629         this_ptr_conv.inner = untag_ptr(this_ptr);
86630         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
86631         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
86632         this_ptr_conv.is_owned = false;
86633         int64_t ret_conv = Utxo_get_satisfaction_weight(&this_ptr_conv);
86634         return ret_conv;
86635 }
86636
86637 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Utxo_1set_1satisfaction_1weight(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
86638         LDKUtxo this_ptr_conv;
86639         this_ptr_conv.inner = untag_ptr(this_ptr);
86640         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
86641         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
86642         this_ptr_conv.is_owned = false;
86643         Utxo_set_satisfaction_weight(&this_ptr_conv, val);
86644 }
86645
86646 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) {
86647         LDKOutPoint outpoint_arg_conv;
86648         outpoint_arg_conv.inner = untag_ptr(outpoint_arg);
86649         outpoint_arg_conv.is_owned = ptr_is_owned(outpoint_arg);
86650         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_arg_conv);
86651         outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
86652         void* output_arg_ptr = untag_ptr(output_arg);
86653         CHECK_ACCESS(output_arg_ptr);
86654         LDKTxOut output_arg_conv = *(LDKTxOut*)(output_arg_ptr);
86655         output_arg_conv = TxOut_clone((LDKTxOut*)untag_ptr(output_arg));
86656         LDKUtxo ret_var = Utxo_new(outpoint_arg_conv, output_arg_conv, satisfaction_weight_arg);
86657         int64_t ret_ref = 0;
86658         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
86659         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
86660         return ret_ref;
86661 }
86662
86663 static inline uint64_t Utxo_clone_ptr(LDKUtxo *NONNULL_PTR arg) {
86664         LDKUtxo ret_var = Utxo_clone(arg);
86665         int64_t ret_ref = 0;
86666         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
86667         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
86668         return ret_ref;
86669 }
86670 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Utxo_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
86671         LDKUtxo arg_conv;
86672         arg_conv.inner = untag_ptr(arg);
86673         arg_conv.is_owned = ptr_is_owned(arg);
86674         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
86675         arg_conv.is_owned = false;
86676         int64_t ret_conv = Utxo_clone_ptr(&arg_conv);
86677         return ret_conv;
86678 }
86679
86680 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Utxo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
86681         LDKUtxo orig_conv;
86682         orig_conv.inner = untag_ptr(orig);
86683         orig_conv.is_owned = ptr_is_owned(orig);
86684         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
86685         orig_conv.is_owned = false;
86686         LDKUtxo ret_var = Utxo_clone(&orig_conv);
86687         int64_t ret_ref = 0;
86688         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
86689         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
86690         return ret_ref;
86691 }
86692
86693 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Utxo_1hash(JNIEnv *env, jclass clz, int64_t o) {
86694         LDKUtxo o_conv;
86695         o_conv.inner = untag_ptr(o);
86696         o_conv.is_owned = ptr_is_owned(o);
86697         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
86698         o_conv.is_owned = false;
86699         int64_t ret_conv = Utxo_hash(&o_conv);
86700         return ret_conv;
86701 }
86702
86703 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Utxo_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
86704         LDKUtxo a_conv;
86705         a_conv.inner = untag_ptr(a);
86706         a_conv.is_owned = ptr_is_owned(a);
86707         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
86708         a_conv.is_owned = false;
86709         LDKUtxo b_conv;
86710         b_conv.inner = untag_ptr(b);
86711         b_conv.is_owned = ptr_is_owned(b);
86712         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
86713         b_conv.is_owned = false;
86714         jboolean ret_conv = Utxo_eq(&a_conv, &b_conv);
86715         return ret_conv;
86716 }
86717
86718 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) {
86719         LDKOutPoint outpoint_conv;
86720         outpoint_conv.inner = untag_ptr(outpoint);
86721         outpoint_conv.is_owned = ptr_is_owned(outpoint);
86722         CHECK_INNER_FIELD_ACCESS_OR_NULL(outpoint_conv);
86723         outpoint_conv = OutPoint_clone(&outpoint_conv);
86724         uint8_t pubkey_hash_arr[20];
86725         CHECK((*env)->GetArrayLength(env, pubkey_hash) == 20);
86726         (*env)->GetByteArrayRegion(env, pubkey_hash, 0, 20, pubkey_hash_arr);
86727         uint8_t (*pubkey_hash_ref)[20] = &pubkey_hash_arr;
86728         LDKUtxo ret_var = Utxo_new_p2pkh(outpoint_conv, value, pubkey_hash_ref);
86729         int64_t ret_ref = 0;
86730         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
86731         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
86732         return ret_ref;
86733 }
86734
86735 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CoinSelection_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
86736         LDKCoinSelection this_obj_conv;
86737         this_obj_conv.inner = untag_ptr(this_obj);
86738         this_obj_conv.is_owned = ptr_is_owned(this_obj);
86739         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
86740         CoinSelection_free(this_obj_conv);
86741 }
86742
86743 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_CoinSelection_1get_1confirmed_1utxos(JNIEnv *env, jclass clz, int64_t this_ptr) {
86744         LDKCoinSelection this_ptr_conv;
86745         this_ptr_conv.inner = untag_ptr(this_ptr);
86746         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
86747         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
86748         this_ptr_conv.is_owned = false;
86749         LDKCVec_UtxoZ ret_var = CoinSelection_get_confirmed_utxos(&this_ptr_conv);
86750         int64_tArray ret_arr = NULL;
86751         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
86752         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
86753         for (size_t g = 0; g < ret_var.datalen; g++) {
86754                 LDKUtxo ret_conv_6_var = ret_var.data[g];
86755                 int64_t ret_conv_6_ref = 0;
86756                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_6_var);
86757                 ret_conv_6_ref = tag_ptr(ret_conv_6_var.inner, ret_conv_6_var.is_owned);
86758                 ret_arr_ptr[g] = ret_conv_6_ref;
86759         }
86760         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
86761         FREE(ret_var.data);
86762         return ret_arr;
86763 }
86764
86765 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CoinSelection_1set_1confirmed_1utxos(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
86766         LDKCoinSelection this_ptr_conv;
86767         this_ptr_conv.inner = untag_ptr(this_ptr);
86768         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
86769         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
86770         this_ptr_conv.is_owned = false;
86771         LDKCVec_UtxoZ val_constr;
86772         val_constr.datalen = (*env)->GetArrayLength(env, val);
86773         if (val_constr.datalen > 0)
86774                 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUtxo), "LDKCVec_UtxoZ Elements");
86775         else
86776                 val_constr.data = NULL;
86777         int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
86778         for (size_t g = 0; g < val_constr.datalen; g++) {
86779                 int64_t val_conv_6 = val_vals[g];
86780                 LDKUtxo val_conv_6_conv;
86781                 val_conv_6_conv.inner = untag_ptr(val_conv_6);
86782                 val_conv_6_conv.is_owned = ptr_is_owned(val_conv_6);
86783                 CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_6_conv);
86784                 val_conv_6_conv = Utxo_clone(&val_conv_6_conv);
86785                 val_constr.data[g] = val_conv_6_conv;
86786         }
86787         (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
86788         CoinSelection_set_confirmed_utxos(&this_ptr_conv, val_constr);
86789 }
86790
86791 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CoinSelection_1get_1change_1output(JNIEnv *env, jclass clz, int64_t this_ptr) {
86792         LDKCoinSelection this_ptr_conv;
86793         this_ptr_conv.inner = untag_ptr(this_ptr);
86794         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
86795         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
86796         this_ptr_conv.is_owned = false;
86797         LDKCOption_TxOutZ *ret_copy = MALLOC(sizeof(LDKCOption_TxOutZ), "LDKCOption_TxOutZ");
86798         *ret_copy = CoinSelection_get_change_output(&this_ptr_conv);
86799         int64_t ret_ref = tag_ptr(ret_copy, true);
86800         return ret_ref;
86801 }
86802
86803 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CoinSelection_1set_1change_1output(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
86804         LDKCoinSelection this_ptr_conv;
86805         this_ptr_conv.inner = untag_ptr(this_ptr);
86806         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
86807         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
86808         this_ptr_conv.is_owned = false;
86809         void* val_ptr = untag_ptr(val);
86810         CHECK_ACCESS(val_ptr);
86811         LDKCOption_TxOutZ val_conv = *(LDKCOption_TxOutZ*)(val_ptr);
86812         val_conv = COption_TxOutZ_clone((LDKCOption_TxOutZ*)untag_ptr(val));
86813         CoinSelection_set_change_output(&this_ptr_conv, val_conv);
86814 }
86815
86816 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) {
86817         LDKCVec_UtxoZ confirmed_utxos_arg_constr;
86818         confirmed_utxos_arg_constr.datalen = (*env)->GetArrayLength(env, confirmed_utxos_arg);
86819         if (confirmed_utxos_arg_constr.datalen > 0)
86820                 confirmed_utxos_arg_constr.data = MALLOC(confirmed_utxos_arg_constr.datalen * sizeof(LDKUtxo), "LDKCVec_UtxoZ Elements");
86821         else
86822                 confirmed_utxos_arg_constr.data = NULL;
86823         int64_t* confirmed_utxos_arg_vals = (*env)->GetLongArrayElements (env, confirmed_utxos_arg, NULL);
86824         for (size_t g = 0; g < confirmed_utxos_arg_constr.datalen; g++) {
86825                 int64_t confirmed_utxos_arg_conv_6 = confirmed_utxos_arg_vals[g];
86826                 LDKUtxo confirmed_utxos_arg_conv_6_conv;
86827                 confirmed_utxos_arg_conv_6_conv.inner = untag_ptr(confirmed_utxos_arg_conv_6);
86828                 confirmed_utxos_arg_conv_6_conv.is_owned = ptr_is_owned(confirmed_utxos_arg_conv_6);
86829                 CHECK_INNER_FIELD_ACCESS_OR_NULL(confirmed_utxos_arg_conv_6_conv);
86830                 confirmed_utxos_arg_conv_6_conv = Utxo_clone(&confirmed_utxos_arg_conv_6_conv);
86831                 confirmed_utxos_arg_constr.data[g] = confirmed_utxos_arg_conv_6_conv;
86832         }
86833         (*env)->ReleaseLongArrayElements(env, confirmed_utxos_arg, confirmed_utxos_arg_vals, 0);
86834         void* change_output_arg_ptr = untag_ptr(change_output_arg);
86835         CHECK_ACCESS(change_output_arg_ptr);
86836         LDKCOption_TxOutZ change_output_arg_conv = *(LDKCOption_TxOutZ*)(change_output_arg_ptr);
86837         change_output_arg_conv = COption_TxOutZ_clone((LDKCOption_TxOutZ*)untag_ptr(change_output_arg));
86838         LDKCoinSelection ret_var = CoinSelection_new(confirmed_utxos_arg_constr, change_output_arg_conv);
86839         int64_t ret_ref = 0;
86840         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
86841         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
86842         return ret_ref;
86843 }
86844
86845 static inline uint64_t CoinSelection_clone_ptr(LDKCoinSelection *NONNULL_PTR arg) {
86846         LDKCoinSelection ret_var = CoinSelection_clone(arg);
86847         int64_t ret_ref = 0;
86848         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
86849         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
86850         return ret_ref;
86851 }
86852 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CoinSelection_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
86853         LDKCoinSelection arg_conv;
86854         arg_conv.inner = untag_ptr(arg);
86855         arg_conv.is_owned = ptr_is_owned(arg);
86856         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
86857         arg_conv.is_owned = false;
86858         int64_t ret_conv = CoinSelection_clone_ptr(&arg_conv);
86859         return ret_conv;
86860 }
86861
86862 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CoinSelection_1clone(JNIEnv *env, jclass clz, int64_t orig) {
86863         LDKCoinSelection orig_conv;
86864         orig_conv.inner = untag_ptr(orig);
86865         orig_conv.is_owned = ptr_is_owned(orig);
86866         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
86867         orig_conv.is_owned = false;
86868         LDKCoinSelection ret_var = CoinSelection_clone(&orig_conv);
86869         int64_t ret_ref = 0;
86870         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
86871         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
86872         return ret_ref;
86873 }
86874
86875 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CoinSelectionSource_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
86876         if (!ptr_is_owned(this_ptr)) return;
86877         void* this_ptr_ptr = untag_ptr(this_ptr);
86878         CHECK_ACCESS(this_ptr_ptr);
86879         LDKCoinSelectionSource this_ptr_conv = *(LDKCoinSelectionSource*)(this_ptr_ptr);
86880         FREE(untag_ptr(this_ptr));
86881         CoinSelectionSource_free(this_ptr_conv);
86882 }
86883
86884 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WalletSource_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
86885         if (!ptr_is_owned(this_ptr)) return;
86886         void* this_ptr_ptr = untag_ptr(this_ptr);
86887         CHECK_ACCESS(this_ptr_ptr);
86888         LDKWalletSource this_ptr_conv = *(LDKWalletSource*)(this_ptr_ptr);
86889         FREE(untag_ptr(this_ptr));
86890         WalletSource_free(this_ptr_conv);
86891 }
86892
86893 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Wallet_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
86894         LDKWallet this_obj_conv;
86895         this_obj_conv.inner = untag_ptr(this_obj);
86896         this_obj_conv.is_owned = ptr_is_owned(this_obj);
86897         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
86898         Wallet_free(this_obj_conv);
86899 }
86900
86901 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Wallet_1new(JNIEnv *env, jclass clz, int64_t source, int64_t logger) {
86902         void* source_ptr = untag_ptr(source);
86903         CHECK_ACCESS(source_ptr);
86904         LDKWalletSource source_conv = *(LDKWalletSource*)(source_ptr);
86905         if (source_conv.free == LDKWalletSource_JCalls_free) {
86906                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
86907                 LDKWalletSource_JCalls_cloned(&source_conv);
86908         }
86909         void* logger_ptr = untag_ptr(logger);
86910         CHECK_ACCESS(logger_ptr);
86911         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
86912         if (logger_conv.free == LDKLogger_JCalls_free) {
86913                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
86914                 LDKLogger_JCalls_cloned(&logger_conv);
86915         }
86916         LDKWallet ret_var = Wallet_new(source_conv, logger_conv);
86917         int64_t ret_ref = 0;
86918         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
86919         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
86920         return ret_ref;
86921 }
86922
86923 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Wallet_1as_1CoinSelectionSource(JNIEnv *env, jclass clz, int64_t this_arg) {
86924         LDKWallet this_arg_conv;
86925         this_arg_conv.inner = untag_ptr(this_arg);
86926         this_arg_conv.is_owned = ptr_is_owned(this_arg);
86927         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
86928         this_arg_conv.is_owned = false;
86929         LDKCoinSelectionSource* ret_ret = MALLOC(sizeof(LDKCoinSelectionSource), "LDKCoinSelectionSource");
86930         *ret_ret = Wallet_as_CoinSelectionSource(&this_arg_conv);
86931         return tag_ptr(ret_ret, true);
86932 }
86933
86934 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BumpTransactionEventHandler_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
86935         LDKBumpTransactionEventHandler this_obj_conv;
86936         this_obj_conv.inner = untag_ptr(this_obj);
86937         this_obj_conv.is_owned = ptr_is_owned(this_obj);
86938         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
86939         BumpTransactionEventHandler_free(this_obj_conv);
86940 }
86941
86942 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) {
86943         void* broadcaster_ptr = untag_ptr(broadcaster);
86944         CHECK_ACCESS(broadcaster_ptr);
86945         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr);
86946         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
86947                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
86948                 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
86949         }
86950         void* utxo_source_ptr = untag_ptr(utxo_source);
86951         CHECK_ACCESS(utxo_source_ptr);
86952         LDKCoinSelectionSource utxo_source_conv = *(LDKCoinSelectionSource*)(utxo_source_ptr);
86953         if (utxo_source_conv.free == LDKCoinSelectionSource_JCalls_free) {
86954                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
86955                 LDKCoinSelectionSource_JCalls_cloned(&utxo_source_conv);
86956         }
86957         void* signer_provider_ptr = untag_ptr(signer_provider);
86958         CHECK_ACCESS(signer_provider_ptr);
86959         LDKSignerProvider signer_provider_conv = *(LDKSignerProvider*)(signer_provider_ptr);
86960         if (signer_provider_conv.free == LDKSignerProvider_JCalls_free) {
86961                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
86962                 LDKSignerProvider_JCalls_cloned(&signer_provider_conv);
86963         }
86964         void* logger_ptr = untag_ptr(logger);
86965         CHECK_ACCESS(logger_ptr);
86966         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
86967         if (logger_conv.free == LDKLogger_JCalls_free) {
86968                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
86969                 LDKLogger_JCalls_cloned(&logger_conv);
86970         }
86971         LDKBumpTransactionEventHandler ret_var = BumpTransactionEventHandler_new(broadcaster_conv, utxo_source_conv, signer_provider_conv, logger_conv);
86972         int64_t ret_ref = 0;
86973         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
86974         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
86975         return ret_ref;
86976 }
86977
86978 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BumpTransactionEventHandler_1handle_1event(JNIEnv *env, jclass clz, int64_t this_arg, int64_t event) {
86979         LDKBumpTransactionEventHandler this_arg_conv;
86980         this_arg_conv.inner = untag_ptr(this_arg);
86981         this_arg_conv.is_owned = ptr_is_owned(this_arg);
86982         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
86983         this_arg_conv.is_owned = false;
86984         LDKBumpTransactionEvent* event_conv = (LDKBumpTransactionEvent*)untag_ptr(event);
86985         BumpTransactionEventHandler_handle_event(&this_arg_conv, event_conv);
86986 }
86987
86988 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FilesystemStore_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
86989         LDKFilesystemStore this_obj_conv;
86990         this_obj_conv.inner = untag_ptr(this_obj);
86991         this_obj_conv.is_owned = ptr_is_owned(this_obj);
86992         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
86993         FilesystemStore_free(this_obj_conv);
86994 }
86995
86996 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FilesystemStore_1new(JNIEnv *env, jclass clz, jstring data_dir) {
86997         LDKStr data_dir_conv = java_to_owned_str(env, data_dir);
86998         LDKFilesystemStore ret_var = FilesystemStore_new(data_dir_conv);
86999         int64_t ret_ref = 0;
87000         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
87001         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
87002         return ret_ref;
87003 }
87004
87005 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_FilesystemStore_1get_1data_1dir(JNIEnv *env, jclass clz, int64_t this_arg) {
87006         LDKFilesystemStore this_arg_conv;
87007         this_arg_conv.inner = untag_ptr(this_arg);
87008         this_arg_conv.is_owned = ptr_is_owned(this_arg);
87009         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
87010         this_arg_conv.is_owned = false;
87011         LDKStr ret_str = FilesystemStore_get_data_dir(&this_arg_conv);
87012         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
87013         Str_free(ret_str);
87014         return ret_conv;
87015 }
87016
87017 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FilesystemStore_1as_1KVStore(JNIEnv *env, jclass clz, int64_t this_arg) {
87018         LDKFilesystemStore this_arg_conv;
87019         this_arg_conv.inner = untag_ptr(this_arg);
87020         this_arg_conv.is_owned = ptr_is_owned(this_arg);
87021         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
87022         this_arg_conv.is_owned = false;
87023         LDKKVStore* ret_ret = MALLOC(sizeof(LDKKVStore), "LDKKVStore");
87024         *ret_ret = FilesystemStore_as_KVStore(&this_arg_conv);
87025         return tag_ptr(ret_ret, true);
87026 }
87027
87028 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BackgroundProcessor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
87029         LDKBackgroundProcessor this_obj_conv;
87030         this_obj_conv.inner = untag_ptr(this_obj);
87031         this_obj_conv.is_owned = ptr_is_owned(this_obj);
87032         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
87033         BackgroundProcessor_free(this_obj_conv);
87034 }
87035
87036 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipSync_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
87037         if (!ptr_is_owned(this_ptr)) return;
87038         void* this_ptr_ptr = untag_ptr(this_ptr);
87039         CHECK_ACCESS(this_ptr_ptr);
87040         LDKGossipSync this_ptr_conv = *(LDKGossipSync*)(this_ptr_ptr);
87041         FREE(untag_ptr(this_ptr));
87042         GossipSync_free(this_ptr_conv);
87043 }
87044
87045 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GossipSync_1p2_1p(JNIEnv *env, jclass clz, int64_t a) {
87046         LDKP2PGossipSync a_conv;
87047         a_conv.inner = untag_ptr(a);
87048         a_conv.is_owned = ptr_is_owned(a);
87049         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
87050         a_conv.is_owned = false;
87051         LDKGossipSync *ret_copy = MALLOC(sizeof(LDKGossipSync), "LDKGossipSync");
87052         *ret_copy = GossipSync_p2_p(&a_conv);
87053         int64_t ret_ref = tag_ptr(ret_copy, true);
87054         return ret_ref;
87055 }
87056
87057 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GossipSync_1rapid(JNIEnv *env, jclass clz, int64_t a) {
87058         LDKRapidGossipSync a_conv;
87059         a_conv.inner = untag_ptr(a);
87060         a_conv.is_owned = ptr_is_owned(a);
87061         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
87062         a_conv.is_owned = false;
87063         LDKGossipSync *ret_copy = MALLOC(sizeof(LDKGossipSync), "LDKGossipSync");
87064         *ret_copy = GossipSync_rapid(&a_conv);
87065         int64_t ret_ref = tag_ptr(ret_copy, true);
87066         return ret_ref;
87067 }
87068
87069 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GossipSync_1none(JNIEnv *env, jclass clz) {
87070         LDKGossipSync *ret_copy = MALLOC(sizeof(LDKGossipSync), "LDKGossipSync");
87071         *ret_copy = GossipSync_none();
87072         int64_t ret_ref = tag_ptr(ret_copy, true);
87073         return ret_ref;
87074 }
87075
87076 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) {
87077         void* persister_ptr = untag_ptr(persister);
87078         CHECK_ACCESS(persister_ptr);
87079         LDKPersister persister_conv = *(LDKPersister*)(persister_ptr);
87080         if (persister_conv.free == LDKPersister_JCalls_free) {
87081                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
87082                 LDKPersister_JCalls_cloned(&persister_conv);
87083         }
87084         void* event_handler_ptr = untag_ptr(event_handler);
87085         CHECK_ACCESS(event_handler_ptr);
87086         LDKEventHandler event_handler_conv = *(LDKEventHandler*)(event_handler_ptr);
87087         if (event_handler_conv.free == LDKEventHandler_JCalls_free) {
87088                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
87089                 LDKEventHandler_JCalls_cloned(&event_handler_conv);
87090         }
87091         LDKChainMonitor chain_monitor_conv;
87092         chain_monitor_conv.inner = untag_ptr(chain_monitor);
87093         chain_monitor_conv.is_owned = ptr_is_owned(chain_monitor);
87094         CHECK_INNER_FIELD_ACCESS_OR_NULL(chain_monitor_conv);
87095         chain_monitor_conv.is_owned = false;
87096         LDKChannelManager channel_manager_conv;
87097         channel_manager_conv.inner = untag_ptr(channel_manager);
87098         channel_manager_conv.is_owned = ptr_is_owned(channel_manager);
87099         CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_manager_conv);
87100         channel_manager_conv.is_owned = false;
87101         void* gossip_sync_ptr = untag_ptr(gossip_sync);
87102         CHECK_ACCESS(gossip_sync_ptr);
87103         LDKGossipSync gossip_sync_conv = *(LDKGossipSync*)(gossip_sync_ptr);
87104         // WARNING: we may need a move here but no clone is available for LDKGossipSync
87105         LDKPeerManager peer_manager_conv;
87106         peer_manager_conv.inner = untag_ptr(peer_manager);
87107         peer_manager_conv.is_owned = ptr_is_owned(peer_manager);
87108         CHECK_INNER_FIELD_ACCESS_OR_NULL(peer_manager_conv);
87109         peer_manager_conv.is_owned = false;
87110         void* logger_ptr = untag_ptr(logger);
87111         CHECK_ACCESS(logger_ptr);
87112         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
87113         if (logger_conv.free == LDKLogger_JCalls_free) {
87114                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
87115                 LDKLogger_JCalls_cloned(&logger_conv);
87116         }
87117         void* scorer_ptr = untag_ptr(scorer);
87118         CHECK_ACCESS(scorer_ptr);
87119         LDKCOption_WriteableScoreZ scorer_conv = *(LDKCOption_WriteableScoreZ*)(scorer_ptr);
87120         // WARNING: we may need a move here but no clone is available for LDKCOption_WriteableScoreZ
87121         if (scorer_conv.tag == LDKCOption_WriteableScoreZ_Some) {
87122                 // Manually implement clone for Java trait instances
87123                 if (scorer_conv.some.free == LDKWriteableScore_JCalls_free) {
87124                         // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
87125                         LDKWriteableScore_JCalls_cloned(&scorer_conv.some);
87126                 }
87127         }
87128         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);
87129         int64_t ret_ref = 0;
87130         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
87131         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
87132         return ret_ref;
87133 }
87134
87135 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BackgroundProcessor_1join(JNIEnv *env, jclass clz, int64_t this_arg) {
87136         LDKBackgroundProcessor this_arg_conv;
87137         this_arg_conv.inner = untag_ptr(this_arg);
87138         this_arg_conv.is_owned = ptr_is_owned(this_arg);
87139         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
87140         // WARNING: we need a move here but no clone is available for LDKBackgroundProcessor
87141         
87142         LDKCResult_NoneIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneIOErrorZ), "LDKCResult_NoneIOErrorZ");
87143         *ret_conv = BackgroundProcessor_join(this_arg_conv);
87144         return tag_ptr(ret_conv, true);
87145 }
87146
87147 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BackgroundProcessor_1stop(JNIEnv *env, jclass clz, int64_t this_arg) {
87148         LDKBackgroundProcessor this_arg_conv;
87149         this_arg_conv.inner = untag_ptr(this_arg);
87150         this_arg_conv.is_owned = ptr_is_owned(this_arg);
87151         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
87152         // WARNING: we need a move here but no clone is available for LDKBackgroundProcessor
87153         
87154         LDKCResult_NoneIOErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneIOErrorZ), "LDKCResult_NoneIOErrorZ");
87155         *ret_conv = BackgroundProcessor_stop(this_arg_conv);
87156         return tag_ptr(ret_conv, true);
87157 }
87158
87159 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Bolt11ParseError_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
87160         if (!ptr_is_owned(this_ptr)) return;
87161         void* this_ptr_ptr = untag_ptr(this_ptr);
87162         CHECK_ACCESS(this_ptr_ptr);
87163         LDKBolt11ParseError this_ptr_conv = *(LDKBolt11ParseError*)(this_ptr_ptr);
87164         FREE(untag_ptr(this_ptr));
87165         Bolt11ParseError_free(this_ptr_conv);
87166 }
87167
87168 static inline uint64_t Bolt11ParseError_clone_ptr(LDKBolt11ParseError *NONNULL_PTR arg) {
87169         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
87170         *ret_copy = Bolt11ParseError_clone(arg);
87171         int64_t ret_ref = tag_ptr(ret_copy, true);
87172         return ret_ref;
87173 }
87174 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11ParseError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
87175         LDKBolt11ParseError* arg_conv = (LDKBolt11ParseError*)untag_ptr(arg);
87176         int64_t ret_conv = Bolt11ParseError_clone_ptr(arg_conv);
87177         return ret_conv;
87178 }
87179
87180 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11ParseError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
87181         LDKBolt11ParseError* orig_conv = (LDKBolt11ParseError*)untag_ptr(orig);
87182         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
87183         *ret_copy = Bolt11ParseError_clone(orig_conv);
87184         int64_t ret_ref = tag_ptr(ret_copy, true);
87185         return ret_ref;
87186 }
87187
87188 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11ParseError_1bech32_1error(JNIEnv *env, jclass clz, int64_t a) {
87189         void* a_ptr = untag_ptr(a);
87190         CHECK_ACCESS(a_ptr);
87191         LDKBech32Error a_conv = *(LDKBech32Error*)(a_ptr);
87192         a_conv = Bech32Error_clone((LDKBech32Error*)untag_ptr(a));
87193         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
87194         *ret_copy = Bolt11ParseError_bech32_error(a_conv);
87195         int64_t ret_ref = tag_ptr(ret_copy, true);
87196         return ret_ref;
87197 }
87198
87199 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11ParseError_1parse_1amount_1error(JNIEnv *env, jclass clz, int32_t a) {
87200         
87201         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
87202         *ret_copy = Bolt11ParseError_parse_amount_error((LDKError){ ._dummy = 0 });
87203         int64_t ret_ref = tag_ptr(ret_copy, true);
87204         return ret_ref;
87205 }
87206
87207 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11ParseError_1malformed_1signature(JNIEnv *env, jclass clz, jclass a) {
87208         LDKSecp256k1Error a_conv = LDKSecp256k1Error_from_java(env, a);
87209         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
87210         *ret_copy = Bolt11ParseError_malformed_signature(a_conv);
87211         int64_t ret_ref = tag_ptr(ret_copy, true);
87212         return ret_ref;
87213 }
87214
87215 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11ParseError_1bad_1prefix(JNIEnv *env, jclass clz) {
87216         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
87217         *ret_copy = Bolt11ParseError_bad_prefix();
87218         int64_t ret_ref = tag_ptr(ret_copy, true);
87219         return ret_ref;
87220 }
87221
87222 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11ParseError_1unknown_1currency(JNIEnv *env, jclass clz) {
87223         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
87224         *ret_copy = Bolt11ParseError_unknown_currency();
87225         int64_t ret_ref = tag_ptr(ret_copy, true);
87226         return ret_ref;
87227 }
87228
87229 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11ParseError_1unknown_1si_1prefix(JNIEnv *env, jclass clz) {
87230         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
87231         *ret_copy = Bolt11ParseError_unknown_si_prefix();
87232         int64_t ret_ref = tag_ptr(ret_copy, true);
87233         return ret_ref;
87234 }
87235
87236 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11ParseError_1malformed_1hrp(JNIEnv *env, jclass clz) {
87237         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
87238         *ret_copy = Bolt11ParseError_malformed_hrp();
87239         int64_t ret_ref = tag_ptr(ret_copy, true);
87240         return ret_ref;
87241 }
87242
87243 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11ParseError_1too_1short_1data_1part(JNIEnv *env, jclass clz) {
87244         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
87245         *ret_copy = Bolt11ParseError_too_short_data_part();
87246         int64_t ret_ref = tag_ptr(ret_copy, true);
87247         return ret_ref;
87248 }
87249
87250 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11ParseError_1unexpected_1end_1of_1tagged_1fields(JNIEnv *env, jclass clz) {
87251         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
87252         *ret_copy = Bolt11ParseError_unexpected_end_of_tagged_fields();
87253         int64_t ret_ref = tag_ptr(ret_copy, true);
87254         return ret_ref;
87255 }
87256
87257 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11ParseError_1description_1decode_1error(JNIEnv *env, jclass clz, int32_t a) {
87258         
87259         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
87260         *ret_copy = Bolt11ParseError_description_decode_error((LDKError){ ._dummy = 0 });
87261         int64_t ret_ref = tag_ptr(ret_copy, true);
87262         return ret_ref;
87263 }
87264
87265 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11ParseError_1padding_1error(JNIEnv *env, jclass clz) {
87266         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
87267         *ret_copy = Bolt11ParseError_padding_error();
87268         int64_t ret_ref = tag_ptr(ret_copy, true);
87269         return ret_ref;
87270 }
87271
87272 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11ParseError_1integer_1overflow_1error(JNIEnv *env, jclass clz) {
87273         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
87274         *ret_copy = Bolt11ParseError_integer_overflow_error();
87275         int64_t ret_ref = tag_ptr(ret_copy, true);
87276         return ret_ref;
87277 }
87278
87279 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11ParseError_1invalid_1seg_1wit_1program_1length(JNIEnv *env, jclass clz) {
87280         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
87281         *ret_copy = Bolt11ParseError_invalid_seg_wit_program_length();
87282         int64_t ret_ref = tag_ptr(ret_copy, true);
87283         return ret_ref;
87284 }
87285
87286 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11ParseError_1invalid_1pub_1key_1hash_1length(JNIEnv *env, jclass clz) {
87287         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
87288         *ret_copy = Bolt11ParseError_invalid_pub_key_hash_length();
87289         int64_t ret_ref = tag_ptr(ret_copy, true);
87290         return ret_ref;
87291 }
87292
87293 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11ParseError_1invalid_1script_1hash_1length(JNIEnv *env, jclass clz) {
87294         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
87295         *ret_copy = Bolt11ParseError_invalid_script_hash_length();
87296         int64_t ret_ref = tag_ptr(ret_copy, true);
87297         return ret_ref;
87298 }
87299
87300 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11ParseError_1invalid_1recovery_1id(JNIEnv *env, jclass clz) {
87301         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
87302         *ret_copy = Bolt11ParseError_invalid_recovery_id();
87303         int64_t ret_ref = tag_ptr(ret_copy, true);
87304         return ret_ref;
87305 }
87306
87307 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11ParseError_1invalid_1slice_1length(JNIEnv *env, jclass clz, jstring a) {
87308         LDKStr a_conv = java_to_owned_str(env, a);
87309         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
87310         *ret_copy = Bolt11ParseError_invalid_slice_length(a_conv);
87311         int64_t ret_ref = tag_ptr(ret_copy, true);
87312         return ret_ref;
87313 }
87314
87315 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11ParseError_1skip(JNIEnv *env, jclass clz) {
87316         LDKBolt11ParseError *ret_copy = MALLOC(sizeof(LDKBolt11ParseError), "LDKBolt11ParseError");
87317         *ret_copy = Bolt11ParseError_skip();
87318         int64_t ret_ref = tag_ptr(ret_copy, true);
87319         return ret_ref;
87320 }
87321
87322 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt11ParseError_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
87323         LDKBolt11ParseError* a_conv = (LDKBolt11ParseError*)untag_ptr(a);
87324         LDKBolt11ParseError* b_conv = (LDKBolt11ParseError*)untag_ptr(b);
87325         jboolean ret_conv = Bolt11ParseError_eq(a_conv, b_conv);
87326         return ret_conv;
87327 }
87328
87329 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ParseOrSemanticError_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
87330         if (!ptr_is_owned(this_ptr)) return;
87331         void* this_ptr_ptr = untag_ptr(this_ptr);
87332         CHECK_ACCESS(this_ptr_ptr);
87333         LDKParseOrSemanticError this_ptr_conv = *(LDKParseOrSemanticError*)(this_ptr_ptr);
87334         FREE(untag_ptr(this_ptr));
87335         ParseOrSemanticError_free(this_ptr_conv);
87336 }
87337
87338 static inline uint64_t ParseOrSemanticError_clone_ptr(LDKParseOrSemanticError *NONNULL_PTR arg) {
87339         LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
87340         *ret_copy = ParseOrSemanticError_clone(arg);
87341         int64_t ret_ref = tag_ptr(ret_copy, true);
87342         return ret_ref;
87343 }
87344 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseOrSemanticError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
87345         LDKParseOrSemanticError* arg_conv = (LDKParseOrSemanticError*)untag_ptr(arg);
87346         int64_t ret_conv = ParseOrSemanticError_clone_ptr(arg_conv);
87347         return ret_conv;
87348 }
87349
87350 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseOrSemanticError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
87351         LDKParseOrSemanticError* orig_conv = (LDKParseOrSemanticError*)untag_ptr(orig);
87352         LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
87353         *ret_copy = ParseOrSemanticError_clone(orig_conv);
87354         int64_t ret_ref = tag_ptr(ret_copy, true);
87355         return ret_ref;
87356 }
87357
87358 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseOrSemanticError_1parse_1error(JNIEnv *env, jclass clz, int64_t a) {
87359         void* a_ptr = untag_ptr(a);
87360         CHECK_ACCESS(a_ptr);
87361         LDKBolt11ParseError a_conv = *(LDKBolt11ParseError*)(a_ptr);
87362         a_conv = Bolt11ParseError_clone((LDKBolt11ParseError*)untag_ptr(a));
87363         LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
87364         *ret_copy = ParseOrSemanticError_parse_error(a_conv);
87365         int64_t ret_ref = tag_ptr(ret_copy, true);
87366         return ret_ref;
87367 }
87368
87369 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseOrSemanticError_1semantic_1error(JNIEnv *env, jclass clz, jclass a) {
87370         LDKBolt11SemanticError a_conv = LDKBolt11SemanticError_from_java(env, a);
87371         LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError");
87372         *ret_copy = ParseOrSemanticError_semantic_error(a_conv);
87373         int64_t ret_ref = tag_ptr(ret_copy, true);
87374         return ret_ref;
87375 }
87376
87377 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ParseOrSemanticError_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
87378         LDKParseOrSemanticError* a_conv = (LDKParseOrSemanticError*)untag_ptr(a);
87379         LDKParseOrSemanticError* b_conv = (LDKParseOrSemanticError*)untag_ptr(b);
87380         jboolean ret_conv = ParseOrSemanticError_eq(a_conv, b_conv);
87381         return ret_conv;
87382 }
87383
87384 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
87385         LDKBolt11Invoice this_obj_conv;
87386         this_obj_conv.inner = untag_ptr(this_obj);
87387         this_obj_conv.is_owned = ptr_is_owned(this_obj);
87388         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
87389         Bolt11Invoice_free(this_obj_conv);
87390 }
87391
87392 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
87393         LDKBolt11Invoice a_conv;
87394         a_conv.inner = untag_ptr(a);
87395         a_conv.is_owned = ptr_is_owned(a);
87396         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
87397         a_conv.is_owned = false;
87398         LDKBolt11Invoice b_conv;
87399         b_conv.inner = untag_ptr(b);
87400         b_conv.is_owned = ptr_is_owned(b);
87401         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
87402         b_conv.is_owned = false;
87403         jboolean ret_conv = Bolt11Invoice_eq(&a_conv, &b_conv);
87404         return ret_conv;
87405 }
87406
87407 static inline uint64_t Bolt11Invoice_clone_ptr(LDKBolt11Invoice *NONNULL_PTR arg) {
87408         LDKBolt11Invoice ret_var = Bolt11Invoice_clone(arg);
87409         int64_t ret_ref = 0;
87410         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
87411         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
87412         return ret_ref;
87413 }
87414 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
87415         LDKBolt11Invoice arg_conv;
87416         arg_conv.inner = untag_ptr(arg);
87417         arg_conv.is_owned = ptr_is_owned(arg);
87418         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
87419         arg_conv.is_owned = false;
87420         int64_t ret_conv = Bolt11Invoice_clone_ptr(&arg_conv);
87421         return ret_conv;
87422 }
87423
87424 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1clone(JNIEnv *env, jclass clz, int64_t orig) {
87425         LDKBolt11Invoice orig_conv;
87426         orig_conv.inner = untag_ptr(orig);
87427         orig_conv.is_owned = ptr_is_owned(orig);
87428         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
87429         orig_conv.is_owned = false;
87430         LDKBolt11Invoice ret_var = Bolt11Invoice_clone(&orig_conv);
87431         int64_t ret_ref = 0;
87432         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
87433         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
87434         return ret_ref;
87435 }
87436
87437 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1hash(JNIEnv *env, jclass clz, int64_t o) {
87438         LDKBolt11Invoice o_conv;
87439         o_conv.inner = untag_ptr(o);
87440         o_conv.is_owned = ptr_is_owned(o);
87441         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
87442         o_conv.is_owned = false;
87443         int64_t ret_conv = Bolt11Invoice_hash(&o_conv);
87444         return ret_conv;
87445 }
87446
87447 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SignedRawBolt11Invoice_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
87448         LDKSignedRawBolt11Invoice this_obj_conv;
87449         this_obj_conv.inner = untag_ptr(this_obj);
87450         this_obj_conv.is_owned = ptr_is_owned(this_obj);
87451         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
87452         SignedRawBolt11Invoice_free(this_obj_conv);
87453 }
87454
87455 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_SignedRawBolt11Invoice_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
87456         LDKSignedRawBolt11Invoice a_conv;
87457         a_conv.inner = untag_ptr(a);
87458         a_conv.is_owned = ptr_is_owned(a);
87459         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
87460         a_conv.is_owned = false;
87461         LDKSignedRawBolt11Invoice b_conv;
87462         b_conv.inner = untag_ptr(b);
87463         b_conv.is_owned = ptr_is_owned(b);
87464         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
87465         b_conv.is_owned = false;
87466         jboolean ret_conv = SignedRawBolt11Invoice_eq(&a_conv, &b_conv);
87467         return ret_conv;
87468 }
87469
87470 static inline uint64_t SignedRawBolt11Invoice_clone_ptr(LDKSignedRawBolt11Invoice *NONNULL_PTR arg) {
87471         LDKSignedRawBolt11Invoice ret_var = SignedRawBolt11Invoice_clone(arg);
87472         int64_t ret_ref = 0;
87473         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
87474         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
87475         return ret_ref;
87476 }
87477 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawBolt11Invoice_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
87478         LDKSignedRawBolt11Invoice arg_conv;
87479         arg_conv.inner = untag_ptr(arg);
87480         arg_conv.is_owned = ptr_is_owned(arg);
87481         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
87482         arg_conv.is_owned = false;
87483         int64_t ret_conv = SignedRawBolt11Invoice_clone_ptr(&arg_conv);
87484         return ret_conv;
87485 }
87486
87487 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawBolt11Invoice_1clone(JNIEnv *env, jclass clz, int64_t orig) {
87488         LDKSignedRawBolt11Invoice orig_conv;
87489         orig_conv.inner = untag_ptr(orig);
87490         orig_conv.is_owned = ptr_is_owned(orig);
87491         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
87492         orig_conv.is_owned = false;
87493         LDKSignedRawBolt11Invoice ret_var = SignedRawBolt11Invoice_clone(&orig_conv);
87494         int64_t ret_ref = 0;
87495         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
87496         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
87497         return ret_ref;
87498 }
87499
87500 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawBolt11Invoice_1hash(JNIEnv *env, jclass clz, int64_t o) {
87501         LDKSignedRawBolt11Invoice o_conv;
87502         o_conv.inner = untag_ptr(o);
87503         o_conv.is_owned = ptr_is_owned(o);
87504         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
87505         o_conv.is_owned = false;
87506         int64_t ret_conv = SignedRawBolt11Invoice_hash(&o_conv);
87507         return ret_conv;
87508 }
87509
87510 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RawBolt11Invoice_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
87511         LDKRawBolt11Invoice this_obj_conv;
87512         this_obj_conv.inner = untag_ptr(this_obj);
87513         this_obj_conv.is_owned = ptr_is_owned(this_obj);
87514         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
87515         RawBolt11Invoice_free(this_obj_conv);
87516 }
87517
87518 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawBolt11Invoice_1get_1data(JNIEnv *env, jclass clz, int64_t this_ptr) {
87519         LDKRawBolt11Invoice this_ptr_conv;
87520         this_ptr_conv.inner = untag_ptr(this_ptr);
87521         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
87522         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
87523         this_ptr_conv.is_owned = false;
87524         LDKRawDataPart ret_var = RawBolt11Invoice_get_data(&this_ptr_conv);
87525         int64_t ret_ref = 0;
87526         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
87527         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
87528         return ret_ref;
87529 }
87530
87531 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RawBolt11Invoice_1set_1data(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
87532         LDKRawBolt11Invoice this_ptr_conv;
87533         this_ptr_conv.inner = untag_ptr(this_ptr);
87534         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
87535         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
87536         this_ptr_conv.is_owned = false;
87537         LDKRawDataPart val_conv;
87538         val_conv.inner = untag_ptr(val);
87539         val_conv.is_owned = ptr_is_owned(val);
87540         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
87541         val_conv = RawDataPart_clone(&val_conv);
87542         RawBolt11Invoice_set_data(&this_ptr_conv, val_conv);
87543 }
87544
87545 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RawBolt11Invoice_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
87546         LDKRawBolt11Invoice a_conv;
87547         a_conv.inner = untag_ptr(a);
87548         a_conv.is_owned = ptr_is_owned(a);
87549         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
87550         a_conv.is_owned = false;
87551         LDKRawBolt11Invoice b_conv;
87552         b_conv.inner = untag_ptr(b);
87553         b_conv.is_owned = ptr_is_owned(b);
87554         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
87555         b_conv.is_owned = false;
87556         jboolean ret_conv = RawBolt11Invoice_eq(&a_conv, &b_conv);
87557         return ret_conv;
87558 }
87559
87560 static inline uint64_t RawBolt11Invoice_clone_ptr(LDKRawBolt11Invoice *NONNULL_PTR arg) {
87561         LDKRawBolt11Invoice ret_var = RawBolt11Invoice_clone(arg);
87562         int64_t ret_ref = 0;
87563         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
87564         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
87565         return ret_ref;
87566 }
87567 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawBolt11Invoice_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
87568         LDKRawBolt11Invoice arg_conv;
87569         arg_conv.inner = untag_ptr(arg);
87570         arg_conv.is_owned = ptr_is_owned(arg);
87571         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
87572         arg_conv.is_owned = false;
87573         int64_t ret_conv = RawBolt11Invoice_clone_ptr(&arg_conv);
87574         return ret_conv;
87575 }
87576
87577 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawBolt11Invoice_1clone(JNIEnv *env, jclass clz, int64_t orig) {
87578         LDKRawBolt11Invoice orig_conv;
87579         orig_conv.inner = untag_ptr(orig);
87580         orig_conv.is_owned = ptr_is_owned(orig);
87581         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
87582         orig_conv.is_owned = false;
87583         LDKRawBolt11Invoice ret_var = RawBolt11Invoice_clone(&orig_conv);
87584         int64_t ret_ref = 0;
87585         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
87586         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
87587         return ret_ref;
87588 }
87589
87590 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawBolt11Invoice_1hash(JNIEnv *env, jclass clz, int64_t o) {
87591         LDKRawBolt11Invoice o_conv;
87592         o_conv.inner = untag_ptr(o);
87593         o_conv.is_owned = ptr_is_owned(o);
87594         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
87595         o_conv.is_owned = false;
87596         int64_t ret_conv = RawBolt11Invoice_hash(&o_conv);
87597         return ret_conv;
87598 }
87599
87600 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RawDataPart_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
87601         LDKRawDataPart this_obj_conv;
87602         this_obj_conv.inner = untag_ptr(this_obj);
87603         this_obj_conv.is_owned = ptr_is_owned(this_obj);
87604         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
87605         RawDataPart_free(this_obj_conv);
87606 }
87607
87608 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawDataPart_1get_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr) {
87609         LDKRawDataPart this_ptr_conv;
87610         this_ptr_conv.inner = untag_ptr(this_ptr);
87611         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
87612         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
87613         this_ptr_conv.is_owned = false;
87614         LDKPositiveTimestamp ret_var = RawDataPart_get_timestamp(&this_ptr_conv);
87615         int64_t ret_ref = 0;
87616         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
87617         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
87618         return ret_ref;
87619 }
87620
87621 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RawDataPart_1set_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
87622         LDKRawDataPart this_ptr_conv;
87623         this_ptr_conv.inner = untag_ptr(this_ptr);
87624         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
87625         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
87626         this_ptr_conv.is_owned = false;
87627         LDKPositiveTimestamp val_conv;
87628         val_conv.inner = untag_ptr(val);
87629         val_conv.is_owned = ptr_is_owned(val);
87630         CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
87631         val_conv = PositiveTimestamp_clone(&val_conv);
87632         RawDataPart_set_timestamp(&this_ptr_conv, val_conv);
87633 }
87634
87635 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RawDataPart_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
87636         LDKRawDataPart a_conv;
87637         a_conv.inner = untag_ptr(a);
87638         a_conv.is_owned = ptr_is_owned(a);
87639         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
87640         a_conv.is_owned = false;
87641         LDKRawDataPart b_conv;
87642         b_conv.inner = untag_ptr(b);
87643         b_conv.is_owned = ptr_is_owned(b);
87644         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
87645         b_conv.is_owned = false;
87646         jboolean ret_conv = RawDataPart_eq(&a_conv, &b_conv);
87647         return ret_conv;
87648 }
87649
87650 static inline uint64_t RawDataPart_clone_ptr(LDKRawDataPart *NONNULL_PTR arg) {
87651         LDKRawDataPart ret_var = RawDataPart_clone(arg);
87652         int64_t ret_ref = 0;
87653         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
87654         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
87655         return ret_ref;
87656 }
87657 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawDataPart_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
87658         LDKRawDataPart arg_conv;
87659         arg_conv.inner = untag_ptr(arg);
87660         arg_conv.is_owned = ptr_is_owned(arg);
87661         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
87662         arg_conv.is_owned = false;
87663         int64_t ret_conv = RawDataPart_clone_ptr(&arg_conv);
87664         return ret_conv;
87665 }
87666
87667 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawDataPart_1clone(JNIEnv *env, jclass clz, int64_t orig) {
87668         LDKRawDataPart orig_conv;
87669         orig_conv.inner = untag_ptr(orig);
87670         orig_conv.is_owned = ptr_is_owned(orig);
87671         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
87672         orig_conv.is_owned = false;
87673         LDKRawDataPart ret_var = RawDataPart_clone(&orig_conv);
87674         int64_t ret_ref = 0;
87675         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
87676         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
87677         return ret_ref;
87678 }
87679
87680 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawDataPart_1hash(JNIEnv *env, jclass clz, int64_t o) {
87681         LDKRawDataPart o_conv;
87682         o_conv.inner = untag_ptr(o);
87683         o_conv.is_owned = ptr_is_owned(o);
87684         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
87685         o_conv.is_owned = false;
87686         int64_t ret_conv = RawDataPart_hash(&o_conv);
87687         return ret_conv;
87688 }
87689
87690 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
87691         LDKPositiveTimestamp this_obj_conv;
87692         this_obj_conv.inner = untag_ptr(this_obj);
87693         this_obj_conv.is_owned = ptr_is_owned(this_obj);
87694         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
87695         PositiveTimestamp_free(this_obj_conv);
87696 }
87697
87698 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
87699         LDKPositiveTimestamp a_conv;
87700         a_conv.inner = untag_ptr(a);
87701         a_conv.is_owned = ptr_is_owned(a);
87702         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
87703         a_conv.is_owned = false;
87704         LDKPositiveTimestamp b_conv;
87705         b_conv.inner = untag_ptr(b);
87706         b_conv.is_owned = ptr_is_owned(b);
87707         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
87708         b_conv.is_owned = false;
87709         jboolean ret_conv = PositiveTimestamp_eq(&a_conv, &b_conv);
87710         return ret_conv;
87711 }
87712
87713 static inline uint64_t PositiveTimestamp_clone_ptr(LDKPositiveTimestamp *NONNULL_PTR arg) {
87714         LDKPositiveTimestamp ret_var = PositiveTimestamp_clone(arg);
87715         int64_t ret_ref = 0;
87716         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
87717         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
87718         return ret_ref;
87719 }
87720 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
87721         LDKPositiveTimestamp arg_conv;
87722         arg_conv.inner = untag_ptr(arg);
87723         arg_conv.is_owned = ptr_is_owned(arg);
87724         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
87725         arg_conv.is_owned = false;
87726         int64_t ret_conv = PositiveTimestamp_clone_ptr(&arg_conv);
87727         return ret_conv;
87728 }
87729
87730 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1clone(JNIEnv *env, jclass clz, int64_t orig) {
87731         LDKPositiveTimestamp orig_conv;
87732         orig_conv.inner = untag_ptr(orig);
87733         orig_conv.is_owned = ptr_is_owned(orig);
87734         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
87735         orig_conv.is_owned = false;
87736         LDKPositiveTimestamp ret_var = PositiveTimestamp_clone(&orig_conv);
87737         int64_t ret_ref = 0;
87738         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
87739         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
87740         return ret_ref;
87741 }
87742
87743 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1hash(JNIEnv *env, jclass clz, int64_t o) {
87744         LDKPositiveTimestamp o_conv;
87745         o_conv.inner = untag_ptr(o);
87746         o_conv.is_owned = ptr_is_owned(o);
87747         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
87748         o_conv.is_owned = false;
87749         int64_t ret_conv = PositiveTimestamp_hash(&o_conv);
87750         return ret_conv;
87751 }
87752
87753 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SiPrefix_1clone(JNIEnv *env, jclass clz, int64_t orig) {
87754         LDKSiPrefix* orig_conv = (LDKSiPrefix*)untag_ptr(orig);
87755         jclass ret_conv = LDKSiPrefix_to_java(env, SiPrefix_clone(orig_conv));
87756         return ret_conv;
87757 }
87758
87759 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SiPrefix_1milli(JNIEnv *env, jclass clz) {
87760         jclass ret_conv = LDKSiPrefix_to_java(env, SiPrefix_milli());
87761         return ret_conv;
87762 }
87763
87764 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SiPrefix_1micro(JNIEnv *env, jclass clz) {
87765         jclass ret_conv = LDKSiPrefix_to_java(env, SiPrefix_micro());
87766         return ret_conv;
87767 }
87768
87769 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SiPrefix_1nano(JNIEnv *env, jclass clz) {
87770         jclass ret_conv = LDKSiPrefix_to_java(env, SiPrefix_nano());
87771         return ret_conv;
87772 }
87773
87774 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SiPrefix_1pico(JNIEnv *env, jclass clz) {
87775         jclass ret_conv = LDKSiPrefix_to_java(env, SiPrefix_pico());
87776         return ret_conv;
87777 }
87778
87779 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_SiPrefix_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
87780         LDKSiPrefix* a_conv = (LDKSiPrefix*)untag_ptr(a);
87781         LDKSiPrefix* b_conv = (LDKSiPrefix*)untag_ptr(b);
87782         jboolean ret_conv = SiPrefix_eq(a_conv, b_conv);
87783         return ret_conv;
87784 }
87785
87786 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SiPrefix_1hash(JNIEnv *env, jclass clz, int64_t o) {
87787         LDKSiPrefix* o_conv = (LDKSiPrefix*)untag_ptr(o);
87788         int64_t ret_conv = SiPrefix_hash(o_conv);
87789         return ret_conv;
87790 }
87791
87792 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SiPrefix_1multiplier(JNIEnv *env, jclass clz, int64_t this_arg) {
87793         LDKSiPrefix* this_arg_conv = (LDKSiPrefix*)untag_ptr(this_arg);
87794         int64_t ret_conv = SiPrefix_multiplier(this_arg_conv);
87795         return ret_conv;
87796 }
87797
87798 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Currency_1clone(JNIEnv *env, jclass clz, int64_t orig) {
87799         LDKCurrency* orig_conv = (LDKCurrency*)untag_ptr(orig);
87800         jclass ret_conv = LDKCurrency_to_java(env, Currency_clone(orig_conv));
87801         return ret_conv;
87802 }
87803
87804 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Currency_1bitcoin(JNIEnv *env, jclass clz) {
87805         jclass ret_conv = LDKCurrency_to_java(env, Currency_bitcoin());
87806         return ret_conv;
87807 }
87808
87809 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Currency_1bitcoin_1testnet(JNIEnv *env, jclass clz) {
87810         jclass ret_conv = LDKCurrency_to_java(env, Currency_bitcoin_testnet());
87811         return ret_conv;
87812 }
87813
87814 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Currency_1regtest(JNIEnv *env, jclass clz) {
87815         jclass ret_conv = LDKCurrency_to_java(env, Currency_regtest());
87816         return ret_conv;
87817 }
87818
87819 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Currency_1simnet(JNIEnv *env, jclass clz) {
87820         jclass ret_conv = LDKCurrency_to_java(env, Currency_simnet());
87821         return ret_conv;
87822 }
87823
87824 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Currency_1signet(JNIEnv *env, jclass clz) {
87825         jclass ret_conv = LDKCurrency_to_java(env, Currency_signet());
87826         return ret_conv;
87827 }
87828
87829 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Currency_1hash(JNIEnv *env, jclass clz, int64_t o) {
87830         LDKCurrency* o_conv = (LDKCurrency*)untag_ptr(o);
87831         int64_t ret_conv = Currency_hash(o_conv);
87832         return ret_conv;
87833 }
87834
87835 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Currency_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
87836         LDKCurrency* a_conv = (LDKCurrency*)untag_ptr(a);
87837         LDKCurrency* b_conv = (LDKCurrency*)untag_ptr(b);
87838         jboolean ret_conv = Currency_eq(a_conv, b_conv);
87839         return ret_conv;
87840 }
87841
87842 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Sha256_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
87843         LDKSha256 this_obj_conv;
87844         this_obj_conv.inner = untag_ptr(this_obj);
87845         this_obj_conv.is_owned = ptr_is_owned(this_obj);
87846         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
87847         Sha256_free(this_obj_conv);
87848 }
87849
87850 static inline uint64_t Sha256_clone_ptr(LDKSha256 *NONNULL_PTR arg) {
87851         LDKSha256 ret_var = Sha256_clone(arg);
87852         int64_t ret_ref = 0;
87853         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
87854         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
87855         return ret_ref;
87856 }
87857 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Sha256_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
87858         LDKSha256 arg_conv;
87859         arg_conv.inner = untag_ptr(arg);
87860         arg_conv.is_owned = ptr_is_owned(arg);
87861         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
87862         arg_conv.is_owned = false;
87863         int64_t ret_conv = Sha256_clone_ptr(&arg_conv);
87864         return ret_conv;
87865 }
87866
87867 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Sha256_1clone(JNIEnv *env, jclass clz, int64_t orig) {
87868         LDKSha256 orig_conv;
87869         orig_conv.inner = untag_ptr(orig);
87870         orig_conv.is_owned = ptr_is_owned(orig);
87871         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
87872         orig_conv.is_owned = false;
87873         LDKSha256 ret_var = Sha256_clone(&orig_conv);
87874         int64_t ret_ref = 0;
87875         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
87876         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
87877         return ret_ref;
87878 }
87879
87880 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Sha256_1hash(JNIEnv *env, jclass clz, int64_t o) {
87881         LDKSha256 o_conv;
87882         o_conv.inner = untag_ptr(o);
87883         o_conv.is_owned = ptr_is_owned(o);
87884         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
87885         o_conv.is_owned = false;
87886         int64_t ret_conv = Sha256_hash(&o_conv);
87887         return ret_conv;
87888 }
87889
87890 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Sha256_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
87891         LDKSha256 a_conv;
87892         a_conv.inner = untag_ptr(a);
87893         a_conv.is_owned = ptr_is_owned(a);
87894         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
87895         a_conv.is_owned = false;
87896         LDKSha256 b_conv;
87897         b_conv.inner = untag_ptr(b);
87898         b_conv.is_owned = ptr_is_owned(b);
87899         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
87900         b_conv.is_owned = false;
87901         jboolean ret_conv = Sha256_eq(&a_conv, &b_conv);
87902         return ret_conv;
87903 }
87904
87905 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Sha256_1from_1bytes(JNIEnv *env, jclass clz, int8_tArray bytes) {
87906         uint8_t bytes_arr[32];
87907         CHECK((*env)->GetArrayLength(env, bytes) == 32);
87908         (*env)->GetByteArrayRegion(env, bytes, 0, 32, bytes_arr);
87909         uint8_t (*bytes_ref)[32] = &bytes_arr;
87910         LDKSha256 ret_var = Sha256_from_bytes(bytes_ref);
87911         int64_t ret_ref = 0;
87912         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
87913         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
87914         return ret_ref;
87915 }
87916
87917 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Description_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
87918         LDKDescription this_obj_conv;
87919         this_obj_conv.inner = untag_ptr(this_obj);
87920         this_obj_conv.is_owned = ptr_is_owned(this_obj);
87921         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
87922         Description_free(this_obj_conv);
87923 }
87924
87925 static inline uint64_t Description_clone_ptr(LDKDescription *NONNULL_PTR arg) {
87926         LDKDescription ret_var = Description_clone(arg);
87927         int64_t ret_ref = 0;
87928         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
87929         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
87930         return ret_ref;
87931 }
87932 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Description_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
87933         LDKDescription arg_conv;
87934         arg_conv.inner = untag_ptr(arg);
87935         arg_conv.is_owned = ptr_is_owned(arg);
87936         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
87937         arg_conv.is_owned = false;
87938         int64_t ret_conv = Description_clone_ptr(&arg_conv);
87939         return ret_conv;
87940 }
87941
87942 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Description_1clone(JNIEnv *env, jclass clz, int64_t orig) {
87943         LDKDescription orig_conv;
87944         orig_conv.inner = untag_ptr(orig);
87945         orig_conv.is_owned = ptr_is_owned(orig);
87946         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
87947         orig_conv.is_owned = false;
87948         LDKDescription ret_var = Description_clone(&orig_conv);
87949         int64_t ret_ref = 0;
87950         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
87951         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
87952         return ret_ref;
87953 }
87954
87955 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Description_1hash(JNIEnv *env, jclass clz, int64_t o) {
87956         LDKDescription o_conv;
87957         o_conv.inner = untag_ptr(o);
87958         o_conv.is_owned = ptr_is_owned(o);
87959         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
87960         o_conv.is_owned = false;
87961         int64_t ret_conv = Description_hash(&o_conv);
87962         return ret_conv;
87963 }
87964
87965 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Description_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
87966         LDKDescription a_conv;
87967         a_conv.inner = untag_ptr(a);
87968         a_conv.is_owned = ptr_is_owned(a);
87969         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
87970         a_conv.is_owned = false;
87971         LDKDescription b_conv;
87972         b_conv.inner = untag_ptr(b);
87973         b_conv.is_owned = ptr_is_owned(b);
87974         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
87975         b_conv.is_owned = false;
87976         jboolean ret_conv = Description_eq(&a_conv, &b_conv);
87977         return ret_conv;
87978 }
87979
87980 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
87981         LDKPayeePubKey this_obj_conv;
87982         this_obj_conv.inner = untag_ptr(this_obj);
87983         this_obj_conv.is_owned = ptr_is_owned(this_obj);
87984         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
87985         PayeePubKey_free(this_obj_conv);
87986 }
87987
87988 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1get_1a(JNIEnv *env, jclass clz, int64_t this_ptr) {
87989         LDKPayeePubKey this_ptr_conv;
87990         this_ptr_conv.inner = untag_ptr(this_ptr);
87991         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
87992         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
87993         this_ptr_conv.is_owned = false;
87994         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
87995         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, PayeePubKey_get_a(&this_ptr_conv).compressed_form);
87996         return ret_arr;
87997 }
87998
87999 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1set_1a(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
88000         LDKPayeePubKey this_ptr_conv;
88001         this_ptr_conv.inner = untag_ptr(this_ptr);
88002         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
88003         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
88004         this_ptr_conv.is_owned = false;
88005         LDKPublicKey val_ref;
88006         CHECK((*env)->GetArrayLength(env, val) == 33);
88007         (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
88008         PayeePubKey_set_a(&this_ptr_conv, val_ref);
88009 }
88010
88011 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1new(JNIEnv *env, jclass clz, int8_tArray a_arg) {
88012         LDKPublicKey a_arg_ref;
88013         CHECK((*env)->GetArrayLength(env, a_arg) == 33);
88014         (*env)->GetByteArrayRegion(env, a_arg, 0, 33, a_arg_ref.compressed_form);
88015         LDKPayeePubKey ret_var = PayeePubKey_new(a_arg_ref);
88016         int64_t ret_ref = 0;
88017         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
88018         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
88019         return ret_ref;
88020 }
88021
88022 static inline uint64_t PayeePubKey_clone_ptr(LDKPayeePubKey *NONNULL_PTR arg) {
88023         LDKPayeePubKey ret_var = PayeePubKey_clone(arg);
88024         int64_t ret_ref = 0;
88025         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
88026         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
88027         return ret_ref;
88028 }
88029 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
88030         LDKPayeePubKey arg_conv;
88031         arg_conv.inner = untag_ptr(arg);
88032         arg_conv.is_owned = ptr_is_owned(arg);
88033         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
88034         arg_conv.is_owned = false;
88035         int64_t ret_conv = PayeePubKey_clone_ptr(&arg_conv);
88036         return ret_conv;
88037 }
88038
88039 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1clone(JNIEnv *env, jclass clz, int64_t orig) {
88040         LDKPayeePubKey orig_conv;
88041         orig_conv.inner = untag_ptr(orig);
88042         orig_conv.is_owned = ptr_is_owned(orig);
88043         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
88044         orig_conv.is_owned = false;
88045         LDKPayeePubKey ret_var = PayeePubKey_clone(&orig_conv);
88046         int64_t ret_ref = 0;
88047         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
88048         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
88049         return ret_ref;
88050 }
88051
88052 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1hash(JNIEnv *env, jclass clz, int64_t o) {
88053         LDKPayeePubKey o_conv;
88054         o_conv.inner = untag_ptr(o);
88055         o_conv.is_owned = ptr_is_owned(o);
88056         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
88057         o_conv.is_owned = false;
88058         int64_t ret_conv = PayeePubKey_hash(&o_conv);
88059         return ret_conv;
88060 }
88061
88062 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
88063         LDKPayeePubKey a_conv;
88064         a_conv.inner = untag_ptr(a);
88065         a_conv.is_owned = ptr_is_owned(a);
88066         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
88067         a_conv.is_owned = false;
88068         LDKPayeePubKey b_conv;
88069         b_conv.inner = untag_ptr(b);
88070         b_conv.is_owned = ptr_is_owned(b);
88071         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
88072         b_conv.is_owned = false;
88073         jboolean ret_conv = PayeePubKey_eq(&a_conv, &b_conv);
88074         return ret_conv;
88075 }
88076
88077 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
88078         LDKExpiryTime this_obj_conv;
88079         this_obj_conv.inner = untag_ptr(this_obj);
88080         this_obj_conv.is_owned = ptr_is_owned(this_obj);
88081         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
88082         ExpiryTime_free(this_obj_conv);
88083 }
88084
88085 static inline uint64_t ExpiryTime_clone_ptr(LDKExpiryTime *NONNULL_PTR arg) {
88086         LDKExpiryTime ret_var = ExpiryTime_clone(arg);
88087         int64_t ret_ref = 0;
88088         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
88089         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
88090         return ret_ref;
88091 }
88092 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
88093         LDKExpiryTime arg_conv;
88094         arg_conv.inner = untag_ptr(arg);
88095         arg_conv.is_owned = ptr_is_owned(arg);
88096         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
88097         arg_conv.is_owned = false;
88098         int64_t ret_conv = ExpiryTime_clone_ptr(&arg_conv);
88099         return ret_conv;
88100 }
88101
88102 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1clone(JNIEnv *env, jclass clz, int64_t orig) {
88103         LDKExpiryTime orig_conv;
88104         orig_conv.inner = untag_ptr(orig);
88105         orig_conv.is_owned = ptr_is_owned(orig);
88106         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
88107         orig_conv.is_owned = false;
88108         LDKExpiryTime ret_var = ExpiryTime_clone(&orig_conv);
88109         int64_t ret_ref = 0;
88110         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
88111         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
88112         return ret_ref;
88113 }
88114
88115 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1hash(JNIEnv *env, jclass clz, int64_t o) {
88116         LDKExpiryTime o_conv;
88117         o_conv.inner = untag_ptr(o);
88118         o_conv.is_owned = ptr_is_owned(o);
88119         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
88120         o_conv.is_owned = false;
88121         int64_t ret_conv = ExpiryTime_hash(&o_conv);
88122         return ret_conv;
88123 }
88124
88125 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
88126         LDKExpiryTime a_conv;
88127         a_conv.inner = untag_ptr(a);
88128         a_conv.is_owned = ptr_is_owned(a);
88129         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
88130         a_conv.is_owned = false;
88131         LDKExpiryTime b_conv;
88132         b_conv.inner = untag_ptr(b);
88133         b_conv.is_owned = ptr_is_owned(b);
88134         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
88135         b_conv.is_owned = false;
88136         jboolean ret_conv = ExpiryTime_eq(&a_conv, &b_conv);
88137         return ret_conv;
88138 }
88139
88140 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiryDelta_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
88141         LDKMinFinalCltvExpiryDelta this_obj_conv;
88142         this_obj_conv.inner = untag_ptr(this_obj);
88143         this_obj_conv.is_owned = ptr_is_owned(this_obj);
88144         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
88145         MinFinalCltvExpiryDelta_free(this_obj_conv);
88146 }
88147
88148 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiryDelta_1get_1a(JNIEnv *env, jclass clz, int64_t this_ptr) {
88149         LDKMinFinalCltvExpiryDelta this_ptr_conv;
88150         this_ptr_conv.inner = untag_ptr(this_ptr);
88151         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
88152         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
88153         this_ptr_conv.is_owned = false;
88154         int64_t ret_conv = MinFinalCltvExpiryDelta_get_a(&this_ptr_conv);
88155         return ret_conv;
88156 }
88157
88158 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiryDelta_1set_1a(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
88159         LDKMinFinalCltvExpiryDelta this_ptr_conv;
88160         this_ptr_conv.inner = untag_ptr(this_ptr);
88161         this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
88162         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
88163         this_ptr_conv.is_owned = false;
88164         MinFinalCltvExpiryDelta_set_a(&this_ptr_conv, val);
88165 }
88166
88167 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiryDelta_1new(JNIEnv *env, jclass clz, int64_t a_arg) {
88168         LDKMinFinalCltvExpiryDelta ret_var = MinFinalCltvExpiryDelta_new(a_arg);
88169         int64_t ret_ref = 0;
88170         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
88171         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
88172         return ret_ref;
88173 }
88174
88175 static inline uint64_t MinFinalCltvExpiryDelta_clone_ptr(LDKMinFinalCltvExpiryDelta *NONNULL_PTR arg) {
88176         LDKMinFinalCltvExpiryDelta ret_var = MinFinalCltvExpiryDelta_clone(arg);
88177         int64_t ret_ref = 0;
88178         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
88179         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
88180         return ret_ref;
88181 }
88182 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiryDelta_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
88183         LDKMinFinalCltvExpiryDelta arg_conv;
88184         arg_conv.inner = untag_ptr(arg);
88185         arg_conv.is_owned = ptr_is_owned(arg);
88186         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
88187         arg_conv.is_owned = false;
88188         int64_t ret_conv = MinFinalCltvExpiryDelta_clone_ptr(&arg_conv);
88189         return ret_conv;
88190 }
88191
88192 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiryDelta_1clone(JNIEnv *env, jclass clz, int64_t orig) {
88193         LDKMinFinalCltvExpiryDelta orig_conv;
88194         orig_conv.inner = untag_ptr(orig);
88195         orig_conv.is_owned = ptr_is_owned(orig);
88196         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
88197         orig_conv.is_owned = false;
88198         LDKMinFinalCltvExpiryDelta ret_var = MinFinalCltvExpiryDelta_clone(&orig_conv);
88199         int64_t ret_ref = 0;
88200         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
88201         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
88202         return ret_ref;
88203 }
88204
88205 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiryDelta_1hash(JNIEnv *env, jclass clz, int64_t o) {
88206         LDKMinFinalCltvExpiryDelta o_conv;
88207         o_conv.inner = untag_ptr(o);
88208         o_conv.is_owned = ptr_is_owned(o);
88209         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
88210         o_conv.is_owned = false;
88211         int64_t ret_conv = MinFinalCltvExpiryDelta_hash(&o_conv);
88212         return ret_conv;
88213 }
88214
88215 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiryDelta_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
88216         LDKMinFinalCltvExpiryDelta a_conv;
88217         a_conv.inner = untag_ptr(a);
88218         a_conv.is_owned = ptr_is_owned(a);
88219         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
88220         a_conv.is_owned = false;
88221         LDKMinFinalCltvExpiryDelta b_conv;
88222         b_conv.inner = untag_ptr(b);
88223         b_conv.is_owned = ptr_is_owned(b);
88224         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
88225         b_conv.is_owned = false;
88226         jboolean ret_conv = MinFinalCltvExpiryDelta_eq(&a_conv, &b_conv);
88227         return ret_conv;
88228 }
88229
88230 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Fallback_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
88231         if (!ptr_is_owned(this_ptr)) return;
88232         void* this_ptr_ptr = untag_ptr(this_ptr);
88233         CHECK_ACCESS(this_ptr_ptr);
88234         LDKFallback this_ptr_conv = *(LDKFallback*)(this_ptr_ptr);
88235         FREE(untag_ptr(this_ptr));
88236         Fallback_free(this_ptr_conv);
88237 }
88238
88239 static inline uint64_t Fallback_clone_ptr(LDKFallback *NONNULL_PTR arg) {
88240         LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
88241         *ret_copy = Fallback_clone(arg);
88242         int64_t ret_ref = tag_ptr(ret_copy, true);
88243         return ret_ref;
88244 }
88245 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Fallback_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
88246         LDKFallback* arg_conv = (LDKFallback*)untag_ptr(arg);
88247         int64_t ret_conv = Fallback_clone_ptr(arg_conv);
88248         return ret_conv;
88249 }
88250
88251 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Fallback_1clone(JNIEnv *env, jclass clz, int64_t orig) {
88252         LDKFallback* orig_conv = (LDKFallback*)untag_ptr(orig);
88253         LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
88254         *ret_copy = Fallback_clone(orig_conv);
88255         int64_t ret_ref = tag_ptr(ret_copy, true);
88256         return ret_ref;
88257 }
88258
88259 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Fallback_1seg_1wit_1program(JNIEnv *env, jclass clz, int8_t version, int8_tArray program) {
88260         
88261         LDKCVec_u8Z program_ref;
88262         program_ref.datalen = (*env)->GetArrayLength(env, program);
88263         program_ref.data = MALLOC(program_ref.datalen, "LDKCVec_u8Z Bytes");
88264         (*env)->GetByteArrayRegion(env, program, 0, program_ref.datalen, program_ref.data);
88265         LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
88266         *ret_copy = Fallback_seg_wit_program((LDKWitnessVersion){ ._0 = version }, program_ref);
88267         int64_t ret_ref = tag_ptr(ret_copy, true);
88268         return ret_ref;
88269 }
88270
88271 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Fallback_1pub_1key_1hash(JNIEnv *env, jclass clz, int8_tArray a) {
88272         LDKTwentyBytes a_ref;
88273         CHECK((*env)->GetArrayLength(env, a) == 20);
88274         (*env)->GetByteArrayRegion(env, a, 0, 20, a_ref.data);
88275         LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
88276         *ret_copy = Fallback_pub_key_hash(a_ref);
88277         int64_t ret_ref = tag_ptr(ret_copy, true);
88278         return ret_ref;
88279 }
88280
88281 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Fallback_1script_1hash(JNIEnv *env, jclass clz, int8_tArray a) {
88282         LDKTwentyBytes a_ref;
88283         CHECK((*env)->GetArrayLength(env, a) == 20);
88284         (*env)->GetByteArrayRegion(env, a, 0, 20, a_ref.data);
88285         LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
88286         *ret_copy = Fallback_script_hash(a_ref);
88287         int64_t ret_ref = tag_ptr(ret_copy, true);
88288         return ret_ref;
88289 }
88290
88291 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Fallback_1hash(JNIEnv *env, jclass clz, int64_t o) {
88292         LDKFallback* o_conv = (LDKFallback*)untag_ptr(o);
88293         int64_t ret_conv = Fallback_hash(o_conv);
88294         return ret_conv;
88295 }
88296
88297 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Fallback_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
88298         LDKFallback* a_conv = (LDKFallback*)untag_ptr(a);
88299         LDKFallback* b_conv = (LDKFallback*)untag_ptr(b);
88300         jboolean ret_conv = Fallback_eq(a_conv, b_conv);
88301         return ret_conv;
88302 }
88303
88304 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceSignature_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
88305         LDKBolt11InvoiceSignature this_obj_conv;
88306         this_obj_conv.inner = untag_ptr(this_obj);
88307         this_obj_conv.is_owned = ptr_is_owned(this_obj);
88308         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
88309         Bolt11InvoiceSignature_free(this_obj_conv);
88310 }
88311
88312 static inline uint64_t Bolt11InvoiceSignature_clone_ptr(LDKBolt11InvoiceSignature *NONNULL_PTR arg) {
88313         LDKBolt11InvoiceSignature ret_var = Bolt11InvoiceSignature_clone(arg);
88314         int64_t ret_ref = 0;
88315         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
88316         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
88317         return ret_ref;
88318 }
88319 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceSignature_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
88320         LDKBolt11InvoiceSignature arg_conv;
88321         arg_conv.inner = untag_ptr(arg);
88322         arg_conv.is_owned = ptr_is_owned(arg);
88323         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
88324         arg_conv.is_owned = false;
88325         int64_t ret_conv = Bolt11InvoiceSignature_clone_ptr(&arg_conv);
88326         return ret_conv;
88327 }
88328
88329 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceSignature_1clone(JNIEnv *env, jclass clz, int64_t orig) {
88330         LDKBolt11InvoiceSignature orig_conv;
88331         orig_conv.inner = untag_ptr(orig);
88332         orig_conv.is_owned = ptr_is_owned(orig);
88333         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
88334         orig_conv.is_owned = false;
88335         LDKBolt11InvoiceSignature ret_var = Bolt11InvoiceSignature_clone(&orig_conv);
88336         int64_t ret_ref = 0;
88337         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
88338         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
88339         return ret_ref;
88340 }
88341
88342 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceSignature_1hash(JNIEnv *env, jclass clz, int64_t o) {
88343         LDKBolt11InvoiceSignature o_conv;
88344         o_conv.inner = untag_ptr(o);
88345         o_conv.is_owned = ptr_is_owned(o);
88346         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
88347         o_conv.is_owned = false;
88348         int64_t ret_conv = Bolt11InvoiceSignature_hash(&o_conv);
88349         return ret_conv;
88350 }
88351
88352 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt11InvoiceSignature_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
88353         LDKBolt11InvoiceSignature a_conv;
88354         a_conv.inner = untag_ptr(a);
88355         a_conv.is_owned = ptr_is_owned(a);
88356         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
88357         a_conv.is_owned = false;
88358         LDKBolt11InvoiceSignature b_conv;
88359         b_conv.inner = untag_ptr(b);
88360         b_conv.is_owned = ptr_is_owned(b);
88361         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
88362         b_conv.is_owned = false;
88363         jboolean ret_conv = Bolt11InvoiceSignature_eq(&a_conv, &b_conv);
88364         return ret_conv;
88365 }
88366
88367 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
88368         LDKPrivateRoute this_obj_conv;
88369         this_obj_conv.inner = untag_ptr(this_obj);
88370         this_obj_conv.is_owned = ptr_is_owned(this_obj);
88371         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
88372         PrivateRoute_free(this_obj_conv);
88373 }
88374
88375 static inline uint64_t PrivateRoute_clone_ptr(LDKPrivateRoute *NONNULL_PTR arg) {
88376         LDKPrivateRoute ret_var = PrivateRoute_clone(arg);
88377         int64_t ret_ref = 0;
88378         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
88379         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
88380         return ret_ref;
88381 }
88382 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
88383         LDKPrivateRoute arg_conv;
88384         arg_conv.inner = untag_ptr(arg);
88385         arg_conv.is_owned = ptr_is_owned(arg);
88386         CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
88387         arg_conv.is_owned = false;
88388         int64_t ret_conv = PrivateRoute_clone_ptr(&arg_conv);
88389         return ret_conv;
88390 }
88391
88392 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1clone(JNIEnv *env, jclass clz, int64_t orig) {
88393         LDKPrivateRoute orig_conv;
88394         orig_conv.inner = untag_ptr(orig);
88395         orig_conv.is_owned = ptr_is_owned(orig);
88396         CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
88397         orig_conv.is_owned = false;
88398         LDKPrivateRoute ret_var = PrivateRoute_clone(&orig_conv);
88399         int64_t ret_ref = 0;
88400         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
88401         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
88402         return ret_ref;
88403 }
88404
88405 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1hash(JNIEnv *env, jclass clz, int64_t o) {
88406         LDKPrivateRoute o_conv;
88407         o_conv.inner = untag_ptr(o);
88408         o_conv.is_owned = ptr_is_owned(o);
88409         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
88410         o_conv.is_owned = false;
88411         int64_t ret_conv = PrivateRoute_hash(&o_conv);
88412         return ret_conv;
88413 }
88414
88415 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
88416         LDKPrivateRoute a_conv;
88417         a_conv.inner = untag_ptr(a);
88418         a_conv.is_owned = ptr_is_owned(a);
88419         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
88420         a_conv.is_owned = false;
88421         LDKPrivateRoute b_conv;
88422         b_conv.inner = untag_ptr(b);
88423         b_conv.is_owned = ptr_is_owned(b);
88424         CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
88425         b_conv.is_owned = false;
88426         jboolean ret_conv = PrivateRoute_eq(&a_conv, &b_conv);
88427         return ret_conv;
88428 }
88429
88430 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawBolt11Invoice_1into_1parts(JNIEnv *env, jclass clz, int64_t this_arg) {
88431         LDKSignedRawBolt11Invoice this_arg_conv;
88432         this_arg_conv.inner = untag_ptr(this_arg);
88433         this_arg_conv.is_owned = ptr_is_owned(this_arg);
88434         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
88435         this_arg_conv = SignedRawBolt11Invoice_clone(&this_arg_conv);
88436         LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ), "LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ");
88437         *ret_conv = SignedRawBolt11Invoice_into_parts(this_arg_conv);
88438         return tag_ptr(ret_conv, true);
88439 }
88440
88441 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawBolt11Invoice_1raw_1invoice(JNIEnv *env, jclass clz, int64_t this_arg) {
88442         LDKSignedRawBolt11Invoice this_arg_conv;
88443         this_arg_conv.inner = untag_ptr(this_arg);
88444         this_arg_conv.is_owned = ptr_is_owned(this_arg);
88445         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
88446         this_arg_conv.is_owned = false;
88447         LDKRawBolt11Invoice ret_var = SignedRawBolt11Invoice_raw_invoice(&this_arg_conv);
88448         int64_t ret_ref = 0;
88449         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
88450         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
88451         return ret_ref;
88452 }
88453
88454 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_SignedRawBolt11Invoice_1signable_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
88455         LDKSignedRawBolt11Invoice this_arg_conv;
88456         this_arg_conv.inner = untag_ptr(this_arg);
88457         this_arg_conv.is_owned = ptr_is_owned(this_arg);
88458         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
88459         this_arg_conv.is_owned = false;
88460         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
88461         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *SignedRawBolt11Invoice_signable_hash(&this_arg_conv));
88462         return ret_arr;
88463 }
88464
88465 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawBolt11Invoice_1signature(JNIEnv *env, jclass clz, int64_t this_arg) {
88466         LDKSignedRawBolt11Invoice this_arg_conv;
88467         this_arg_conv.inner = untag_ptr(this_arg);
88468         this_arg_conv.is_owned = ptr_is_owned(this_arg);
88469         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
88470         this_arg_conv.is_owned = false;
88471         LDKBolt11InvoiceSignature ret_var = SignedRawBolt11Invoice_signature(&this_arg_conv);
88472         int64_t ret_ref = 0;
88473         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
88474         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
88475         return ret_ref;
88476 }
88477
88478 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawBolt11Invoice_1recover_1payee_1pub_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
88479         LDKSignedRawBolt11Invoice this_arg_conv;
88480         this_arg_conv.inner = untag_ptr(this_arg);
88481         this_arg_conv.is_owned = ptr_is_owned(this_arg);
88482         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
88483         this_arg_conv.is_owned = false;
88484         LDKCResult_PayeePubKeySecp256k1ErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeySecp256k1ErrorZ), "LDKCResult_PayeePubKeySecp256k1ErrorZ");
88485         *ret_conv = SignedRawBolt11Invoice_recover_payee_pub_key(&this_arg_conv);
88486         return tag_ptr(ret_conv, true);
88487 }
88488
88489 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_SignedRawBolt11Invoice_1check_1signature(JNIEnv *env, jclass clz, int64_t this_arg) {
88490         LDKSignedRawBolt11Invoice this_arg_conv;
88491         this_arg_conv.inner = untag_ptr(this_arg);
88492         this_arg_conv.is_owned = ptr_is_owned(this_arg);
88493         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
88494         this_arg_conv.is_owned = false;
88495         jboolean ret_conv = SignedRawBolt11Invoice_check_signature(&this_arg_conv);
88496         return ret_conv;
88497 }
88498
88499 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RawBolt11Invoice_1signable_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
88500         LDKRawBolt11Invoice this_arg_conv;
88501         this_arg_conv.inner = untag_ptr(this_arg);
88502         this_arg_conv.is_owned = ptr_is_owned(this_arg);
88503         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
88504         this_arg_conv.is_owned = false;
88505         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
88506         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, RawBolt11Invoice_signable_hash(&this_arg_conv).data);
88507         return ret_arr;
88508 }
88509
88510 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawBolt11Invoice_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
88511         LDKRawBolt11Invoice this_arg_conv;
88512         this_arg_conv.inner = untag_ptr(this_arg);
88513         this_arg_conv.is_owned = ptr_is_owned(this_arg);
88514         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
88515         this_arg_conv.is_owned = false;
88516         LDKSha256 ret_var = RawBolt11Invoice_payment_hash(&this_arg_conv);
88517         int64_t ret_ref = 0;
88518         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
88519         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
88520         return ret_ref;
88521 }
88522
88523 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawBolt11Invoice_1description(JNIEnv *env, jclass clz, int64_t this_arg) {
88524         LDKRawBolt11Invoice this_arg_conv;
88525         this_arg_conv.inner = untag_ptr(this_arg);
88526         this_arg_conv.is_owned = ptr_is_owned(this_arg);
88527         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
88528         this_arg_conv.is_owned = false;
88529         LDKDescription ret_var = RawBolt11Invoice_description(&this_arg_conv);
88530         int64_t ret_ref = 0;
88531         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
88532         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
88533         return ret_ref;
88534 }
88535
88536 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawBolt11Invoice_1payee_1pub_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
88537         LDKRawBolt11Invoice this_arg_conv;
88538         this_arg_conv.inner = untag_ptr(this_arg);
88539         this_arg_conv.is_owned = ptr_is_owned(this_arg);
88540         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
88541         this_arg_conv.is_owned = false;
88542         LDKPayeePubKey ret_var = RawBolt11Invoice_payee_pub_key(&this_arg_conv);
88543         int64_t ret_ref = 0;
88544         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
88545         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
88546         return ret_ref;
88547 }
88548
88549 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawBolt11Invoice_1description_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
88550         LDKRawBolt11Invoice this_arg_conv;
88551         this_arg_conv.inner = untag_ptr(this_arg);
88552         this_arg_conv.is_owned = ptr_is_owned(this_arg);
88553         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
88554         this_arg_conv.is_owned = false;
88555         LDKSha256 ret_var = RawBolt11Invoice_description_hash(&this_arg_conv);
88556         int64_t ret_ref = 0;
88557         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
88558         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
88559         return ret_ref;
88560 }
88561
88562 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawBolt11Invoice_1expiry_1time(JNIEnv *env, jclass clz, int64_t this_arg) {
88563         LDKRawBolt11Invoice this_arg_conv;
88564         this_arg_conv.inner = untag_ptr(this_arg);
88565         this_arg_conv.is_owned = ptr_is_owned(this_arg);
88566         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
88567         this_arg_conv.is_owned = false;
88568         LDKExpiryTime ret_var = RawBolt11Invoice_expiry_time(&this_arg_conv);
88569         int64_t ret_ref = 0;
88570         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
88571         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
88572         return ret_ref;
88573 }
88574
88575 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawBolt11Invoice_1min_1final_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_arg) {
88576         LDKRawBolt11Invoice this_arg_conv;
88577         this_arg_conv.inner = untag_ptr(this_arg);
88578         this_arg_conv.is_owned = ptr_is_owned(this_arg);
88579         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
88580         this_arg_conv.is_owned = false;
88581         LDKMinFinalCltvExpiryDelta ret_var = RawBolt11Invoice_min_final_cltv_expiry_delta(&this_arg_conv);
88582         int64_t ret_ref = 0;
88583         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
88584         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
88585         return ret_ref;
88586 }
88587
88588 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawBolt11Invoice_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
88589         LDKRawBolt11Invoice this_arg_conv;
88590         this_arg_conv.inner = untag_ptr(this_arg);
88591         this_arg_conv.is_owned = ptr_is_owned(this_arg);
88592         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
88593         this_arg_conv.is_owned = false;
88594         LDKCOption_ThirtyTwoBytesZ *ret_copy = MALLOC(sizeof(LDKCOption_ThirtyTwoBytesZ), "LDKCOption_ThirtyTwoBytesZ");
88595         *ret_copy = RawBolt11Invoice_payment_secret(&this_arg_conv);
88596         int64_t ret_ref = tag_ptr(ret_copy, true);
88597         return ret_ref;
88598 }
88599
88600 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawBolt11Invoice_1payment_1metadata(JNIEnv *env, jclass clz, int64_t this_arg) {
88601         LDKRawBolt11Invoice this_arg_conv;
88602         this_arg_conv.inner = untag_ptr(this_arg);
88603         this_arg_conv.is_owned = ptr_is_owned(this_arg);
88604         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
88605         this_arg_conv.is_owned = false;
88606         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
88607         *ret_copy = RawBolt11Invoice_payment_metadata(&this_arg_conv);
88608         int64_t ret_ref = tag_ptr(ret_copy, true);
88609         return ret_ref;
88610 }
88611
88612 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawBolt11Invoice_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
88613         LDKRawBolt11Invoice this_arg_conv;
88614         this_arg_conv.inner = untag_ptr(this_arg);
88615         this_arg_conv.is_owned = ptr_is_owned(this_arg);
88616         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
88617         this_arg_conv.is_owned = false;
88618         LDKBolt11InvoiceFeatures ret_var = RawBolt11Invoice_features(&this_arg_conv);
88619         int64_t ret_ref = 0;
88620         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
88621         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
88622         return ret_ref;
88623 }
88624
88625 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_RawBolt11Invoice_1private_1routes(JNIEnv *env, jclass clz, int64_t this_arg) {
88626         LDKRawBolt11Invoice this_arg_conv;
88627         this_arg_conv.inner = untag_ptr(this_arg);
88628         this_arg_conv.is_owned = ptr_is_owned(this_arg);
88629         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
88630         this_arg_conv.is_owned = false;
88631         LDKCVec_PrivateRouteZ ret_var = RawBolt11Invoice_private_routes(&this_arg_conv);
88632         int64_tArray ret_arr = NULL;
88633         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
88634         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
88635         for (size_t o = 0; o < ret_var.datalen; o++) {
88636                 LDKPrivateRoute ret_conv_14_var = ret_var.data[o];
88637                 int64_t ret_conv_14_ref = 0;
88638                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_14_var);
88639                 ret_conv_14_ref = tag_ptr(ret_conv_14_var.inner, ret_conv_14_var.is_owned);
88640                 ret_arr_ptr[o] = ret_conv_14_ref;
88641         }
88642         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
88643         FREE(ret_var.data);
88644         return ret_arr;
88645 }
88646
88647 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawBolt11Invoice_1amount_1pico_1btc(JNIEnv *env, jclass clz, int64_t this_arg) {
88648         LDKRawBolt11Invoice this_arg_conv;
88649         this_arg_conv.inner = untag_ptr(this_arg);
88650         this_arg_conv.is_owned = ptr_is_owned(this_arg);
88651         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
88652         this_arg_conv.is_owned = false;
88653         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
88654         *ret_copy = RawBolt11Invoice_amount_pico_btc(&this_arg_conv);
88655         int64_t ret_ref = tag_ptr(ret_copy, true);
88656         return ret_ref;
88657 }
88658
88659 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_RawBolt11Invoice_1currency(JNIEnv *env, jclass clz, int64_t this_arg) {
88660         LDKRawBolt11Invoice this_arg_conv;
88661         this_arg_conv.inner = untag_ptr(this_arg);
88662         this_arg_conv.is_owned = ptr_is_owned(this_arg);
88663         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
88664         this_arg_conv.is_owned = false;
88665         jclass ret_conv = LDKCurrency_to_java(env, RawBolt11Invoice_currency(&this_arg_conv));
88666         return ret_conv;
88667 }
88668
88669 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1from_1unix_1timestamp(JNIEnv *env, jclass clz, int64_t unix_seconds) {
88670         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
88671         *ret_conv = PositiveTimestamp_from_unix_timestamp(unix_seconds);
88672         return tag_ptr(ret_conv, true);
88673 }
88674
88675 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1from_1system_1time(JNIEnv *env, jclass clz, int64_t time) {
88676         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
88677         *ret_conv = PositiveTimestamp_from_system_time(time);
88678         return tag_ptr(ret_conv, true);
88679 }
88680
88681 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1from_1duration_1since_1epoch(JNIEnv *env, jclass clz, int64_t duration) {
88682         LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
88683         *ret_conv = PositiveTimestamp_from_duration_since_epoch(duration);
88684         return tag_ptr(ret_conv, true);
88685 }
88686
88687 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1as_1unix_1timestamp(JNIEnv *env, jclass clz, int64_t this_arg) {
88688         LDKPositiveTimestamp this_arg_conv;
88689         this_arg_conv.inner = untag_ptr(this_arg);
88690         this_arg_conv.is_owned = ptr_is_owned(this_arg);
88691         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
88692         this_arg_conv.is_owned = false;
88693         int64_t ret_conv = PositiveTimestamp_as_unix_timestamp(&this_arg_conv);
88694         return ret_conv;
88695 }
88696
88697 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1as_1duration_1since_1epoch(JNIEnv *env, jclass clz, int64_t this_arg) {
88698         LDKPositiveTimestamp this_arg_conv;
88699         this_arg_conv.inner = untag_ptr(this_arg);
88700         this_arg_conv.is_owned = ptr_is_owned(this_arg);
88701         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
88702         this_arg_conv.is_owned = false;
88703         int64_t ret_conv = PositiveTimestamp_as_duration_since_epoch(&this_arg_conv);
88704         return ret_conv;
88705 }
88706
88707 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1as_1time(JNIEnv *env, jclass clz, int64_t this_arg) {
88708         LDKPositiveTimestamp this_arg_conv;
88709         this_arg_conv.inner = untag_ptr(this_arg);
88710         this_arg_conv.is_owned = ptr_is_owned(this_arg);
88711         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
88712         this_arg_conv.is_owned = false;
88713         int64_t ret_conv = PositiveTimestamp_as_time(&this_arg_conv);
88714         return ret_conv;
88715 }
88716
88717 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1signable_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
88718         LDKBolt11Invoice this_arg_conv;
88719         this_arg_conv.inner = untag_ptr(this_arg);
88720         this_arg_conv.is_owned = ptr_is_owned(this_arg);
88721         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
88722         this_arg_conv.is_owned = false;
88723         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
88724         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, Bolt11Invoice_signable_hash(&this_arg_conv).data);
88725         return ret_arr;
88726 }
88727
88728 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1into_1signed_1raw(JNIEnv *env, jclass clz, int64_t this_arg) {
88729         LDKBolt11Invoice this_arg_conv;
88730         this_arg_conv.inner = untag_ptr(this_arg);
88731         this_arg_conv.is_owned = ptr_is_owned(this_arg);
88732         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
88733         this_arg_conv = Bolt11Invoice_clone(&this_arg_conv);
88734         LDKSignedRawBolt11Invoice ret_var = Bolt11Invoice_into_signed_raw(this_arg_conv);
88735         int64_t ret_ref = 0;
88736         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
88737         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
88738         return ret_ref;
88739 }
88740
88741 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1check_1signature(JNIEnv *env, jclass clz, int64_t this_arg) {
88742         LDKBolt11Invoice this_arg_conv;
88743         this_arg_conv.inner = untag_ptr(this_arg);
88744         this_arg_conv.is_owned = ptr_is_owned(this_arg);
88745         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
88746         this_arg_conv.is_owned = false;
88747         LDKCResult_NoneBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt11SemanticErrorZ), "LDKCResult_NoneBolt11SemanticErrorZ");
88748         *ret_conv = Bolt11Invoice_check_signature(&this_arg_conv);
88749         return tag_ptr(ret_conv, true);
88750 }
88751
88752 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1from_1signed(JNIEnv *env, jclass clz, int64_t signed_invoice) {
88753         LDKSignedRawBolt11Invoice signed_invoice_conv;
88754         signed_invoice_conv.inner = untag_ptr(signed_invoice);
88755         signed_invoice_conv.is_owned = ptr_is_owned(signed_invoice);
88756         CHECK_INNER_FIELD_ACCESS_OR_NULL(signed_invoice_conv);
88757         signed_invoice_conv = SignedRawBolt11Invoice_clone(&signed_invoice_conv);
88758         LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ), "LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ");
88759         *ret_conv = Bolt11Invoice_from_signed(signed_invoice_conv);
88760         return tag_ptr(ret_conv, true);
88761 }
88762
88763 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1timestamp(JNIEnv *env, jclass clz, int64_t this_arg) {
88764         LDKBolt11Invoice this_arg_conv;
88765         this_arg_conv.inner = untag_ptr(this_arg);
88766         this_arg_conv.is_owned = ptr_is_owned(this_arg);
88767         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
88768         this_arg_conv.is_owned = false;
88769         int64_t ret_conv = Bolt11Invoice_timestamp(&this_arg_conv);
88770         return ret_conv;
88771 }
88772
88773 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1duration_1since_1epoch(JNIEnv *env, jclass clz, int64_t this_arg) {
88774         LDKBolt11Invoice this_arg_conv;
88775         this_arg_conv.inner = untag_ptr(this_arg);
88776         this_arg_conv.is_owned = ptr_is_owned(this_arg);
88777         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
88778         this_arg_conv.is_owned = false;
88779         int64_t ret_conv = Bolt11Invoice_duration_since_epoch(&this_arg_conv);
88780         return ret_conv;
88781 }
88782
88783 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
88784         LDKBolt11Invoice this_arg_conv;
88785         this_arg_conv.inner = untag_ptr(this_arg);
88786         this_arg_conv.is_owned = ptr_is_owned(this_arg);
88787         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
88788         this_arg_conv.is_owned = false;
88789         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
88790         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *Bolt11Invoice_payment_hash(&this_arg_conv));
88791         return ret_arr;
88792 }
88793
88794 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1payee_1pub_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
88795         LDKBolt11Invoice this_arg_conv;
88796         this_arg_conv.inner = untag_ptr(this_arg);
88797         this_arg_conv.is_owned = ptr_is_owned(this_arg);
88798         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
88799         this_arg_conv.is_owned = false;
88800         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
88801         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, Bolt11Invoice_payee_pub_key(&this_arg_conv).compressed_form);
88802         return ret_arr;
88803 }
88804
88805 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
88806         LDKBolt11Invoice this_arg_conv;
88807         this_arg_conv.inner = untag_ptr(this_arg);
88808         this_arg_conv.is_owned = ptr_is_owned(this_arg);
88809         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
88810         this_arg_conv.is_owned = false;
88811         int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
88812         (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *Bolt11Invoice_payment_secret(&this_arg_conv));
88813         return ret_arr;
88814 }
88815
88816 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1payment_1metadata(JNIEnv *env, jclass clz, int64_t this_arg) {
88817         LDKBolt11Invoice this_arg_conv;
88818         this_arg_conv.inner = untag_ptr(this_arg);
88819         this_arg_conv.is_owned = ptr_is_owned(this_arg);
88820         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
88821         this_arg_conv.is_owned = false;
88822         LDKCOption_CVec_u8ZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_u8ZZ), "LDKCOption_CVec_u8ZZ");
88823         *ret_copy = Bolt11Invoice_payment_metadata(&this_arg_conv);
88824         int64_t ret_ref = tag_ptr(ret_copy, true);
88825         return ret_ref;
88826 }
88827
88828 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
88829         LDKBolt11Invoice this_arg_conv;
88830         this_arg_conv.inner = untag_ptr(this_arg);
88831         this_arg_conv.is_owned = ptr_is_owned(this_arg);
88832         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
88833         this_arg_conv.is_owned = false;
88834         LDKBolt11InvoiceFeatures ret_var = Bolt11Invoice_features(&this_arg_conv);
88835         int64_t ret_ref = 0;
88836         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
88837         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
88838         return ret_ref;
88839 }
88840
88841 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1recover_1payee_1pub_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
88842         LDKBolt11Invoice this_arg_conv;
88843         this_arg_conv.inner = untag_ptr(this_arg);
88844         this_arg_conv.is_owned = ptr_is_owned(this_arg);
88845         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
88846         this_arg_conv.is_owned = false;
88847         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
88848         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, Bolt11Invoice_recover_payee_pub_key(&this_arg_conv).compressed_form);
88849         return ret_arr;
88850 }
88851
88852 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1get_1payee_1pub_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
88853         LDKBolt11Invoice this_arg_conv;
88854         this_arg_conv.inner = untag_ptr(this_arg);
88855         this_arg_conv.is_owned = ptr_is_owned(this_arg);
88856         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
88857         this_arg_conv.is_owned = false;
88858         int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
88859         (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, Bolt11Invoice_get_payee_pub_key(&this_arg_conv).compressed_form);
88860         return ret_arr;
88861 }
88862
88863 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1expires_1at(JNIEnv *env, jclass clz, int64_t this_arg) {
88864         LDKBolt11Invoice this_arg_conv;
88865         this_arg_conv.inner = untag_ptr(this_arg);
88866         this_arg_conv.is_owned = ptr_is_owned(this_arg);
88867         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
88868         this_arg_conv.is_owned = false;
88869         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
88870         *ret_copy = Bolt11Invoice_expires_at(&this_arg_conv);
88871         int64_t ret_ref = tag_ptr(ret_copy, true);
88872         return ret_ref;
88873 }
88874
88875 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1expiry_1time(JNIEnv *env, jclass clz, int64_t this_arg) {
88876         LDKBolt11Invoice this_arg_conv;
88877         this_arg_conv.inner = untag_ptr(this_arg);
88878         this_arg_conv.is_owned = ptr_is_owned(this_arg);
88879         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
88880         this_arg_conv.is_owned = false;
88881         int64_t ret_conv = Bolt11Invoice_expiry_time(&this_arg_conv);
88882         return ret_conv;
88883 }
88884
88885 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1is_1expired(JNIEnv *env, jclass clz, int64_t this_arg) {
88886         LDKBolt11Invoice this_arg_conv;
88887         this_arg_conv.inner = untag_ptr(this_arg);
88888         this_arg_conv.is_owned = ptr_is_owned(this_arg);
88889         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
88890         this_arg_conv.is_owned = false;
88891         jboolean ret_conv = Bolt11Invoice_is_expired(&this_arg_conv);
88892         return ret_conv;
88893 }
88894
88895 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1duration_1until_1expiry(JNIEnv *env, jclass clz, int64_t this_arg) {
88896         LDKBolt11Invoice this_arg_conv;
88897         this_arg_conv.inner = untag_ptr(this_arg);
88898         this_arg_conv.is_owned = ptr_is_owned(this_arg);
88899         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
88900         this_arg_conv.is_owned = false;
88901         int64_t ret_conv = Bolt11Invoice_duration_until_expiry(&this_arg_conv);
88902         return ret_conv;
88903 }
88904
88905 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) {
88906         LDKBolt11Invoice this_arg_conv;
88907         this_arg_conv.inner = untag_ptr(this_arg);
88908         this_arg_conv.is_owned = ptr_is_owned(this_arg);
88909         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
88910         this_arg_conv.is_owned = false;
88911         int64_t ret_conv = Bolt11Invoice_expiration_remaining_from_epoch(&this_arg_conv, time);
88912         return ret_conv;
88913 }
88914
88915 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1would_1expire(JNIEnv *env, jclass clz, int64_t this_arg, int64_t at_time) {
88916         LDKBolt11Invoice this_arg_conv;
88917         this_arg_conv.inner = untag_ptr(this_arg);
88918         this_arg_conv.is_owned = ptr_is_owned(this_arg);
88919         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
88920         this_arg_conv.is_owned = false;
88921         jboolean ret_conv = Bolt11Invoice_would_expire(&this_arg_conv, at_time);
88922         return ret_conv;
88923 }
88924
88925 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1min_1final_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_arg) {
88926         LDKBolt11Invoice this_arg_conv;
88927         this_arg_conv.inner = untag_ptr(this_arg);
88928         this_arg_conv.is_owned = ptr_is_owned(this_arg);
88929         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
88930         this_arg_conv.is_owned = false;
88931         int64_t ret_conv = Bolt11Invoice_min_final_cltv_expiry_delta(&this_arg_conv);
88932         return ret_conv;
88933 }
88934
88935 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1fallback_1addresses(JNIEnv *env, jclass clz, int64_t this_arg) {
88936         LDKBolt11Invoice this_arg_conv;
88937         this_arg_conv.inner = untag_ptr(this_arg);
88938         this_arg_conv.is_owned = ptr_is_owned(this_arg);
88939         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
88940         this_arg_conv.is_owned = false;
88941         LDKCVec_StrZ ret_var = Bolt11Invoice_fallback_addresses(&this_arg_conv);
88942         jobjectArray ret_arr = NULL;
88943         ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, String_clz, NULL);
88944         ;
88945         jstring *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
88946         for (size_t i = 0; i < ret_var.datalen; i++) {
88947                 LDKStr ret_conv_8_str = ret_var.data[i];
88948                 jstring ret_conv_8_conv = str_ref_to_java(env, ret_conv_8_str.chars, ret_conv_8_str.len);
88949                 Str_free(ret_conv_8_str);
88950                 ret_arr_ptr[i] = ret_conv_8_conv;
88951         }
88952         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
88953         FREE(ret_var.data);
88954         return ret_arr;
88955 }
88956
88957 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1private_1routes(JNIEnv *env, jclass clz, int64_t this_arg) {
88958         LDKBolt11Invoice this_arg_conv;
88959         this_arg_conv.inner = untag_ptr(this_arg);
88960         this_arg_conv.is_owned = ptr_is_owned(this_arg);
88961         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
88962         this_arg_conv.is_owned = false;
88963         LDKCVec_PrivateRouteZ ret_var = Bolt11Invoice_private_routes(&this_arg_conv);
88964         int64_tArray ret_arr = NULL;
88965         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
88966         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
88967         for (size_t o = 0; o < ret_var.datalen; o++) {
88968                 LDKPrivateRoute ret_conv_14_var = ret_var.data[o];
88969                 int64_t ret_conv_14_ref = 0;
88970                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_14_var);
88971                 ret_conv_14_ref = tag_ptr(ret_conv_14_var.inner, ret_conv_14_var.is_owned);
88972                 ret_arr_ptr[o] = ret_conv_14_ref;
88973         }
88974         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
88975         FREE(ret_var.data);
88976         return ret_arr;
88977 }
88978
88979 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1route_1hints(JNIEnv *env, jclass clz, int64_t this_arg) {
88980         LDKBolt11Invoice this_arg_conv;
88981         this_arg_conv.inner = untag_ptr(this_arg);
88982         this_arg_conv.is_owned = ptr_is_owned(this_arg);
88983         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
88984         this_arg_conv.is_owned = false;
88985         LDKCVec_RouteHintZ ret_var = Bolt11Invoice_route_hints(&this_arg_conv);
88986         int64_tArray ret_arr = NULL;
88987         ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
88988         int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
88989         for (size_t l = 0; l < ret_var.datalen; l++) {
88990                 LDKRouteHint ret_conv_11_var = ret_var.data[l];
88991                 int64_t ret_conv_11_ref = 0;
88992                 CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_11_var);
88993                 ret_conv_11_ref = tag_ptr(ret_conv_11_var.inner, ret_conv_11_var.is_owned);
88994                 ret_arr_ptr[l] = ret_conv_11_ref;
88995         }
88996         (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
88997         FREE(ret_var.data);
88998         return ret_arr;
88999 }
89000
89001 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1currency(JNIEnv *env, jclass clz, int64_t this_arg) {
89002         LDKBolt11Invoice this_arg_conv;
89003         this_arg_conv.inner = untag_ptr(this_arg);
89004         this_arg_conv.is_owned = ptr_is_owned(this_arg);
89005         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
89006         this_arg_conv.is_owned = false;
89007         jclass ret_conv = LDKCurrency_to_java(env, Bolt11Invoice_currency(&this_arg_conv));
89008         return ret_conv;
89009 }
89010
89011 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1amount_1milli_1satoshis(JNIEnv *env, jclass clz, int64_t this_arg) {
89012         LDKBolt11Invoice this_arg_conv;
89013         this_arg_conv.inner = untag_ptr(this_arg);
89014         this_arg_conv.is_owned = ptr_is_owned(this_arg);
89015         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
89016         this_arg_conv.is_owned = false;
89017         LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
89018         *ret_copy = Bolt11Invoice_amount_milli_satoshis(&this_arg_conv);
89019         int64_t ret_ref = tag_ptr(ret_copy, true);
89020         return ret_ref;
89021 }
89022
89023 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Description_1new(JNIEnv *env, jclass clz, jstring description) {
89024         LDKStr description_conv = java_to_owned_str(env, description);
89025         LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
89026         *ret_conv = Description_new(description_conv);
89027         return tag_ptr(ret_conv, true);
89028 }
89029
89030 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Description_1into_1inner(JNIEnv *env, jclass clz, int64_t this_arg) {
89031         LDKDescription this_arg_conv;
89032         this_arg_conv.inner = untag_ptr(this_arg);
89033         this_arg_conv.is_owned = ptr_is_owned(this_arg);
89034         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
89035         this_arg_conv = Description_clone(&this_arg_conv);
89036         LDKUntrustedString ret_var = Description_into_inner(this_arg_conv);
89037         int64_t ret_ref = 0;
89038         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
89039         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
89040         return ret_ref;
89041 }
89042
89043 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Description_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
89044         LDKDescription o_conv;
89045         o_conv.inner = untag_ptr(o);
89046         o_conv.is_owned = ptr_is_owned(o);
89047         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
89048         o_conv.is_owned = false;
89049         LDKStr ret_str = Description_to_str(&o_conv);
89050         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
89051         Str_free(ret_str);
89052         return ret_conv;
89053 }
89054
89055 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1from_1seconds(JNIEnv *env, jclass clz, int64_t seconds) {
89056         LDKExpiryTime ret_var = ExpiryTime_from_seconds(seconds);
89057         int64_t ret_ref = 0;
89058         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
89059         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
89060         return ret_ref;
89061 }
89062
89063 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1from_1duration(JNIEnv *env, jclass clz, int64_t duration) {
89064         LDKExpiryTime ret_var = ExpiryTime_from_duration(duration);
89065         int64_t ret_ref = 0;
89066         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
89067         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
89068         return ret_ref;
89069 }
89070
89071 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1as_1seconds(JNIEnv *env, jclass clz, int64_t this_arg) {
89072         LDKExpiryTime this_arg_conv;
89073         this_arg_conv.inner = untag_ptr(this_arg);
89074         this_arg_conv.is_owned = ptr_is_owned(this_arg);
89075         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
89076         this_arg_conv.is_owned = false;
89077         int64_t ret_conv = ExpiryTime_as_seconds(&this_arg_conv);
89078         return ret_conv;
89079 }
89080
89081 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1as_1duration(JNIEnv *env, jclass clz, int64_t this_arg) {
89082         LDKExpiryTime this_arg_conv;
89083         this_arg_conv.inner = untag_ptr(this_arg);
89084         this_arg_conv.is_owned = ptr_is_owned(this_arg);
89085         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
89086         this_arg_conv.is_owned = false;
89087         int64_t ret_conv = ExpiryTime_as_duration(&this_arg_conv);
89088         return ret_conv;
89089 }
89090
89091 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1new(JNIEnv *env, jclass clz, int64_t hops) {
89092         LDKRouteHint hops_conv;
89093         hops_conv.inner = untag_ptr(hops);
89094         hops_conv.is_owned = ptr_is_owned(hops);
89095         CHECK_INNER_FIELD_ACCESS_OR_NULL(hops_conv);
89096         hops_conv = RouteHint_clone(&hops_conv);
89097         LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
89098         *ret_conv = PrivateRoute_new(hops_conv);
89099         return tag_ptr(ret_conv, true);
89100 }
89101
89102 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1into_1inner(JNIEnv *env, jclass clz, int64_t this_arg) {
89103         LDKPrivateRoute this_arg_conv;
89104         this_arg_conv.inner = untag_ptr(this_arg);
89105         this_arg_conv.is_owned = ptr_is_owned(this_arg);
89106         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
89107         this_arg_conv = PrivateRoute_clone(&this_arg_conv);
89108         LDKRouteHint ret_var = PrivateRoute_into_inner(this_arg_conv);
89109         int64_t ret_ref = 0;
89110         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
89111         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
89112         return ret_ref;
89113 }
89114
89115 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CreationError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
89116         LDKCreationError* orig_conv = (LDKCreationError*)untag_ptr(orig);
89117         jclass ret_conv = LDKCreationError_to_java(env, CreationError_clone(orig_conv));
89118         return ret_conv;
89119 }
89120
89121 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CreationError_1description_1too_1long(JNIEnv *env, jclass clz) {
89122         jclass ret_conv = LDKCreationError_to_java(env, CreationError_description_too_long());
89123         return ret_conv;
89124 }
89125
89126 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CreationError_1route_1too_1long(JNIEnv *env, jclass clz) {
89127         jclass ret_conv = LDKCreationError_to_java(env, CreationError_route_too_long());
89128         return ret_conv;
89129 }
89130
89131 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CreationError_1timestamp_1out_1of_1bounds(JNIEnv *env, jclass clz) {
89132         jclass ret_conv = LDKCreationError_to_java(env, CreationError_timestamp_out_of_bounds());
89133         return ret_conv;
89134 }
89135
89136 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CreationError_1invalid_1amount(JNIEnv *env, jclass clz) {
89137         jclass ret_conv = LDKCreationError_to_java(env, CreationError_invalid_amount());
89138         return ret_conv;
89139 }
89140
89141 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CreationError_1missing_1route_1hints(JNIEnv *env, jclass clz) {
89142         jclass ret_conv = LDKCreationError_to_java(env, CreationError_missing_route_hints());
89143         return ret_conv;
89144 }
89145
89146 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CreationError_1min_1final_1cltv_1expiry_1delta_1too_1short(JNIEnv *env, jclass clz) {
89147         jclass ret_conv = LDKCreationError_to_java(env, CreationError_min_final_cltv_expiry_delta_too_short());
89148         return ret_conv;
89149 }
89150
89151 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CreationError_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
89152         LDKCreationError* a_conv = (LDKCreationError*)untag_ptr(a);
89153         LDKCreationError* b_conv = (LDKCreationError*)untag_ptr(b);
89154         jboolean ret_conv = CreationError_eq(a_conv, b_conv);
89155         return ret_conv;
89156 }
89157
89158 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_CreationError_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
89159         LDKCreationError* o_conv = (LDKCreationError*)untag_ptr(o);
89160         LDKStr ret_str = CreationError_to_str(o_conv);
89161         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
89162         Str_free(ret_str);
89163         return ret_conv;
89164 }
89165
89166 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt11SemanticError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
89167         LDKBolt11SemanticError* orig_conv = (LDKBolt11SemanticError*)untag_ptr(orig);
89168         jclass ret_conv = LDKBolt11SemanticError_to_java(env, Bolt11SemanticError_clone(orig_conv));
89169         return ret_conv;
89170 }
89171
89172 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt11SemanticError_1no_1payment_1hash(JNIEnv *env, jclass clz) {
89173         jclass ret_conv = LDKBolt11SemanticError_to_java(env, Bolt11SemanticError_no_payment_hash());
89174         return ret_conv;
89175 }
89176
89177 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt11SemanticError_1multiple_1payment_1hashes(JNIEnv *env, jclass clz) {
89178         jclass ret_conv = LDKBolt11SemanticError_to_java(env, Bolt11SemanticError_multiple_payment_hashes());
89179         return ret_conv;
89180 }
89181
89182 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt11SemanticError_1no_1description(JNIEnv *env, jclass clz) {
89183         jclass ret_conv = LDKBolt11SemanticError_to_java(env, Bolt11SemanticError_no_description());
89184         return ret_conv;
89185 }
89186
89187 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt11SemanticError_1multiple_1descriptions(JNIEnv *env, jclass clz) {
89188         jclass ret_conv = LDKBolt11SemanticError_to_java(env, Bolt11SemanticError_multiple_descriptions());
89189         return ret_conv;
89190 }
89191
89192 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt11SemanticError_1no_1payment_1secret(JNIEnv *env, jclass clz) {
89193         jclass ret_conv = LDKBolt11SemanticError_to_java(env, Bolt11SemanticError_no_payment_secret());
89194         return ret_conv;
89195 }
89196
89197 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt11SemanticError_1multiple_1payment_1secrets(JNIEnv *env, jclass clz) {
89198         jclass ret_conv = LDKBolt11SemanticError_to_java(env, Bolt11SemanticError_multiple_payment_secrets());
89199         return ret_conv;
89200 }
89201
89202 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt11SemanticError_1invalid_1features(JNIEnv *env, jclass clz) {
89203         jclass ret_conv = LDKBolt11SemanticError_to_java(env, Bolt11SemanticError_invalid_features());
89204         return ret_conv;
89205 }
89206
89207 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt11SemanticError_1invalid_1recovery_1id(JNIEnv *env, jclass clz) {
89208         jclass ret_conv = LDKBolt11SemanticError_to_java(env, Bolt11SemanticError_invalid_recovery_id());
89209         return ret_conv;
89210 }
89211
89212 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt11SemanticError_1invalid_1signature(JNIEnv *env, jclass clz) {
89213         jclass ret_conv = LDKBolt11SemanticError_to_java(env, Bolt11SemanticError_invalid_signature());
89214         return ret_conv;
89215 }
89216
89217 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt11SemanticError_1imprecise_1amount(JNIEnv *env, jclass clz) {
89218         jclass ret_conv = LDKBolt11SemanticError_to_java(env, Bolt11SemanticError_imprecise_amount());
89219         return ret_conv;
89220 }
89221
89222 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Bolt11SemanticError_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
89223         LDKBolt11SemanticError* a_conv = (LDKBolt11SemanticError*)untag_ptr(a);
89224         LDKBolt11SemanticError* b_conv = (LDKBolt11SemanticError*)untag_ptr(b);
89225         jboolean ret_conv = Bolt11SemanticError_eq(a_conv, b_conv);
89226         return ret_conv;
89227 }
89228
89229 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Bolt11SemanticError_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
89230         LDKBolt11SemanticError* o_conv = (LDKBolt11SemanticError*)untag_ptr(o);
89231         LDKStr ret_str = Bolt11SemanticError_to_str(o_conv);
89232         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
89233         Str_free(ret_str);
89234         return ret_conv;
89235 }
89236
89237 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
89238         if (!ptr_is_owned(this_ptr)) return;
89239         void* this_ptr_ptr = untag_ptr(this_ptr);
89240         CHECK_ACCESS(this_ptr_ptr);
89241         LDKSignOrCreationError this_ptr_conv = *(LDKSignOrCreationError*)(this_ptr_ptr);
89242         FREE(untag_ptr(this_ptr));
89243         SignOrCreationError_free(this_ptr_conv);
89244 }
89245
89246 static inline uint64_t SignOrCreationError_clone_ptr(LDKSignOrCreationError *NONNULL_PTR arg) {
89247         LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
89248         *ret_copy = SignOrCreationError_clone(arg);
89249         int64_t ret_ref = tag_ptr(ret_copy, true);
89250         return ret_ref;
89251 }
89252 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
89253         LDKSignOrCreationError* arg_conv = (LDKSignOrCreationError*)untag_ptr(arg);
89254         int64_t ret_conv = SignOrCreationError_clone_ptr(arg_conv);
89255         return ret_conv;
89256 }
89257
89258 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
89259         LDKSignOrCreationError* orig_conv = (LDKSignOrCreationError*)untag_ptr(orig);
89260         LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
89261         *ret_copy = SignOrCreationError_clone(orig_conv);
89262         int64_t ret_ref = tag_ptr(ret_copy, true);
89263         return ret_ref;
89264 }
89265
89266 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1sign_1error(JNIEnv *env, jclass clz) {
89267         LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
89268         *ret_copy = SignOrCreationError_sign_error();
89269         int64_t ret_ref = tag_ptr(ret_copy, true);
89270         return ret_ref;
89271 }
89272
89273 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1creation_1error(JNIEnv *env, jclass clz, jclass a) {
89274         LDKCreationError a_conv = LDKCreationError_from_java(env, a);
89275         LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
89276         *ret_copy = SignOrCreationError_creation_error(a_conv);
89277         int64_t ret_ref = tag_ptr(ret_copy, true);
89278         return ret_ref;
89279 }
89280
89281 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
89282         LDKSignOrCreationError* a_conv = (LDKSignOrCreationError*)untag_ptr(a);
89283         LDKSignOrCreationError* b_conv = (LDKSignOrCreationError*)untag_ptr(b);
89284         jboolean ret_conv = SignOrCreationError_eq(a_conv, b_conv);
89285         return ret_conv;
89286 }
89287
89288 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
89289         LDKSignOrCreationError* o_conv = (LDKSignOrCreationError*)untag_ptr(o);
89290         LDKStr ret_str = SignOrCreationError_to_str(o_conv);
89291         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
89292         Str_free(ret_str);
89293         return ret_conv;
89294 }
89295
89296 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) {
89297         LDKBolt11Invoice invoice_conv;
89298         invoice_conv.inner = untag_ptr(invoice);
89299         invoice_conv.is_owned = ptr_is_owned(invoice);
89300         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_conv);
89301         invoice_conv.is_owned = false;
89302         LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ), "LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ");
89303         *ret_conv = payment_parameters_from_zero_amount_invoice(&invoice_conv, amount_msat);
89304         return tag_ptr(ret_conv, true);
89305 }
89306
89307 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_payment_1parameters_1from_1invoice(JNIEnv *env, jclass clz, int64_t invoice) {
89308         LDKBolt11Invoice invoice_conv;
89309         invoice_conv.inner = untag_ptr(invoice);
89310         invoice_conv.is_owned = ptr_is_owned(invoice);
89311         CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_conv);
89312         invoice_conv.is_owned = false;
89313         LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ), "LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ");
89314         *ret_conv = payment_parameters_from_invoice(&invoice_conv);
89315         return tag_ptr(ret_conv, true);
89316 }
89317
89318 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) {
89319         void* amt_msat_ptr = untag_ptr(amt_msat);
89320         CHECK_ACCESS(amt_msat_ptr);
89321         LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
89322         amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amt_msat));
89323         void* payment_hash_ptr = untag_ptr(payment_hash);
89324         CHECK_ACCESS(payment_hash_ptr);
89325         LDKCOption_ThirtyTwoBytesZ payment_hash_conv = *(LDKCOption_ThirtyTwoBytesZ*)(payment_hash_ptr);
89326         payment_hash_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(payment_hash));
89327         LDKStr description_conv = java_to_owned_str(env, description);
89328         LDKCVec_PhantomRouteHintsZ phantom_route_hints_constr;
89329         phantom_route_hints_constr.datalen = (*env)->GetArrayLength(env, phantom_route_hints);
89330         if (phantom_route_hints_constr.datalen > 0)
89331                 phantom_route_hints_constr.data = MALLOC(phantom_route_hints_constr.datalen * sizeof(LDKPhantomRouteHints), "LDKCVec_PhantomRouteHintsZ Elements");
89332         else
89333                 phantom_route_hints_constr.data = NULL;
89334         int64_t* phantom_route_hints_vals = (*env)->GetLongArrayElements (env, phantom_route_hints, NULL);
89335         for (size_t t = 0; t < phantom_route_hints_constr.datalen; t++) {
89336                 int64_t phantom_route_hints_conv_19 = phantom_route_hints_vals[t];
89337                 LDKPhantomRouteHints phantom_route_hints_conv_19_conv;
89338                 phantom_route_hints_conv_19_conv.inner = untag_ptr(phantom_route_hints_conv_19);
89339                 phantom_route_hints_conv_19_conv.is_owned = ptr_is_owned(phantom_route_hints_conv_19);
89340                 CHECK_INNER_FIELD_ACCESS_OR_NULL(phantom_route_hints_conv_19_conv);
89341                 phantom_route_hints_conv_19_conv = PhantomRouteHints_clone(&phantom_route_hints_conv_19_conv);
89342                 phantom_route_hints_constr.data[t] = phantom_route_hints_conv_19_conv;
89343         }
89344         (*env)->ReleaseLongArrayElements(env, phantom_route_hints, phantom_route_hints_vals, 0);
89345         void* entropy_source_ptr = untag_ptr(entropy_source);
89346         CHECK_ACCESS(entropy_source_ptr);
89347         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
89348         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
89349                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
89350                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
89351         }
89352         void* node_signer_ptr = untag_ptr(node_signer);
89353         CHECK_ACCESS(node_signer_ptr);
89354         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
89355         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
89356                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
89357                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
89358         }
89359         void* logger_ptr = untag_ptr(logger);
89360         CHECK_ACCESS(logger_ptr);
89361         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
89362         if (logger_conv.free == LDKLogger_JCalls_free) {
89363                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
89364                 LDKLogger_JCalls_cloned(&logger_conv);
89365         }
89366         LDKCurrency network_conv = LDKCurrency_from_java(env, network);
89367         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
89368         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
89369         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
89370         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
89371         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
89372         *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);
89373         return tag_ptr(ret_conv, true);
89374 }
89375
89376 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) {
89377         void* amt_msat_ptr = untag_ptr(amt_msat);
89378         CHECK_ACCESS(amt_msat_ptr);
89379         LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
89380         amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amt_msat));
89381         void* payment_hash_ptr = untag_ptr(payment_hash);
89382         CHECK_ACCESS(payment_hash_ptr);
89383         LDKCOption_ThirtyTwoBytesZ payment_hash_conv = *(LDKCOption_ThirtyTwoBytesZ*)(payment_hash_ptr);
89384         payment_hash_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(payment_hash));
89385         LDKSha256 description_hash_conv;
89386         description_hash_conv.inner = untag_ptr(description_hash);
89387         description_hash_conv.is_owned = ptr_is_owned(description_hash);
89388         CHECK_INNER_FIELD_ACCESS_OR_NULL(description_hash_conv);
89389         description_hash_conv = Sha256_clone(&description_hash_conv);
89390         LDKCVec_PhantomRouteHintsZ phantom_route_hints_constr;
89391         phantom_route_hints_constr.datalen = (*env)->GetArrayLength(env, phantom_route_hints);
89392         if (phantom_route_hints_constr.datalen > 0)
89393                 phantom_route_hints_constr.data = MALLOC(phantom_route_hints_constr.datalen * sizeof(LDKPhantomRouteHints), "LDKCVec_PhantomRouteHintsZ Elements");
89394         else
89395                 phantom_route_hints_constr.data = NULL;
89396         int64_t* phantom_route_hints_vals = (*env)->GetLongArrayElements (env, phantom_route_hints, NULL);
89397         for (size_t t = 0; t < phantom_route_hints_constr.datalen; t++) {
89398                 int64_t phantom_route_hints_conv_19 = phantom_route_hints_vals[t];
89399                 LDKPhantomRouteHints phantom_route_hints_conv_19_conv;
89400                 phantom_route_hints_conv_19_conv.inner = untag_ptr(phantom_route_hints_conv_19);
89401                 phantom_route_hints_conv_19_conv.is_owned = ptr_is_owned(phantom_route_hints_conv_19);
89402                 CHECK_INNER_FIELD_ACCESS_OR_NULL(phantom_route_hints_conv_19_conv);
89403                 phantom_route_hints_conv_19_conv = PhantomRouteHints_clone(&phantom_route_hints_conv_19_conv);
89404                 phantom_route_hints_constr.data[t] = phantom_route_hints_conv_19_conv;
89405         }
89406         (*env)->ReleaseLongArrayElements(env, phantom_route_hints, phantom_route_hints_vals, 0);
89407         void* entropy_source_ptr = untag_ptr(entropy_source);
89408         CHECK_ACCESS(entropy_source_ptr);
89409         LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
89410         if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
89411                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
89412                 LDKEntropySource_JCalls_cloned(&entropy_source_conv);
89413         }
89414         void* node_signer_ptr = untag_ptr(node_signer);
89415         CHECK_ACCESS(node_signer_ptr);
89416         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
89417         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
89418                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
89419                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
89420         }
89421         void* logger_ptr = untag_ptr(logger);
89422         CHECK_ACCESS(logger_ptr);
89423         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
89424         if (logger_conv.free == LDKLogger_JCalls_free) {
89425                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
89426                 LDKLogger_JCalls_cloned(&logger_conv);
89427         }
89428         LDKCurrency network_conv = LDKCurrency_from_java(env, network);
89429         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
89430         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
89431         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
89432         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
89433         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
89434         *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);
89435         return tag_ptr(ret_conv, true);
89436 }
89437
89438 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) {
89439         LDKChannelManager channelmanager_conv;
89440         channelmanager_conv.inner = untag_ptr(channelmanager);
89441         channelmanager_conv.is_owned = ptr_is_owned(channelmanager);
89442         CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
89443         channelmanager_conv.is_owned = false;
89444         void* node_signer_ptr = untag_ptr(node_signer);
89445         CHECK_ACCESS(node_signer_ptr);
89446         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
89447         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
89448                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
89449                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
89450         }
89451         void* logger_ptr = untag_ptr(logger);
89452         CHECK_ACCESS(logger_ptr);
89453         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
89454         if (logger_conv.free == LDKLogger_JCalls_free) {
89455                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
89456                 LDKLogger_JCalls_cloned(&logger_conv);
89457         }
89458         LDKCurrency network_conv = LDKCurrency_from_java(env, network);
89459         void* amt_msat_ptr = untag_ptr(amt_msat);
89460         CHECK_ACCESS(amt_msat_ptr);
89461         LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
89462         amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amt_msat));
89463         LDKStr description_conv = java_to_owned_str(env, description);
89464         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
89465         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
89466         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
89467         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
89468         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
89469         *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);
89470         return tag_ptr(ret_conv, true);
89471 }
89472
89473 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) {
89474         LDKChannelManager channelmanager_conv;
89475         channelmanager_conv.inner = untag_ptr(channelmanager);
89476         channelmanager_conv.is_owned = ptr_is_owned(channelmanager);
89477         CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
89478         channelmanager_conv.is_owned = false;
89479         void* node_signer_ptr = untag_ptr(node_signer);
89480         CHECK_ACCESS(node_signer_ptr);
89481         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
89482         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
89483                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
89484                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
89485         }
89486         void* logger_ptr = untag_ptr(logger);
89487         CHECK_ACCESS(logger_ptr);
89488         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
89489         if (logger_conv.free == LDKLogger_JCalls_free) {
89490                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
89491                 LDKLogger_JCalls_cloned(&logger_conv);
89492         }
89493         LDKCurrency network_conv = LDKCurrency_from_java(env, network);
89494         void* amt_msat_ptr = untag_ptr(amt_msat);
89495         CHECK_ACCESS(amt_msat_ptr);
89496         LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
89497         amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amt_msat));
89498         LDKSha256 description_hash_conv;
89499         description_hash_conv.inner = untag_ptr(description_hash);
89500         description_hash_conv.is_owned = ptr_is_owned(description_hash);
89501         CHECK_INNER_FIELD_ACCESS_OR_NULL(description_hash_conv);
89502         description_hash_conv = Sha256_clone(&description_hash_conv);
89503         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
89504         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
89505         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
89506         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
89507         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
89508         *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);
89509         return tag_ptr(ret_conv, true);
89510 }
89511
89512 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) {
89513         LDKChannelManager channelmanager_conv;
89514         channelmanager_conv.inner = untag_ptr(channelmanager);
89515         channelmanager_conv.is_owned = ptr_is_owned(channelmanager);
89516         CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
89517         channelmanager_conv.is_owned = false;
89518         void* node_signer_ptr = untag_ptr(node_signer);
89519         CHECK_ACCESS(node_signer_ptr);
89520         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
89521         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
89522                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
89523                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
89524         }
89525         void* logger_ptr = untag_ptr(logger);
89526         CHECK_ACCESS(logger_ptr);
89527         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
89528         if (logger_conv.free == LDKLogger_JCalls_free) {
89529                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
89530                 LDKLogger_JCalls_cloned(&logger_conv);
89531         }
89532         LDKCurrency network_conv = LDKCurrency_from_java(env, network);
89533         void* amt_msat_ptr = untag_ptr(amt_msat);
89534         CHECK_ACCESS(amt_msat_ptr);
89535         LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
89536         amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amt_msat));
89537         LDKSha256 description_hash_conv;
89538         description_hash_conv.inner = untag_ptr(description_hash);
89539         description_hash_conv.is_owned = ptr_is_owned(description_hash);
89540         CHECK_INNER_FIELD_ACCESS_OR_NULL(description_hash_conv);
89541         description_hash_conv = Sha256_clone(&description_hash_conv);
89542         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
89543         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
89544         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
89545         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
89546         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
89547         *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);
89548         return tag_ptr(ret_conv, true);
89549 }
89550
89551 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) {
89552         LDKChannelManager channelmanager_conv;
89553         channelmanager_conv.inner = untag_ptr(channelmanager);
89554         channelmanager_conv.is_owned = ptr_is_owned(channelmanager);
89555         CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
89556         channelmanager_conv.is_owned = false;
89557         void* node_signer_ptr = untag_ptr(node_signer);
89558         CHECK_ACCESS(node_signer_ptr);
89559         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
89560         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
89561                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
89562                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
89563         }
89564         void* logger_ptr = untag_ptr(logger);
89565         CHECK_ACCESS(logger_ptr);
89566         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
89567         if (logger_conv.free == LDKLogger_JCalls_free) {
89568                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
89569                 LDKLogger_JCalls_cloned(&logger_conv);
89570         }
89571         LDKCurrency network_conv = LDKCurrency_from_java(env, network);
89572         void* amt_msat_ptr = untag_ptr(amt_msat);
89573         CHECK_ACCESS(amt_msat_ptr);
89574         LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
89575         amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amt_msat));
89576         LDKStr description_conv = java_to_owned_str(env, description);
89577         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
89578         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
89579         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
89580         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
89581         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
89582         *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);
89583         return tag_ptr(ret_conv, true);
89584 }
89585
89586 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) {
89587         LDKChannelManager channelmanager_conv;
89588         channelmanager_conv.inner = untag_ptr(channelmanager);
89589         channelmanager_conv.is_owned = ptr_is_owned(channelmanager);
89590         CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv);
89591         channelmanager_conv.is_owned = false;
89592         void* node_signer_ptr = untag_ptr(node_signer);
89593         CHECK_ACCESS(node_signer_ptr);
89594         LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
89595         if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
89596                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
89597                 LDKNodeSigner_JCalls_cloned(&node_signer_conv);
89598         }
89599         void* logger_ptr = untag_ptr(logger);
89600         CHECK_ACCESS(logger_ptr);
89601         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
89602         if (logger_conv.free == LDKLogger_JCalls_free) {
89603                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
89604                 LDKLogger_JCalls_cloned(&logger_conv);
89605         }
89606         LDKCurrency network_conv = LDKCurrency_from_java(env, network);
89607         void* amt_msat_ptr = untag_ptr(amt_msat);
89608         CHECK_ACCESS(amt_msat_ptr);
89609         LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr);
89610         amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amt_msat));
89611         LDKStr description_conv = java_to_owned_str(env, description);
89612         LDKThirtyTwoBytes payment_hash_ref;
89613         CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
89614         (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
89615         void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta);
89616         CHECK_ACCESS(min_final_cltv_expiry_delta_ptr);
89617         LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr);
89618         min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta));
89619         LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceSignOrCreationErrorZ), "LDKCResult_Bolt11InvoiceSignOrCreationErrorZ");
89620         *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);
89621         return tag_ptr(ret_conv, true);
89622 }
89623
89624 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SiPrefix_1from_1str(JNIEnv *env, jclass clz, jstring s) {
89625         LDKStr s_conv = java_to_owned_str(env, s);
89626         LDKCResult_SiPrefixBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixBolt11ParseErrorZ), "LDKCResult_SiPrefixBolt11ParseErrorZ");
89627         *ret_conv = SiPrefix_from_str(s_conv);
89628         return tag_ptr(ret_conv, true);
89629 }
89630
89631 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1from_1str(JNIEnv *env, jclass clz, jstring s) {
89632         LDKStr s_conv = java_to_owned_str(env, s);
89633         LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ), "LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ");
89634         *ret_conv = Bolt11Invoice_from_str(s_conv);
89635         return tag_ptr(ret_conv, true);
89636 }
89637
89638 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawBolt11Invoice_1from_1str(JNIEnv *env, jclass clz, jstring s) {
89639         LDKStr s_conv = java_to_owned_str(env, s);
89640         LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ), "LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ");
89641         *ret_conv = SignedRawBolt11Invoice_from_str(s_conv);
89642         return tag_ptr(ret_conv, true);
89643 }
89644
89645 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Bolt11ParseError_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
89646         LDKBolt11ParseError* o_conv = (LDKBolt11ParseError*)untag_ptr(o);
89647         LDKStr ret_str = Bolt11ParseError_to_str(o_conv);
89648         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
89649         Str_free(ret_str);
89650         return ret_conv;
89651 }
89652
89653 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_ParseOrSemanticError_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
89654         LDKParseOrSemanticError* o_conv = (LDKParseOrSemanticError*)untag_ptr(o);
89655         LDKStr ret_str = ParseOrSemanticError_to_str(o_conv);
89656         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
89657         Str_free(ret_str);
89658         return ret_conv;
89659 }
89660
89661 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Bolt11Invoice_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
89662         LDKBolt11Invoice o_conv;
89663         o_conv.inner = untag_ptr(o);
89664         o_conv.is_owned = ptr_is_owned(o);
89665         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
89666         o_conv.is_owned = false;
89667         LDKStr ret_str = Bolt11Invoice_to_str(&o_conv);
89668         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
89669         Str_free(ret_str);
89670         return ret_conv;
89671 }
89672
89673 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_SignedRawBolt11Invoice_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
89674         LDKSignedRawBolt11Invoice o_conv;
89675         o_conv.inner = untag_ptr(o);
89676         o_conv.is_owned = ptr_is_owned(o);
89677         CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
89678         o_conv.is_owned = false;
89679         LDKStr ret_str = SignedRawBolt11Invoice_to_str(&o_conv);
89680         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
89681         Str_free(ret_str);
89682         return ret_conv;
89683 }
89684
89685 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Currency_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
89686         LDKCurrency* o_conv = (LDKCurrency*)untag_ptr(o);
89687         LDKStr ret_str = Currency_to_str(o_conv);
89688         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
89689         Str_free(ret_str);
89690         return ret_conv;
89691 }
89692
89693 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_SiPrefix_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
89694         LDKSiPrefix* o_conv = (LDKSiPrefix*)untag_ptr(o);
89695         LDKStr ret_str = SiPrefix_to_str(o_conv);
89696         jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
89697         Str_free(ret_str);
89698         return ret_conv;
89699 }
89700
89701 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GraphSyncError_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
89702         if (!ptr_is_owned(this_ptr)) return;
89703         void* this_ptr_ptr = untag_ptr(this_ptr);
89704         CHECK_ACCESS(this_ptr_ptr);
89705         LDKGraphSyncError this_ptr_conv = *(LDKGraphSyncError*)(this_ptr_ptr);
89706         FREE(untag_ptr(this_ptr));
89707         GraphSyncError_free(this_ptr_conv);
89708 }
89709
89710 static inline uint64_t GraphSyncError_clone_ptr(LDKGraphSyncError *NONNULL_PTR arg) {
89711         LDKGraphSyncError *ret_copy = MALLOC(sizeof(LDKGraphSyncError), "LDKGraphSyncError");
89712         *ret_copy = GraphSyncError_clone(arg);
89713         int64_t ret_ref = tag_ptr(ret_copy, true);
89714         return ret_ref;
89715 }
89716 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GraphSyncError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) {
89717         LDKGraphSyncError* arg_conv = (LDKGraphSyncError*)untag_ptr(arg);
89718         int64_t ret_conv = GraphSyncError_clone_ptr(arg_conv);
89719         return ret_conv;
89720 }
89721
89722 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GraphSyncError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
89723         LDKGraphSyncError* orig_conv = (LDKGraphSyncError*)untag_ptr(orig);
89724         LDKGraphSyncError *ret_copy = MALLOC(sizeof(LDKGraphSyncError), "LDKGraphSyncError");
89725         *ret_copy = GraphSyncError_clone(orig_conv);
89726         int64_t ret_ref = tag_ptr(ret_copy, true);
89727         return ret_ref;
89728 }
89729
89730 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GraphSyncError_1decode_1error(JNIEnv *env, jclass clz, int64_t a) {
89731         void* a_ptr = untag_ptr(a);
89732         CHECK_ACCESS(a_ptr);
89733         LDKDecodeError a_conv = *(LDKDecodeError*)(a_ptr);
89734         a_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(a));
89735         LDKGraphSyncError *ret_copy = MALLOC(sizeof(LDKGraphSyncError), "LDKGraphSyncError");
89736         *ret_copy = GraphSyncError_decode_error(a_conv);
89737         int64_t ret_ref = tag_ptr(ret_copy, true);
89738         return ret_ref;
89739 }
89740
89741 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GraphSyncError_1lightning_1error(JNIEnv *env, jclass clz, int64_t a) {
89742         LDKLightningError a_conv;
89743         a_conv.inner = untag_ptr(a);
89744         a_conv.is_owned = ptr_is_owned(a);
89745         CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
89746         a_conv = LightningError_clone(&a_conv);
89747         LDKGraphSyncError *ret_copy = MALLOC(sizeof(LDKGraphSyncError), "LDKGraphSyncError");
89748         *ret_copy = GraphSyncError_lightning_error(a_conv);
89749         int64_t ret_ref = tag_ptr(ret_copy, true);
89750         return ret_ref;
89751 }
89752
89753 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RapidGossipSync_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
89754         LDKRapidGossipSync this_obj_conv;
89755         this_obj_conv.inner = untag_ptr(this_obj);
89756         this_obj_conv.is_owned = ptr_is_owned(this_obj);
89757         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
89758         RapidGossipSync_free(this_obj_conv);
89759 }
89760
89761 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RapidGossipSync_1new(JNIEnv *env, jclass clz, int64_t network_graph, int64_t logger) {
89762         LDKNetworkGraph network_graph_conv;
89763         network_graph_conv.inner = untag_ptr(network_graph);
89764         network_graph_conv.is_owned = ptr_is_owned(network_graph);
89765         CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
89766         network_graph_conv.is_owned = false;
89767         void* logger_ptr = untag_ptr(logger);
89768         CHECK_ACCESS(logger_ptr);
89769         LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
89770         if (logger_conv.free == LDKLogger_JCalls_free) {
89771                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
89772                 LDKLogger_JCalls_cloned(&logger_conv);
89773         }
89774         LDKRapidGossipSync ret_var = RapidGossipSync_new(&network_graph_conv, logger_conv);
89775         int64_t ret_ref = 0;
89776         CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
89777         ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
89778         return ret_ref;
89779 }
89780
89781 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) {
89782         LDKRapidGossipSync this_arg_conv;
89783         this_arg_conv.inner = untag_ptr(this_arg);
89784         this_arg_conv.is_owned = ptr_is_owned(this_arg);
89785         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
89786         this_arg_conv.is_owned = false;
89787         LDKStr sync_path_conv = java_to_owned_str(env, sync_path);
89788         LDKCResult_u32GraphSyncErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_u32GraphSyncErrorZ), "LDKCResult_u32GraphSyncErrorZ");
89789         *ret_conv = RapidGossipSync_sync_network_graph_with_file_path(&this_arg_conv, sync_path_conv);
89790         return tag_ptr(ret_conv, true);
89791 }
89792
89793 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) {
89794         LDKRapidGossipSync this_arg_conv;
89795         this_arg_conv.inner = untag_ptr(this_arg);
89796         this_arg_conv.is_owned = ptr_is_owned(this_arg);
89797         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
89798         this_arg_conv.is_owned = false;
89799         LDKu8slice update_data_ref;
89800         update_data_ref.datalen = (*env)->GetArrayLength(env, update_data);
89801         update_data_ref.data = (*env)->GetByteArrayElements (env, update_data, NULL);
89802         LDKCResult_u32GraphSyncErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_u32GraphSyncErrorZ), "LDKCResult_u32GraphSyncErrorZ");
89803         *ret_conv = RapidGossipSync_update_network_graph(&this_arg_conv, update_data_ref);
89804         (*env)->ReleaseByteArrayElements(env, update_data, (int8_t*)update_data_ref.data, 0);
89805         return tag_ptr(ret_conv, true);
89806 }
89807
89808 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) {
89809         LDKRapidGossipSync this_arg_conv;
89810         this_arg_conv.inner = untag_ptr(this_arg);
89811         this_arg_conv.is_owned = ptr_is_owned(this_arg);
89812         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
89813         this_arg_conv.is_owned = false;
89814         LDKu8slice update_data_ref;
89815         update_data_ref.datalen = (*env)->GetArrayLength(env, update_data);
89816         update_data_ref.data = (*env)->GetByteArrayElements (env, update_data, NULL);
89817         void* current_time_unix_ptr = untag_ptr(current_time_unix);
89818         CHECK_ACCESS(current_time_unix_ptr);
89819         LDKCOption_u64Z current_time_unix_conv = *(LDKCOption_u64Z*)(current_time_unix_ptr);
89820         current_time_unix_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(current_time_unix));
89821         LDKCResult_u32GraphSyncErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_u32GraphSyncErrorZ), "LDKCResult_u32GraphSyncErrorZ");
89822         *ret_conv = RapidGossipSync_update_network_graph_no_std(&this_arg_conv, update_data_ref, current_time_unix_conv);
89823         (*env)->ReleaseByteArrayElements(env, update_data, (int8_t*)update_data_ref.data, 0);
89824         return tag_ptr(ret_conv, true);
89825 }
89826
89827 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RapidGossipSync_1is_1initial_1sync_1complete(JNIEnv *env, jclass clz, int64_t this_arg) {
89828         LDKRapidGossipSync this_arg_conv;
89829         this_arg_conv.inner = untag_ptr(this_arg);
89830         this_arg_conv.is_owned = ptr_is_owned(this_arg);
89831         CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
89832         this_arg_conv.is_owned = false;
89833         jboolean ret_conv = RapidGossipSync_is_initial_sync_complete(&this_arg_conv);
89834         return ret_conv;
89835 }
89836